Good Day
I am trying to follow a tutorial to implement a custom bootloader on a STM32F072. The tutorial provides a ldscript.ld to link the bootload code into the specific memory address (for that MCU), how do I use this ldscript.ld in uVision5? I cannot find anywhere how to import a .ld script.
This is the code from the Linker Script:
/* memory layout for an STM32F072 */ MEMORY { FLASH (rx) : ORIGIN = 0x08000000, LENGTH = 12K /* First 6 sectors */ SRAM (xrw) : ORIGIN = 0x200000B8, LENGTH = 16K - 0xB8 } ENTRY(_start); __stack = ORIGIN(SRAM) + LENGTH(SRAM); _estack = __stack; /* STM specific definition */ /* output sections */ SECTIONS { /* Program code into FLASH */ .text : ALIGN(4) { *(.isr_vector) /* Vector table */ *(.text .text*) /* Program code */ KEEP(*(.isr_vector)) } >FLASH /* Initialized global and static variables (which we don't have any in this example) into SRAM */ /* Used by the startup to initialize data */ _sidata = LOADADDR(.data); .data : ALIGN(4) { _sdata = .; /* create a global symbol at data start */ *(.data) *(.data*) . = ALIGN(4); _edata = .; /* define a global symbol at data end */ } >SRAM AT>FLASH /* Uninitialized data section */ .bss (NOLOAD) : ALIGN(4) { _sbss = .; /* define a global symbol at bss start */ *(.bss) *(.bss*) *(COMMON) . = ALIGN(4); _ebss = .; /* define a global symbol at bss end */ } >SRAM _end_static = _ebss; _Heap_Size = 0x190; _Heap_Limit = _end_static + _Heap_Size; _Min_Stack_Size = 0x400; /* User_heap_stack section, used to check that there is enough RAM left */ ._user_heap_stack : { . = ALIGN(4); . = . + _Heap_Size; . = . + _Min_Stack_Size; . = ALIGN(4); } >SRAM /* Constant data goes into FLASH */ .rodata : ALIGN(4) { *(.rodata) /* .rodata sections (constants) */ *(.rodata*) /* .rodata* sections (strings, etc.) */ } >FLASH }
I would appreciate your help.
Keil uses scatter files, it doesn't import linker scripts
Go into the Target dialog
Change the IROM and IRAM memory settings to reflect those in the linker script.
IROM1 0x08000000 0x3000 IRAM1 0x200000B8 0x3F48
Thank you Clive One!