Advertisement
Guest User

Untitled

a guest
Aug 4th, 2013
127
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 2.88 KB | None | 0 0
  1. MEMORY
  2. {
  3.     FLASH (rx)  : ORIGIN = 0x00000000, LENGTH = 0x00040000
  4.     RAM (rwx)   : ORIGIN = 0x20000000, LENGTH = 0x00008000
  5.     STACK (rwx) : ORIGIN = 0x20007FFF, LENGTH = 0x00000000
  6. }
  7.  
  8. /*
  9. * Sections definitions:
  10. *
  11. * .text         - machine instructions.
  12. * .data         - initialized data defined in the program.
  13. * .bss          - un-initialized global and static variables (to be initialized to 0 before starting main).
  14. * .stack        - just contains the pointer to the stack end at the right place.
  15. */
  16. SECTIONS
  17. {  
  18.     /* This section it's the code, containing the NVIC Vector table that must start at 0x0
  19.     *   Look at the LM4F120H5QR datasheet for details. (Table 2-8. Exception Types)
  20.     */
  21.     .text :
  22.     {
  23.         KEEP(*(.nvic_table)) /* I should keep the NVIC ISR Table because it's needed by the processor to start. */
  24.         _start_text = .;        /* This is an index to the start of .text segment. */
  25.         *(.text.*)          /* This contains the code after the ISR table. */
  26.         *(.text)            /* This contains the code after the ISR table. */
  27.         *(.rodata)
  28.         *(.rodata.*)        /* Read only data.  */
  29.         *(.glue_7)
  30.         *(.glue_7t)
  31.         *(.vfp11_veneer)
  32.         *(.v4_bx)
  33.         *(.dyn)
  34.         *(.iplt)
  35.         *(.rel.dyn)
  36.         *(.rel.iplt)
  37.         _end_text = .;      /* This is an index to the end of .text segment. */
  38.     }>FLASH
  39.    
  40.     /*
  41.     * .data segment must be placed in RAM but it's originally stored in FLASH
  42.     * So I set the data segment in ram, but I specify the load address with the AT
  43.     * keyword to set that right after the .text section.
  44.     * (Look at the LD documentation. (Optional Section Attributes))
  45.     * Thanks https://github.com/utzig for the hints!
  46.     */
  47.     .data :
  48.     {
  49.         . = ALIGN(4);
  50.         _start_data = .;    /* An index to the beginning of .data segment. */
  51.         *(vtable)           /* vtable it's generated by stellarisware to store the NVIC table in ram*/
  52.         *(.data)            /* I should put there all my initialized data of my program. */
  53.         *(.data.*)
  54.         . = ALIGN(4);
  55.         _end_data = .;      /* And another index to the end of .data segment. */
  56.     } >RAM AT >FLASH
  57.    
  58.  
  59.     /*
  60.     * .bss contains the unitialized variables and must be set as 0x0 during runtime.
  61.     * It should be loaded in RAM and particular care should be taken initializing them in the startup file.
  62.     */
  63.     .bss :
  64.     {
  65.         . = ALIGN(4);
  66.         _start_bss = .;     /* This is an index to the beginning of .bss segment. */
  67.         *(.bss)             /* The un-initialized data should go there.  */
  68.         *(.bss.*)
  69.         *(COMMON)           /* All the other stuff should be put there */
  70.         . = ALIGN(4);
  71.         _end_bss = .;       /* End index for .bss segment */
  72.     }>RAM
  73.    
  74.     /*
  75.     * .stack contains nothing, but I use it to set the first vector item (SP R13).
  76.     */
  77.     .stack :
  78.     {
  79.         _stack_top = .; /* An index to the end of the stack */
  80.     }>STACK
  81.    
  82. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement