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
Question about aarch64 memory access #10
Comments
The asm output for the 1st variant (loop over values) generates 32-bit load/stores 801d8: ldr w8, [x1]
801dc: movk w21, #16128, lsl #16
801e0: str w8, [x0, #20]
801e4: ldr w8, [x1, #4]
801e8: stp w8, wzr, [x0, #24] The second variant (copy_from_slice) seems to use one 64-bit load/store 801d8: ldr x8, [x1]
801dc: movk w21, #16128, lsl #16
801e0: str wzr, [x0, #28]
801e4: stur x8, [x0, #20] I'm not sure why one would work and not the other. |
Hi, the cluprit is This causes a synchronous exception in AArch64, that's why your RPi3 hardware just halts. |
Ah, thank you for the pointer and the explanation. That makes perfect sense now. Exceptions are next on my list so I guess now will be as good of a time as ever to jump into them. Big thanks for the work on this repo and other embedded crates. They made the experience of porting my C64 emulator to bare-metal RPI3 quite enjoyable! Cheers, |
Glad to hear, thanks 👍 I'll go ahead and close this, and try to get |
targets: aarch64-unknown-none: Add +strict-align On AArch64, an unaligned access causes a synchronous exception. In the current state of the target, the compiler might generate unaligned accesses, see rust-embedded/rust-raspberrypi-OS-tutorials#10. Since this is a bare-metal target, it is possible that there is no exception handling in place (yet) to recover from this case, causing a binary to just silently fail. Add `+strict-align` to avoid this case.
I am running into an interesting issue where a slightly modified version of 05_uart0 example keeps hanging on my rpi3 hardware.
I modified the example and for clarify moved code to get the board serial number into its own function. The function takes a slice (&mut [u32]) to fill in the part of mbox buffer that represents request data and uses it to collect response output.
The issue I'm running into is around how my slice gets copied into the mbox buffer.
If I simply do a loop and iterate over slice values, it works fine.
However, if I use rust's copy_from_slice function, the program hangs
This feels to me like some unaligned access issue but I'm not sure how to further debug it. Is there anything I'm doing wrong when trying to use copy_from_slice?
Thanks
-Seb
Here is the complete modified source code for main.rs.
The text was updated successfully, but these errors were encountered: