|
5 V0 i6 `9 |1 T在 ARM 端 StarterWare 例程中 CMD 文件比 DSP 端多了这样一句6 F# } Y- H* C! y
/* 重新配置程序入口点 */
! s: [! s: ]9 I' F0 R5 C0 }& f+ v-e Entry- /****************************************************************************/: j i, i' U, N
- /* */
. e4 M1 O: }' I( e - /* OMAPL138 及 DSP C6748 内存空间分配定义 */# t' j: n; b4 X' ^
- /* */) ~% o+ _1 i3 X+ @, J1 E$ `
- /* 2015年04月20日 */' K) m8 |* r+ l- m0 [+ h& U
- /* */0 s6 U; ~: ^4 v8 e) g! X
- /****************************************************************************/
) H' M! E4 d3 A5 m3 a8 C$ i2 r - /* 堆栈 */
+ G' p7 `1 ?' u- w1 z5 G - -stack 0x80000 D7 B" c! c& ~' D/ q- F! b* _" I
- -heap 0x2000$ ~- i5 {, ]3 T
- / Z7 w! Y% `4 g2 m# E+ x: q
- /* 重新配置程序入口点 */3 B) l$ }) ~1 O3 e% ^
- -e Entry
1 \0 ?; x/ b7 F* E
% k% c: i% y' n4 W; b- MEMORY
6 n7 A- C; l3 r; @" A9 K9 X - {8 R+ k# w) f* p
- #ifdef DSP_CORE
4 ^; U" R5 K$ }! M" `7 u - /****************************************************************************/& c5 @% j! a. s8 G
- /* */. h: p# U a8 {( A- N$ Q5 y
- /* DSP 专有内存区域 */! Y3 w5 x; g- o
- /* */
: y1 k W9 q9 K+ l9 G; ?1 j: H! o - /****************************************************************************/4 y/ \& h; h) O
- DSPL2ROM o = 0x00700000 l = 0x00100000 /* 1MB L2 DSP 本地 ROM (DSP ROM Bootloader) */
, g$ c6 |# N; m0 z' m - DSPL2RAM o = 0x00800000 l = 0x00040000 /* 256kB L2 DSP 本地 RAM */
! l' I* K2 O1 R1 F* q) L8 D - DSPL1PRAM o = 0x00E00000 l = 0x00008000 /* 32kB L1 DSP 本地程序 RAM */- V% Q" I9 t" K0 k
- DSPL1DRAM o = 0x00F00000 l = 0x00008000 /* 32kB L1 DSP 本地数据 RAM */' _" z0 F$ o, y* b- Y, Y' p
- #endif
复制代码 这是一段汇编代码用于切换到特权模式
1 b! A7 h' J) X* V( g/ [* C7 f4 s- ?. \7 B- Z/ {2 k( P7 M
OMAPL138_StarterWare_1_10_04_01\system_config\armv5\cgt\init.asm
$ \, b! n U$ L# W% d" K7 ?- ;******************************************************************************$ d! \; k, b- C; {2 r+ ^7 d
- ;
5 B% x- F: r% w6 ]* x - ; init.asm - Init code routines
D: c/ [6 O$ O - ;% O d6 }! W8 L, l
- ; Copyright (C) 2010 Texas Instruments Incorporated - http://www.ti.com/) N1 P) e8 q' I
- ; All rights reserved.7 T. [& |0 @, H: a& ]
- ;
h- o, f) E2 R - ;******************************************************************************
; A. g, I7 @, n- n1 c - ;****************************** Global Symbols*******************************
3 `8 x3 B& g/ _+ J4 W' G - .global Entry
" p- T+ f& Z* \1 ~- B+ [ - .global start_boot
* ~0 X1 e _9 T, W& M" z# \ - .global __TI_auto_init
. a* c1 r. M! ^/ S3 x - & V8 f* v3 X1 {/ P
- .ref __stack
# y& `& D/ f; J6 f ^) C( \2 j( B - .ref __STACK_END
8 ~* @4 d! q6 w+ l - .ref bss_start) J' ~3 H. x s& {0 s: K
- .ref bss_end
' c' C9 e2 }% p% K+ q, M4 N+ y o - .ref start_boot) \2 O6 `& U8 j
- : V9 q P3 ~$ J# d
- ;************************ Internal Definitions ******************************; v9 ^" j3 B0 d* y. R' n& [
- ;. A) I; k3 c9 z
- ; Define the stack sizes for different modes. The user/system mode will use* a: N' [* T' k& a" C& R, z
- ; the rest of the total stack size5 b+ M2 h; _/ l6 B4 u
- ;) x1 j, U+ W% Q8 I( s
- $ M [8 D" e1 `. F7 ?# f5 b
- UND_STACK_SIZE .set 0x8- a4 r% P) h ^0 B* b5 n& J
- ABT_STACK_SIZE .set 0x8
- k! z3 L: h3 q+ a3 V - FIQ_STACK_SIZE .set 0x8
( U4 V1 p0 P: q - IRQ_STACK_SIZE .set 0x5001 P: W) _% A; ~/ o
- SVC_STACK_SIZE .set 0x8
( ~0 ?! x a8 B: {: ?+ a8 e - ! A; a) j- M; R3 n" J9 ^4 g" s. S- y
- ;' q8 H, B$ D7 t) n* _* ?
- ; to set the mode bits in CPSR for different modes& N" u6 t9 E' z' J: N# U( U' {
- ;/ y1 Q6 f& G5 s0 i5 L
" a& ^3 ?! Z {% G" u5 Z r- MODE_USR .set 0x10' h1 K1 ^' Y% y7 {, k! [
- MODE_FIQ .set 0x11* w' b; D9 K% V4 i
- MODE_IRQ .set 0x127 ?' B% F' a. i& \& p8 S4 J7 I
- MODE_SVC .set 0x13
6 l9 L+ G7 p* I( v - MODE_ABT .set 0x17- ^) d+ i" W2 \* i/ M2 G
- MODE_UND .set 0x1B
* D7 r/ t$ b& F( l4 I - MODE_SYS .set 0x1F4 n2 D; T, u5 Y( L( q9 c: c! q. B
- . m+ [' F, u% c) ]1 C9 c. E
- I_F_BIT .set 0xC0% j4 q% ]3 C: ^. I3 p
- L5 W* C& `9 M
- ;**************************** Code Seection ***********************************
5 E/ I, {8 E( h1 [+ R! i+ R - .text' u0 w& f4 s3 `4 f) W9 ~5 V# P
3 i. k& O+ _, F9 i2 E: O$ i- ;
; Q9 [0 P/ Y8 D7 e G - ; This code is assembled for ARM instructions
& A; n8 G2 G" J6 @% H3 u - ;1 J5 K; m& N$ A
- .state32
! J5 T1 `( y- ]; @
/ R' t5 K' A$ B3 b) d$ C; f- ;******************************************************************************* S8 K4 C R9 [: I- k( G
- ;! Y# U% ]$ B/ v3 r# N
- ;******************************************************************************
' V3 q( M6 I4 }* A - ;" u* g2 d4 R2 |$ f, S4 m& {
- ; The reset handler sets up the stack pointers for all the modes. The FIQ and
) n( k4 T) g1 K: q/ f. p - ; IRQ shall be disabled during this. Then, clearthe BSS sections, switch to the7 ]5 [- C n+ P4 a0 ?6 ^
- ; main() function.! t* m/ M& y/ o, \! l6 k, R7 i
- ;* j9 K0 {$ I0 P6 ~& y' q
- Entry:
8 e6 ?: B! I* ` - ;
- g/ w: a7 \' _ - ; Set up the Stack for Undefined mode6 `- q/ s/ W- w; @. y+ @
- ;
/ S& X7 g4 r+ f( U- H - LDR r0, _stackptr ; Read and align the stack pointer
1 D+ f# d4 _) h9 w - SUB r0, r0, #8$ V" i. B6 ]& h6 A) D( ]% r% @
- BIC r0, r0, #71 E# f* I% s/ ^: G
- MSR cpsr_c, #MODE_UND|I_F_BIT ; switch to undef mode' X' z5 h S8 V; K3 q9 Q8 P+ t
- MOV sp,r0 ; write the stack pointer
; n6 q# L7 t5 K5 s6 } - SUB r0, r0, #UND_STACK_SIZE ; give stack space
( \0 P$ o+ W* g7 s - ;
' L; F, B& A/ ] - ; Set up the Stack for abort mode- L$ F0 C/ x# V- T* a/ [( @/ k* f1 T
- ;
. n* _- q5 p! A1 S - MSR cpsr_c, #MODE_ABT|I_F_BIT ; Change to abort mode. o( h: Z$ b- L
- MOV sp, r0 ; write the stack pointer
0 }5 \ d; w* {. Y8 _! c - SUB r0,r0, #ABT_STACK_SIZE ; give stack space" Q" h$ }' |0 r# U
- ;. j4 c: `, N2 D/ B; L
- ; Set up the Stack for FIQ mode! Z6 h/ ~' N1 o2 N
- ;
9 \, U- N$ L* g# D - MSR cpsr_c, #MODE_FIQ|I_F_BIT ; change to FIQ mode
- i$ W: i; s7 C: { - MOV sp,r0 ; write the stack pointer
- Q, M# @4 f f- {9 G - SUB r0,r0, #FIQ_STACK_SIZE ; give stack space/ S [0 C4 k3 {$ O
- ;, q( @7 [; s0 ^+ X% G0 d
- ; Set up the Stack for IRQ mode
' P; k) w1 v0 x6 ^3 d - ;
7 |4 A: w1 L: m- A# Y" V/ s4 l& `% { - MSR cpsr_c, #MODE_IRQ|I_F_BIT ; change to IRQ mode
1 ~2 o5 }" E! e8 P- X1 P" g - MOV sp,r0 ; write the stack pointer, V3 I+ P0 t( f
- SUB r0,r0, #IRQ_STACK_SIZE ; give stack space
4 Y& b; b4 g& s5 _- b, d! a - ;
9 `1 W4 m* l! y: ]9 c. j - ; Set up the Stack for SVC mode
6 x. C' V) t8 ?, e% S+ {% B - ;( @3 s) \; \! o) @7 U2 a4 d
- MSR cpsr_c, #MODE_SVC|I_F_BIT ; change to SVC mode7 C' G5 N$ v; @
- MOV sp,r0 ; write the stack pointer% w7 Q$ G/ E+ G3 E- T
- SUB r0,r0, #SVC_STACK_SIZE ; give stack space+ [2 X' K6 i) ]' F
- ;
" g- E# w% ~2 c- x - ; Set up the Stack for USer/System mode; _* D' o7 t1 y8 u) l
- ;
8 g& ?+ L8 p+ ^; Y6 g7 p, Q - MSR cpsr_c, #MODE_SYS|I_F_BIT ; change to system mode
! |6 w+ v) p' q o - MOV sp,r0 ; write the stack pointer4 H3 J0 H( W+ M8 Y0 u2 u
9 P; S; ~) H M2 J1 B- ;- e, N& B, z7 f$ j8 n3 c2 e1 y
- ; Clear the BSS section here9 l2 @( J! B8 d" b" z7 }4 w
- ; v# o6 B% D) X' \8 C4 C7 `( L
- Clear_Bss_Section:" _) u5 {0 U9 z- J9 ~. e& v
6 Y7 z# h r# j+ T8 C2 k5 s- LDR r0, _bss_start ; Start address of BSS. W1 H0 l0 d# ?7 d& v( i
- LDR r1, _bss_end ; End address of BSS' m+ u1 u6 v8 q$ u
- SUB r1,r1,#4, c: Q. X0 P& f8 l& n. G/ j& u
- MOV r2, #00 x8 r/ a( l' G7 U4 |* X2 a
- Loop:/ M8 Y0 \) _' d9 }4 F
- STR r2, [r0], #4 ; Clear one word in BSS
C- w" s; M( I3 w - CMP r0, r1
! X' L) J/ k% l' s8 N - BLE Loop ; Clear till BSS end9 Q* Q: q& o2 Q
1 D1 |8 ^. n* ?/ G8 @2 x1 \6 n8 e2 F; @- BL __TI_auto_init ; Call TI auto init0 B# U: h- ~1 Q
- - B' u+ \/ h, }3 L7 ]
- ;: f+ Z$ l2 d7 p9 O! _- W2 }
- ; Enter the start_boot function. The execution still happens in system mode$ {7 n3 d; l. r0 l- E2 C( I
- ;3 W5 F6 s( c: N
- LDR r10, _start_boot ; Get the address of start_boot# T0 f: }5 P0 n% K+ _
- MOV lr,pc ; Dummy return 8 m9 V+ y( c7 X! T6 F. ?
- BX r10 ; Branch to start_boot
: i% A/ p& T: b1 ~5 {2 ] - SUB pc, pc, #0x08 ; looping; T! t& k1 v- f" j n% f. z
! c; |1 E: O" g- ; MSR cpsr_c, #MODE_SVC|I_F_BIT ; change to SVC mode& I. X5 _ i4 I5 R' }6 s
- ; BX lr+ z v+ l+ F6 D* O
- ;
% Z0 o# e% W' l; C1 k* F+ Z% { - ; End of the file5 p2 I' P1 R. l1 A5 C* \
- ; N8 n# h+ s5 H" V6 X/ b+ p
" K% t( ~8 n$ k- _stackptr:$ F/ L+ @ ?: U
- .word __STACK_END# t: |$ ?- Z. y7 M+ x0 L5 |
- _bss_start:# w* T; `; f, O0 ?) N
- .word bss_start9 X7 x6 ?8 B* ]/ U% E
- _bss_end:
' G) `3 \ U" \1 r1 R* q3 X - .word bss_end
5 o U8 v! H- g k - _start_boot:1 t: _+ W7 \5 H' a/ w& f5 q4 q# g$ q8 x
- .word start_boot
- p: i1 ^; J9 Z4 h7 F# v8 ] - _data_auto_init:) `; _4 a! b: {# d* ?- \
- .word __TI_auto_init1 G2 c& _ U1 m6 h. k: h! r$ h0 i
- .end
6 j7 n' A0 J, C- i( u -
, |) d7 Z/ f& k8 R - # W" ~" n9 G6 o. X
( K% b; q1 f' l/ }* s. B# s1 l
复制代码 ( ~# N4 h$ W6 i: y
m+ u1 i6 F- t- }' q6 u: Z |: I
0 U0 @* y/ R+ l. O T
7 d h! W* `* q6 f* m+ m$ r4 M% g V" I
|
|