Atmel website | ARM Community | AVR freaks | Technical Support
Banner
 FAQ •  Search •  Register •  Login 

All times are UTC + 1 hour [ DST ]




Post new topic Reply to topic  [ 2 posts ] 
Author Message
 Post subject: Arm-32 vs Thumb
PostPosted: Fri Dec 09, 2011 3:24 pm 
Offline

Joined: Fri Dec 02, 2011 12:40 am
Posts: 9
We currently thinking about switching to Thumb code for an existing project which involves both C and assembler source files and which was written for ARM-32 code.
Target is AT91SAM7XC256 or AT91SAM7XC512.
Experimental compilation with GNU toolchain learned that Thumb code image for same application was about 30% smaller than ARM-32 image. But the code will probably not work...(did not test it, though)

As we have no experience with Thumb code, the following questions popped up:

1. What are the advantages/disadvantages when switching to Thumb code?
2. Can we expect existing C code to work immediately when compiling to Thumb code?
3. What about assembler code? Do we need to dig into assembler code sources and change things there?
4. Will debugging with SAM-ICE still work?

May be one of you has experience with 'porting' exisiting code from ARM-32 to Thumb and can help/advise me on this and give me a kick-start?

Thanx!

Robbie


Top
 Profile  
 
 Post subject: Re: Arm-32 vs Thumb
PostPosted: Fri Dec 09, 2011 4:51 pm 
Offline

Joined: Sat Oct 30, 2010 6:04 pm
Posts: 574
Thumb dates back to at least 1994-5, so should have pretty good support at this point. Most ARM7 and ARM9 processors utilize it, the Cortex-M3 cannot run ARM 32-bit code at all. Unless you are using stone-age tools, you'll be fine.

Disadvantage, not useable for interrupt handlers in ARM7/9, access to a smaller register subset. Can be slower to perform the same operations, ie can require more instructions to do same thing.

Advantages, better code density, better cache utilization, more effective on 16-bit memory devices.

Yes, SAM-ICE will work with Thumb code.

Yes, Your C compiler should generate code just fine, and the linker/compiler should be able to handle the calls between 16/32 bit code just fine. It's been used everywhere for well over a decade, so you are very late to the party.

http://www.eetimes.com/discussion/other ... -ARM-thumb

You'll have to look over the assembler code, it is mostly a subset, with less instruction combinations, and less registers.

The ARM7T parts can run both, and switch transparently, so the need to rewrite anything is pretty small, just recompile and link, and transition the parts that are critical.

If you plan to migrate to Cortex-M3, consider what code needs to be in assembler. Thumb2 is more comprehensive.

The interrupt handler issue mentioned as a disadvantage only impacts the routine being called by the processor, the interrupt handler routine can subsequently call other routines written in Thumb.

If you think 30% improvement in code size is good, you should perhaps be trying the Realview/Keil ARM compilers which are real embedded compilers, and do a much better job than GCC.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

All times are UTC + 1 hour [ DST ]


Who is online

Users browsing this forum: Bing [Bot], Google [Bot] and 3 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to: