Altera_Forum
Honored Contributor
21 years agoNIOS II hangs when switching to onchip memory
Hi,
I've trouble moving from a NIOS II system with flash and external SRAM to a self contained system runnning with onchip memory only. We need this for programming our flash the very first time, so the small system using onchip memory only should be able to program the flash. The data for flash programming come from an external interface, in this case not the JTAG interface. Our system and code run fine, if external memory is used , switching to onchip memory, the system hangs when calling "alt_flash_open_dev" from the HAL. Maybe the system even restarts. No warnings about low memory or other things come up in the NIOS IDE. Our NIOS system has its reset vector and interrupts set to the beginning of the onchip ram, 24kByte in our case, and no JTAG interface installed. Interrutps occur during communication with external interfaces. Sure, we optimized our compiler settings to make the code fit into the onchip memory: application settings * faster code, no frame pointer : on * optimize most (-=3) * Debug Level none system library setting: * faster code, no frame pointer : on * optimize most (-=3) * Debug Level none * stdout: null * stderr : null * stdin: null * Periodic system timer: none * Timestamp timer: none * Max file dscriptors:4 * Clean exit: unchecked * Small C library: checked * ModelSim only: unchecked * Reduced device drivers: unchecked (we need the HAL handling the flash memory for us) * Link with profiling library: unchecked * we use an auto-generated linker script * Program memory (.text): onchip_memory * Read-only data memory (.rodata): onchip_memory * Read/write memory: ext_sram, 1Mbyte in this case. When compiling the code, the IDE messages a program size of 25KBytes (code + initialized data) and 1012kBytes free for stack + heap. How can this program fit into an onchip memory of 24kBytes size? Any idea what's on? Thanks!