This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

ldr (register, several values)

Hello,

I've a small simple question:

ldr     r4, =||Image$$ER_IROM1$$RO$$Length||+||Image$$RW_IRAM1$$RW$$Length||

At the moment I get an error message from Keil, using this code in the startup file. Maybe an syntax error?

If I write

ldr     r4, =||Image$$ER_IROM1$$RO$$Length||
ldr     r4, =||Image$$RW_IRAM1$$RW$$Length||

there's no such error message.

best regards
David

Parents
  • Hi David

    The symbols are linker defined and their values will end up in a
    literal pool. The symbols themselves will be converted into
    (pc-relative) pointers into that pool.

    The inline expression in your original code requires values known at
    compilation time in order to work. Hence the error message.

    Instead you could write something like this:

    Reset_Handler
    
    ; this part is always equal
    
    ldr     r4, =||Image$$ER_IROM1$$RO$$Length||
    ldr     r5, =||Image$$RW_IRAM1$$RW$$Length||
    add     r4, r4, r5
    

    Best regards
    Marcus
    http://www.doulos.com/arm/

Reply
  • Hi David

    The symbols are linker defined and their values will end up in a
    literal pool. The symbols themselves will be converted into
    (pc-relative) pointers into that pool.

    The inline expression in your original code requires values known at
    compilation time in order to work. Hence the error message.

    Instead you could write something like this:

    Reset_Handler
    
    ; this part is always equal
    
    ldr     r4, =||Image$$ER_IROM1$$RO$$Length||
    ldr     r5, =||Image$$RW_IRAM1$$RW$$Length||
    add     r4, r4, r5
    

    Best regards
    Marcus
    http://www.doulos.com/arm/

Children