Here is the working script builder for STM32F105RB (there are also versions for R8 and RC):
https://github.com/anrope/stm-arp/blob/github/arp.rb.ld (text below)
My elite guesses that you have nothing to change. Perhaps this is the origin of the regions defined in the MEMORY {} statement. We hope you find the comments helpful.
I used this with the GNU / GCC cross-compiler that I was rolling around. After compilation, it is useful to run nm in your code to make sure that the partitions are located at the correct addresses.
Edit: I linked this linker script together using the GNU ld documentation:
http://sourceware.org/binutils/docs/ld/
and having examined the output of cross-compiling GCC with a standard script linker using nm . I basically determined all the sections that are displayed and figured out which ones are really useful, and where in memory they should go to STM32F105.
I took notes in the script builder for each section.
OUTPUT_FORMAT ("elf32-littlearm", "elf32-bigarm", "elf32-littlearm") ENTRY(_start) SEARCH_DIR("/home/arp/stm32dev-root/usrlol/arm-eabi/lib") MEMORY { ram (rwx) : ORIGIN = 0x20000000, LENGTH = 32k flash (rx) : ORIGIN = 0x08000000, LENGTH = 128k option_bytes_rom (rx) : ORIGIN = 0x1FFFF800, LENGTH = 16 } _sheap = _ebss + 4; _sstack = _ebss + 4; _eheap = ORIGIN(ram) + LENGTH(ram) - 1; _estack = ORIGIN(ram) + LENGTH(ram) - 1; SECTIONS { . = SEGMENT_START("text-segment", 0); .isr_vector : { . = ALIGN(4); _sisr_vector = .; *(.isr_vector) _eisr_vector = .; } >flash .text : { . = ALIGN(4); *(.text) . = ALIGN(4); *(.text.*) } >flash .init : { . = ALIGN(4); KEEP(*(.init)) } >flash .fini : { . = ALIGN(4); KEEP(*(.fini)) } >flash .rodata : { . = ALIGN(4); *(.rodata) . = ALIGN(4); _sidata = .; } >flash .data : AT(_sidata) { . = ALIGN(4); _sdata = .; *(.data) _edata = .; } >ram .bss : { . = ALIGN(4); _sbss = .; __bss_start__ = .; *(.bss) . = ALIGN(4); *(COMMON) _ebss = .; __bss_end__ = .; } >ram AT>flash . = ALIGN(4); end = .; DISCARD : { libc.a ( * ) libm.a ( * ) libgcc.a ( * ) } .stab 0 : { *(.stab) } .stabstr 0 : { *(.stabstr) } .stab.excl 0 : { *(.stab.excl) } .stab.exclstr 0 : { *(.stab.exclstr) } .stab.index 0 : { *(.stab.index) } .stab.indexstr 0 : { *(.stab.indexstr) } .comment 0 : { *(.comment) } .debug 0 : { *(.debug) } .line 0 : { *(.line) } .debug_srcinfo 0 : { *(.debug_srcinfo) } .debug_sfnames 0 : { *(.debug_sfnames) } .debug_aranges 0 : { *(.debug_aranges) } .debug_pubnames 0 : { *(.debug_pubnames) } .debug_info 0 : { *(.debug_info .gnu.linkonce.wi.*) } .debug_abbrev 0 : { *(.debug_abbrev) } .debug_line 0 : { *(.debug_line) } .debug_frame 0 : { *(.debug_frame) } .debug_str 0 : { *(.debug_str) } .debug_loc 0 : { *(.debug_loc) } .debug_macinfo 0 : { *(.debug_macinfo) } .debug_weaknames 0 : { *(.debug_weaknames) } .debug_funcnames 0 : { *(.debug_funcnames) } .debug_typenames 0 : { *(.debug_typenames) } .debug_varnames 0 : { *(.debug_varnames) } }
source share