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

Difference between thumb machine directives

Hi Experts,

What is the key difference between the following directives

.thumb

.thumb_func

.force_thumb

.thumb_set

What is the exact use case where the above things can to be applied ?

Regards,

Techguyz

Parents
  • In addition to the above excellent answers, you really should know that...

    Put a .thumb_func right before each symbol in your code that you have a pointer to.

    For instance, if you don't have a .thumb_func before your SysTick_Handler, the pointer in the exception vectors will be incorrect (it'll point to an even address instead of an odd address).

    You may also have your own jump-table - or state machine table, or the like.. Those symbols that are placed in the table, should have the .thumb_func right before them.

    You can...

    find_end_l:

        ldrb    r0,[r1],#1

        .thumb_func

    find_end:

        cmp    r0,#0

        bne    find_end_l

        bx    lr

    -That means, the .thumb_func directive is 'transparent', it just serves as a way to mark the next symbol to be a thumb function symbol.

    Normally I place both of these ...

         .type mySymbol,%function

         .thumb_func

    mySymbol:

    ... right before the functions I declare.

Reply
  • In addition to the above excellent answers, you really should know that...

    Put a .thumb_func right before each symbol in your code that you have a pointer to.

    For instance, if you don't have a .thumb_func before your SysTick_Handler, the pointer in the exception vectors will be incorrect (it'll point to an even address instead of an odd address).

    You may also have your own jump-table - or state machine table, or the like.. Those symbols that are placed in the table, should have the .thumb_func right before them.

    You can...

    find_end_l:

        ldrb    r0,[r1],#1

        .thumb_func

    find_end:

        cmp    r0,#0

        bne    find_end_l

        bx    lr

    -That means, the .thumb_func directive is 'transparent', it just serves as a way to mark the next symbol to be a thumb function symbol.

    Normally I place both of these ...

         .type mySymbol,%function

         .thumb_func

    mySymbol:

    ... right before the functions I declare.

Children
No data