Forum Discussion

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

My First Nios-II

Hi,

I am trying to run a really simple Nios-II application using the ISS. After starting execution, the application does not even reach main(), however.

Instead it decides to crash within the system initialization routines, specifically, in a strcmp() call. The ISS reports:

'cpu::nios2ModelRun: ERROR: [439] instruction fetch access to address 0x1af8 returned uninitialized memory (valid mask=0x0)',

...and that is the end of the show.

The C-statement causing the error is:

strcmp("hoi","la"); /* yes, I lacked inspiration in coming up with better string names */

And the assembly statement within strcmp() causing the error when single stepping over it is:

0x00001af8 <strcmp>: ldb r6,0(r4)

Now, the value of register r4 right before entering the offending assembly line is r4 = 0x402c. So the Nios-II is reading a byte from location 0x402c in memory.

At this specific location is the value:

format: (address) (hex contents) (ascii contents)

0x0000402c 68 6f 69 00 hoi.

One would say that reading this memory location would be perfectly legal... I wonder if it has to do with the remark &#39;valid mask=0x0&#39; in the error message.

Anyone, any idea ?

Bye,

Roland Vossen.

------ info about my Nios-II system ---

Altera Nios II ISS Software Simulation Environment Version 2.0

Copyright © 2003 Altera Corporation

Info : Successfully read SOPC Builder PTF file &#39;D:\altera\roland_designs\first_nios\rollator.ptf&#39;

Info : The SOPC Builder system contains the following modules:

Info : Bus module &#39;cpu_instruction_master_bus&#39; - avalon.dll

Info : Bus module &#39;cpu_data_master_bus&#39; - avalon.dll

Info : Master module &#39;cpu&#39; - altera_nios2.dll

Info : Slave module &#39;timer&#39; - altera_avalon_timer.dll

Info : Address span: 0x8800-0x881F (cpu_data_master_bus)

Warning : SOPC Builder system component pio_led is not supported by the simulator. Simulation may be incorrect if your software attempts to access it

Info : Slave module &#39;pio_led&#39; - altera_avalon_pio.dll

Info : Address span: 0x8840-0x884F (cpu_data_master_bus)

Info : Slave module &#39;onchip_ram&#39; - altera_memory.dll

Info : Address span: 0x4000-0x7FFF (cpu_instruction_master_bus)

Info : Address span: 0x4000-0x7FFF (cpu_data_master_bus)

Info : Slave module &#39;onchip_rom&#39; - altera_memory.dll

Info : Address span: 0x0000-0x3FFF (cpu_instruction_master_bus)

Info : Address span: 0x0000-0x3FFF (cpu_data_master_bus)

Info : Slave module &#39;uart_0&#39; - altera_avalon_uart.dll

Info : Address span: 0x8820-0x883F (cpu_data_master_bus)

Info : The debugger will be attached to processor cpu on port 2342

Info : Configuring &#39;rollator&#39; model

Info : PTF Setting uart_0/SYSTEM_BUILDER_INFO/Iss_Launch_Telnet="0" detected

Info : &#39;uart_0&#39; character stream will be displayed in this window

Info : The host communication device for stdin is uart_0

Info : The host communication device for stdout is uart_0

Info : The host communication device for stderr is uart_0

Info : Running &#39;rollator&#39; model

Error! : Failed memory access in component cpu - Reading data 0x12f1d0 from uninitialised memory (addr = 0x1af8)

Info : Component cpu&#39;s program has terminated

Info : Instructions executed = 439

Info : cpu simulation return code 1

Info : Exiting rollator model with return code 1 (0 fatal errors, 1 error, 1 warning)

cpu::nios2ModelRun: ERROR: [439] instruction fetch access to address 0x1af8 returned uninitialized memory (valid mask=0x0)

2 Replies

  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    Roland,

    The error message is complaining about the instruction fetch.

    <div class='quotetop'>QUOTE </div>

    --- Quote Start ---

    ERROR: [439] instruction fetch access to address 0x1af8 returned uninitialized memory[/b]

    --- Quote End ---

    It sounds like the simulator&#39;s memory at 0x1af8 hasn&#39;t been initialized. The simulator realizes this when it fetches an instruction from that address.

    <div class='quotetop'>QUOTE </div>

    --- Quote Start ---

    I wonder if it has to do with the remark &#39;valid mask=0x0&#39; in the error message.[/b]

    --- Quote End ---

    I think that the value mask records which bytes of the memory have been initialized. 0x0 means an entirely uninitialized word.

    Kerry
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    Hi,

    Update: this problem was solved by upgrading from Nios-II V2.0 to Nios-II V2.1. Issue closed.

    Bye,

    Roland.