Thursday, August 22, 2013

IE_stm32.ld

/*
 ***********************************************************************
 *name:         IE_stm32.ld
 *author:       Samuel Igwe
 *date:         08/04/2013
 *description:  linker script that I have created for use in all stm32
 *              development related matters on this board
 *
 *              it took some time to set this up. the ld manual was 
 *              sadly inadequate. I must credit zilogic's "embedded 
 *              programming with the gnu toolchain" at 
 *              www.bravegnu.org/gnu-eprog-dist.pdf
 *              for clearing up issues related to loading the .data 
 *              section into its appropriate position in ram and 
 *              setting up the linker appropriately.
 *
 *              first this is the memory map I had decided on 
 *    
 *              0x2000 4fff             +++++++++++++++++++++++++++++++
 *                                      +            ram              +
 *              0x2000 0000             +++++++++++++++++++++++++++++++
 *                                      +                             +
 *              0x0001 ffff             +++++++++++++++++++++++++++++++
 *                                      +           flash             +
 *              0x0000 0000             +++++++++++++++++++++++++++++++
 *
 *
 *              my stm32f103 board is jumpered to boot from flash at 
 *              offset 0x2000 0000. the first 256*4 will be reserved 
 *              for the NVIC interrupt vector table and hopefull the
 *              last 512 bytes for the stack
 *
 *              adding the variable _loadaddr_data_section_ to the end
 *              of the .text along with the AT> directive places a copy
 *              of the .data right after .text but leaves the virtual
 *              addresses pointing at .data in ram
 *              
 *              in the assembler initialization file I can copy .data 
 *              from bottom of .text into .data in sram
 ***********************************************************************
 */
MEMORY  {
        STM32_RAM    : ORIGIN = 0x20000000,   LENGTH = (20480 - 1024)
        }


SECTIONS
        {
        .data :   
                {
                *(.data);
                } > STM32_RAM

        .text :   
                {
                *(.text);
                *(.rodata*);
                } > STM32_RAM

        .bss :
                {
                *(.bss);
                } > STM32_RAM
        }



No comments:

Post a Comment