link.lds 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. /* Entry Point */
  2. ENTRY(Reset_Handler)
  3. /* Specify the memory areas */
  4. MEMORY
  5. {
  6. ROM (arx) : ORIGIN = 0x00000000, LENGTH = 0x00080000 /* 512k */
  7. RAM (arw) : ORIGIN = 0x20000000, LENGTH = 0x00020000 /* 128k */
  8. }
  9. /* Define output sections */
  10. SECTIONS
  11. {
  12. . = ORIGIN(ROM);
  13. .text :
  14. {
  15. KEEP(*(.isr_vector))
  16. *(.text)
  17. *(.text*)
  18. *(.rodata*)
  19. } > ROM
  20. . = ALIGN(4);
  21. __data_load__ = LOADADDR(.data);
  22. . = ALIGN(4);
  23. .data :
  24. {
  25. __data_start__ = .;
  26. *(.data)
  27. *(.data*)
  28. . = ALIGN(4);
  29. __data_end__ = .;
  30. } > RAM AT> ROM
  31. . = ALIGN(4);
  32. .bss :
  33. {
  34. __bss_start__ = .;
  35. *(.bss)
  36. *(.bss*)
  37. *(COMMON)
  38. . = ALIGN(4);
  39. __bss_end__ = .;
  40. } > RAM
  41. . = ALIGN(4);
  42. .heap :
  43. {
  44. end = .;
  45. __HeapBase = .;
  46. *(.heap)
  47. } > RAM
  48. /* .stack_dummy section doesn't contains any symbols.
  49. * It is only used for linker to calculate size of stack sections */
  50. .stack_dummy :
  51. {
  52. *(.stack)
  53. } > RAM
  54. __StackTop = ORIGIN(RAM) + LENGTH(RAM);
  55. __StackLimit = __StackTop - SIZEOF(.stack_dummy);
  56. ASSERT(__StackLimit >= __HeapLimit, "region RAM overflowed with stack")
  57. }