Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Altera_Forum
Honored Contributor I
753 Views

Exception vectors in on-chip memory - crash

Hi, 

 

I have a long-running GEN2 NIOS software project that has been running for years with exception vectors in DDR (the code is copied from EPCS to DDR via a custom bootloader). I would like to move them to on-chip memory for various reasons and assumed it was a simple matter of modifying the vector memory drop-down in the NIOS component and rebuilding everything. However, doing this results in the application crashing soon after startup. The exact crash depends on whether or not I enable alt_load_copy_exceptions in the BSP settings. 

 

With alt_load_copy_exceptions enabled, the vectors are copied by the application startup code during _alt_load from DDR to the on-chip exception memory as expected. However the code subsequently crashes 'after a little while' with UNHANDLED EXCEPTION 2 (NIOS HARDWARE INTERRUPT). Somewhat curiously, debugging would suggest that some hardware interrupts are happening - and working - before this crash is encountered. I guess I should note that this is the setting that I ultimately intend to use. 

 

With alt_load_copy_exceptions disabled, the vectors are copied by the bootloader whilst the rest of the program is copied into DDR. Alternatively, the exception vectors are populated whilst the program is being loaded via GDB. All as expected. In this case, however, the code crashes 'after a little while' with UNHANDLED EXCEPTION 5 (ILLEGAL INSTRUCTION). 

 

I'm at a loss to explain exactly how I'm getting either of these two issues. GDB isn't much help as (not surprisingly) there's no context available at the time of the UHE. 

 

Using Quartus 15.1.2, GEN2 NIOS, no tightly coupled memories. Instruction cache, no data cache. Vector offset is currently 0x0, but I've tried 0x100 as well. 

 

Any idea what I may have overlooked? I've searched the forums but no hints for my specific issue. 

TIA
0 Kudos
1 Reply
Altera_Forum
Honored Contributor I
38 Views

Did you check the linker script at the BSP editor whether the exception is mapped correctly? 

Did you connect the data master to the exception memory? 

 

Since it it in onchip-memory, can you initialized the memory and avoiding from alt_load or bootloader the exception code?
Reply