Other Parts Discussed in Thread: HALCOGEN
i use halcogen generate all the peripheral code include freertos.
but the isr does not link to freertos isr process,
i think, must be package the naked isr code in freertos, then i fill s_vim_init[] in sys_startup.c with xxx_ISREntry(),
follow is my packed isr asm code, is right? if it's some errors, please correct it, thanks a lot!
os_portISR.asm:
.text
.state32
;-------------------------------------------------------------------------------
; Restore Context
.def osPortRestoreContext
.def osPortSaveContext
.ref pxCurrentTCB
.ref ulCriticalNesting
.def xcurTCB
.def ulcritNest
.asmfunc
osPortRestoreContext:
ldr r0, xcurTCB
ldr r0, [r0]
ldr lr, [r0]
ldr r0, ulcritNest
ldmfd lr!, {r1}
str r1, [r0]
.if __TI_VFPV3D16_SUPPORT__ = 1
ldmfd lr!, {r0,r1}
fldmiad lr!, {d0-d15}
fmxr fpscr, r1
.else
ldmfd lr!, {r0}
.endif
msr spsr_cf, r0
ldmfd lr, {r0-r14}^
ldr lr, [lr, #0x3C]
subs pc, lr, #4
.endasmfunc
;-------------------------------------------------------------------------------
; Save context
.asmfunc
osPortSaveContext:
stmfd sp!, {r0}
stmfd sp, {sp}^
sub sp, sp, #4
ldmfd sp!, {r0}
stmfd r0!, {lr}
mov lr, r0
ldmfd sp!, {r0}
stmfd lr, {r0-lr}^
sub lr, lr, #0x3C
.if __TI_VFPV3D16_SUPPORT__ = 1
fstmdbd lr!, {d0-d15}
mrs r0, spsr
fmrx r1, fpscr
stmfd lr!, {r0,r1}
.else
mrs r0, spsr
stmfd lr!, {r0}
.endif
ldr r0, ulcritNest
ldr r0, [r0]
stmfd lr!, {r0}
ldr r0, xcurTCB
ldr r0, [r0]
str lr, [r0]
.endasmfunc
;-------------------------------------------------------------------------------
; Global Definitions
xcurTCB: .word pxCurrentTCB
ulcritNest: .word ulCriticalNesting
;------------------------------------------------------------------------------
.ref rtiCompare0Interrupt
.global rtiCompare0_ISREntry
vrtiCompare0Interrupt .word rtiCompare0Interrupt
.asmfunc
rtiCompare0_ISREntry:
; Save the context of the interrupted task.
b osPortSaveContext
; Call the C handler function - defined within *.c.
LDR R0, vrtiCompare0Interrupt
MOV LR, PC
BX R0
; Finish off by restoring the context of the task that has been chosen to
; run next - which might be a different task to that which was originally
; interrupted.
b osPortRestoreContext
.endasmfunc
;------------------------------------------------------------------------------
.ref can1HighLevelInterrupt
.global can1HighLevel_ISREntry
vcan1HighLevelInterrupt .word can1HighLevelInterrupt
.asmfunc
can1HighLevel_ISREntry:
; Save the context of the interrupted task.
b osPortSaveContext
; Call the C handler function - defined within *.c.
LDR R0, vcan1HighLevelInterrupt
MOV LR, PC
BX R0
; Finish off by restoring the context of the task that has been chosen to
; run next - which might be a different task to that which was originally
; interrupted.
b osPortRestoreContext
.endasmfunc