2
votes

Is there a way in the ARM world to use only 32-bit instructions (on a Cortex M3 for example) and to disable 16-bit thumb instructions ? I'm talking about the instruction itself, not about the load/store access mechanism.

Sorry if this was already asked, or if this question is way too stupid, etc.

Thanks a lot for helping ...

3
Most Cortex-M chips only use Thumb2 mode. Really there is only thumb and ARM mode. Thumb2 is an extension of the thumb mode which has both 32bit and 16bit instructions and pseudo-conditional execution. All of these overloaded concepts can make this question (and answers) confusing.artless noise
Up to Cortex-m3 there is ONLY thumb mode. M4 and M7 support Thumb2. There isn't an ARM mode on ANY Cortex-M family.Jake 'Alquimista' LEE

3 Answers

2
votes

If you only want to force selection of 32-bit encodings over 16-bit ones where they exist, that's possible in assembly by adding the .W suffix to individual mnemonics. The assembler will then emit the 32-bit encoding or raise an error if one is not available. You thus can't simply apply it to every instruction since some only have 16-bit encodings, but knocking up some sort of grotty regex-based transformation seems feasible. If you're dealing with compiled higher-level code, then transformation of intermediate assembly listings, or hacking the assembler/compiler are probably the only viable options.

0
votes

Most of the newer chips use only the Thumb-2 instruction set, which means you'll have some 16-bit instructions and some 32-bit instructions. You'll need to find older hardware if you want to use the old-fashioned 32-bit-only ARM instruction set.

0
votes

the cortex-m3 is only a thumb machine so it only has a 16 but thumb core, the 32 bit instructions are just undefined 16 bit extensions, so you have to use the 16 bit thumb core to even get at the 32 bit thumb2 extensions...So no by definition it is not possible.

also the 32 bit extensions are not enough to do everything you might want.