Using 32 bit variable whenever posible

More
30 Oct 2014 02:37 - 30 Oct 2014 02:38 #26209 by jimqjp
All developers, I would like to point out a fact many developers do not realize.

PLEASE USE 32-BIT VARIABLES WHENEVER POSSIBLE FOR DEVOs!

For most ARMs, include ST32F family, the native memory and register width are 32 bit, the compiler will align variables to 32-bit address boundary. Using 8-bit or 16-bit variables usually does not save RAM space. On the other hands, the compiler needs code to convert them for 32-bit instructions, waste extra code space and CPU time. This is very different from 8-bit environment.

You can easily prove this by compiling two functions with uint8_t and uint32_t variables respectively and comparing the codes sizes. If you set building switches to output assembly list files, you will find how the compile use extra code to convert 8-bit variables.

The Devo7E has limited code space, it is more important to make more compact code.
Last edit: 30 Oct 2014 02:38 by jimqjp.

Please Log in or Create an account to join the conversation.

Time to create page: 0.032 seconds
Powered by Kunena Forum