X-Git-Url: https://git.sur5r.net/?a=blobdiff_plain;f=FreeRTOS%2FSource%2Fportable%2FTasking%2FARM_CM4F%2Fport_asm.asm;h=6b47555fa85bc29dc568564fcc25f14c5d5a25bf;hb=b15dfacb6026af3b0ba697e5753844923b468d2b;hp=9d9c42074348f255fc739800dced3fd52f892b8f;hpb=617d46d8432c30e925e24d1687d310be7aa39f6c;p=freertos diff --git a/FreeRTOS/Source/portable/Tasking/ARM_CM4F/port_asm.asm b/FreeRTOS/Source/portable/Tasking/ARM_CM4F/port_asm.asm index 9d9c42074..6b47555fa 100644 --- a/FreeRTOS/Source/portable/Tasking/ARM_CM4F/port_asm.asm +++ b/FreeRTOS/Source/portable/Tasking/ARM_CM4F/port_asm.asm @@ -1,56 +1,29 @@ ;/* -; FreeRTOS V7.5.3 - Copyright (C) 2013 Real Time Engineers Ltd. -; All rights reserved -; -; -; *************************************************************************** -; * * -; * FreeRTOS tutorial books are available in pdf and paperback. * -; * Complete, revised, and edited pdf reference manuals are also * -; * available. * -; * * -; * Purchasing FreeRTOS documentation will not only help you, by * -; * ensuring you get running as quickly as possible and with an * -; * in-depth knowledge of how to use FreeRTOS, it will also help * -; * the FreeRTOS project to continue with its mission of providing * -; * professional grade, cross platform, de facto standard solutions * -; * for microcontrollers - completely free of charge! * -; * * -; * >>> See http://www.FreeRTOS.org/Documentation for details. <<< * -; * * -; * Thank you for using FreeRTOS, and thank you for your support! * -; * * -; *************************************************************************** -; -; -; This file is part of the FreeRTOS distribution. -; -; FreeRTOS is free software; you can redistribute it and/or modify it under -; the terms of the GNU General Public License (version 2) as published by the -; Free Software Foundation AND MODIFIED BY the FreeRTOS exception. -; >>>NOTE<<< The modification to the GPL is included to allow you to -; distribute a combined work that includes FreeRTOS without being obliged to -; provide the source code for proprietary components outside of the FreeRTOS -; kernel. FreeRTOS is distributed in the hope that it will be useful, but -; WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -; or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for -; more details. You should have received a copy of the GNU General Public -; License and the FreeRTOS license exception along with FreeRTOS; if not it -; can be viewed here: http://www.freertos.org/a00114.html and also obtained -; by writing to Richard Barry, contact details for whom are available on the -; FreeRTOS WEB site. -; -; 1 tab == 4 spaces! -; -; http://www.FreeRTOS.org - Documentation, latest information, license and -; contact details. -; -; http://www.SafeRTOS.com - A version that is certified for use in safety -; critical systems. -; -; http://www.OpenRTOS.com - Commercial support, development, porting, -; licensing and training services. -;*/ +; * FreeRTOS Kernel V10.3.0 +; * Copyright (C) 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. +; * +; * Permission is hereby granted, free of charge, to any person obtaining a copy of +; * this software and associated documentation files (the "Software"), to deal in +; * the Software without restriction, including without limitation the rights to +; * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of +; * the Software, and to permit persons to whom the Software is furnished to do so, +; * subject to the following conditions: +; * +; * The above copyright notice and this permission notice shall be included in all +; * copies or substantial portions of the Software. +; * +; * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +; * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS +; * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR +; * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER +; * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +; * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +; * +; * http://www.FreeRTOS.org +; * http://aws.amazon.com/freertos +; * +; * 1 tab == 4 spaces! +; */ .extern pxCurrentTCB @@ -64,7 +37,7 @@ .global vPortEnableVFP .global ulPortSetInterruptMask .global vPortClearInterruptMask - + ;----------------------------------------------------------- .section .text @@ -73,6 +46,7 @@ _vector_14: .type func mrs r0, psp + isb ;Get the location of the current TCB. ldr.w r3, =pxCurrentTCB @@ -89,13 +63,14 @@ _vector_14: .type func ;Save the new top of stack into the first member of the TCB. str r0, [r2] - stmdb sp!, {r3, r14} + stmdb sp!, {r0, r3} ldr.w r0, =ulMaxSyscallInterruptPriorityConst + ldr r0, [r0] msr basepri, r0 bl vTaskSwitchContext mov r0, #0 msr basepri, r0 - ldmia sp!, {r3, r14} + ldmia sp!, {r0, r3} ;The first item in pxCurrentTCB is the task top of stack. ldr r1, [r3] @@ -110,6 +85,7 @@ _vector_14: .type func vldmiaeq r0!, {s16-s31} msr psp, r0 + isb bx r14 .size _vector_14, $-_vector_14 @@ -125,6 +101,7 @@ _vector_14: .type func _lc_ref__vector_pp_14: .type func mrs r0, psp + isb ;Get the location of the current TCB. ldr.w r3, =pxCurrentTCB @@ -141,13 +118,14 @@ _lc_ref__vector_pp_14: .type func ;Save the new top of stack into the first member of the TCB. str r0, [r2] - stmdb sp!, {r3, r14} + stmdb sp!, {r3} ldr.w r0, =ulMaxSyscallInterruptPriorityConst + ldr r0, [r0] msr basepri, r0 bl vTaskSwitchContext mov r0, #0 msr basepri, r0 - ldmia sp!, {r3, r14} + ldmia sp!, {r3} ;The first item in pxCurrentTCB is the task top of stack. ldr r1, [r3] @@ -162,6 +140,7 @@ _lc_ref__vector_pp_14: .type func vldmiaeq r0!, {s16-s31} msr psp, r0 + isb push { lr } pop { pc } ; XMC4000 specific errata workaround. Do not used "bx lr" here. @@ -181,6 +160,7 @@ SVC_Handler: .type func ;Pop the core registers. ldmia r0!, {r4-r11, r14} msr psp, r0 + isb mov r0, #0 msr basepri, r0 bx r14 @@ -201,6 +181,9 @@ vPortStartFirstTask .type func msr msp, r0 ;Call SVC to start the first task. cpsie i + cpsie f + dsb + isb svc 0 .size vPortStartFirstTask, $-vPortStartFirstTask .endsec @@ -230,6 +213,7 @@ vPortEnableVFP .type func ulPortSetInterruptMask: mrs r0, basepri ldr.w r1, =ulMaxSyscallInterruptPriorityConst + ldr r1, [r1] msr basepri, r1 bx r14 .size ulPortSetInterruptMask, $-ulPortSetInterruptMask @@ -249,4 +233,4 @@ vPortClearInterruptMask: ;----------------------------------------------------------- .end - +