Re: ARM code size

Hi,

I am moving from 8051 to ARM, I have a question related to code size.

In 8051, if code size is about 64K bytes, it should be big enough. However, for ARM(take LPC2214 as example), it has 256k bytes built-i flash, because ARM instruction is 32bits word long, so its actually code size 64 instructions, then my question is 64K instructions code size is enough mos ARM project ? Thanks.

Daniel

Reply to
daniel
Loading thread data ...

An ARM instruction is capable of doing much more than an 8051 instruction, so you should need less instructions for the same task.

If space is a concern, get an ARM with the 'T' (like ARM7TDMI) and use the Thumb mode. The size is roughly 60% of the equivalent

32-bit ARM code, albeit somewhat slower.
--
Tauno Voipio
tauno voipio (at) iki fi
 Click to see the full signature
Reply to
Tauno Voipio

64K

The ARM instructions are more powerful, and can handle 32 bits at a time, so if your application uses a lot of 16/32 bit arithmetic, a single ARM instruction can replace a number of 8051 instructions. Even for 8 bit data, the ARM can combine arithmetic, a shift and a condition code in a single instruction. The ARM also has plenty of registers, and can quickly access local data on a stack, so it doesn't waste a lot of overhead on moving data back and forth.

On the other hand, if you manipulate single bits, it may take several ARM instructions (load, modify, store) to replace one 8051 instruction.

Except in most extreme cases, 64K ARM instructions should easily replace 64K 8051 instructions. Don't forget that the LPC2214 also has a 16 bit Thumb mode, giving you 128K instruction space, and still have more powerful instructions than the 8051 for typical cases.

Reply to
Artenz

I think in some cases the Thumb code can be roughly as fast or faster-- where the (flash) code memory is the bottleneck, so you're reducing the code memory bandwidth, but adding core cycles.

Best regards, Spehro Pefhany

--
"it's the network..."                          "The Journey is the reward"
speff@interlog.com             Info for manufacturers: http://www.trexon.com
 Click to see the full signature
Reply to
Spehro Pefhany

Overall I would expect ARM code to be slightly bigger and Thumb code to be slightly smaller - it depends a lot on the particular coding style used. 32-bit RISC processors prefer variables to be local rather than global and int rather than char or short, while for 8051 it is the other way around. Clearing or setting single bits in peripherals takes more instructions on a load/store architecture without special hardware assist (which some ARM chips have). As you might expect, the tools you use can easily make 30% difference.

So if you have 64KBytes of flash on 8051, you will need 128KBytes using ARM but 64KBytes is likely enough for Thumb.

This is typically the case when 16-bit buses are used or when running above ~50Mhz (where flash needs wait states). However the LPC2214 and variants solve this by fetching 128 bits from flash, so you only pay a penalty when branching.

Wilco

Reply to
Wilco Dijkstra

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.