Forum Discussion

Altera_Forum's avatar
Altera_Forum
Icon for Honored Contributor rankHonored Contributor
8 years ago

__CTOR_LIST__ points to nonsense in HAL initialization?

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?
No RepliesBe the first to reply