cristianowa / elua4stellarisLauchpad

Attempt to port eLua to stellaris lauchpad.
Other
0 stars 0 forks source link

Thumb instruction set. #21

Open cristianowa opened 11 years ago

cristianowa commented 11 years ago

Since arms processors supports both arm and thumb operation modes, we shall try both mode. Just a quick rembember :

Thumb mode is a smaller set, witch gives a smaller program memory footprint and has a small decoding machine ( less power ), but it also has limited access to registers.

Arm mode ( normal ) is bigger and uses all the processor can give, thus, spending more power.

The mode can be toogle through a instruction, so code can be splited in thumb and normal, but the processor must accept that.

Now the elua is being compiling with -mthumb. witch makes the processor use only thumb instructions. We shall test both with a cpu-intensive benchmark ( some taylor series maybe do the job ) and choose the best cost-benefit relation. We shall also seek for a way to compile with both instructions.

jvportal commented 11 years ago

As stated in http://www.arm.com/products/processors/cortex-m/cortex-m4-processor.php, Cortex-M4 only supports thumb and thumb2 instructions (see 'Specifications' tab). Thumb2 is an extension of thumb instructions, creating a mixed 16-bit and 32-bit instruction set. Information of thumb2 instructions: http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.ddi0344c/Beiiegaf.html .

I think that is not possible to use arm normal instructions in Cortex-M4. We shall concentrate in using Thumb2 instructions in the project.

cristianowa commented 11 years ago

According to jvpportal : the flag "-march=armv7-m " could be added to compile with thumb2 instructions.

I've used it, and I've also used the '-mtune=cortex-m4','-O3' and '-Os' flags. The memory footprint just got bigger or equal. I think the options '-mcpu=cortex-m4' and '-mthumb' are fine enough to this port. We have to reduce footprint in other things.