Dual-State Interworking
460
SNIU028A – February 2016 – Revised April 2016
Copyright © 2016, Texas Instruments Incorporated
ARM7TDMI-S MPUSS
Example-1. Code Compiled for 16-BIS State: Sum( )
•
C Program
int total = 0;
sum(int val1, int val2)
{
int val = max(val1, val2);
total += val;
}
•
16-bit assembly program
;*****************************************************************
;
function venner: _sum
*
;*****************************************************************
_sum:
.state32
STMFD sp!, {lr}
ADD lr, pc, #1
BX lr
.state16
BL $sum
BX pc
NOP
.state16
.sect ".text"
.global $sum
;*****************************************************************
;
function def: $sum
*
;*****************************************************************
$sum:
PUSH {LR}
BL $max
LDR A2, CON1
LDR A3, [A2, #0]
ADD A1, A1, A3
STR A1, [A2, #0]
POP {PC}
;*****************************************************************
;
constant table
*
;*****************************************************************
sect
".text"
.align4