Altera_Forum
Honored Contributor
11 years agoELF download behaves differently than initialized hex
I have searched the archives but haven't turned up this problem.
I have a NIOS II based system with some custom embedded peripherals, a JTAG UART (for debugging) and a non-JTAG UART (the system I'm designing is using RS-232 communication). I am running a project derived from the "hello_world_small" sample using the NIOS build tools in Eclipse. It uses a minimal amount of HAL functionality, but no operating system. The NIOS currently has two embedded RAM blocks (currently both 8K in size), one for code and one for data. (I say "currently" because originally I had an embedded ROM block for code segments .text and .rodata. I changed it to RAM to enable the test I am describing here.) The code RAM is configured to be initialized with the .HEX version of the system software. So here's the problem. If I download .SOF of the NIOS system, THEN download the ELF binary of the system software using the Eclipse Run As NIOS II hardware functionality, the software appears to work perfectly. (It seems to send, process and respond to an arbitrary number of packets over RS-232.) BUT... If I download the .SOF of the NIOS system and DON'T download the ELF binary of the software, but rather just let it boot from the .HEX version of the software as initialized into the code RAM, the software appears to work perfectly for a while, then hang. The behaviour is repeatable. For a given build, the system will respond correctly to six packets, or eight, or four, or some other fixed number, then hang. It has the feel of a stack overflow problem. The interrupt service routines are still running (at least the ISR that responds to serial input is definitely running) but the high-level program fails. So, I have two questions: 1) Has anybody encountered something like this before? What could possibly be different between the downloaded ELF and the initialized HEX version of the same software? I speculate that it might be different handling of unused portions of the memory, but I can't imagine why it would matter what is in code space that is never reached. I also can't even hypothesize how the system could respond properly to six copies of the same packet, then fail on the seventh. 2) Does anybody have suggestions of how to debug this? Right now, all I know for sure is what I have written above. The software works, then it doesn't. I can't send debug messages out the JTAG UART because I'm not using it. Is it possible to use the Eclipse NIOS JTAG UART console without downloading the ELF? if so, I haven't figured out how.