Forum Discussion

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

Memory Commands

Hi,

im trying to use a SOPC-generated On-Chip-Memory (RAM) as a general purpose Data-Memory in my NIOS-System. What C-Functions can i use tio access the Memory?

Is there a .h-File for the On-Chip-Memory? I did not find any documentation about using the Memory in C.

Paddy

4 Replies

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

    You can use C pointers. The address of your memory block will be in system.h (ON_CHIP_MEMORY_BASE if your on-chip RAM is called on_chip_memory)

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

    Ok, i found the address (BASE-Address) in my system.h. But how can i access the memory? Is there a function like IOWR and IOREAD? Which parameters do this functions use?

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

    How do you access RAM in a standard micro controller? With a function? No. You just define some variables and the linker "places" these into the RAM. Since NIOS *is* a standard micro controller it's the same method here. Tell the linker to use your RAM as for the rwdata or the stack or the heap...

    In case you already have a RAM for your variables and want to use an additional RAM you have to use pointers for reading and writing to the additional RAM, as Daixiwen said.

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

    Ok, i think now i understand what you wrote about the pointers. I will try it out!

    Thanks,

    Paddy