Can one BSP support multiple memory maps?

Chris Johns cjohns at cybertec.com.au
Wed Mar 6 21:21:57 UTC 2002


Joel Sherrill wrote:
> 
> FYI I recall some user mentioning a trick to avoid
> duplicating info between the two linker scripts.  Something
> about setting values and including a base linker script.
> Who was that?
> 

The trick I use is in the linker command file do something like:

SECTIONS
{
  .text . :
  {
     .....
  }

  .data . :
     AT (ADDR(.text) + SIZEOF(.text))
  {
     .....

  }

  .bss (ADDR(.data) + SIZEOF(.data)) :
  {
     .....
  }
}


Then in the makefile use something like:


  ifdef DEBUG
  ROM_BASE=0x00000000
  else
  ROM_BASE=0xff400000
  RAM_BASE=0x00000000
  endif

    ....

  ifdef DEBUG
  ADDRESS_MAP = -Ttext $(ROM_BASE)
  else
  ADDRESS_MAP = -Ttext $(ROM_BASE) -Tdata $(RAM_BASE)
  endif

    ....

  LFLAGS := -N $(ADDRESS_MAP) 

    ....

  $(LD) $(LFLAGS)


I hope you get the idea and I am sure you can change this to meet your
specific needs. I use DEBUG to switch the code between a RAM debug
memory map and the ROM memory map with the one linker script.


-- 
 Chris Johns, cjohns at cybertec.com.au



More information about the users mailing list