-
Notifications
You must be signed in to change notification settings - Fork 19
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
Works on real hardware again! #8
base: master
Are you sure you want to change the base?
Conversation
6c0c52d
to
69db93b
Compare
This commit adds various changes to ClashOS to get the stack traces and bootloader to work again in qemu and on real hardware. The linker scripts are changed to allow the binary to be linked at the address 0x80000. This is the default address at which the raspberry pi will load kernel8.img when no 'config.txt' file is present on the sd card. To allow stack traces to work, the link register had to be zero'ed, because it contains random stuff on start up on real hardware. It work on qemu, because it sets the link register to zero. The code for the framebuffer is currently comment out, because for some reason the loading over serial fails to work when that code is compiled. But loading over serial now works!
69db93b
to
31b15c6
Compare
\o/ I'll work with you on upstreaming all the zig improvements needed to get this working again. |
Great! I guess the "+strict-align" is being solved with ziglang/zig#3927 ? It is actually a work around for unaligned code that is generated in the std, but it does solve the problem (with some performance penalty i guess). For the issue with the DWARF spec, I'm not what the correct thing will be, we could just not assert, but maybe we have to find a workaround in ClashOS instead of the std library. |
Note: I actually had to change |
Here's the issue to get rid of the llvm-objcopy dependency: ziglang/zig#2826 |
Jup, but actually it wasn't working at all on real hardware when using |
Okay, so I've had the stack tracing working in freestanding before in my LIMNOS project. It's broken now though, and I'm not sure if it's due to changes on my side or in the standard library, because I started with a custom overridden standard library, updated it a couple times, then switched to the OS layer in the standard library. I might be able to find a working commit though and see what actually changed, because I'm very interested in that feature as well. |
This commit adds various changes to ClashOS to get the stack traces
and bootloader to work again in qemu and on real hardware.
The linker scripts are changed to allow the binary to be linked at the
address 0x80000. This is the default address at which the raspberry pi
will load kernel8.img when no 'config.txt' file is present on the sd card.
To allow stack traces to work, the link register had to be zero'ed, because
it contains random stuff on start up on real hardware. It work on qemu,
because it sets the link register to zero.
The code for the framebuffer is currently comment out, because for some reason
the loading over serial fails to work when that code is compiled. But
loading over serial now works!
The current implementation of the DWARF debug info parsing doesn't work for freestanding, because of some assert, which is actually part of the DWARF specification according to @LemonBoy. Also in
FixedBufferAllocator.alloc
there is some code generated that causes an alignment exception on real hardware. The following patch was used to solve these two issues:BTW: I know that the target_specific_features shouldn't be solved like this, but that's a different issue. For this to work it needs "+strict-align".