Programmable Devices
CPLDs, FPGAs, SoC FPGAs, Configuration, and Transceivers
Need Forum Guidance? Click here

Search our FPGA Knowledge Articles here.
18958 Discussions

__CTOR_LIST__ points to nonsense in HAL initialization?

Honored Contributor II

Hello all, 


I'm working on a firmware project employing the Nios II processor. The project seems to run just fine when I upload the whole .pof file to my board, but when I run the .sof using Quartus II and then try to debug, I run into a problem - the application receives a SIGTRAP signal before even entering main(), resulting in the following error message: 


Program received signal SIGTRAP, Trace/breakpoint trap. 

0x00080148 in alt_instruction_exception_entry () 


Afterwards, I cannot move any further in the application. 


Upon closer inspection, this happens in the _do_ctors() subroutine in alt_main(), apparently when calling the first constructor.  


I stepped through the disassembly code in the _do_ctors() subroutine - the aforementioned address (0x80148) contains a "callr r2" instruction, which should correspond to calling a constructor. However, the value contained in r2 at the time is 0x0800683a, which not only doesn't point to a valid instruction, it is also not divisible by 4, so there might even be an issue with alignment. 


Can you tell me where the __CTOR_LIST__ and __CTOR_END__ values actually come from so I can determine their validity? Or do you maybe have some other suggestions about what the problem might be or how to help find it?
0 Kudos
0 Replies