Skip to content

Form a Cortex-A team? #182

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
japaric opened this issue Aug 20, 2018 · 9 comments
Closed

Form a Cortex-A team? #182

japaric opened this issue Aug 20, 2018 · 9 comments

Comments

@japaric
Copy link
Member

japaric commented Aug 20, 2018

We have a Cortex-M team focused on bare metal (no_std) development for
Cortex-M devices and an Embedded Linux team focused on development for embedded
Linux devices (this includes Cortex-A devices, MIPS routers, etc.).

Should we make a Cortex-A team focused on bare metal (no_std) development for
Cortex-A processors? This team would be involved in improving the developer
experience in this area, collecting or writing resources on the topic, and
maintaining and developing widely used crates.

In this space I know of these projects:

Opportunities I see:

  • Develop core crates for bare metal Cortex-A development. cortex-a would be
    in this group, and perhaps it makes sense to have some cortex-m-rt like
    crate (see also embedonomicon) to boot a RPi 3 or QEMU? What else could go
    here? It should not be board specific (e.g. not RPi specific).
  • Make it possible to build AArch64 kernels / programs on stable. The
    aarch64-unknown-none target would help here but a pre-compiled rust-std
    component would also be needed to avoid depending on Xargo / cargo-xbuild.
    What compilation target does the AArch64 port of Redox use?

  • Push for a stable core::arch::arm module (see Stable assembly operations #63) to make the cortex-a
    crate (see its asm module) work on stable w/o depending on GCC.

Who would be interested in forming part of such team?

cc @andre-richter @wizofe and I believe there was another person interested but
I forgot their name :-(

cc @Amanieu? I know you maintain general purpose no_std crates and iirc you
work, or have done work, with Cortex-A processors (though it may have been
no_std programs on top of Linux?)

@wizofe
Copy link

wizofe commented Aug 20, 2018

Help is here! I am definitely more than happy to work on that 👍 (and thanks for the invite)!

@jamesmunns
Copy link
Member

👍 to this, we might also want to CC @SergioBenitez, as he has taught a class on this at Stanford, and might be interested or able to point us to other people in this space.

I had 2-3 people asking me about this at RustConf this past weekend.

@jamesmunns
Copy link
Member

We also may want to consider either renaming this to a "microprocessor" team, or consider some other arches like PPC, which are used in a bare metal fashion for things like control systems, satellites, etc as well.

That being said, I have seen the most public interest in cortex-a bare metal so far.

@ghost
Copy link

ghost commented Aug 20, 2018

Sorry to steal your line, sir. But I love it when a plan comes together.

A-Team

@andre-richter
Copy link
Member

I'm glad to see interest in this topic.

The past couple of months I already put effort into laying the groundwork for making Rust on AArch64 an enjoyable and seamless experience. I'm most happy that register-rs has landed (thanks again to the nice collaboration with the tock team!), which provides a unified interface for both MMIO and CPU registers. It features the same API for both resources. cortex-a already leverages register-rs (btw its not cortex-a specific, feel free to pick it up!).

Also, with aarch64-unknown-none, the first aarch64 bare-metal target has landed upstream.

Finally, rust-raspi3-tutorial is basically the showcase that presents all of these resources coming together, while adhering to the embedonomicon for writing the boot code.

If people think it helps with regards to visibility or promotion, I'm open to move all this stuff to the WG. I put register-rs into @phil-opp 's OSDEV group recently, but we can nicely ask him if he would support moving it to a "more official" place if people deem it useful :)

In the past I also tried to write a cortex-a-rt, but soon abandoned the idea. I found that initialization code for kernels differs just too much between each other. Once you go multi-core, there's usually lots of custom assembly involved already in the earliest stages of booting. Even the target architecture can be a difficult disussion already, as has been shown here.

@raw-bin
Copy link

raw-bin commented Aug 21, 2018

Hi.

A focused group on Cortex-A and Rust would be a very good thing! (Thanks @japaric for the heads up).

I'm with Arm working on open source system software for safety critical domains and wanted to share some thoughts here.

Within the Arm safety critical ecosystem, there is growing interest in enabling Cortex-A Armv8 bare-metal programming with Rust. The primary use-cases are Secure-EL3 resident applications (secure monitors, Trusted bare-metal 'applets', Trusted Firmware) as well as more traditional boot loader class software (non-secure EL1 resident). There's a similar theme for Cortex-M.

See Trusted Firmware for Cortex-A and for Cortex-M for pertinent examples of the kind of software that could be fortified by Rust.

Agree with @andre-richter about kernel init code being different between kernels - often needlessly so IMO. I'm on the lookout for ways to prevent needless duplication. Towards that aim: I'm porting Redox OS to Armv8, specifically the 64-bit AArch64 execution state. See here for a slightly dated overview. I hope to make the Redox AArch64 specific code a comprehensive and re-purposable example of typical Armv8 EL1 -> EL0 initialisation and run-time code written in Rust to the extent permissible. I think that would be an interesting alignment/discussion point for a Cortex-A Rust focused group.

(Some background info about the port which may be of interest: At work I'm exploring overlaps between microkernel designs and upcoming Arm architectural extensions. I'd like Rust to be the foundation for this exploration. Rather than do a microkernel from scratch I decided to port Redox instead. I'm initially targeting a virtual Armv8 platform (qemu-system-aarch64) for the core kernel bring-up. I've made a fair bit of progress and at present I see stirrings from user-space which is exciting! @wizofe is an RSoC assignee who's shadowing me and is tasked with bringing up my core port on the Hikey960 board. He's also super-keen to help! Oh and since @andre-richter mentioned aarch64-unknown-none: I have a WIP support for the aarch64-unknown-redox triplet to rustc+llvm and binutils+GCC).

I had no idea about register-rs! I wrote my own Armv8 system control register access routines for Redox. I will look to see if I can revector to this crate eventually.

At some point I'd like to 'port' @phil-opp's excellent x86_64 Rust kernel blog to AArch64 - something that the Redox core work should help with. That would be another tiny step to prevent redundant re-implementation of common OS design idioms.

Anyway, I think I should be able to help provide Cortex-A architecture insights and channels to the mothership as and when needed! Please advise on next steps. Cheers.

@japaric
Copy link
Member Author

japaric commented Sep 1, 2018

It's great to see there's lots of interest.

To create a new team you'll need to make PR adding the ilst of team members to the README. This PR will also be a proposal for the /all team to vote on so it must also include a rough plan of what you want to accomplish in the short and medium term, for example: getting AArch64 no_std programs to build on stable (see built-in targets and rust-std components); creating or moving existing core crates (e.g. cortex-a listed above) or resources like tutorials into the organization; etc.

You can use proposal #199 as an example / reference.

@raw-bin
Copy link

raw-bin commented Sep 6, 2018

Hi.
Thanks for the info and the pointer to the reference PR. I'll follow up on this.

bors bot added a commit that referenced this issue Oct 8, 2018
207: [RFC] Initial Cortex-A team r=hannobraun a=andre-richter

This is a proposal for creating a Cortex-A team.

This is based on and will close issue #182. Please refrain from approving until I removed the [DRAFT] from the title and every proposed member has his points on the agenda.

@raw-bin, @wizofe and me will be the initial members.

The following work is planned for this team:

### Maintain a set of ecosystem crates under the embedded WG

- [ ] Write a tool that generates accessors for the ARM System Register XML.
- [ ] Move [cortex-a](https://github.com/andre-richter/cortex-a) to the WG and keep extending/completing it.
    - [ ] If feasible, feed the XML accessors into the crate.
    - [ ] Add ready-to-use idioms for bare-metal use cases.
        - [ ] MMU idioms
        - [ ] GIC idioms
        - [ ] ...? 
- [ ] Move [register-rs](https://github.com/rust-osdev/register-rs) to the WG. CC @phil-opp for sign-off.
- [ ] Discuss if something the likes of `cortex-m-rt` is feasible for cortex-a.

### Provide resources for learning

- [ ] Move [rust-raspi3-tutorial](https://github.com/andre-richter/rust-raspi3-tutorial) to the WG

### Make it possible to build AArch64 kernels / programs on stable.

- [ ] Add a `rust-std` component for `aarch64-unknown-none`
- [ ] Differentiate into further aarch64 targets, e.g. a non-fp version of `aarch64-unknown-none`, and add them as well.

### Stabilization

- [ ] Push for a stable core::arch::arm module (see #63) to make the `cortex-a` crate (see its asm module) work on stable w/o depending on GCC.

------------------

@raw-bin and @wizofe, kindly let me know your agenda points and I will edit them into this comment.
I understand your Redox work will most probably be a part of it, but I want to leave it to you guys to describe it.

Once we are set, I will remove the [DRAFT] and open this for members to approve.

@jamesmunns I tend to agree to your thought about having a microprocessor group. However, I think that cortex-a alone is such a complex architecture, it can easily keep the initial three of us busy for years to come.
I would argue that we would need separate teams for PPC, RISC-V and the likes.

Co-authored-by: Andre Richter <[email protected]>
@andre-richter
Copy link
Member

Closed by #207

@dylanmckay dylanmckay mentioned this issue Dec 19, 2018
8 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants