Skip to content
New issue

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

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

Already on GitHub? # to your account

Add aarch32 support #33

Merged
merged 8 commits into from
Jan 30, 2025
Merged

Conversation

jonathanpallant
Copy link
Contributor

Implements the sysreg calls for aarch32 and aarch64.

Also fixes an issue I observed where SPECIAL_SECURE was being withheld from the application, but not SPECIAL_NONE - that seemed wrong.

See https://github.com/ferrous-systems/cortex-r/blob/send-arm-gic-upstream/cortex-r-examples/src/bin/gic.rs for an example tested in QEMU:

$ criticalup run cargo run --bin gic --features=gic --target=armv8r-none-eabihf
   Compiling cortex-r-examples v0.1.0 (/Users/jonathan/Documents/ferrous-systems/demos/embedded-world-2025/cortex-r/cortex-r-examples)
   Compiling arm-gic v0.1.2 (https://github.com/jonathanpallant/arm-gic.git?rev=4b7fb201707be062546148bc5c4b70b08c8c0455#4b7fb201)
    Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.49s
     Running `qemu-system-arm -machine mps3-an536 -cpu cortex-r52 -semihosting -nographic -kernel /Users/jonathan/Documents/ferrous-systems/demos/embedded-world-2025/cortex-r/target/armv8r-none-eabihf/debug/gic`
Found PERIPHBASE 0xf0000000
Creating GIC driver @ 0xf0000000 / 0xf0100000
Calling git.setup()
Configure SGI
gic.enable_interrupt()
Enabling interrupts...
CPSR: CPSR { N=0 Z=1 C=1 V=0 Q=0 J=0 E=0 A=0 I=1 F=1 T=0 MODE=0x1f }
CPSR: CPSR { N=0 Z=1 C=1 V=0 Q=0 J=0 E=0 A=0 I=0 F=1 T=0 MODE=0x1f }
Send SGI
> IRQ
- IRQ handle SGI 3
< IRQ

I'm using Ferrocene (criticalup run) because upstream Rust has armv8r-none-eabihf at Tier 3 so it isn't in rustup. But also because I can.

Copy link

google-cla bot commented Jan 28, 2025

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

@jonathanpallant
Copy link
Contributor Author

BRB, talking to my legal team about the CLA.

@jonathanpallant
Copy link
Contributor Author

oops, I forgot fake.rs. Tests should now pass.

@jonathanpallant
Copy link
Contributor Author

jonathanpallant commented Jan 28, 2025

The multi-core PR got merged and I need to rebase. Unfortunately that PR didn't update the example in lib.rs so I don't really know what I need to change in my application.

@qwandor
Copy link
Collaborator

qwandor commented Jan 28, 2025

The multi-core PR got merged and I need to rebase. Unfortunately that PR didn't update the example in lib.rs so I don't really know what I need to change in my application.

Ah sorry, we don't have doc tests running so I missed that. I'll send a PR to fix it, but it if you're on a single-core system it should just be a matter of passing 0 in a bunch of places.

@jonathanpallant
Copy link
Contributor Author

Rebased and re-tested.

If you don't get it right, you get a panic :/. But at least that told me that SGIs are in fact private interrupts (which makes sense). A compile failure would be better but I can't immediately think how to do that - you would probably have to split the interrupt type into private and shared kinds.

@qwandor qwandor self-requested a review January 28, 2025 16:13
Currently it witholds SPECIAL_START, which is actually SPECIAL_SECURE. This appears to be a typo, but I'm happy to be corrected (in which case I will have to deal with SPECIAL_NONE in my application).
@jonathanpallant
Copy link
Contributor Author

rebased on main

@qwandor
Copy link
Collaborator

qwandor commented Jan 28, 2025

Thanks for rebasing. I'll look at this once the CLA is sorted.

@jonathanpallant
Copy link
Contributor Author

The CLA is signed - just waiting for it to process.

@qwandor
Copy link
Collaborator

qwandor commented Jan 29, 2025

The CLA is signed - just waiting for it to process.

Hi Jonathan, your CLA signature still isn't showing up, either against your GitHub username or your email address jonathan.pallant@ferrous-systems.com. Did you maybe make a typo entering your GitHub username when you signed it?

@jonathanpallant
Copy link
Contributor Author

We have signed it as a Corporation, and I am a member of the google-cla@ferrous-systems.com group.

@qwandor
Copy link
Collaborator

qwandor commented Jan 29, 2025

Ah, gotcha. Hopefully that gets processed soon then.

@jonathanpallant
Copy link
Contributor Author

tada

Copy link
Collaborator

@qwandor qwandor left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@qwandor qwandor merged commit ad3377a into google:main Jan 30, 2025
3 checks passed
@qwandor qwandor linked an issue Jan 30, 2025 that may be closed by this pull request
jonathanpallant added a commit to ferrous-systems/cortex-r that referenced this pull request Jan 30, 2025
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

AArch32 support
2 participants