ARM.SoC.Architecture

The ratio will vary from program to program but in a

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: closer to the sort of application for which Thumb was developed. Mobile telephone and pager applications incorporate real-time digital signal processing (DSP) functions that may require the full power of the ARM, but these are tightly coded routines that can fit in a small amount of on-chip memory. The more complex and much larger code that controls the user interface, battery management system, and so on, is less time-critical, and the use of Thumb code will enable off-chip ROMs to give good performance on an 8- or 16-bit bus, saving cost and improving battery life. 7.11 Example and exercises Rewrite the 'Hello World' program in Section 3.4 on page 69 to use Thumb instructions. How do the ARM and Thumb code sizes compare? Here is the original ARM program: Example 7.1 Most of these instructions have direct Thumb equivalents; however, some do not. The load byte instruction does not support auto-indexing and the supervisor call cannot be conditionally executed. Hence the Thumb code needs to be slightly modified: AREA SWI_WriteC SWI_Exit ENTRY CODES2 HelloW_Thumb,CODE,READONLY EQU &0 ; output character in r0 EQU &11 ; finish program ; code entry point ; enter in ARM state Example and exercises 205 ; get Thumb entry address ; enter Thumb area ; Thumb code follows.. ADR BX CODE16 r0, START+1 r0 START ADR LOOP LDRB ADD r1, TEXT r0, [r1] r1, r1, #1 ; r1 -> "Hello World" ; get the next byte ; increment pointer **T CMP BEQ SWI DONE TEXT B SWI ALIGN DATA END r0, #0 DONE SWI_WriteC LOOP SWI_Exit ; check for text end ; finished? **T ; if not end print . . ; .. and loop back ; end of execution ; to ensure ADR works "Hello World",&0a,&0d,&00 The two additional instructions required to compensate for the features absent from the Thumb instruction set are marked with '**T' in the above listing. The ARM code size is six instructions plus 14 bytes of data, 38 bytes in all. The Thumb code size is eight instructions plus 14 bytes of data (ignoring the preamble required...
View Full Document

Ask a homework question - tutors are online