So I then built a minimal app to test loader ... so minimal on board LED blinker code ![Smile :-)]()
Again fairly simple to follow
1.) sets the stack pointer to value you set (loader does that but you may want different)
2.) sets the IO port to the onboard LED to output
3.) Goes in a loop flashing the LED
As a placement in RAM when loaded I have assumed it is right after bootloader at 0x20000100
so the linker file looks like this
Again fairly simple to follow
1.) sets the stack pointer to value you set (loader does that but you may want different)
2.) sets the IO port to the onboard LED to output
3.) Goes in a loop flashing the LED
Code:
.cpu cortex-m0plus.thumb.section .text/* reset handler */.thumb_func.global _reset_reset:ldr r0, .STACK_PTR_START ;@ Stack Pointer start pointmov sp, r0movsr1, #32ldrr0, .hardvaluesstrr1, [r0]ldrr0, .hardvalues+4wait_for_reset:movsr2, #32ldr r1,[r0]tst r2, r1beq wait_for_resetmovsr1, #05ldrr0, .hardvalues+8strr1, [r0]ldrr0, .hardvalues+12ldrr1, .hardvalues+16strr1, [r0].FLASH_LOOP:ldrr3, .DELAY_COUNT.DELAY_LOOP:nopsubr3, r3, #1cmpr3, #0bne.DELAY_LOOPldrr0, .hardvalues+20ldrr1, .hardvalues+16strr1, [r0]b .FLASH_LOOPb ..balign(4).STACK_PTR_START:.word0x20004000 ;@ .hardvalues:.word0x4000f000 ;@.word0x4000c008 ;@.word 0x400140cc ;@.word0xd0000020 ;@.word(1 << 25) ;@.word 0xd000001c ;@.DELAY_COUNT:.word 150000 ;@so the linker file looks like this
Code:
MEMORY{ /* We are loaded to block after bootloader, size can whatever you need but well below stack position */ sram : ORIGIN = 0x20000100, LENGTH = 0x800}SECTIONS{ .text : { KEEP(*(.text*)) } > sram}Statistics: Posted by LdB — Thu Oct 16, 2025 11:43 pm