-
Notifications
You must be signed in to change notification settings - Fork 420
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
Add new uart0-helloworld-sdboot.sunxi bootable test image #44
Conversation
a2427bb
to
5c9331a
Compare
Updated the pull request. Changes in v2 (5c9331a):
|
Now we can easily test SPI boot for any A10/A20/H3/A64 board without all the hassle compiling and embedding a suitable U-Boot SPL or boot0 blob. Also see linux-sunxi/sunxi-tools#44 Signed-off-by: Siarhei Siamashka <siarhei.siamashka@gmail.com>
Nice work. I consider this very useful - not only as a test payload per se, but also in gaining the ability to make use of UART output for diagnostic purposes, e.g. when debugging the BROM → SPL transition. |
I've been struggling quite a bit with my armv7a-hardfloat-linux-gnueabi-gcc-4.9.3 compiler to get this working on a Banana Pi. The A20 would happily print After a while I could narrow the hang down to the source line doing the The root cause is that After adding this to ARM_ELF_FLAGS, the gcc-4.9.3 compiled binary works just fine - e.g. it returns gracefully to FEL. |
After adding the above |
Oh, thanks for investigating this. My only concern is that the As an alternative solution, maybe inline assembly code could do the job and hide the NULL pointer from the compiler? Something like |
Or we could pretend that the SPL header starts at the address 4, skipping the initial branch instruction. |
I just came up with that idea, too... Let's make it a "signature" pointer at 0x4 or 0x10004. 😃 I'll retest that when I get back home later (~20:30 UTC). I also dislike having to add a bunch of compiler options to the Makefile that are hard to track / understand, and might not work well across a wide range of compilers. |
BTW, this test program also relies on the existing stack setup. The BROM seesm to configure the initial stack location in a reasonable way (when booting from the SD card, eMMc, NAND, etc.), see the "Initial stack pointer value (SP register) " column in the table at https://linux-sunxi.org/BROM#U-Boot_SPL_limitations for more details. As for the FEL mode, currently the stack is set up just below the thunk code. Most of the SoC variants have a lot of room for the stack below the thunk code in the FEL mode, but A31 and A80 are a little bit problematic. Either we need to change the thunk code location on A31 and A80 to provide more space for the stack, or the uart0-helloworld-sdboot.sunxi needs to setup it's own stack. |
Using an offset of 0x4 (= the start of the SPL signature) avoids the NULL pointer quirk without changes to the Makefile / ARM_ELF_FLAGS: https://gist.github.com/n1tehawk/776bdd1e3f0fdeb04deefbec3b531bdd. A test on A20 passed without problems. I also like the idea of converting |
Siarhei, in case you're short on time / too busy to submit a v2: I'm also okay with merging this as-is, augmented by a fixup commit that addresses the possible "NULL pointer dereference" (by doing the suggested change to offset 0x4). |
This is a universal bootable image, which just prints a hello message on UART0. For example, it is useful as a test payload when debugging the SPI boot functionality: https://linux-sunxi.org/Bootable_SPI_flash Changes in v2: - A workaround for https://patchwork.ozlabs.org/patch/622173 - Also print the type of the used bootable media Changes in v3: - Bernhard Nortmann's workaround for https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63803 More details in linux-sunxi#44 Signed-off-by: Siarhei Siamashka <siarhei.siamashka@gmail.com>
5c9331a
to
958143e
Compare
Updated the pull request. Changes in v3 (958143e ):
|
Thanks, merged. We can do additional improvements (A80 support?) via other pull requests. |
This is a universal bootable image, which just prints a hello message on UART0. For example, it is useful as a test payload when debugging the SPI boot functionality.
Still no support for A23, A33, A83T and A80, because I don't have any of these devices to test.
Patch revision v1 (53f7f14).