Forum Discussion
Altera_Forum
Honored Contributor
14 years agoIn the past I removed a lot of that crud (WTF does it call close() when main returns!) by renaming my function alt_main() instead of main() - since a lot of the code that faffed about with libc setup/teardown for stdio was in alt_main().
But in the end I gave up and used completely custom linker scripts and my own code at the reset vector. You only need about 4 instructions before jumping into C. Since I don't use interrupts for anything (the code's main loop polls the hardware registers), the only interrupt/exception entries are fatal traps - so the execption code dumps all the registers into a 'save area' and leaves the system in a state where outside code can read memory (in my case the nios writes to a pio location that puts itself into reset!)