OK, after a little investigation, I figured out the issue, which appears to be related to LTO (Link-Time Optimization).
Basically, interrupt handlers were not being correctly called -- for instance, OTG_FS_IRQHandler, rather than calling its C implementation, was calling Default_Handler which of course goes into an infinite loop. This appears to be a gcc LTO issue, and I believe this StackOverflow question may shed light into the issue.
For now I did the hackiest thing imaginable: I edited the startup file and commented out every single .weak/.thumbset block and tried compiling again. There were linking errors for the missing IRQ handlers, so I added them back only as necessary. In the end, only IRQ Handlers that are actually declared elsewhere in the code were commented out.
With this hack, Espruino correctly compiles and runs on gcc 8-2018-q4-major.
I'm researching the "correct" solution in this case, and will create a pull request when I find it.
Espruino is a JavaScript interpreter for low-power Microcontrollers. This site is both a support community for Espruino and a place to share what you are working on.
OK, after a little investigation, I figured out the issue, which appears to be related to LTO (Link-Time Optimization).
Basically, interrupt handlers were not being correctly called -- for instance,
OTG_FS_IRQHandler
, rather than calling its C implementation, was callingDefault_Handler
which of course goes into an infinite loop. This appears to be a gcc LTO issue, and I believe this StackOverflow question may shed light into the issue.For now I did the hackiest thing imaginable: I edited the startup file and commented out every single
.weak
/.thumbset
block and tried compiling again. There were linking errors for the missing IRQ handlers, so I added them back only as necessary. In the end, only IRQ Handlers that are actually declared elsewhere in the code were commented out.With this hack, Espruino correctly compiles and runs on gcc 8-2018-q4-major.
I'm researching the "correct" solution in this case, and will create a pull request when I find it.