Forum Discussion

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

MEMORY TEST program usage

Hi guys,

I need to test DDR on my board.

I've created SOPC builder project with Nios and 2 memories - on-chip and DDR controller.

Both reset and exceptions point to on_chip.

Altera provides memtest.c which allows to test your external memory.

It is stated there that
The RAM test is destructive to the contents of the RAM.  For this
 * reason, you MUST assure that none of the software sections are located in 
 * the RAM being tested.  This requires that code, data, and exception 
 * locations must all be in a memory seperate from the one being tested.

So in the BSP settings all sectors go to the on_chip RAM.

But I don't know exactly how this memtest program knows which specific memory to test???

Basically, first you write in the Nios console which specific range of memory you would like to test by writing address in 0xXXXXXXXX format to the memory_base and memory_end variables.

Then the program tests this specific locations say,

 MemTestAddressBus(memory_base, memory_size);

But it doesn't have sense for me. Because 0xXXXXXXXX can be in the on-chip memory???

How to make sure that I'm testing the external DDR?

Please help.

P.S. Some additional information. If I put .text section to on_chip I see strange symbols, like hieroglyph, instead of welcome text, etc.

If I put .text section to DDR, my program stops execution after some seconds.

I don't see any solutions, what i do wrong?

5 Replies

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

    You should put the .text section in on_chip. If you put it in the DDR, you will overwrite the application when it tests the memory. The strange symbols could come from the fact that you don't have enough memory for the application. Try to use the small drivers/c library and turn on the optimizations, and/or increase the on_chip memory size.

    To be sure that you test the DDR and not any other memory, you just need to write the correct address when the application asks for it.
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    Thank you Daixiwen.

    I've increased the onchip mem and i have no hieroglyphs any more.

    Hope I'm testing DDR because i specify

    ALTMEMDDR_0_BASE as memory base.

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

    --- Quote Start ---

    You should put the .text section in on_chip. If you put it in the DDR, you will overwrite the application when it tests the memory. The strange symbols could come from the fact that you don't have enough memory for the application. Try to use the small drivers/c library and turn on the optimizations, and/or increase the on_chip memory size.

    To be sure that you test the DDR and not any other memory, you just need to write the correct address when the application asks for it.

    --- Quote End ---

    Hello,

    I'm limited to 48K in my On_Chip_memory! I cannot increase any more!

    How can I use the small drivers/c library ? and where can I turn ON the Optimizations ?

    Thank you in advance.
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    If you use Nios EDS version 9.1 or higher you need to right-click on the BSP uin the Project Explorer, select Properties-> Nios II BSP Properties and select Reduced Device Drivers check-box, unselect Support C++ checkbox and select use small C library check-box. And select optimization level to SIZE in the Optimization level field.

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

    --- Quote Start ---

    If you use Nios EDS version 9.1 or higher you need to right-click on the BSP uin the Project Explorer, select Properties-> Nios II BSP Properties and select Reduced Device Drivers check-box, unselect Support C++ checkbox and select use small C library check-box. And select optimization level to SIZE in the Optimization level field.

    --- Quote End ---

    Thank you, it works!