Forum Discussion

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

Exception Address Problem

I am new to using NIOS II and have run through a number of examples and tutorials successfully.

I have been able to succesfully run the "Hello World" program on the "standard" example for the NIOS II Cyclone 1C20 development board (in ../kits/nios2_51/examples/vhdl/niosII_cyclone_1c20/standard).

I have then attempted to modify this example by changing the Exception address to map to the ext_ram memory module as opposed to the SDRAM memory module in the "More NIOS II cpu Settings" tab in SOPC builder. I can see the exception address changes to within a valid address for my system (0x02000020)

I then rebuild in SOPC Builder, update the symbol and recomple in Quartus. I then download the new program to the FPGA and launch the NIOS II IDE from SOPC builder. I then select a new project based on the "hello world" template and ensure that this project is based on the correct ptf builder file.

If i then go to system library in properties of the syslib folder that has been created i see that the program memory, read only data memory and read/write data memory heap memory and stack memory are all set to SDRAM. This conflicts with the settings i made in builder. Is this correct?

I can select ext_ram from the drop down menu for the above memories and then run the application, however i do not see "Hello World" printed to the console window.

Apart from the lack of a printf to the console the program does appear to be running.

Can anyone help me understand why this occurs and what i need to do to make my system behave.

Thanks in advance

Conners

4 Replies

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

    Hi conners,

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

    --- Quote Start ---

    If i then go to system library in properties of the syslib folder that has been created i see that the program memory, read only data memory and read/write data memory heap memory and stack memory are all set to SDRAM. This conflicts with the settings i made in builder. Is this correct?[/b]

    --- Quote End ---

    It is correct.

    The compiler generate many sector of Nios, see the following:

    0 .entry 00000000 00800c20 00800c20 00000094 2**5

    CONTENTS, ALLOC, LOAD, READONLY, CODE

    1 .exceptions 000001a8 01000020 01000020 00000094 2**2

    CONTENTS, ALLOC, LOAD, READONLY, CODE

    2 .text 0001a8a4 010001c8 010001c8 0000023c 2**2

    CONTENTS, ALLOC, LOAD, READONLY, CODE

    3 .rodata 0001d380 0101aa6c 0101aa6c 0001aae0 2**2

    CONTENTS, ALLOC, LOAD, READONLY, DATA

    4 .rwdata 00001f5c 01037dec 01037dec 00037e60 2**2

    CONTENTS, ALLOC, LOAD, DATA, SMALL_DATA

    5 .bss 000004d0 01039d48 01039d48 00039dbc 2**2

    ALLOC, SMALL_DATA

    6 .sdram_0 00000000 0103a218 0103a218 00039dbc 2**0

    CONTENTS

    7 .onchip_memory 00000000 00800c40 00800c40 00039dbc 2**0

    CONTENTS

    You can only set your .exceptions address in SOPC Builder, and can&#39;t modify it in NiosII IDE.

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

    --- Quote Start ---

    however i do not see "Hello World" printed to the console window.[/b]

    --- Quote End ---

    About this issue, I think you can search in this forum, there are many posts discussing it.

    FYI.

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

    --- Quote Start ---

    originally posted by david_cai@Apr 17 2006, 07:25 AM

    hi conners,

    <div class='quotetop'>quote

    --- quote end ---

    --- quote start ---

    if i then go to system library in properties of the syslib folder that has been created i see that the program memory, read only data memory and read/write data memory heap memory and stack memory are all set to sdram. this conflicts with the settings i made in builder. is this correct?

    --- Quote End ---

    It is correct.

    The compiler generate many sector of Nios, see the following:

    0 .entry 00000000 00800c20 00800c20 00000094 2**5

    CONTENTS, ALLOC, LOAD, READONLY, CODE

    1 .exceptions 000001a8 01000020 01000020 00000094 2**2

    CONTENTS, ALLOC, LOAD, READONLY, CODE

    2 .text 0001a8a4 010001c8 010001c8 0000023c 2**2

    CONTENTS, ALLOC, LOAD, READONLY, CODE

    3 .rodata 0001d380 0101aa6c 0101aa6c 0001aae0 2**2

    CONTENTS, ALLOC, LOAD, READONLY, DATA

    4 .rwdata 00001f5c 01037dec 01037dec 00037e60 2**2

    CONTENTS, ALLOC, LOAD, DATA, SMALL_DATA

    5 .bss 000004d0 01039d48 01039d48 00039dbc 2**2

    ALLOC, SMALL_DATA

    6 .sdram_0 00000000 0103a218 0103a218 00039dbc 2**0

    CONTENTS

    7 .onchip_memory 00000000 00800c40 00800c40 00039dbc 2**0

    CONTENTS

    You can only set your .exceptions address in SOPC Builder, and can&#39;t modify it in NiosII IDE.

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

    --- Quote Start ---

    however i do not see "Hello World" printed to the console window.[/b]

    --- Quote End ---

    About this issue, I think you can search in this forum, there are many posts discussing it.

    FYI.

    David

    <div align='right'><{post_snapback}> (index.php?act=findpost&pid=14425)</div>

    [/b]

    --- Quote End ---

    David,

    Thank you for your reply. I have checked my objdump file and can see where the exceptions should reside. From what i can see this file looks ok and the exception address falls within valid address space.

    I have re-run my program but removed the printf and replaced it with some code that increments a variable. When I run this program in debug mode I cannot get the code to break in main at all when my exception address is set to be located in ext_ram in SOPC Builder. Identical code will break if i set the exception address to be located in SDRAM. This is the only difference between the two builds.

    This leads me to believe that it is not a printf problem and is completely down to the exception address being located away from SDRAM. Any more tips and advice that you can give would be greatly appreciated. I dont think it should be this difficult!!!

    Thanks again

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

    Having carried out more experiments I now know that it is not just down to the exception address being in a different memory module.

    I also get exactly the same error if i change the offset of the exception address from say 0x00800020 (which works) to 0x00800220 (which doesnt work).

    I have viewed the objdump file and it seems to be aware of these "modified" addresses
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    I have now solved the problem. It appears that everything I was doing was correct however the version of software was not the latest. Having installed Service Pack 2 and a critical patch for the Quartus and Sevice Pack 1 for SOPC Builder the printf gets printed to the console as it should.