"Spehro Pefhany" <speffSNIP@interlogDOTyou.knowwhat> wrote in message
news:hc0r02lhngb3in22vg847afcri0uuesa0e@4ax.com...
> On Tue, 07 Mar 2006 07:13:43 GMT, the renowned Tauno Voipio
> <tauno.voipio@INVALIDiki.fi> wrote:
>
>>daniel wrote:
>>> 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-in
>>> flash,
>>> because ARM instruction is 32bits word long, so its actually code size
>>> 64K
>>> instructions, then my question is 64K instructions code size is enough
>>> most
>>> ARM project ? Thanks.
>>
>>An ARM instruction is capable of doing much more than
>>an 8051 instruction, so you should need less instructions
>>for the same task.
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.
>>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.
>
> 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.
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 by Spehro Pefhany●March 7, 20062006-03-07
On Tue, 07 Mar 2006 07:13:43 GMT, the renowned Tauno Voipio
<tauno.voipio@INVALIDiki.fi> wrote:
>daniel wrote:
>> 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-in
>> flash,
>> because ARM instruction is 32bits word long, so its actually code size 64K
>> instructions, then my question is 64K instructions code size is enough most
>> ARM project ? Thanks.
>
>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.
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
Embedded software/hardware/analog Info for designers: http://www.speff.com
Reply by Artenz●March 7, 20062006-03-07
daniel wrote:
> 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-in
> flash, because ARM instruction is 32bits word long, so its actually code size 64K
> instructions, then my question is 64K instructions code size is enough most
> ARM project ? Thanks.
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 by Tauno Voipio●March 7, 20062006-03-07
daniel wrote:
> 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-in
> flash,
> because ARM instruction is 32bits word long, so its actually code size 64K
> instructions, then my question is 64K instructions code size is enough most
> ARM project ? Thanks.
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
'
Reply by daniel●March 7, 20062006-03-07
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-in
flash,
because ARM instruction is 32bits word long, so its actually code size 64K
instructions, then my question is 64K instructions code size is enough most
ARM project ? Thanks.
Daniel