;/*\r
-; FreeRTOS V7.1.1 - Copyright (C) 2012 Real Time Engineers Ltd.\r
+; FreeRTOS V9.0.0rc2 - Copyright (C) 2016 Real Time Engineers Ltd.\r
+; All rights reserved\r
;\r
;\r
; ***************************************************************************\r
; licensing and training services.\r
;*/\r
\r
+\r
.extern pxCurrentTCB\r
.extern vTaskSwitchContext\r
.extern ulMaxSyscallInterruptPriorityConst\r
\r
- .global PendSV_Handler\r
+ .global _vector_14\r
+ .global _lc_ref__vector_pp_14\r
.global SVC_Handler\r
.global vPortStartFirstTask\r
.global vPortEnableVFP\r
- \r
+ .global ulPortSetInterruptMask\r
+ .global vPortClearInterruptMask\r
+\r
;-----------------------------------------------------------\r
\r
.section .text\r
.thumb\r
.align 4\r
-PendSV_Handler: .type func\r
+_vector_14: .type func\r
+\r
mrs r0, psp\r
+ isb\r
\r
;Get the location of the current TCB.\r
ldr.w r3, =pxCurrentTCB\r
;Save the new top of stack into the first member of the TCB.\r
str r0, [r2]\r
\r
- stmdb sp!, {r3, r14}\r
+ stmdb sp!, {r3}\r
ldr.w r0, =ulMaxSyscallInterruptPriorityConst\r
+ ldr r0, [r0]\r
msr basepri, r0\r
bl vTaskSwitchContext\r
mov r0, #0\r
msr basepri, r0\r
- ldmia sp!, {r3, r14}\r
+ ldmia sp!, {r3}\r
\r
;The first item in pxCurrentTCB is the task top of stack.\r
ldr r1, [r3]\r
vldmiaeq r0!, {s16-s31}\r
\r
msr psp, r0\r
+ isb\r
bx r14\r
\r
- .size PendSV_Handler, $-PendSV_Handler\r
+ .size _vector_14, $-_vector_14\r
+ .endsec\r
+\r
+;-----------------------------------------------------------\r
+\r
+; This function is an XMC4000 silicon errata workaround. It will get used when\r
+; the SILICON_BUG_PMC_CM_001 linker macro is defined.\r
+ .section .text\r
+ .thumb\r
+ .align 4\r
+_lc_ref__vector_pp_14: .type func\r
+\r
+ mrs r0, psp\r
+ isb\r
+\r
+ ;Get the location of the current TCB.\r
+ ldr.w r3, =pxCurrentTCB\r
+ ldr r2, [r3]\r
+\r
+ ;Is the task using the FPU context? If so, push high vfp registers.\r
+ tst r14, #0x10\r
+ it eq\r
+ vstmdbeq r0!, {s16-s31}\r
+\r
+ ;Save the core registers.\r
+ stmdb r0!, {r4-r11, r14}\r
+\r
+ ;Save the new top of stack into the first member of the TCB.\r
+ str r0, [r2]\r
+\r
+ stmdb sp!, {r3}\r
+ ldr.w r0, =ulMaxSyscallInterruptPriorityConst\r
+ ldr r0, [r0]\r
+ msr basepri, r0\r
+ bl vTaskSwitchContext\r
+ mov r0, #0\r
+ msr basepri, r0\r
+ ldmia sp!, {r3}\r
+\r
+ ;The first item in pxCurrentTCB is the task top of stack.\r
+ ldr r1, [r3]\r
+ ldr r0, [r1]\r
+\r
+ ;Pop the core registers.\r
+ ldmia r0!, {r4-r11, r14}\r
+\r
+ ;Is the task using the FPU context? If so, pop the high vfp registers too.\r
+ tst r14, #0x10\r
+ it eq\r
+ vldmiaeq r0!, {s16-s31}\r
+\r
+ msr psp, r0\r
+ isb\r
+ push { lr }\r
+ pop { pc } ; XMC4000 specific errata workaround. Do not used "bx lr" here.\r
+\r
+ .size _lc_ref__vector_pp_14, $-_lc_ref__vector_pp_14\r
.endsec\r
\r
;-----------------------------------------------------------\r
;Pop the core registers.\r
ldmia r0!, {r4-r11, r14}\r
msr psp, r0\r
+ isb\r
mov r0, #0\r
msr basepri, r0\r
bx r14\r
msr msp, r0\r
;Call SVC to start the first task.\r
cpsie i\r
+ cpsie f\r
+ dsb\r
+ isb\r
svc 0\r
.size vPortStartFirstTask, $-vPortStartFirstTask\r
.endsec\r
.size vPortEnableVFP, $-vPortEnableVFP\r
.endsec\r
\r
+;-----------------------------------------------------------\r
+\r
+ .section .text\r
+ .thumb\r
+ .align 4\r
+ulPortSetInterruptMask:\r
+ mrs r0, basepri\r
+ ldr.w r1, =ulMaxSyscallInterruptPriorityConst\r
+ ldr r1, [r1]\r
+ msr basepri, r1\r
+ bx r14\r
+ .size ulPortSetInterruptMask, $-ulPortSetInterruptMask\r
+ .endsec\r
+\r
+;-----------------------------------------------------------\r
+\r
+ .section .text\r
+ .thumb\r
+ .align 4\r
+vPortClearInterruptMask:\r
+ msr basepri, r0\r
+ bx r14\r
+ .size vPortClearInterruptMask, $-vPortClearInterruptMask\r
+ .endsec\r
+\r
+;-----------------------------------------------------------\r
\r
.end\r
- \r
+\r