Forum Discussion

Altera_Forum's avatar
Altera_Forum
Icon for Honored Contributor rankHonored Contributor
20 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

5 Replies

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

    Hi Conners,

    > ...

    > 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?

    This is not a conflict. Remember, the only thing you changed was the exception

    address -- the address that is loaded into the PC when an exception is taken.

    Everything else is the same. You can continue to place all of your code/data in

    SDRAM -- only the exception code _must_ be located at the exception address

    in your SRAM.

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

    > system behave.

    Make sure your exception code is really where it ought to be: use objdump to confirm

    that your ".exceptions" section is correctly located.

    BTW: How do you load your application into memory?

    Regards,

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

    the .exception code should be located in the ext_ram.

    and i also met the same question about the print word in the console
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    --- Quote Start ---

    originally posted by wbqyy@Apr 14 2006, 02:58 AM

    the .exception code should be located in the ext_ram.

    and i also met the same question about the print word in the console

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

    --- quote end ---

    --- Quote End ---

    Thank you for your replies. 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.

    My code is downloaded through the JTAG port using the USB Blaster and i have put no code into flash. I run or debug the program as NIOS II HARDWARE

    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.