Advertisement
doragasu

Linker script with heap and stack

Feb 13th, 2013
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. MEMORY
  2. {
  3.     FLASH (rx)  : ORIGIN = 0x00000000, LENGTH = 256K
  4.     SRAM  (rwx) : ORIGIN = 0x20000000, LENGTH = 32K - 4K
  5.     STACK (rwx) : ORIGIN = 0x20007000, LENGTH = 4K
  6. }
  7.  
  8. SECTIONS
  9. {
  10.     .text :
  11.     {
  12.         _text = .;
  13.         KEEP(*(.isr_vector))
  14.         *(.text*)
  15.         *(.rodata*)
  16.         _etext = .;
  17.     } > FLASH
  18.  
  19.     .data : AT(ADDR(.text) + SIZEOF(.text))
  20.     {
  21.         _data = .;
  22.         *(vtable)
  23.         *(.data*)
  24.         _edata = .;
  25.     } > SRAM
  26.  
  27.     .bss :
  28.     {
  29.         _bss = .;
  30.         *(.bss*)
  31.         *(COMMON)
  32.         _ebss = .;
  33.     } > SRAM
  34.  
  35.     /* Beginning of heap, just where used RAM ends */
  36.     . = ALIGN(8);
  37.     _heap_bottom = .;
  38.  
  39.     /* Beginning of stack */
  40.     _stack_bottom = ORIGIN(STACK);
  41.     /* End of stack (default value of the stack pointer) */
  42.     _stack_top = ORIGIN(STACK) + LENGTH(STACK);
  43. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement