- 
          
- 
                Notifications
    You must be signed in to change notification settings 
- Fork 780
nrf51: convert crt1.c to rust (UNTESTED - NOMERGE) #369
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
Conversation
| @niklasad1 @frenicth would be great if you could take a look at this too. | 
| We definitely want to port to Rust. If this proves challanging, I'll take it on as part of another change i want to make w.r.t interrupt handling anyway. | 
these should've been near enough without being necessarily in the same functions, but llvm complained, and it's an easy fix
| Current status: panic's pretty immediately: tossing in a breakpoint a few instructions into  That should be in the  ohh... what if generic's jumping to unhandled somehow? yeah.. that's absolutely what's happening. It is not immediately obvious how generic isr ends up jumping to unhandled interrupt without triggering another interrupt though? This stream-of-consciousness debug session to be picked up again tomorrow | 
| Oh yeah.. generic_isr will be interleaving here - following this path, it's not a process interrupt, so jump to no stacking, from ipsr we're looking for interrupt 0x12, which is entry 0x12-16 = 2 in our interrupt table which is  | 
| Okay, that hack just results in a hard fault. Actually stopping working on this for the day now. | 
Using https://github.com/jameysharp/corrode, automatically convert the old crt1.c to Rust. In contrast to #369, which sought to update this file to newer Tock conventions, this is a blind translation, but should hopefully unblock #367.
| Yeah, I think there is still some work to be done to convert #649 to more human-friendly Rust, but that’s a different path forward than this PR. | 
Starting to get down a rabbit hole here:
So, #367 is blocked because it doesn't build on the NRF. This is because the build.rs gcc invocation is emitting a .got section that being pulled into the vector_table, which overruns its now limited size (before it was just wasted/ignored space). Of the two paths forward (1) fixing the C compilation or (2) porting the nrf crt1.c to Rust, @brghena pushed me to the latter, which was the right choice.
Thus this PR, which is now blocked because it manages to trip a known bug ( https://bugs.llvm.org//show_bug.cgi?id=30279 found via japaric/f3#42 ) in LLVM 3.9, which our current nightly is at. Thus, we need to bump nightlies to get to LLVM 4.0, which will be the next PR, forthcoming either later tonight or tomorrow depending on how easy/hard the nightly bump is.