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

[Cortex-M0] Thumb mode & code size

Hi,

I'm somewhat confused with the Thumb mode code size.  My understanding is compiling with ARM mode will generate 32-bit instructions and compiling with Thumb mode will generate 16-bit instructions.  When I compile my Cortex-M0+ project (which should use Thumb mode instructions only), the output binary file always increments in multiple of 4 bytes.  Do I miss something here?

Here are the instructions I use:

armcc -c -O3 -Ospace --cpu Cortex-M0plus --thumb --apcs=interwork -I ./ -g -c aaa.c -o aaa.o

armasm --cpu Cortex-M0plus --apcs=interwork -I ./ -g startup.s -o startup.o

armlink --cpu Cortex-M0plus --ro_base 0x00000000 --rw-base 0x00100000 --entry Reset_Handler --first __Vectors aaa.o startup.o -o aaa.axf

Thanks,

Parents
  • The AXF file contains a lot of other information - it's not just a raw hex file containing only the code, and different sections in it have alignment requirements the extra bits are probably just padding. If you want to get an accurate look at the size of the code use fromelf to disassemble it.

Reply
  • The AXF file contains a lot of other information - it's not just a raw hex file containing only the code, and different sections in it have alignment requirements the extra bits are probably just padding. If you want to get an accurate look at the size of the code use fromelf to disassemble it.

Children