Forum Discussion

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

Custom Linker Script

I'd like to carve out a section in sdram normally used for the heap and reserve it.

The sdram sits at 0- 0x01800000, and I want my user logic to have sole write access to 0-0x1000. So to keep it simple, I assign only the heap to the sdram, and slightly modify the ide generated, "generated.x".. but is it enough to change just the following:

from:

PROVIDE( __alt_heap_start = end );

PROVIDE( __alt_heap_limit = 0x01800000 );

to:

PROVIDE( __alt_heap_start = end );

PROVIDE( __alt_heap_limit = 0x017FF000 );

My logic outside of the nios could then write to the memory at 0-0x1000, but the nios will only be able read (never write) to that area.

There's so much more in the generated.x file that I'm not sure if anything else needs to change... I read the bootlader normally changes whenever you modify the linker script but I don't think that applies in this case, right?

1 Reply

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

    I think the change you suggest will reserve the top of sdram - not the bottom.

    If the heap start is at 'end', this will normally be the address following the code and static data. So the '0' address actually contains something else (probably code).

    It might be easier to use a chunk of high sdram for the fixed address buffer.

    Alternatively, if you only have a small program, write an ldscript that assigns all the sections to appropraite memory areas. If you don't use any stdio functions, you may not even need a heap!