|
在IAR V8.32.3移植ThreadX运行于iMX6ULL上,坛里的大佬有人试验过在CortexA7上运行没,望赐教指点!
移植运行可以执行到VOID _tx_thread_shell_entry(VOID)函数的TX_DISABLE语句后,程序就跳入未定义异常
__tx_undefined
B __tx_undefined ; Undefined handler
cstartup.s
(5.98 KB, 下载次数: 17)
tx_initialize_low_level.s
(15.31 KB, 下载次数: 19)
tx_setup_systick.c
(4.99 KB, 下载次数: 14)
在cstartup.s主要添加
;
; Add initialization needed before setup of stackpointers here.
;
CPSID I ; Mask interrupts
; Reset SCTLR Settings
MRC P15, 0, R0, C1, C0, 0 ; Read CP15 System Control register
BIC R0, R0, #(0x1 << 12) ; Clear I bit 12 to disable I Cache
BIC R0, R0, #(0x1 << 2) ; Clear C bit 2 to disable D Cache
BIC R0, R0, #0x2 ; Clear A bit 1 to disable strict alignment
BIC R0, R0, #(0x1 << 11) ; Clear Z bit 11 to disable branch prediction
BIC R0, R0, #0x1 ; Clear M bit 0 to disable MMU
MCR P15, 0, R0, C1, C0, 0 ; Write value back to CP15 System Control register
....
;
; Add more initialization here
;
LDR R0, =SystemInit
BLX R0
CPSIE I ; Unmask interrupts
在tx_initialize_low_level.s中主要新增:
; /* For debug purpose, execute the timer interrupt processing here. In
; a real system, some kind of status indication would have to be checked
; before the timer interrupt handler could be called. */
;
; BL _tx_timer_interrupt ; Timer interrupt handler
;
; /* Application IRQ handlers can be called here! */
PUSH {LR} ; Save return address+4
PUSH {R0-R3, R12} ; Push caller save registers
MRS R0, SPSR ; Save SPRS to allow interrupt reentry
PUSH {R0}
MRC P15, 4, R1, C15, C0, 0 ; Get GIC base address
ADD R1, R1, #0x2000 ; R1: GICC base address
LDR R0, [R1, #0xC] ; R0: IAR
PUSH {R0, R1}
CPS #0x13 ; Change to Supervisor mode to allow interrupt reentry
PUSH {LR} ; Save Supervisor LR
LDR R2, =SystemIrqHandler
BLX R2 ; Call SystemIrqHandler with param IAR
POP {LR}
CPS #0x12 ; Back to IRQ mode
POP {R0, R1}
STR R0, [R1, #0x10] ; Now IRQ handler finished: write to EOIR
POP {R0}
MSR SPSR_CXSF, R0
POP {R0-R3, R12}
POP {LR}
SUBS PC, LR, #4
;
通过在tx_user.h中定义宏在内核启动时配置滴答定时器
extern void tx_config_systick(void);
extern void tx_startup_notify(void);
#define TX_PORT_SPECIFIC_PRE_INITIALIZATION tx_config_systick();
#define TX_PORT_SPECIFIC_POST_INITIALIZATION
#define TX_PORT_SPECIFIC_PRE_SCHEDULER_INITIALIZATION tx_startup_notify();
|
|