Problem in converting the ARM code into THUMB

Hi,
Good Day.

I am working on ARM7TDMI core processor from Analog Devices family (ADuC703x). I developed a preemptive scheduler on the same in ARM environment. The functionality of the same is fine and its working well. For the purpose of optimization, i migrated into thumb mode using Keil RV compiler option (by changing the code generation option to THUMB mode and the optimization level option to 3 in C/C++ tab of the target settings option).

After changing the settings my code size is reduced by 2 KB. But, the complete functionality of the software got changed.

Can anybody help me out to get out of this problem?
Also, I would like to know why this kind of behavior is occurring... Please let me know your valuable suggesions.

Thanking you in anticipation,
Ravi Kumar Desaraju.

Parents
  • Desaraju,
    Are you trying to increase code density? please not that if you are using a 32 bit data bus, you actually decreased your system performance. Note that not all processor registers are as easily accessable when in thumb mode: R8-R12 are only modifiable via MOV, ADD and CMP. Have you remembered to manually change to thumb mode before your context switch is taking place (can be done by a branch)? Also notice that the multiple-register load-store instructions only support the increment after (IA) addressing mode.
    Pay attention to the following table, which represents offsets available from a base pointer per instruction when in thumb mode:

    LDRB, LDRSB, STRB       0 to 31 bytes
    LDRH, LDRSH, STRH       0 to 62 bytes
    LDR, STR                0 to 124 bytes
    

    I am busy with a similar project, never tried it with thumb but I don't see how such a relatively small piece of assembly can win you that much performance when compiled in thumb.

Reply
  • Desaraju,
    Are you trying to increase code density? please not that if you are using a 32 bit data bus, you actually decreased your system performance. Note that not all processor registers are as easily accessable when in thumb mode: R8-R12 are only modifiable via MOV, ADD and CMP. Have you remembered to manually change to thumb mode before your context switch is taking place (can be done by a branch)? Also notice that the multiple-register load-store instructions only support the increment after (IA) addressing mode.
    Pay attention to the following table, which represents offsets available from a base pointer per instruction when in thumb mode:

    LDRB, LDRSB, STRB       0 to 31 bytes
    LDRH, LDRSH, STRH       0 to 62 bytes
    LDR, STR                0 to 124 bytes
    

    I am busy with a similar project, never tried it with thumb but I don't see how such a relatively small piece of assembly can win you that much performance when compiled in thumb.

Children
More questions in this forum