-
Notifications
You must be signed in to change notification settings - Fork 49
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
Raspberry Pi 4B & 5 baremetal blink example #67
base: main
Are you sure you want to change the base?
Conversation
This doesn't need to be necesarily specific to the 4B, I might as well adapt it to the 5B. Some register values might be different, especially because the 5's ACT (green) LED (and the whole GPIO) is not directly connected to the main processor, but via the RP1 chip, perhaps making it a bit harder to blink directly. Still, one could blink another LED connected directly to the GPIO by changing the pin(currently hardcoded in Swift MMIO registers) Edit: I think I'm partially wrong, It appears that the green (ACT) led is connacted to the always-on GPIO pin 9 (the BCM2712's GPIO) on the RPi 5 according to this. Edit 2: Yes, the last edit is accurate. I got this working. |
That was faster than expected, I think it's ready for review now! |
|
I also got this working on a Pi 5! I managed to gather the relevant register details (adresses & necessary bit values). |
I think the example makes sense to add. However Im trying to get CI setup for this repo before adding additional examples, so avoid hosting broken code! |
Make sense, alright!
I'm not sure what you mean by that, do you mean that this example is broken somewhere? I was able to build & run it just fine, but maybe that's on my machine only. Let me know if you had any problems if you tested this. Either way, as you suggested, we should popstone this example and come back to it once we get CI integration. That's a good idea. |
I mean the examples silently breaking due to changes in the swift compiler or other example dependencies, e.g. the SDKs where we depend on a branch. |
Oh, right, yeah. Great idea. |
52f43bb
to
b2e3601
Compare
Currently just a draft for a baremetal Raspberry Pi 4B 64-bit blink example (
-target aarch64-none-none-elf
). I'll add the code soon - I'm making this draft public now to receive suggestions & feedback as I work on this example.I already got Embedded Swift working on a 4B (blinking a led with Swift-MMIO), but I need to do some cleanup & better organize the code & build process. I'll upload it here after I do that (it will be in a Swift Package format).
I'm currently using
llvm-objcopy
as a last step to convert the resultedELF
file, with something like$(LLVMPATH)/llvm-objcopy -O binary kernel8.elf kernel8.img
. From what I've seen, there doesn't seem to be any viable alternative, so users will need to install llvm withbrew
, sincellvm-objcopy
is not installed by default.