Altera_Forum
Honored Contributor
15 years agoMPU problems
I'm running Quartus 10.0 SP1 and have a system that is comprised of 1MB of off-board SRAM memory, 32MB of off-board FLASH (unused), and 196kbytes of on-chip memory. Further, I have several peripheral devices defined using SOPC builder... including a NIOS II/f with the MPU enabled. I have MPU limits enabled. Instruction regions are defined w/64kbyte boundaries and 8 total regions. Data regions are defined w/16kbyte boundaries and 8 total regions. I've read AN540 and used the example code as a basis to define regions in my application.
At the beginning of my main() function, I execute the data & instruction region configuration initialization and then enable the MPU via nios2_mpu_enable(). It's at this point that operation fails. The failure exhibits itself simply as the system hanging. When I hit the Suspend button in NIOS II Debug, the debugger comes up with alt_irq_entry(), but I am unable to step through it. Worse, sometimes I don't even see that and I get: "assertion "m_state == STATE_RUNNING || m_state == STATE_HUNG || (m_state == STATE_DEBUG && with_reset)" failed: file "nios2debug.cpp", line 297". Not very helpful to say the least. Tracing into the enable function, I reach nios2_write_config() where it performs a NIOS2_WRITE_CONFIG(bstatus). It's at this point that I have troubles. I've tried to configure the MPU so that everything is wide open -- all data is available for R/W access and all instruction regions are available for execution. No difference. Added to that I've tried to mark everything as uncached. No difference. Any ideas on the proper method to troubleshoot this or what the problem might be? I never did build the example project in AN540, but I've used MMUs before (which are a bit more complicated than MPUs) and haven't run into problems like this before. Thanks, --tim