How can i get the real binary size of a Program


i wrote a little (my first) ARM Assembler Program to copy a  Bootloader to RAM and execute it there.

The Bootloader is placed like a data Array directly behind the Assembler Program by using external tools.

To copy this BL to RAM i Need the first Adress of the appended Bootloader or the total size of my Binary.

I tried a Label at the End, but the Compiler places ROM-constants behind this code so it seems not to be reliable.

Actually, i compiled it, looked the Size in the Debugger and corrected it in the Code.

Is there a possibility to get the size through a placeholder, like the Build Date f.i.?

Controller: STM32F103RB, Keil uVision 5

Here is the Code:

       EXPORT Reset_Handler
       LDR  R4,=0x0800002C  ; Application Array starting address

       LDR  R6,=0x00003FD4       ; Application Array len until 0x08004000 - 0x0800002C
       LDR  R5,=0x20000000 ; Destination starting address

       LDR  R0, [R4], #4
       STR  R0, [R5], #4
       SUBS R6, #4
       BNE  CopyFlashToSRAMLoop
       LDR  R0,=0x20000101
       BX   R0   ; this branch to C startup code  

More questions in this forum