2 ; FreeRTOS V8.1.1 - Copyright (C) 2014 Real Time Engineers Ltd.
\r
3 ; All rights reserved
\r
6 ; ***************************************************************************
\r
8 ; * FreeRTOS tutorial books are available in pdf and paperback. *
\r
9 ; * Complete, revised, and edited pdf reference manuals are also *
\r
12 ; * Purchasing FreeRTOS documentation will not only help you, by *
\r
13 ; * ensuring you get running as quickly as possible and with an *
\r
14 ; * in-depth knowledge of how to use FreeRTOS, it will also help *
\r
15 ; * the FreeRTOS project to continue with its mission of providing *
\r
16 ; * professional grade, cross platform, de facto standard solutions *
\r
17 ; * for microcontrollers - completely free of charge! *
\r
19 ; * >>> See http://www.FreeRTOS.org/Documentation for details. <<< *
\r
21 ; * Thank you for using FreeRTOS, and thank you for your support! *
\r
23 ; ***************************************************************************
\r
26 ; This file is part of the FreeRTOS distribution.
\r
28 ; FreeRTOS is free software; you can redistribute it and/or modify it under
\r
29 ; the terms of the GNU General Public License (version 2) as published by the
\r
30 ; Free Software Foundation AND MODIFIED BY the FreeRTOS exception.
\r
31 ; >>>NOTE<<< The modification to the GPL is included to allow you to
\r
32 ; distribute a combined work that includes FreeRTOS without being obliged to
\r
33 ; provide the source code for proprietary components outside of the FreeRTOS
\r
34 ; kernel. FreeRTOS is distributed in the hope that it will be useful, but
\r
35 ; WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
\r
36 ; or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
\r
37 ; more details. You should have received a copy of the GNU General Public
\r
38 ; License and the FreeRTOS license exception along with FreeRTOS; if not it
\r
39 ; can be viewed here: http://www.freertos.org/a00114.html and also obtained
\r
40 ; by writing to Richard Barry, contact details for whom are available on the
\r
41 ; FreeRTOS WEB site.
\r
43 ; 1 tab == 4 spaces!
\r
45 ; http://www.FreeRTOS.org - Documentation, latest information, license and
\r
48 ; http://www.SafeRTOS.com - A version that is certified for use in safety
\r
51 ; http://www.OpenRTOS.com - Commercial support, development, porting,
\r
52 ; licensing and training services.
\r
56 .extern pxCurrentTCB
\r
57 .extern vTaskSwitchContext
\r
58 .extern ulMaxSyscallInterruptPriorityConst
\r
61 .global _lc_ref__vector_pp_14
\r
63 .global vPortStartFirstTask
\r
64 .global vPortEnableVFP
\r
65 .global ulPortSetInterruptMask
\r
66 .global vPortClearInterruptMask
\r
68 ;-----------------------------------------------------------
\r
73 _vector_14: .type func
\r
78 ;Get the location of the current TCB.
\r
79 ldr.w r3, =pxCurrentTCB
\r
82 ;Is the task using the FPU context? If so, push high vfp registers.
\r
85 vstmdbeq r0!, {s16-s31}
\r
87 ;Save the core registers.
\r
88 stmdb r0!, {r4-r11, r14}
\r
90 ;Save the new top of stack into the first member of the TCB.
\r
94 ldr.w r0, =ulMaxSyscallInterruptPriorityConst
\r
97 bl vTaskSwitchContext
\r
102 ;The first item in pxCurrentTCB is the task top of stack.
\r
106 ;Pop the core registers.
\r
107 ldmia r0!, {r4-r11, r14}
\r
109 ;Is the task using the FPU context? If so, pop the high vfp registers too.
\r
112 vldmiaeq r0!, {s16-s31}
\r
118 .size _vector_14, $-_vector_14
\r
121 ;-----------------------------------------------------------
\r
123 ; This function is an XMC4000 silicon errata workaround. It will get used when
\r
124 ; the SILICON_BUG_PMC_CM_001 linker macro is defined.
\r
128 _lc_ref__vector_pp_14: .type func
\r
133 ;Get the location of the current TCB.
\r
134 ldr.w r3, =pxCurrentTCB
\r
137 ;Is the task using the FPU context? If so, push high vfp registers.
\r
140 vstmdbeq r0!, {s16-s31}
\r
142 ;Save the core registers.
\r
143 stmdb r0!, {r4-r11, r14}
\r
145 ;Save the new top of stack into the first member of the TCB.
\r
149 ldr.w r0, =ulMaxSyscallInterruptPriorityConst
\r
152 bl vTaskSwitchContext
\r
157 ;The first item in pxCurrentTCB is the task top of stack.
\r
161 ;Pop the core registers.
\r
162 ldmia r0!, {r4-r11, r14}
\r
164 ;Is the task using the FPU context? If so, pop the high vfp registers too.
\r
167 vldmiaeq r0!, {s16-s31}
\r
172 pop { pc } ; XMC4000 specific errata workaround. Do not used "bx lr" here.
\r
174 .size _lc_ref__vector_pp_14, $-_lc_ref__vector_pp_14
\r
177 ;-----------------------------------------------------------
\r
182 SVC_Handler: .type func
\r
183 ;Get the location of the current TCB.
\r
184 ldr.w r3, =pxCurrentTCB
\r
187 ;Pop the core registers.
\r
188 ldmia r0!, {r4-r11, r14}
\r
194 .size SVC_Handler, $-SVC_Handler
\r
197 ;-----------------------------------------------------------
\r
202 vPortStartFirstTask .type func
\r
203 ;Use the NVIC offset register to locate the stack.
\r
204 ldr.w r0, =0xE000ED08
\r
207 ;Set the msp back to the start of the stack.
\r
209 ;Call SVC to start the first task.
\r
215 .size vPortStartFirstTask, $-vPortStartFirstTask
\r
218 ;-----------------------------------------------------------
\r
223 vPortEnableVFP .type func
\r
224 ;The FPU enable bits are in the CPACR.
\r
225 ldr.w r0, =0xE000ED88
\r
228 ;Enable CP10 and CP11 coprocessors, then save back.
\r
229 orr r1, r1, #( 0xf << 20 )
\r
232 .size vPortEnableVFP, $-vPortEnableVFP
\r
235 ;-----------------------------------------------------------
\r
240 ulPortSetInterruptMask:
\r
242 ldr.w r1, =ulMaxSyscallInterruptPriorityConst
\r
246 .size ulPortSetInterruptMask, $-ulPortSetInterruptMask
\r
249 ;-----------------------------------------------------------
\r
254 vPortClearInterruptMask:
\r
257 .size vPortClearInterruptMask, $-vPortClearInterruptMask
\r
260 ;-----------------------------------------------------------
\r