├── .cyignore ├── EULA ├── LICENSE ├── README.md ├── RELEASE.md ├── Source ├── croutine.c ├── event_groups.c ├── include │ ├── FreeRTOS.h │ ├── StackMacros.h │ ├── atomic.h │ ├── croutine.h │ ├── deprecated_definitions.h │ ├── event_groups.h │ ├── list.h │ ├── message_buffer.h │ ├── mpu_prototypes.h │ ├── mpu_wrappers.h │ ├── portable.h │ ├── projdefs.h │ ├── queue.h │ ├── semphr.h │ ├── stack_macros.h │ ├── stdint.readme │ ├── stream_buffer.h │ ├── task.h │ └── timers.h ├── list.c ├── portable │ ├── COMPONENT_CM0 │ │ ├── FreeRTOSConfig.h │ │ ├── TOOLCHAIN_ARM │ │ │ ├── port.c │ │ │ └── portmacro.h │ │ ├── TOOLCHAIN_GCC_ARM │ │ │ ├── port.c │ │ │ └── portmacro.h │ │ └── TOOLCHAIN_IAR │ │ │ ├── port.c │ │ │ ├── portasm.s │ │ │ └── portmacro.h │ ├── COMPONENT_CM0P │ │ ├── FreeRTOSConfig.h │ │ ├── TOOLCHAIN_ARM │ │ │ ├── port.c │ │ │ └── portmacro.h │ │ ├── TOOLCHAIN_GCC_ARM │ │ │ ├── port.c │ │ │ └── portmacro.h │ │ └── TOOLCHAIN_IAR │ │ │ ├── port.c │ │ │ ├── portasm.s │ │ │ └── portmacro.h │ ├── COMPONENT_CM33 │ │ ├── FreeRTOSConfig.h │ │ ├── TOOLCHAIN_ARM │ │ │ ├── port.c │ │ │ ├── portasm.c │ │ │ ├── portasm.h │ │ │ ├── portdsram.c │ │ │ ├── portdsram.h │ │ │ ├── portmacro.h │ │ │ └── portmacrocommon.h │ │ ├── TOOLCHAIN_GCC_ARM │ │ │ ├── port.c │ │ │ ├── portasm.c │ │ │ ├── portasm.h │ │ │ ├── portdsram.c │ │ │ ├── portdsram.h │ │ │ ├── portmacro.h │ │ │ └── portmacrocommon.h │ │ └── TOOLCHAIN_IAR │ │ │ ├── port.c │ │ │ ├── portasm.S │ │ │ ├── portasm.h │ │ │ ├── portdsram.s │ │ │ ├── portmacro.h │ │ │ └── portmacrocommon.h │ ├── COMPONENT_CM4 │ │ ├── FreeRTOSConfig.h │ │ ├── TOOLCHAIN_ARM │ │ │ ├── port.c │ │ │ └── portmacro.h │ │ ├── TOOLCHAIN_GCC_ARM │ │ │ ├── port.c │ │ │ └── portmacro.h │ │ └── TOOLCHAIN_IAR │ │ │ ├── port.c │ │ │ ├── portasm.s │ │ │ └── portmacro.h │ ├── COMPONENT_CM55 │ │ ├── FreeRTOSConfig.h │ │ ├── TOOLCHAIN_ARM │ │ │ ├── port.c │ │ │ ├── portasm.c │ │ │ ├── portasm.h │ │ │ ├── portmacro.h │ │ │ └── portmacrocommon.h │ │ ├── TOOLCHAIN_GCC_ARM │ │ │ ├── port.c │ │ │ ├── portasm.c │ │ │ ├── portasm.h │ │ │ ├── portmacro.h │ │ │ └── portmacrocommon.h │ │ └── TOOLCHAIN_IAR │ │ │ ├── port.c │ │ │ ├── portasm.h │ │ │ ├── portasm.s │ │ │ ├── portmacro.h │ │ │ └── portmacrocommon.h │ ├── COMPONENT_CM7 │ │ ├── FreeRTOSConfig.h │ │ ├── TOOLCHAIN_ARM │ │ │ ├── port.c │ │ │ └── portmacro.h │ │ ├── TOOLCHAIN_GCC_ARM │ │ │ ├── port.c │ │ │ └── portmacro.h │ │ └── TOOLCHAIN_IAR │ │ │ ├── port.c │ │ │ ├── portasm.s │ │ │ └── portmacro.h │ ├── COMPONENT_CR4 │ │ ├── FreeRTOSConfig.h │ │ ├── TOOLCHAIN_GCC_ARM │ │ │ ├── port.c │ │ │ ├── portASM.S │ │ │ └── portmacro.h │ │ └── low_level_init.c │ ├── MemMang │ │ ├── ReadMe.url │ │ ├── heap_1.c │ │ ├── heap_2.c │ │ ├── heap_3.c │ │ ├── heap_4.c │ │ ├── heap_5.c │ │ └── static_malloc.txt │ └── readme.txt ├── queue.c ├── readme.txt ├── stream_buffer.c ├── tasks.c └── timers.c ├── docs ├── api_reference_manual.html └── api_reference_manual │ ├── html │ ├── bc_s.png │ ├── bdwn.png │ ├── closed.png │ ├── cypress_logo.png │ ├── doc.png │ ├── doxygen.png │ ├── doxygen_style.css │ ├── dynsections.js │ ├── folderclosed.png │ ├── folderopen.png │ ├── index.html │ ├── jquery.js │ ├── nav_f.png │ ├── nav_g.png │ ├── nav_h.png │ ├── open.png │ ├── search │ │ ├── all_0.html │ │ ├── all_0.js │ │ ├── close.png │ │ ├── mag_sel.png │ │ ├── nomatches.html │ │ ├── pages_0.html │ │ ├── pages_0.js │ │ ├── search.css │ │ ├── search.js │ │ ├── search_l.png │ │ ├── search_m.png │ │ ├── search_r.png │ │ └── searchdata.js │ ├── splitbar.png │ ├── sync_off.png │ ├── sync_on.png │ ├── tab_a.png │ ├── tab_b.png │ ├── tab_h.png │ ├── tab_s.png │ └── tabs.css │ └── xml │ ├── combine.xslt │ ├── compound.xsd │ ├── doxyfile__main__page_8txt.xml │ ├── index.xml │ ├── index.xsd │ └── indexpage.xml ├── freertos-kernel-version.txt └── version.xml /.cyignore: -------------------------------------------------------------------------------- 1 | docs 2 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2024 Infineon Technologies AG 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy of this 6 | software and associated documentation files (the "Software"), to deal in the 7 | Software without restriction, including without limitation the rights to use, copy, 8 | modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, 9 | and to permit persons to whom the Software is furnished to do so, subject to the 10 | following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 19 | BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 20 | WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 22 | DEALINGS IN THE SOFTWARE. 23 | -------------------------------------------------------------------------------- /RELEASE.md: -------------------------------------------------------------------------------- 1 | # FreeRTOS for Infineon MCUs 2 | 3 | ## What's included? 4 | 5 | - FreeRTOS kernel 10.5.0 6 | - Ports for GCC, IAR, Arm® compilers and Cortex®-M0 (CM0), Cortex®-M0+ (CM0P), Cortex®-M4 (CM4), Cortex®-M33 (CM33), Cortex®-R4 (CR4) and Cortex®-M7 (CM7) CPUs 7 | - *FreeRTOSConfig.h* template with the recommended configuration options 8 | - Cortex®-R4 (CR4) is currently supported only on GCC_ARM 9 | 10 | See [README.md](./README.md) for a complete description of FreeRTOS. 11 | 12 | ## Known Issues 13 | | Problem | Workaround | 14 | | ------- | ---------- | 15 | | In Eclipse IDE, call stack does not show when debugging multithreaded applications with FreeRTOS. |
To see the call stack properly, do one of the following options:
1. Disable compiler optimization. To disable compiler optimization on ARMC6 & GCC_ARM toolchains, please add CFLAGS+=-O0 to application Makefile
2. Add fno-omit-frame-pointer in application Makefile by adding CFLAGS+=-fno-omit-frame-pointer.
3. Above two options will increase some amount of code size. If there is a memory constraint, then please use Visual Studio Code IDE for debugging. To use, Visual Studio Code for ModusToolbox™ IDE Refer User Manual section at [ModusToolbox™ Software page](https://www.infineon.com/cms/en/design-support/tools/sdk/modustoolbox-software/?gad_source=1&gclid=CjwKCAjw17qvBhBrEiwA1rU9w5xTYwo11nLYqYNEXBi1i4tmOyH5sadgBM1QXq5VSh7eOgmbzeGi-hoCtacQAvD_BwE&gclsrc=aw.ds).
| 16 | 17 | ## Changelog 18 | 19 | ### v10.5.004 20 | 21 | - Updated CM33 GCC_ARM port file to fix build issues with -flto linker option. 22 | 23 | ### v10.5.003 24 | 25 | - Updated the Cortex®-M33 *FreeRTOSConfig.h* template to support FreeRTOS on secure devices. 26 | - Setting Cortex®-M33 Deep Sleep Latency Configuration to 2 ticks to allow vApplicationSleep function to handle different kind of sleep modes, like simple MCU sleep without tickless. 27 | - Added support for D-cache enablement on XMC7200 devices (CM7). 28 | 29 | ### v10.5.002 30 | 31 | - Added support of DSRAM feature for 20829B0 kit (CM33) on IAR compiler 32 | 33 | ### v10.5.001 34 | 35 | - Added support for 20829B0 kit (CM33) on IAR compiler 36 | 37 | ### v10.5.0 38 | 39 | - Updated to upstream FreeRTOS kernel version 10.5.0 40 | 41 | ### v10.4.306 42 | 43 | - Modified the FreeRTOSConfig.h of CR4 port to fix the issue with debugger 44 | - Fixed MISRA warnings 45 | - DSRAM support added for CM33 ARM port 46 | 47 | ### v10.4.305 48 | 49 | - Added functions to save and restore context before sleep for CM33 50 | 51 | ### v10.4.304 52 | 53 | - Created a common section for frequently called freertos functions 54 | 55 | ### v10.4.303 56 | 57 | - Added Cortex®-M7 (CM7) support based on upstream FreeRTOS kernel version 10.4.3 LTS Patch 2 58 | 59 | ### v10.4.302 60 | 61 | - Updated to upstream FreeRTOS kernel version 10.4.3 LTS Patch 2 62 | 63 | ### v10.4.4 64 | 65 | - Added Cortex®-R4 (CR4) support based on upstream FreeRTOS kernel version 10.4.3 LTS Patch 1 66 | 67 | ### v10.4.3 68 | 69 | - Updated to match the upstream FreeRTOS kernel version 10.4.3 70 | - Updated to match the upstream FreeRTOS kernel version 10.4.3 LTS Patch 1 71 | 72 | ### v10.3.1 73 | 74 | - Updated to match the upstream FreeRTOS kernel version 10.3.1 75 | - Added ports for Cortex®-M0 and Cortex®-M0+ CPUs. 76 | - Added ports for the ARM Compiler 6 (based on GCC port files). 77 | - Updated the *FreeRTOSConfig.h* template to enable configuration options required by RTOS support libraries: 78 | 79 | ``` 80 | #define configUSE_MUTEXES 1 81 | #define configUSE_RECURSIVE_MUTEXES 1 82 | #define configUSE_COUNTING_SEMAPHORES 1 83 | #define configSUPPORT_STATIC_ALLOCATION 1 84 | #define configUSE_TRACE_FACILITY 1 85 | #define INCLUDE_xTimerPendFunctionCall 1 86 | ``` 87 | 88 | - Enabled allocation of thread reentrancy structures for each task: 89 | 90 | ``` 91 | #define configUSE_NEWLIB_REENTRANT 1 92 | ``` 93 | 94 | - Automatically enable low-power tickless mode based on ModusToolbox™ device configurator selection: 95 | 96 | ``` 97 | #if defined(CY_CFG_PWR_SYS_IDLE_MODE) && \ 98 | ((CY_CFG_PWR_SYS_IDLE_MODE == CY_CFG_PWR_MODE_SLEEP) || \ 99 | (CY_CFG_PWR_SYS_IDLE_MODE == CY_CFG_PWR_MODE_DEEPSLEEP)) 100 | extern void vApplicationSleep( uint32_t xExpectedIdleTime ); 101 | #define portSUPPRESS_TICKS_AND_SLEEP( xIdleTime ) vApplicationSleep( xIdleTime ) 102 | #define configUSE_TICKLESS_IDLE 2 103 | #else 104 | #define configUSE_TICKLESS_IDLE 0 105 | #endif 106 | ``` 107 | 108 | - Automatically configure the deep sleep latency based on ModusToolbox™ device configurator selection: 109 | 110 | ``` 111 | #if( CY_CFG_PWR_DEEPSLEEP_LATENCY > 0 ) 112 | #define configEXPECTED_IDLE_TIME_BEFORE_SLEEP CY_CFG_PWR_DEEPSLEEP_LATENCY 113 | #endif 114 | ``` 115 | 116 | - Added dependency on the [CLib FreeRTOS support](https://github.com/Infineon/clib-support) and [RTOS abstraction](https://github.com/Infineon/abstraction-rtos) libraries. 117 | 118 | 119 | ## Supported software and tools 120 | 121 | This version of FreeRTOS was validated for compatibility with the following software and tools: 122 | 123 | | Software and tools | Version | 124 | | :--- | :----: | 125 | | ModusToolbox™ software environment | 3.4 | 126 | | Peripheral driver library (`mtb-pdl-cat1`) | 3.16.0 | 127 | | GCC compiler | 11.3.1 | 128 | | IAR compiler | 9.50.2 | 129 | | Arm® compiler 6 | 6.22 | 130 | 131 | 132 | ## Known issues 133 | 134 | Usage of the Arm® compiler 6 with enabled LTO (link-time optimization) option can result in an incorrect behavior of the application in some scenarios. It is recommended to avoid enabling LTO compiler/linker flags (`-flto`) 135 | when using Arm® Compiler 6 with FreeRTOS applications. 136 | 137 | ### More information 138 | 139 | - [FreeRTOS README.md](./README.md) 140 | - [FreeRTOS API documentation](http://www.freertos.org/a00106.html) 141 | - [FreeRTOS homepage](https://www.freertos.org/index.html) 142 | - [ModusToolbox™ software environment, quick start guide, documentation, and videos](https://www.cypress.com/products/modustoolbox-software-environment) 143 | - [PSoC™ 6 technical reference manuals](https://www.cypress.com/search/all?f%5B0%5D=meta_type%3Atechnical_documents&f%5B1%5D=resource_meta_type%3A583&f%5B2%5D=field_related_products%3A114026) 144 | - [PSoC™ 6 datasheets](https://www.cypress.com/search/all?f%5B0%5D=meta_type%3Atechnical_documents&f%5B1%5D=field_related_products%3A114026&f%5B2%5D=resource_meta_type%3A575) 145 | - [Cypress semiconductor](http://www.cypress.com) website 146 | --- 147 | © Cypress Semiconductor Corporation, 2019-2021 148 | -------------------------------------------------------------------------------- /Source/include/StackMacros.h: -------------------------------------------------------------------------------- 1 | /* 2 | * FreeRTOS Kernel V10.5.0 3 | * Copyright (C) 2021 Amazon.com, Inc. or its affiliates. All Rights Reserved. 4 | * 5 | * SPDX-License-Identifier: MIT 6 | * 7 | * Permission is hereby granted, free of charge, to any person obtaining a copy of 8 | * this software and associated documentation files (the "Software"), to deal in 9 | * the Software without restriction, including without limitation the rights to 10 | * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 11 | * the Software, and to permit persons to whom the Software is furnished to do so, 12 | * subject to the following conditions: 13 | * 14 | * The above copyright notice and this permission notice shall be included in all 15 | * copies or substantial portions of the Software. 16 | * 17 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 19 | * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 20 | * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 21 | * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 22 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 23 | * 24 | * https://www.FreeRTOS.org 25 | * https://github.com/FreeRTOS 26 | * 27 | */ 28 | 29 | 30 | #ifndef _MSC_VER /* Visual Studio doesn't support #warning. */ 31 | #warning The name of this file has changed to stack_macros.h. Please update your code accordingly. This source file (which has the original name) will be removed in a future release. 32 | #endif 33 | 34 | #include "stack_macros.h" 35 | -------------------------------------------------------------------------------- /Source/include/deprecated_definitions.h: -------------------------------------------------------------------------------- 1 | /* 2 | * FreeRTOS Kernel V10.5.0 3 | * Copyright (C) 2021 Amazon.com, Inc. or its affiliates. All Rights Reserved. 4 | * 5 | * SPDX-License-Identifier: MIT 6 | * 7 | * Permission is hereby granted, free of charge, to any person obtaining a copy of 8 | * this software and associated documentation files (the "Software"), to deal in 9 | * the Software without restriction, including without limitation the rights to 10 | * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 11 | * the Software, and to permit persons to whom the Software is furnished to do so, 12 | * subject to the following conditions: 13 | * 14 | * The above copyright notice and this permission notice shall be included in all 15 | * copies or substantial portions of the Software. 16 | * 17 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 19 | * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 20 | * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 21 | * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 22 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 23 | * 24 | * https://www.FreeRTOS.org 25 | * https://github.com/FreeRTOS 26 | * 27 | */ 28 | 29 | #ifndef DEPRECATED_DEFINITIONS_H 30 | #define DEPRECATED_DEFINITIONS_H 31 | 32 | 33 | /* Each FreeRTOS port has a unique portmacro.h header file. Originally a 34 | * pre-processor definition was used to ensure the pre-processor found the correct 35 | * portmacro.h file for the port being used. That scheme was deprecated in favour 36 | * of setting the compiler's include path such that it found the correct 37 | * portmacro.h file - removing the need for the constant and allowing the 38 | * portmacro.h file to be located anywhere in relation to the port being used. The 39 | * definitions below remain in the code for backward compatibility only. New 40 | * projects should not use them. */ 41 | 42 | #ifdef OPEN_WATCOM_INDUSTRIAL_PC_PORT 43 | #include "..\..\Source\portable\owatcom\16bitdos\pc\portmacro.h" 44 | typedef void ( __interrupt __far * pxISR )(); 45 | #endif 46 | 47 | #ifdef OPEN_WATCOM_FLASH_LITE_186_PORT 48 | #include "..\..\Source\portable\owatcom\16bitdos\flsh186\portmacro.h" 49 | typedef void ( __interrupt __far * pxISR )(); 50 | #endif 51 | 52 | #ifdef GCC_MEGA_AVR 53 | #include "../portable/GCC/ATMega323/portmacro.h" 54 | #endif 55 | 56 | #ifdef IAR_MEGA_AVR 57 | #include "../portable/IAR/ATMega323/portmacro.h" 58 | #endif 59 | 60 | #ifdef MPLAB_PIC24_PORT 61 | #include "../../Source/portable/MPLAB/PIC24_dsPIC/portmacro.h" 62 | #endif 63 | 64 | #ifdef MPLAB_DSPIC_PORT 65 | #include "../../Source/portable/MPLAB/PIC24_dsPIC/portmacro.h" 66 | #endif 67 | 68 | #ifdef MPLAB_PIC18F_PORT 69 | #include "../../Source/portable/MPLAB/PIC18F/portmacro.h" 70 | #endif 71 | 72 | #ifdef MPLAB_PIC32MX_PORT 73 | #include "../../Source/portable/MPLAB/PIC32MX/portmacro.h" 74 | #endif 75 | 76 | #ifdef _FEDPICC 77 | #include "libFreeRTOS/Include/portmacro.h" 78 | #endif 79 | 80 | #ifdef SDCC_CYGNAL 81 | #include "../../Source/portable/SDCC/Cygnal/portmacro.h" 82 | #endif 83 | 84 | #ifdef GCC_ARM7 85 | #include "../../Source/portable/GCC/ARM7_LPC2000/portmacro.h" 86 | #endif 87 | 88 | #ifdef GCC_ARM7_ECLIPSE 89 | #include "portmacro.h" 90 | #endif 91 | 92 | #ifdef ROWLEY_LPC23xx 93 | #include "../../Source/portable/GCC/ARM7_LPC23xx/portmacro.h" 94 | #endif 95 | 96 | #ifdef IAR_MSP430 97 | #include "..\..\Source\portable\IAR\MSP430\portmacro.h" 98 | #endif 99 | 100 | #ifdef GCC_MSP430 101 | #include "../../Source/portable/GCC/MSP430F449/portmacro.h" 102 | #endif 103 | 104 | #ifdef ROWLEY_MSP430 105 | #include "../../Source/portable/Rowley/MSP430F449/portmacro.h" 106 | #endif 107 | 108 | #ifdef ARM7_LPC21xx_KEIL_RVDS 109 | #include "..\..\Source\portable\RVDS\ARM7_LPC21xx\portmacro.h" 110 | #endif 111 | 112 | #ifdef SAM7_GCC 113 | #include "../../Source/portable/GCC/ARM7_AT91SAM7S/portmacro.h" 114 | #endif 115 | 116 | #ifdef SAM7_IAR 117 | #include "..\..\Source\portable\IAR\AtmelSAM7S64\portmacro.h" 118 | #endif 119 | 120 | #ifdef SAM9XE_IAR 121 | #include "..\..\Source\portable\IAR\AtmelSAM9XE\portmacro.h" 122 | #endif 123 | 124 | #ifdef LPC2000_IAR 125 | #include "..\..\Source\portable\IAR\LPC2000\portmacro.h" 126 | #endif 127 | 128 | #ifdef STR71X_IAR 129 | #include "..\..\Source\portable\IAR\STR71x\portmacro.h" 130 | #endif 131 | 132 | #ifdef STR75X_IAR 133 | #include "..\..\Source\portable\IAR\STR75x\portmacro.h" 134 | #endif 135 | 136 | #ifdef STR75X_GCC 137 | #include "..\..\Source\portable\GCC\STR75x\portmacro.h" 138 | #endif 139 | 140 | #ifdef STR91X_IAR 141 | #include "..\..\Source\portable\IAR\STR91x\portmacro.h" 142 | #endif 143 | 144 | #ifdef GCC_H8S 145 | #include "../../Source/portable/GCC/H8S2329/portmacro.h" 146 | #endif 147 | 148 | #ifdef GCC_AT91FR40008 149 | #include "../../Source/portable/GCC/ARM7_AT91FR40008/portmacro.h" 150 | #endif 151 | 152 | #ifdef RVDS_ARMCM3_LM3S102 153 | #include "../../Source/portable/RVDS/ARM_CM3/portmacro.h" 154 | #endif 155 | 156 | #ifdef GCC_ARMCM3_LM3S102 157 | #include "../../Source/portable/GCC/ARM_CM3/portmacro.h" 158 | #endif 159 | 160 | #ifdef GCC_ARMCM3 161 | #include "../../Source/portable/GCC/ARM_CM3/portmacro.h" 162 | #endif 163 | 164 | #ifdef IAR_ARM_CM3 165 | #include "../../Source/portable/IAR/ARM_CM3/portmacro.h" 166 | #endif 167 | 168 | #ifdef IAR_ARMCM3_LM 169 | #include "../../Source/portable/IAR/ARM_CM3/portmacro.h" 170 | #endif 171 | 172 | #ifdef HCS12_CODE_WARRIOR 173 | #include "../../Source/portable/CodeWarrior/HCS12/portmacro.h" 174 | #endif 175 | 176 | #ifdef MICROBLAZE_GCC 177 | #include "../../Source/portable/GCC/MicroBlaze/portmacro.h" 178 | #endif 179 | 180 | #ifdef TERN_EE 181 | #include "..\..\Source\portable\Paradigm\Tern_EE\small\portmacro.h" 182 | #endif 183 | 184 | #ifdef GCC_HCS12 185 | #include "../../Source/portable/GCC/HCS12/portmacro.h" 186 | #endif 187 | 188 | #ifdef GCC_MCF5235 189 | #include "../../Source/portable/GCC/MCF5235/portmacro.h" 190 | #endif 191 | 192 | #ifdef COLDFIRE_V2_GCC 193 | #include "../../../Source/portable/GCC/ColdFire_V2/portmacro.h" 194 | #endif 195 | 196 | #ifdef COLDFIRE_V2_CODEWARRIOR 197 | #include "../../Source/portable/CodeWarrior/ColdFire_V2/portmacro.h" 198 | #endif 199 | 200 | #ifdef GCC_PPC405 201 | #include "../../Source/portable/GCC/PPC405_Xilinx/portmacro.h" 202 | #endif 203 | 204 | #ifdef GCC_PPC440 205 | #include "../../Source/portable/GCC/PPC440_Xilinx/portmacro.h" 206 | #endif 207 | 208 | #ifdef _16FX_SOFTUNE 209 | #include "..\..\Source\portable\Softune\MB96340\portmacro.h" 210 | #endif 211 | 212 | #ifdef BCC_INDUSTRIAL_PC_PORT 213 | 214 | /* A short file name has to be used in place of the normal 215 | * FreeRTOSConfig.h when using the Borland compiler. */ 216 | #include "frconfig.h" 217 | #include "..\portable\BCC\16BitDOS\PC\prtmacro.h" 218 | typedef void ( __interrupt __far * pxISR )(); 219 | #endif 220 | 221 | #ifdef BCC_FLASH_LITE_186_PORT 222 | 223 | /* A short file name has to be used in place of the normal 224 | * FreeRTOSConfig.h when using the Borland compiler. */ 225 | #include "frconfig.h" 226 | #include "..\portable\BCC\16BitDOS\flsh186\prtmacro.h" 227 | typedef void ( __interrupt __far * pxISR )(); 228 | #endif 229 | 230 | #ifdef __GNUC__ 231 | #ifdef __AVR32_AVR32A__ 232 | #include "portmacro.h" 233 | #endif 234 | #endif 235 | 236 | #ifdef __ICCAVR32__ 237 | #ifdef __CORE__ 238 | #if __CORE__ == __AVR32A__ 239 | #include "portmacro.h" 240 | #endif 241 | #endif 242 | #endif 243 | 244 | #ifdef __91467D 245 | #include "portmacro.h" 246 | #endif 247 | 248 | #ifdef __96340 249 | #include "portmacro.h" 250 | #endif 251 | 252 | 253 | #ifdef __IAR_V850ES_Fx3__ 254 | #include "../../Source/portable/IAR/V850ES/portmacro.h" 255 | #endif 256 | 257 | #ifdef __IAR_V850ES_Jx3__ 258 | #include "../../Source/portable/IAR/V850ES/portmacro.h" 259 | #endif 260 | 261 | #ifdef __IAR_V850ES_Jx3_L__ 262 | #include "../../Source/portable/IAR/V850ES/portmacro.h" 263 | #endif 264 | 265 | #ifdef __IAR_V850ES_Jx2__ 266 | #include "../../Source/portable/IAR/V850ES/portmacro.h" 267 | #endif 268 | 269 | #ifdef __IAR_V850ES_Hx2__ 270 | #include "../../Source/portable/IAR/V850ES/portmacro.h" 271 | #endif 272 | 273 | #ifdef __IAR_78K0R_Kx3__ 274 | #include "../../Source/portable/IAR/78K0R/portmacro.h" 275 | #endif 276 | 277 | #ifdef __IAR_78K0R_Kx3L__ 278 | #include "../../Source/portable/IAR/78K0R/portmacro.h" 279 | #endif 280 | 281 | #endif /* DEPRECATED_DEFINITIONS_H */ 282 | -------------------------------------------------------------------------------- /Source/include/projdefs.h: -------------------------------------------------------------------------------- 1 | /* 2 | * FreeRTOS Kernel V10.5.0 3 | * Copyright (C) 2021 Amazon.com, Inc. or its affiliates. All Rights Reserved. 4 | * 5 | * SPDX-License-Identifier: MIT 6 | * 7 | * Permission is hereby granted, free of charge, to any person obtaining a copy of 8 | * this software and associated documentation files (the "Software"), to deal in 9 | * the Software without restriction, including without limitation the rights to 10 | * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 11 | * the Software, and to permit persons to whom the Software is furnished to do so, 12 | * subject to the following conditions: 13 | * 14 | * The above copyright notice and this permission notice shall be included in all 15 | * copies or substantial portions of the Software. 16 | * 17 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 19 | * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 20 | * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 21 | * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 22 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 23 | * 24 | * https://www.FreeRTOS.org 25 | * https://github.com/FreeRTOS 26 | * 27 | */ 28 | 29 | #ifndef PROJDEFS_H 30 | #define PROJDEFS_H 31 | 32 | /* 33 | * Defines the prototype to which task functions must conform. Defined in this 34 | * file to ensure the type is known before portable.h is included. 35 | */ 36 | typedef void (* TaskFunction_t)( void * ); 37 | 38 | /* Converts a time in milliseconds to a time in ticks. This macro can be 39 | * overridden by a macro of the same name defined in FreeRTOSConfig.h in case the 40 | * definition here is not suitable for your application. */ 41 | #ifndef pdMS_TO_TICKS 42 | #define pdMS_TO_TICKS( xTimeInMs ) ( ( TickType_t ) ( ( ( TickType_t ) ( xTimeInMs ) * ( TickType_t ) configTICK_RATE_HZ ) / ( TickType_t ) 1000U ) ) 43 | #endif 44 | 45 | #define pdFALSE ( ( BaseType_t ) 0 ) 46 | #define pdTRUE ( ( BaseType_t ) 1 ) 47 | 48 | #define pdPASS ( pdTRUE ) 49 | #define pdFAIL ( pdFALSE ) 50 | #define errQUEUE_EMPTY ( ( BaseType_t ) 0 ) 51 | #define errQUEUE_FULL ( ( BaseType_t ) 0 ) 52 | 53 | /* FreeRTOS error definitions. */ 54 | #define errCOULD_NOT_ALLOCATE_REQUIRED_MEMORY ( -1 ) 55 | #define errQUEUE_BLOCKED ( -4 ) 56 | #define errQUEUE_YIELD ( -5 ) 57 | 58 | /* Macros used for basic data corruption checks. */ 59 | #ifndef configUSE_LIST_DATA_INTEGRITY_CHECK_BYTES 60 | #define configUSE_LIST_DATA_INTEGRITY_CHECK_BYTES 0 61 | #endif 62 | 63 | #if ( configUSE_16_BIT_TICKS == 1 ) 64 | #define pdINTEGRITY_CHECK_VALUE 0x5a5a 65 | #else 66 | #define pdINTEGRITY_CHECK_VALUE 0x5a5a5a5aUL 67 | #endif 68 | 69 | /* The following errno values are used by FreeRTOS+ components, not FreeRTOS 70 | * itself. */ 71 | #define pdFREERTOS_ERRNO_NONE 0 /* No errors */ 72 | #define pdFREERTOS_ERRNO_ENOENT 2 /* No such file or directory */ 73 | #define pdFREERTOS_ERRNO_EINTR 4 /* Interrupted system call */ 74 | #define pdFREERTOS_ERRNO_EIO 5 /* I/O error */ 75 | #define pdFREERTOS_ERRNO_ENXIO 6 /* No such device or address */ 76 | #define pdFREERTOS_ERRNO_EBADF 9 /* Bad file number */ 77 | #define pdFREERTOS_ERRNO_EAGAIN 11 /* No more processes */ 78 | #define pdFREERTOS_ERRNO_EWOULDBLOCK 11 /* Operation would block */ 79 | #define pdFREERTOS_ERRNO_ENOMEM 12 /* Not enough memory */ 80 | #define pdFREERTOS_ERRNO_EACCES 13 /* Permission denied */ 81 | #define pdFREERTOS_ERRNO_EFAULT 14 /* Bad address */ 82 | #define pdFREERTOS_ERRNO_EBUSY 16 /* Mount device busy */ 83 | #define pdFREERTOS_ERRNO_EEXIST 17 /* File exists */ 84 | #define pdFREERTOS_ERRNO_EXDEV 18 /* Cross-device link */ 85 | #define pdFREERTOS_ERRNO_ENODEV 19 /* No such device */ 86 | #define pdFREERTOS_ERRNO_ENOTDIR 20 /* Not a directory */ 87 | #define pdFREERTOS_ERRNO_EISDIR 21 /* Is a directory */ 88 | #define pdFREERTOS_ERRNO_EINVAL 22 /* Invalid argument */ 89 | #define pdFREERTOS_ERRNO_ENOSPC 28 /* No space left on device */ 90 | #define pdFREERTOS_ERRNO_ESPIPE 29 /* Illegal seek */ 91 | #define pdFREERTOS_ERRNO_EROFS 30 /* Read only file system */ 92 | #define pdFREERTOS_ERRNO_EUNATCH 42 /* Protocol driver not attached */ 93 | #define pdFREERTOS_ERRNO_EBADE 50 /* Invalid exchange */ 94 | #define pdFREERTOS_ERRNO_EFTYPE 79 /* Inappropriate file type or format */ 95 | #define pdFREERTOS_ERRNO_ENMFILE 89 /* No more files */ 96 | #define pdFREERTOS_ERRNO_ENOTEMPTY 90 /* Directory not empty */ 97 | #define pdFREERTOS_ERRNO_ENAMETOOLONG 91 /* File or path name too long */ 98 | #define pdFREERTOS_ERRNO_EOPNOTSUPP 95 /* Operation not supported on transport endpoint */ 99 | #define pdFREERTOS_ERRNO_ENOBUFS 105 /* No buffer space available */ 100 | #define pdFREERTOS_ERRNO_ENOPROTOOPT 109 /* Protocol not available */ 101 | #define pdFREERTOS_ERRNO_EADDRINUSE 112 /* Address already in use */ 102 | #define pdFREERTOS_ERRNO_ETIMEDOUT 116 /* Connection timed out */ 103 | #define pdFREERTOS_ERRNO_EINPROGRESS 119 /* Connection already in progress */ 104 | #define pdFREERTOS_ERRNO_EALREADY 120 /* Socket already connected */ 105 | #define pdFREERTOS_ERRNO_EADDRNOTAVAIL 125 /* Address not available */ 106 | #define pdFREERTOS_ERRNO_EISCONN 127 /* Socket is already connected */ 107 | #define pdFREERTOS_ERRNO_ENOTCONN 128 /* Socket is not connected */ 108 | #define pdFREERTOS_ERRNO_ENOMEDIUM 135 /* No medium inserted */ 109 | #define pdFREERTOS_ERRNO_EILSEQ 138 /* An invalid UTF-16 sequence was encountered. */ 110 | #define pdFREERTOS_ERRNO_ECANCELED 140 /* Operation canceled. */ 111 | 112 | /* The following endian values are used by FreeRTOS+ components, not FreeRTOS 113 | * itself. */ 114 | #define pdFREERTOS_LITTLE_ENDIAN 0 115 | #define pdFREERTOS_BIG_ENDIAN 1 116 | 117 | /* Re-defining endian values for generic naming. */ 118 | #define pdLITTLE_ENDIAN pdFREERTOS_LITTLE_ENDIAN 119 | #define pdBIG_ENDIAN pdFREERTOS_BIG_ENDIAN 120 | 121 | 122 | #endif /* PROJDEFS_H */ 123 | -------------------------------------------------------------------------------- /Source/include/stdint.readme: -------------------------------------------------------------------------------- 1 | /* 2 | * FreeRTOS Kernel V10.5.0 3 | * Copyright (C) 2021 Amazon.com, Inc. or its affiliates. All Rights Reserved. 4 | * 5 | * SPDX-License-Identifier: MIT 6 | * 7 | * Permission is hereby granted, free of charge, to any person obtaining a copy of 8 | * this software and associated documentation files (the "Software"), to deal in 9 | * the Software without restriction, including without limitation the rights to 10 | * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 11 | * the Software, and to permit persons to whom the Software is furnished to do so, 12 | * subject to the following conditions: 13 | * 14 | * The above copyright notice and this permission notice shall be included in all 15 | * copies or substantial portions of the Software. 16 | * 17 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 19 | * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 20 | * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 21 | * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 22 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 23 | * 24 | * https://www.FreeRTOS.org 25 | * https://github.com/FreeRTOS 26 | * 27 | */ 28 | 29 | #ifndef FREERTOS_STDINT 30 | #define FREERTOS_STDINT 31 | 32 | /******************************************************************************* 33 | * THIS IS NOT A FULL stdint.h IMPLEMENTATION - It only contains the definitions 34 | * necessary to build the FreeRTOS code. It is provided to allow FreeRTOS to be 35 | * built using compilers that do not provide their own stdint.h definition. 36 | * 37 | * To use this file: 38 | * 39 | * 1) Copy this file into the directory that contains your FreeRTOSConfig.h 40 | * header file, as that directory will already be in the compiler's include 41 | * path. 42 | * 43 | * 2) Rename the copied file stdint.h. 44 | * 45 | */ 46 | 47 | typedef signed char int8_t; 48 | typedef unsigned char uint8_t; 49 | typedef short int16_t; 50 | typedef unsigned short uint16_t; 51 | typedef long int32_t; 52 | typedef unsigned long uint32_t; 53 | 54 | #ifndef SIZE_MAX 55 | #define SIZE_MAX ( ( size_t ) -1 ) 56 | #endif 57 | 58 | #endif /* FREERTOS_STDINT */ 59 | -------------------------------------------------------------------------------- /Source/portable/COMPONENT_CM0/TOOLCHAIN_ARM/portmacro.h: -------------------------------------------------------------------------------- 1 | /* 2 | * FreeRTOS Kernel V10.5.0 3 | * Copyright (C) 2021 Amazon.com, Inc. or its affiliates. All Rights Reserved. 4 | * 5 | * SPDX-License-Identifier: MIT 6 | * 7 | * Permission is hereby granted, free of charge, to any person obtaining a copy of 8 | * this software and associated documentation files (the "Software"), to deal in 9 | * the Software without restriction, including without limitation the rights to 10 | * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 11 | * the Software, and to permit persons to whom the Software is furnished to do so, 12 | * subject to the following conditions: 13 | * 14 | * The above copyright notice and this permission notice shall be included in all 15 | * copies or substantial portions of the Software. 16 | * 17 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 19 | * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 20 | * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 21 | * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 22 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 23 | * 24 | * https://www.FreeRTOS.org 25 | * https://github.com/FreeRTOS 26 | * 27 | */ 28 | 29 | 30 | #ifndef PORTMACRO_H 31 | #define PORTMACRO_H 32 | 33 | #ifdef __cplusplus 34 | extern "C" { 35 | #endif 36 | 37 | /*----------------------------------------------------------- 38 | * Port specific definitions. 39 | * 40 | * The settings in this file configure FreeRTOS correctly for the 41 | * given hardware and compiler. 42 | * 43 | * These settings should not be altered. 44 | *----------------------------------------------------------- 45 | */ 46 | 47 | /* Type definitions. */ 48 | #define portCHAR char 49 | #define portFLOAT float 50 | #define portDOUBLE double 51 | #define portLONG long 52 | #define portSHORT short 53 | #define portSTACK_TYPE uint32_t 54 | #define portBASE_TYPE long 55 | 56 | typedef portSTACK_TYPE StackType_t; 57 | typedef long BaseType_t; 58 | typedef unsigned long UBaseType_t; 59 | 60 | #if ( configUSE_16_BIT_TICKS == 1 ) 61 | typedef uint16_t TickType_t; 62 | #define portMAX_DELAY ( TickType_t ) 0xffff 63 | #else 64 | typedef uint32_t TickType_t; 65 | #define portMAX_DELAY ( TickType_t ) 0xffffffffUL 66 | 67 | /* 32-bit tick type on a 32-bit architecture, so reads of the tick count do 68 | * not need to be guarded with a critical section. */ 69 | #define portTICK_TYPE_IS_ATOMIC 1 70 | #endif 71 | /*-----------------------------------------------------------*/ 72 | 73 | /* Architecture specifics. */ 74 | #define portSTACK_GROWTH ( -1 ) 75 | #define portTICK_PERIOD_MS ( ( TickType_t ) 1000 / configTICK_RATE_HZ ) 76 | #define portBYTE_ALIGNMENT 8 77 | #define portDONT_DISCARD __attribute__( ( used ) ) 78 | /*-----------------------------------------------------------*/ 79 | 80 | 81 | /* Scheduler utilities. */ 82 | extern void vPortYield( void ); 83 | #define portNVIC_INT_CTRL_REG ( *( ( volatile uint32_t * ) 0xe000ed04 ) ) 84 | #define portNVIC_PENDSVSET_BIT ( 1UL << 28UL ) 85 | #define portYIELD() vPortYield() 86 | #define portEND_SWITCHING_ISR( xSwitchRequired ) do { if( xSwitchRequired ) portNVIC_INT_CTRL_REG = portNVIC_PENDSVSET_BIT; } while( 0 ) 87 | #define portYIELD_FROM_ISR( x ) portEND_SWITCHING_ISR( x ) 88 | /*-----------------------------------------------------------*/ 89 | 90 | 91 | /* Critical section management. */ 92 | extern void vPortEnterCritical( void ); 93 | extern void vPortExitCritical( void ); 94 | extern uint32_t ulSetInterruptMaskFromISR( void ) __attribute__( ( naked ) ); 95 | extern void vClearInterruptMaskFromISR( uint32_t ulMask ) __attribute__( ( naked ) ); 96 | 97 | #define portSET_INTERRUPT_MASK_FROM_ISR() ulSetInterruptMaskFromISR() 98 | #define portCLEAR_INTERRUPT_MASK_FROM_ISR( x ) vClearInterruptMaskFromISR( x ) 99 | #define portDISABLE_INTERRUPTS() __asm volatile ( " cpsid i " ::: "memory" ) 100 | #define portENABLE_INTERRUPTS() __asm volatile ( " cpsie i " ::: "memory" ) 101 | #define portENTER_CRITICAL() vPortEnterCritical() 102 | #define portEXIT_CRITICAL() vPortExitCritical() 103 | 104 | /*-----------------------------------------------------------*/ 105 | 106 | /* Tickless idle/low power functionality. */ 107 | #ifndef portSUPPRESS_TICKS_AND_SLEEP 108 | extern void vPortSuppressTicksAndSleep( TickType_t xExpectedIdleTime ); 109 | #define portSUPPRESS_TICKS_AND_SLEEP( xExpectedIdleTime ) vPortSuppressTicksAndSleep( xExpectedIdleTime ) 110 | #endif 111 | /*-----------------------------------------------------------*/ 112 | 113 | /* Task function macros as described on the FreeRTOS.org WEB site. */ 114 | #define portTASK_FUNCTION_PROTO( vFunction, pvParameters ) void vFunction( void * pvParameters ) 115 | #define portTASK_FUNCTION( vFunction, pvParameters ) void vFunction( void * pvParameters ) 116 | 117 | #define portNOP() 118 | 119 | #define portMEMORY_BARRIER() __asm volatile ( "" ::: "memory" ) 120 | 121 | #ifdef __cplusplus 122 | } 123 | #endif 124 | 125 | #endif /* PORTMACRO_H */ 126 | -------------------------------------------------------------------------------- /Source/portable/COMPONENT_CM0/TOOLCHAIN_GCC_ARM/portmacro.h: -------------------------------------------------------------------------------- 1 | /* 2 | * FreeRTOS Kernel V10.5.0 3 | * Copyright (C) 2021 Amazon.com, Inc. or its affiliates. All Rights Reserved. 4 | * 5 | * SPDX-License-Identifier: MIT 6 | * 7 | * Permission is hereby granted, free of charge, to any person obtaining a copy of 8 | * this software and associated documentation files (the "Software"), to deal in 9 | * the Software without restriction, including without limitation the rights to 10 | * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 11 | * the Software, and to permit persons to whom the Software is furnished to do so, 12 | * subject to the following conditions: 13 | * 14 | * The above copyright notice and this permission notice shall be included in all 15 | * copies or substantial portions of the Software. 16 | * 17 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 19 | * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 20 | * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 21 | * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 22 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 23 | * 24 | * https://www.FreeRTOS.org 25 | * https://github.com/FreeRTOS 26 | * 27 | */ 28 | 29 | 30 | #ifndef PORTMACRO_H 31 | #define PORTMACRO_H 32 | 33 | #ifdef __cplusplus 34 | extern "C" { 35 | #endif 36 | 37 | /*----------------------------------------------------------- 38 | * Port specific definitions. 39 | * 40 | * The settings in this file configure FreeRTOS correctly for the 41 | * given hardware and compiler. 42 | * 43 | * These settings should not be altered. 44 | *----------------------------------------------------------- 45 | */ 46 | 47 | /* Type definitions. */ 48 | #define portCHAR char 49 | #define portFLOAT float 50 | #define portDOUBLE double 51 | #define portLONG long 52 | #define portSHORT short 53 | #define portSTACK_TYPE uint32_t 54 | #define portBASE_TYPE long 55 | 56 | typedef portSTACK_TYPE StackType_t; 57 | typedef long BaseType_t; 58 | typedef unsigned long UBaseType_t; 59 | 60 | #if ( configUSE_16_BIT_TICKS == 1 ) 61 | typedef uint16_t TickType_t; 62 | #define portMAX_DELAY ( TickType_t ) 0xffff 63 | #else 64 | typedef uint32_t TickType_t; 65 | #define portMAX_DELAY ( TickType_t ) 0xffffffffUL 66 | 67 | /* 32-bit tick type on a 32-bit architecture, so reads of the tick count do 68 | * not need to be guarded with a critical section. */ 69 | #define portTICK_TYPE_IS_ATOMIC 1 70 | #endif 71 | /*-----------------------------------------------------------*/ 72 | 73 | /* Architecture specifics. */ 74 | #define portSTACK_GROWTH ( -1 ) 75 | #define portTICK_PERIOD_MS ( ( TickType_t ) 1000 / configTICK_RATE_HZ ) 76 | #define portBYTE_ALIGNMENT 8 77 | #define portDONT_DISCARD __attribute__( ( used ) ) 78 | /*-----------------------------------------------------------*/ 79 | 80 | 81 | /* Scheduler utilities. */ 82 | extern void vPortYield( void ); 83 | #define portNVIC_INT_CTRL_REG ( *( ( volatile uint32_t * ) 0xe000ed04 ) ) 84 | #define portNVIC_PENDSVSET_BIT ( 1UL << 28UL ) 85 | #define portYIELD() vPortYield() 86 | #define portEND_SWITCHING_ISR( xSwitchRequired ) do { if( xSwitchRequired ) portNVIC_INT_CTRL_REG = portNVIC_PENDSVSET_BIT; } while( 0 ) 87 | #define portYIELD_FROM_ISR( x ) portEND_SWITCHING_ISR( x ) 88 | /*-----------------------------------------------------------*/ 89 | 90 | 91 | /* Critical section management. */ 92 | extern void vPortEnterCritical( void ); 93 | extern void vPortExitCritical( void ); 94 | extern uint32_t ulSetInterruptMaskFromISR( void ) __attribute__( ( naked ) ); 95 | extern void vClearInterruptMaskFromISR( uint32_t ulMask ) __attribute__( ( naked ) ); 96 | 97 | #define portSET_INTERRUPT_MASK_FROM_ISR() ulSetInterruptMaskFromISR() 98 | #define portCLEAR_INTERRUPT_MASK_FROM_ISR( x ) vClearInterruptMaskFromISR( x ) 99 | #define portDISABLE_INTERRUPTS() __asm volatile ( " cpsid i " ::: "memory" ) 100 | #define portENABLE_INTERRUPTS() __asm volatile ( " cpsie i " ::: "memory" ) 101 | #define portENTER_CRITICAL() vPortEnterCritical() 102 | #define portEXIT_CRITICAL() vPortExitCritical() 103 | 104 | /*-----------------------------------------------------------*/ 105 | 106 | /* Tickless idle/low power functionality. */ 107 | #ifndef portSUPPRESS_TICKS_AND_SLEEP 108 | extern void vPortSuppressTicksAndSleep( TickType_t xExpectedIdleTime ); 109 | #define portSUPPRESS_TICKS_AND_SLEEP( xExpectedIdleTime ) vPortSuppressTicksAndSleep( xExpectedIdleTime ) 110 | #endif 111 | /*-----------------------------------------------------------*/ 112 | 113 | /* Task function macros as described on the FreeRTOS.org WEB site. */ 114 | #define portTASK_FUNCTION_PROTO( vFunction, pvParameters ) void vFunction( void * pvParameters ) 115 | #define portTASK_FUNCTION( vFunction, pvParameters ) void vFunction( void * pvParameters ) 116 | 117 | #define portNOP() 118 | 119 | #define portMEMORY_BARRIER() __asm volatile ( "" ::: "memory" ) 120 | 121 | #ifdef __cplusplus 122 | } 123 | #endif 124 | 125 | #endif /* PORTMACRO_H */ 126 | -------------------------------------------------------------------------------- /Source/portable/COMPONENT_CM0/TOOLCHAIN_IAR/portasm.s: -------------------------------------------------------------------------------- 1 | /* 2 | * FreeRTOS Kernel V10.5.0 3 | * Copyright (C) 2021 Amazon.com, Inc. or its affiliates. All Rights Reserved. 4 | * 5 | * SPDX-License-Identifier: MIT 6 | * 7 | * Copyright (C) 2019-2024 Cypress Semiconductor Corporation, or a subsidiary of 8 | * Cypress Semiconductor Corporation. All Rights Reserved. 9 | * 10 | * Updated function names to be compliant with CMSIS standard names. 11 | * 12 | * Permission is hereby granted, free of charge, to any person obtaining a copy of 13 | * this software and associated documentation files (the "Software"), to deal in 14 | * the Software without restriction, including without limitation the rights to 15 | * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 16 | * the Software, and to permit persons to whom the Software is furnished to do so, 17 | * subject to the following conditions: 18 | * 19 | * The above copyright notice and this permission notice shall be included in all 20 | * copies or substantial portions of the Software. 21 | * 22 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 23 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 24 | * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 25 | * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 26 | * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 27 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 28 | * 29 | * https://www.FreeRTOS.org 30 | * https://github.com/FreeRTOS 31 | * http://www.cypress.com 32 | * 33 | */ 34 | 35 | RSEG CODE:CODE(2) 36 | thumb 37 | 38 | EXTERN vPortYieldFromISR 39 | EXTERN pxCurrentTCB 40 | EXTERN vTaskSwitchContext 41 | 42 | PUBLIC vSetMSP 43 | PUBLIC PendSV_Handler 44 | PUBLIC SVC_Handler 45 | PUBLIC vPortStartFirstTask 46 | PUBLIC ulSetInterruptMaskFromISR 47 | PUBLIC vClearInterruptMaskFromISR 48 | 49 | /*-----------------------------------------------------------*/ 50 | 51 | vSetMSP 52 | msr msp, r0 53 | bx lr 54 | 55 | /*-----------------------------------------------------------*/ 56 | 57 | PendSV_Handler: 58 | mrs r0, psp 59 | 60 | ldr r3, =pxCurrentTCB /* Get the location of the current TCB. */ 61 | ldr r2, [r3] 62 | 63 | subs r0, r0, #32 /* Make space for the remaining low registers. */ 64 | str r0, [r2] /* Save the new top of stack. */ 65 | stmia r0!, {r4-r7} /* Store the low registers that are not saved automatically. */ 66 | mov r4, r8 /* Store the high registers. */ 67 | mov r5, r9 68 | mov r6, r10 69 | mov r7, r11 70 | stmia r0!, {r4-r7} 71 | 72 | push {r3, r14} 73 | cpsid i 74 | bl vTaskSwitchContext 75 | cpsie i 76 | pop {r2, r3} /* lr goes in r3. r2 now holds tcb pointer. */ 77 | 78 | ldr r1, [r2] 79 | ldr r0, [r1] /* The first item in pxCurrentTCB is the task top of stack. */ 80 | adds r0, r0, #16 /* Move to the high registers. */ 81 | ldmia r0!, {r4-r7} /* Pop the high registers. */ 82 | mov r8, r4 83 | mov r9, r5 84 | mov r10, r6 85 | mov r11, r7 86 | 87 | msr psp, r0 /* Remember the new top of stack for the task. */ 88 | 89 | subs r0, r0, #32 /* Go back for the low registers that are not automatically restored. */ 90 | ldmia r0!, {r4-r7} /* Pop low registers. */ 91 | 92 | bx r3 93 | 94 | /*-----------------------------------------------------------*/ 95 | 96 | SVC_Handler; 97 | /* This function is no longer used, but retained for backward 98 | compatibility. */ 99 | bx lr 100 | 101 | /*-----------------------------------------------------------*/ 102 | 103 | vPortStartFirstTask 104 | /* The MSP stack is not reset as, unlike on M3/4 parts, there is no vector 105 | table offset register that can be used to locate the initial stack value. 106 | Not all M0 parts have the application vector table at address 0. */ 107 | 108 | ldr r3, =pxCurrentTCB /* Obtain location of pxCurrentTCB. */ 109 | ldr r1, [r3] 110 | ldr r0, [r1] /* The first item in pxCurrentTCB is the task top of stack. */ 111 | adds r0, #32 /* Discard everything up to r0. */ 112 | msr psp, r0 /* This is now the new top of stack to use in the task. */ 113 | movs r0, #2 /* Switch to the psp stack. */ 114 | msr CONTROL, r0 115 | isb 116 | pop {r0-r5} /* Pop the registers that are saved automatically. */ 117 | mov lr, r5 /* lr is now in r5. */ 118 | pop {r3} /* The return address is now in r3. */ 119 | pop {r2} /* Pop and discard the XPSR. */ 120 | cpsie i /* The first task has its context and interrupts can be enabled. */ 121 | bx r3 /* Jump to the user defined task code. */ 122 | 123 | /*-----------------------------------------------------------*/ 124 | 125 | ulSetInterruptMaskFromISR 126 | mrs r0, PRIMASK 127 | cpsid i 128 | bx lr 129 | 130 | /*-----------------------------------------------------------*/ 131 | 132 | vClearInterruptMaskFromISR 133 | msr PRIMASK, r0 134 | bx lr 135 | 136 | END 137 | -------------------------------------------------------------------------------- /Source/portable/COMPONENT_CM0/TOOLCHAIN_IAR/portmacro.h: -------------------------------------------------------------------------------- 1 | /* 2 | * FreeRTOS Kernel V10.5.0 3 | * Copyright (C) 2021 Amazon.com, Inc. or its affiliates. All Rights Reserved. 4 | * 5 | * SPDX-License-Identifier: MIT 6 | * 7 | * Permission is hereby granted, free of charge, to any person obtaining a copy of 8 | * this software and associated documentation files (the "Software"), to deal in 9 | * the Software without restriction, including without limitation the rights to 10 | * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 11 | * the Software, and to permit persons to whom the Software is furnished to do so, 12 | * subject to the following conditions: 13 | * 14 | * The above copyright notice and this permission notice shall be included in all 15 | * copies or substantial portions of the Software. 16 | * 17 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 19 | * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 20 | * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 21 | * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 22 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 23 | * 24 | * https://www.FreeRTOS.org 25 | * https://github.com/FreeRTOS 26 | * 27 | */ 28 | 29 | 30 | #ifndef PORTMACRO_H 31 | #define PORTMACRO_H 32 | 33 | #ifdef __cplusplus 34 | extern "C" { 35 | #endif 36 | 37 | /*----------------------------------------------------------- 38 | * Port specific definitions. 39 | * 40 | * The settings in this file configure FreeRTOS correctly for the 41 | * given hardware and compiler. 42 | * 43 | * These settings should not be altered. 44 | *----------------------------------------------------------- 45 | */ 46 | 47 | /* Type definitions. */ 48 | #define portCHAR char 49 | #define portFLOAT float 50 | #define portDOUBLE double 51 | #define portLONG long 52 | #define portSHORT short 53 | #define portSTACK_TYPE uint32_t 54 | #define portBASE_TYPE long 55 | 56 | typedef portSTACK_TYPE StackType_t; 57 | typedef long BaseType_t; 58 | typedef unsigned long UBaseType_t; 59 | 60 | 61 | #if ( configUSE_16_BIT_TICKS == 1 ) 62 | typedef uint16_t TickType_t; 63 | #define portMAX_DELAY ( TickType_t ) 0xffff 64 | #else 65 | typedef uint32_t TickType_t; 66 | #define portMAX_DELAY ( TickType_t ) 0xffffffffUL 67 | 68 | /* 32-bit tick type on a 32-bit architecture, so reads of the tick count do 69 | * not need to be guarded with a critical section. */ 70 | #define portTICK_TYPE_IS_ATOMIC 1 71 | #endif 72 | /*-----------------------------------------------------------*/ 73 | 74 | /* Architecture specifics. */ 75 | #define portSTACK_GROWTH ( -1 ) 76 | #define portTICK_PERIOD_MS ( ( TickType_t ) 1000 / configTICK_RATE_HZ ) 77 | #define portBYTE_ALIGNMENT 8 78 | /*-----------------------------------------------------------*/ 79 | 80 | 81 | /* Scheduler utilities. */ 82 | extern void vPortYield( void ); 83 | #define portNVIC_INT_CTRL ( ( volatile uint32_t * ) 0xe000ed04 ) 84 | #define portNVIC_PENDSVSET 0x10000000 85 | #define portYIELD() vPortYield() 86 | #define portEND_SWITCHING_ISR( xSwitchRequired ) if( xSwitchRequired ) *( portNVIC_INT_CTRL ) = portNVIC_PENDSVSET 87 | #define portYIELD_FROM_ISR( x ) portEND_SWITCHING_ISR( x ) 88 | /*-----------------------------------------------------------*/ 89 | 90 | 91 | /* Critical section management. */ 92 | 93 | extern void vPortEnterCritical( void ); 94 | extern void vPortExitCritical( void ); 95 | extern uint32_t ulSetInterruptMaskFromISR( void ); 96 | extern void vClearInterruptMaskFromISR( uint32_t ulMask ); 97 | 98 | #define portDISABLE_INTERRUPTS() __asm volatile ( "cpsid i" ) 99 | #define portENABLE_INTERRUPTS() __asm volatile ( "cpsie i" ) 100 | #define portENTER_CRITICAL() vPortEnterCritical() 101 | #define portEXIT_CRITICAL() vPortExitCritical() 102 | #define portSET_INTERRUPT_MASK_FROM_ISR() ulSetInterruptMaskFromISR() 103 | #define portCLEAR_INTERRUPT_MASK_FROM_ISR( x ) vClearInterruptMaskFromISR( x ) 104 | 105 | /*-----------------------------------------------------------*/ 106 | 107 | /* Tickless idle/low power functionality. */ 108 | #ifndef portSUPPRESS_TICKS_AND_SLEEP 109 | extern void vPortSuppressTicksAndSleep( TickType_t xExpectedIdleTime ); 110 | #define portSUPPRESS_TICKS_AND_SLEEP( xExpectedIdleTime ) vPortSuppressTicksAndSleep( xExpectedIdleTime ) 111 | #endif 112 | /*-----------------------------------------------------------*/ 113 | 114 | /* Task function macros as described on the FreeRTOS.org WEB site. */ 115 | #define portTASK_FUNCTION_PROTO( vFunction, pvParameters ) void vFunction( void * pvParameters ) 116 | #define portTASK_FUNCTION( vFunction, pvParameters ) void vFunction( void * pvParameters ) 117 | 118 | #define portNOP() 119 | 120 | /* Suppress warnings that are generated by the IAR tools, but cannot be fixed in 121 | * the source code because to do so would cause other compilers to generate 122 | * warnings. */ 123 | #pragma diag_suppress=Pa082 124 | 125 | #ifdef __cplusplus 126 | } 127 | #endif 128 | 129 | #endif /* PORTMACRO_H */ 130 | -------------------------------------------------------------------------------- /Source/portable/COMPONENT_CM0P/TOOLCHAIN_ARM/portmacro.h: -------------------------------------------------------------------------------- 1 | /* 2 | * FreeRTOS Kernel V10.5.0 3 | * Copyright (C) 2021 Amazon.com, Inc. or its affiliates. All Rights Reserved. 4 | * 5 | * SPDX-License-Identifier: MIT 6 | * 7 | * Permission is hereby granted, free of charge, to any person obtaining a copy of 8 | * this software and associated documentation files (the "Software"), to deal in 9 | * the Software without restriction, including without limitation the rights to 10 | * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 11 | * the Software, and to permit persons to whom the Software is furnished to do so, 12 | * subject to the following conditions: 13 | * 14 | * The above copyright notice and this permission notice shall be included in all 15 | * copies or substantial portions of the Software. 16 | * 17 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 19 | * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 20 | * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 21 | * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 22 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 23 | * 24 | * https://www.FreeRTOS.org 25 | * https://github.com/FreeRTOS 26 | * 27 | */ 28 | 29 | 30 | #ifndef PORTMACRO_H 31 | #define PORTMACRO_H 32 | 33 | #ifdef __cplusplus 34 | extern "C" { 35 | #endif 36 | 37 | /*----------------------------------------------------------- 38 | * Port specific definitions. 39 | * 40 | * The settings in this file configure FreeRTOS correctly for the 41 | * given hardware and compiler. 42 | * 43 | * These settings should not be altered. 44 | *----------------------------------------------------------- 45 | */ 46 | 47 | /* Type definitions. */ 48 | #define portCHAR char 49 | #define portFLOAT float 50 | #define portDOUBLE double 51 | #define portLONG long 52 | #define portSHORT short 53 | #define portSTACK_TYPE uint32_t 54 | #define portBASE_TYPE long 55 | 56 | typedef portSTACK_TYPE StackType_t; 57 | typedef long BaseType_t; 58 | typedef unsigned long UBaseType_t; 59 | 60 | #if ( configUSE_16_BIT_TICKS == 1 ) 61 | typedef uint16_t TickType_t; 62 | #define portMAX_DELAY ( TickType_t ) 0xffff 63 | #else 64 | typedef uint32_t TickType_t; 65 | #define portMAX_DELAY ( TickType_t ) 0xffffffffUL 66 | 67 | /* 32-bit tick type on a 32-bit architecture, so reads of the tick count do 68 | * not need to be guarded with a critical section. */ 69 | #define portTICK_TYPE_IS_ATOMIC 1 70 | #endif 71 | /*-----------------------------------------------------------*/ 72 | 73 | /* Architecture specifics. */ 74 | #define portSTACK_GROWTH ( -1 ) 75 | #define portTICK_PERIOD_MS ( ( TickType_t ) 1000 / configTICK_RATE_HZ ) 76 | #define portBYTE_ALIGNMENT 8 77 | #define portDONT_DISCARD __attribute__( ( used ) ) 78 | /*-----------------------------------------------------------*/ 79 | 80 | 81 | /* Scheduler utilities. */ 82 | extern void vPortYield( void ); 83 | #define portNVIC_INT_CTRL_REG ( *( ( volatile uint32_t * ) 0xe000ed04 ) ) 84 | #define portNVIC_PENDSVSET_BIT ( 1UL << 28UL ) 85 | #define portYIELD() vPortYield() 86 | #define portEND_SWITCHING_ISR( xSwitchRequired ) do { if( xSwitchRequired ) portNVIC_INT_CTRL_REG = portNVIC_PENDSVSET_BIT; } while( 0 ) 87 | #define portYIELD_FROM_ISR( x ) portEND_SWITCHING_ISR( x ) 88 | /*-----------------------------------------------------------*/ 89 | 90 | 91 | /* Critical section management. */ 92 | extern void vPortEnterCritical( void ); 93 | extern void vPortExitCritical( void ); 94 | extern uint32_t ulSetInterruptMaskFromISR( void ) __attribute__( ( naked ) ); 95 | extern void vClearInterruptMaskFromISR( uint32_t ulMask ) __attribute__( ( naked ) ); 96 | 97 | #define portSET_INTERRUPT_MASK_FROM_ISR() ulSetInterruptMaskFromISR() 98 | #define portCLEAR_INTERRUPT_MASK_FROM_ISR( x ) vClearInterruptMaskFromISR( x ) 99 | #define portDISABLE_INTERRUPTS() __asm volatile ( " cpsid i " ::: "memory" ) 100 | #define portENABLE_INTERRUPTS() __asm volatile ( " cpsie i " ::: "memory" ) 101 | #define portENTER_CRITICAL() vPortEnterCritical() 102 | #define portEXIT_CRITICAL() vPortExitCritical() 103 | 104 | /*-----------------------------------------------------------*/ 105 | 106 | /* Tickless idle/low power functionality. */ 107 | #ifndef portSUPPRESS_TICKS_AND_SLEEP 108 | extern void vPortSuppressTicksAndSleep( TickType_t xExpectedIdleTime ); 109 | #define portSUPPRESS_TICKS_AND_SLEEP( xExpectedIdleTime ) vPortSuppressTicksAndSleep( xExpectedIdleTime ) 110 | #endif 111 | /*-----------------------------------------------------------*/ 112 | 113 | /* Task function macros as described on the FreeRTOS.org WEB site. */ 114 | #define portTASK_FUNCTION_PROTO( vFunction, pvParameters ) void vFunction( void * pvParameters ) 115 | #define portTASK_FUNCTION( vFunction, pvParameters ) void vFunction( void * pvParameters ) 116 | 117 | #define portNOP() 118 | 119 | #define portMEMORY_BARRIER() __asm volatile ( "" ::: "memory" ) 120 | 121 | #ifdef __cplusplus 122 | } 123 | #endif 124 | 125 | #endif /* PORTMACRO_H */ 126 | -------------------------------------------------------------------------------- /Source/portable/COMPONENT_CM0P/TOOLCHAIN_GCC_ARM/portmacro.h: -------------------------------------------------------------------------------- 1 | /* 2 | * FreeRTOS Kernel V10.5.0 3 | * Copyright (C) 2021 Amazon.com, Inc. or its affiliates. All Rights Reserved. 4 | * 5 | * SPDX-License-Identifier: MIT 6 | * 7 | * Permission is hereby granted, free of charge, to any person obtaining a copy of 8 | * this software and associated documentation files (the "Software"), to deal in 9 | * the Software without restriction, including without limitation the rights to 10 | * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 11 | * the Software, and to permit persons to whom the Software is furnished to do so, 12 | * subject to the following conditions: 13 | * 14 | * The above copyright notice and this permission notice shall be included in all 15 | * copies or substantial portions of the Software. 16 | * 17 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 19 | * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 20 | * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 21 | * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 22 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 23 | * 24 | * https://www.FreeRTOS.org 25 | * https://github.com/FreeRTOS 26 | * 27 | */ 28 | 29 | 30 | #ifndef PORTMACRO_H 31 | #define PORTMACRO_H 32 | 33 | #ifdef __cplusplus 34 | extern "C" { 35 | #endif 36 | 37 | /*----------------------------------------------------------- 38 | * Port specific definitions. 39 | * 40 | * The settings in this file configure FreeRTOS correctly for the 41 | * given hardware and compiler. 42 | * 43 | * These settings should not be altered. 44 | *----------------------------------------------------------- 45 | */ 46 | 47 | /* Type definitions. */ 48 | #define portCHAR char 49 | #define portFLOAT float 50 | #define portDOUBLE double 51 | #define portLONG long 52 | #define portSHORT short 53 | #define portSTACK_TYPE uint32_t 54 | #define portBASE_TYPE long 55 | 56 | typedef portSTACK_TYPE StackType_t; 57 | typedef long BaseType_t; 58 | typedef unsigned long UBaseType_t; 59 | 60 | #if ( configUSE_16_BIT_TICKS == 1 ) 61 | typedef uint16_t TickType_t; 62 | #define portMAX_DELAY ( TickType_t ) 0xffff 63 | #else 64 | typedef uint32_t TickType_t; 65 | #define portMAX_DELAY ( TickType_t ) 0xffffffffUL 66 | 67 | /* 32-bit tick type on a 32-bit architecture, so reads of the tick count do 68 | * not need to be guarded with a critical section. */ 69 | #define portTICK_TYPE_IS_ATOMIC 1 70 | #endif 71 | /*-----------------------------------------------------------*/ 72 | 73 | /* Architecture specifics. */ 74 | #define portSTACK_GROWTH ( -1 ) 75 | #define portTICK_PERIOD_MS ( ( TickType_t ) 1000 / configTICK_RATE_HZ ) 76 | #define portBYTE_ALIGNMENT 8 77 | #define portDONT_DISCARD __attribute__( ( used ) ) 78 | /*-----------------------------------------------------------*/ 79 | 80 | 81 | /* Scheduler utilities. */ 82 | extern void vPortYield( void ); 83 | #define portNVIC_INT_CTRL_REG ( *( ( volatile uint32_t * ) 0xe000ed04 ) ) 84 | #define portNVIC_PENDSVSET_BIT ( 1UL << 28UL ) 85 | #define portYIELD() vPortYield() 86 | #define portEND_SWITCHING_ISR( xSwitchRequired ) do { if( xSwitchRequired ) portNVIC_INT_CTRL_REG = portNVIC_PENDSVSET_BIT; } while( 0 ) 87 | #define portYIELD_FROM_ISR( x ) portEND_SWITCHING_ISR( x ) 88 | /*-----------------------------------------------------------*/ 89 | 90 | 91 | /* Critical section management. */ 92 | extern void vPortEnterCritical( void ); 93 | extern void vPortExitCritical( void ); 94 | extern uint32_t ulSetInterruptMaskFromISR( void ) __attribute__( ( naked ) ); 95 | extern void vClearInterruptMaskFromISR( uint32_t ulMask ) __attribute__( ( naked ) ); 96 | 97 | #define portSET_INTERRUPT_MASK_FROM_ISR() ulSetInterruptMaskFromISR() 98 | #define portCLEAR_INTERRUPT_MASK_FROM_ISR( x ) vClearInterruptMaskFromISR( x ) 99 | #define portDISABLE_INTERRUPTS() __asm volatile ( " cpsid i " ::: "memory" ) 100 | #define portENABLE_INTERRUPTS() __asm volatile ( " cpsie i " ::: "memory" ) 101 | #define portENTER_CRITICAL() vPortEnterCritical() 102 | #define portEXIT_CRITICAL() vPortExitCritical() 103 | 104 | /*-----------------------------------------------------------*/ 105 | 106 | /* Tickless idle/low power functionality. */ 107 | #ifndef portSUPPRESS_TICKS_AND_SLEEP 108 | extern void vPortSuppressTicksAndSleep( TickType_t xExpectedIdleTime ); 109 | #define portSUPPRESS_TICKS_AND_SLEEP( xExpectedIdleTime ) vPortSuppressTicksAndSleep( xExpectedIdleTime ) 110 | #endif 111 | /*-----------------------------------------------------------*/ 112 | 113 | /* Task function macros as described on the FreeRTOS.org WEB site. */ 114 | #define portTASK_FUNCTION_PROTO( vFunction, pvParameters ) void vFunction( void * pvParameters ) 115 | #define portTASK_FUNCTION( vFunction, pvParameters ) void vFunction( void * pvParameters ) 116 | 117 | #define portNOP() 118 | 119 | #define portMEMORY_BARRIER() __asm volatile ( "" ::: "memory" ) 120 | 121 | #ifdef __cplusplus 122 | } 123 | #endif 124 | 125 | #endif /* PORTMACRO_H */ 126 | -------------------------------------------------------------------------------- /Source/portable/COMPONENT_CM0P/TOOLCHAIN_IAR/portasm.s: -------------------------------------------------------------------------------- 1 | /* 2 | * FreeRTOS Kernel V10.5.0 3 | * Copyright (C) 2021 Amazon.com, Inc. or its affiliates. All Rights Reserved. 4 | * 5 | * SPDX-License-Identifier: MIT 6 | * 7 | * Copyright (C) 2019-2024 Cypress Semiconductor Corporation, or a subsidiary of 8 | * Cypress Semiconductor Corporation. All Rights Reserved. 9 | * 10 | * Updated function names to be compliant with CMSIS standard names. 11 | * 12 | * Permission is hereby granted, free of charge, to any person obtaining a copy of 13 | * this software and associated documentation files (the "Software"), to deal in 14 | * the Software without restriction, including without limitation the rights to 15 | * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 16 | * the Software, and to permit persons to whom the Software is furnished to do so, 17 | * subject to the following conditions: 18 | * 19 | * The above copyright notice and this permission notice shall be included in all 20 | * copies or substantial portions of the Software. 21 | * 22 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 23 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 24 | * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 25 | * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 26 | * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 27 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 28 | * 29 | * https://www.FreeRTOS.org 30 | * https://github.com/FreeRTOS 31 | * http://www.cypress.com 32 | * 33 | */ 34 | 35 | RSEG CODE:CODE(2) 36 | thumb 37 | 38 | EXTERN vPortYieldFromISR 39 | EXTERN pxCurrentTCB 40 | EXTERN vTaskSwitchContext 41 | 42 | PUBLIC vSetMSP 43 | PUBLIC PendSV_Handler 44 | PUBLIC SVC_Handler 45 | PUBLIC vPortStartFirstTask 46 | PUBLIC ulSetInterruptMaskFromISR 47 | PUBLIC vClearInterruptMaskFromISR 48 | 49 | /*-----------------------------------------------------------*/ 50 | 51 | vSetMSP 52 | msr msp, r0 53 | bx lr 54 | 55 | /*-----------------------------------------------------------*/ 56 | 57 | PendSV_Handler: 58 | mrs r0, psp 59 | 60 | ldr r3, =pxCurrentTCB /* Get the location of the current TCB. */ 61 | ldr r2, [r3] 62 | 63 | subs r0, r0, #32 /* Make space for the remaining low registers. */ 64 | str r0, [r2] /* Save the new top of stack. */ 65 | stmia r0!, {r4-r7} /* Store the low registers that are not saved automatically. */ 66 | mov r4, r8 /* Store the high registers. */ 67 | mov r5, r9 68 | mov r6, r10 69 | mov r7, r11 70 | stmia r0!, {r4-r7} 71 | 72 | push {r3, r14} 73 | cpsid i 74 | bl vTaskSwitchContext 75 | cpsie i 76 | pop {r2, r3} /* lr goes in r3. r2 now holds tcb pointer. */ 77 | 78 | ldr r1, [r2] 79 | ldr r0, [r1] /* The first item in pxCurrentTCB is the task top of stack. */ 80 | adds r0, r0, #16 /* Move to the high registers. */ 81 | ldmia r0!, {r4-r7} /* Pop the high registers. */ 82 | mov r8, r4 83 | mov r9, r5 84 | mov r10, r6 85 | mov r11, r7 86 | 87 | msr psp, r0 /* Remember the new top of stack for the task. */ 88 | 89 | subs r0, r0, #32 /* Go back for the low registers that are not automatically restored. */ 90 | ldmia r0!, {r4-r7} /* Pop low registers. */ 91 | 92 | bx r3 93 | 94 | /*-----------------------------------------------------------*/ 95 | 96 | SVC_Handler; 97 | /* This function is no longer used, but retained for backward 98 | compatibility. */ 99 | bx lr 100 | 101 | /*-----------------------------------------------------------*/ 102 | 103 | vPortStartFirstTask 104 | /* The MSP stack is not reset as, unlike on M3/4 parts, there is no vector 105 | table offset register that can be used to locate the initial stack value. 106 | Not all M0 parts have the application vector table at address 0. */ 107 | 108 | ldr r3, =pxCurrentTCB /* Obtain location of pxCurrentTCB. */ 109 | ldr r1, [r3] 110 | ldr r0, [r1] /* The first item in pxCurrentTCB is the task top of stack. */ 111 | adds r0, #32 /* Discard everything up to r0. */ 112 | msr psp, r0 /* This is now the new top of stack to use in the task. */ 113 | movs r0, #2 /* Switch to the psp stack. */ 114 | msr CONTROL, r0 115 | isb 116 | pop {r0-r5} /* Pop the registers that are saved automatically. */ 117 | mov lr, r5 /* lr is now in r5. */ 118 | pop {r3} /* The return address is now in r3. */ 119 | pop {r2} /* Pop and discard the XPSR. */ 120 | cpsie i /* The first task has its context and interrupts can be enabled. */ 121 | bx r3 /* Jump to the user defined task code. */ 122 | 123 | /*-----------------------------------------------------------*/ 124 | 125 | ulSetInterruptMaskFromISR 126 | mrs r0, PRIMASK 127 | cpsid i 128 | bx lr 129 | 130 | /*-----------------------------------------------------------*/ 131 | 132 | vClearInterruptMaskFromISR 133 | msr PRIMASK, r0 134 | bx lr 135 | 136 | END 137 | -------------------------------------------------------------------------------- /Source/portable/COMPONENT_CM0P/TOOLCHAIN_IAR/portmacro.h: -------------------------------------------------------------------------------- 1 | /* 2 | * FreeRTOS Kernel V10.5.0 3 | * Copyright (C) 2021 Amazon.com, Inc. or its affiliates. All Rights Reserved. 4 | * 5 | * SPDX-License-Identifier: MIT 6 | * 7 | * Permission is hereby granted, free of charge, to any person obtaining a copy of 8 | * this software and associated documentation files (the "Software"), to deal in 9 | * the Software without restriction, including without limitation the rights to 10 | * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 11 | * the Software, and to permit persons to whom the Software is furnished to do so, 12 | * subject to the following conditions: 13 | * 14 | * The above copyright notice and this permission notice shall be included in all 15 | * copies or substantial portions of the Software. 16 | * 17 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 19 | * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 20 | * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 21 | * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 22 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 23 | * 24 | * https://www.FreeRTOS.org 25 | * https://github.com/FreeRTOS 26 | * 27 | */ 28 | 29 | 30 | #ifndef PORTMACRO_H 31 | #define PORTMACRO_H 32 | 33 | #ifdef __cplusplus 34 | extern "C" { 35 | #endif 36 | 37 | /*----------------------------------------------------------- 38 | * Port specific definitions. 39 | * 40 | * The settings in this file configure FreeRTOS correctly for the 41 | * given hardware and compiler. 42 | * 43 | * These settings should not be altered. 44 | *----------------------------------------------------------- 45 | */ 46 | 47 | /* Type definitions. */ 48 | #define portCHAR char 49 | #define portFLOAT float 50 | #define portDOUBLE double 51 | #define portLONG long 52 | #define portSHORT short 53 | #define portSTACK_TYPE uint32_t 54 | #define portBASE_TYPE long 55 | 56 | typedef portSTACK_TYPE StackType_t; 57 | typedef long BaseType_t; 58 | typedef unsigned long UBaseType_t; 59 | 60 | 61 | #if ( configUSE_16_BIT_TICKS == 1 ) 62 | typedef uint16_t TickType_t; 63 | #define portMAX_DELAY ( TickType_t ) 0xffff 64 | #else 65 | typedef uint32_t TickType_t; 66 | #define portMAX_DELAY ( TickType_t ) 0xffffffffUL 67 | 68 | /* 32-bit tick type on a 32-bit architecture, so reads of the tick count do 69 | * not need to be guarded with a critical section. */ 70 | #define portTICK_TYPE_IS_ATOMIC 1 71 | #endif 72 | /*-----------------------------------------------------------*/ 73 | 74 | /* Architecture specifics. */ 75 | #define portSTACK_GROWTH ( -1 ) 76 | #define portTICK_PERIOD_MS ( ( TickType_t ) 1000 / configTICK_RATE_HZ ) 77 | #define portBYTE_ALIGNMENT 8 78 | /*-----------------------------------------------------------*/ 79 | 80 | 81 | /* Scheduler utilities. */ 82 | extern void vPortYield( void ); 83 | #define portNVIC_INT_CTRL ( ( volatile uint32_t * ) 0xe000ed04 ) 84 | #define portNVIC_PENDSVSET 0x10000000 85 | #define portYIELD() vPortYield() 86 | #define portEND_SWITCHING_ISR( xSwitchRequired ) if( xSwitchRequired ) *( portNVIC_INT_CTRL ) = portNVIC_PENDSVSET 87 | #define portYIELD_FROM_ISR( x ) portEND_SWITCHING_ISR( x ) 88 | /*-----------------------------------------------------------*/ 89 | 90 | 91 | /* Critical section management. */ 92 | 93 | extern void vPortEnterCritical( void ); 94 | extern void vPortExitCritical( void ); 95 | extern uint32_t ulSetInterruptMaskFromISR( void ); 96 | extern void vClearInterruptMaskFromISR( uint32_t ulMask ); 97 | 98 | #define portDISABLE_INTERRUPTS() __asm volatile ( "cpsid i" ) 99 | #define portENABLE_INTERRUPTS() __asm volatile ( "cpsie i" ) 100 | #define portENTER_CRITICAL() vPortEnterCritical() 101 | #define portEXIT_CRITICAL() vPortExitCritical() 102 | #define portSET_INTERRUPT_MASK_FROM_ISR() ulSetInterruptMaskFromISR() 103 | #define portCLEAR_INTERRUPT_MASK_FROM_ISR( x ) vClearInterruptMaskFromISR( x ) 104 | 105 | /*-----------------------------------------------------------*/ 106 | 107 | /* Tickless idle/low power functionality. */ 108 | #ifndef portSUPPRESS_TICKS_AND_SLEEP 109 | extern void vPortSuppressTicksAndSleep( TickType_t xExpectedIdleTime ); 110 | #define portSUPPRESS_TICKS_AND_SLEEP( xExpectedIdleTime ) vPortSuppressTicksAndSleep( xExpectedIdleTime ) 111 | #endif 112 | /*-----------------------------------------------------------*/ 113 | 114 | /* Task function macros as described on the FreeRTOS.org WEB site. */ 115 | #define portTASK_FUNCTION_PROTO( vFunction, pvParameters ) void vFunction( void * pvParameters ) 116 | #define portTASK_FUNCTION( vFunction, pvParameters ) void vFunction( void * pvParameters ) 117 | 118 | #define portNOP() 119 | 120 | /* Suppress warnings that are generated by the IAR tools, but cannot be fixed in 121 | * the source code because to do so would cause other compilers to generate 122 | * warnings. */ 123 | #pragma diag_suppress=Pa082 124 | 125 | #ifdef __cplusplus 126 | } 127 | #endif 128 | 129 | #endif /* PORTMACRO_H */ 130 | -------------------------------------------------------------------------------- /Source/portable/COMPONENT_CM33/TOOLCHAIN_ARM/portasm.h: -------------------------------------------------------------------------------- 1 | /* 2 | * FreeRTOS Kernel V10.5.0 3 | * Copyright (C) 2021 Amazon.com, Inc. or its affiliates. All Rights Reserved. 4 | * 5 | * SPDX-License-Identifier: MIT 6 | * 7 | * Permission is hereby granted, free of charge, to any person obtaining a copy of 8 | * this software and associated documentation files (the "Software"), to deal in 9 | * the Software without restriction, including without limitation the rights to 10 | * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 11 | * the Software, and to permit persons to whom the Software is furnished to do so, 12 | * subject to the following conditions: 13 | * 14 | * The above copyright notice and this permission notice shall be included in all 15 | * copies or substantial portions of the Software. 16 | * 17 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 19 | * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 20 | * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 21 | * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 22 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 23 | * 24 | * https://www.FreeRTOS.org 25 | * https://github.com/FreeRTOS 26 | * 27 | */ 28 | 29 | #ifndef __PORT_ASM_H__ 30 | #define __PORT_ASM_H__ 31 | 32 | /* Scheduler includes. */ 33 | #include "FreeRTOS.h" 34 | 35 | /* MPU wrappers includes. */ 36 | #include "mpu_wrappers.h" 37 | 38 | /** 39 | * @brief Restore the context of the first task so that the first task starts 40 | * executing. 41 | */ 42 | void vRestoreContextOfFirstTask( void ) __attribute__( ( naked ) ) PRIVILEGED_FUNCTION; 43 | 44 | /** 45 | * @brief Checks whether or not the processor is privileged. 46 | * 47 | * @return 1 if the processor is already privileged, 0 otherwise. 48 | */ 49 | BaseType_t xIsPrivileged( void ) __attribute__( ( naked ) ); 50 | 51 | /** 52 | * @brief Raises the privilege level by clearing the bit 0 of the CONTROL 53 | * register. 54 | * 55 | * @note This is a privileged function and should only be called from the kenrel 56 | * code. 57 | * 58 | * Bit 0 of the CONTROL register defines the privilege level of Thread Mode. 59 | * Bit[0] = 0 --> The processor is running privileged 60 | * Bit[0] = 1 --> The processor is running unprivileged. 61 | */ 62 | void vRaisePrivilege( void ) __attribute__( ( naked ) ) PRIVILEGED_FUNCTION; 63 | 64 | /** 65 | * @brief Lowers the privilege level by setting the bit 0 of the CONTROL 66 | * register. 67 | * 68 | * Bit 0 of the CONTROL register defines the privilege level of Thread Mode. 69 | * Bit[0] = 0 --> The processor is running privileged 70 | * Bit[0] = 1 --> The processor is running unprivileged. 71 | */ 72 | void vResetPrivilege( void ) __attribute__( ( naked ) ); 73 | 74 | /** 75 | * @brief Starts the first task. 76 | */ 77 | void vStartFirstTask( void ) __attribute__( ( naked ) ) PRIVILEGED_FUNCTION; 78 | 79 | /** 80 | * @brief Disables interrupts. 81 | */ 82 | uint32_t ulSetInterruptMask( void ) __attribute__( ( naked ) ) PRIVILEGED_FUNCTION; 83 | 84 | /** 85 | * @brief Enables interrupts. 86 | */ 87 | void vClearInterruptMask( uint32_t ulMask ) __attribute__( ( naked ) ) PRIVILEGED_FUNCTION; 88 | 89 | /** 90 | * @brief PendSV Exception handler. 91 | */ 92 | void PendSV_Handler( void ) __attribute__( ( naked ) ) PRIVILEGED_FUNCTION; 93 | 94 | /** 95 | * @brief SVC Handler. 96 | */ 97 | void SVC_Handler( void ) __attribute__( ( naked ) ) PRIVILEGED_FUNCTION; 98 | 99 | /** 100 | * @brief Allocate a Secure context for the calling task. 101 | * 102 | * @param[in] ulSecureStackSize The size of the stack to be allocated on the 103 | * secure side for the calling task. 104 | */ 105 | void vPortAllocateSecureContext( uint32_t ulSecureStackSize ) __attribute__( ( naked ) ); 106 | 107 | /** 108 | * @brief Free the task's secure context. 109 | * 110 | * @param[in] pulTCB Pointer to the Task Control Block (TCB) of the task. 111 | */ 112 | void vPortFreeSecureContext( uint32_t * pulTCB ) __attribute__( ( naked ) ) PRIVILEGED_FUNCTION; 113 | 114 | #endif /* __PORT_ASM_H__ */ 115 | -------------------------------------------------------------------------------- /Source/portable/COMPONENT_CM33/TOOLCHAIN_ARM/portdsram.c: -------------------------------------------------------------------------------- 1 | /* 2 | * FreeRTOS Kernel V10.5.0 3 | * Copyright (C) 2021 Amazon.com, Inc. or its affiliates. All Rights Reserved. 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining a copy of 6 | * this software and associated documentation files (the "Software"), to deal in 7 | * the Software without restriction, including without limitation the rights to 8 | * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 9 | * the Software, and to permit persons to whom the Software is furnished to do so, 10 | * subject to the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be included in all 13 | * copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 17 | * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 18 | * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 19 | * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 20 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | * 22 | * https://www.FreeRTOS.org 23 | * https://github.com/FreeRTOS 24 | * 25 | * 1 tab == 4 spaces! 26 | */ 27 | 28 | /* Standard includes. */ 29 | #include "portdsram.h" 30 | 31 | /* Defining MPU_WRAPPERS_INCLUDED_FROM_API_FILE ensures that PRIVILEGED_FUNCTION 32 | * is defined correctly and privileged functions are placed in correct sections. */ 33 | #define MPU_WRAPPERS_INCLUDED_FROM_API_FILE 34 | 35 | /* Portasm includes. */ 36 | #include "portasm.h" 37 | 38 | /* MPU_WRAPPERS_INCLUDED_FROM_API_FILE is needed to be defined only for the 39 | * header files. */ 40 | #undef MPU_WRAPPERS_INCLUDED_FROM_API_FILE 41 | 42 | FREERTOS_COMMON_SECTION_BEGIN 43 | void vStoreDSRAMContextWithWFI( void ) /* __attribute__ (( naked )) PRIVILEGED_FUNCTION */ 44 | { 45 | __asm volatile 46 | ( 47 | " .syntax unified \n" 48 | " stmdb sp!, {r1-r11, lr} \n" /* Store reg on the stack*/ 49 | " mrs r1, psplim \n" /* r1 = PSPLIM. */ 50 | " mrs r2, control \n" /* r2 = Control. */ 51 | " adr r3, wfi_exit + 1 \n" 52 | " stmdb sp!, {r1-r3} \n" /* Store on the stack - PSPLIM, Control Return Address */ 53 | " \n" 54 | " ldr r2, =pxCurrentTCB \n" /* Read the location of pxCurrentTCB i.e. &( pxCurrentTCB ). */ 55 | " ldr r1, [r2] \n" /* Read pxCurrentTCB. */ 56 | " mrs r0, psp \n" /* Read PSP in r0. */ 57 | " str r0, [r1] \n" /* Save the new top of stack in TCB. */ 58 | " wfi \n" 59 | " isb \n" 60 | " add sp, sp, #12 \n" /* We we do not enter DSRAM pop-out PSPLIM, Control Return Address*/ 61 | "wfi_exit: dsb \n" 62 | " ldmia sp!, {r1-r11, pc} \n" 63 | ); 64 | } 65 | FREERTOS_COMMON_SECTION_END 66 | 67 | FREERTOS_COMMON_SECTION_BEGIN 68 | void vRestoreDSRAMContext( void ) 69 | { 70 | __asm volatile 71 | ( 72 | " ldr r2, pxCurrentTCBConstE1 \n" /* Read the location of pxCurrentTCB i.e. &( pxCurrentTCB ). */ 73 | " ldr r1, [r2] \n" /* Read pxCurrentTCB. */ 74 | " ldr r0, [r1] \n" /* The first item in pxCurrentTCB is the task top of stack. r0 now points to the top of stack. */ 75 | " \n" 76 | " ldmia r0!, {r1-r3} \n" /* Read from stack - r1 = PSPLIM, r2 = CONTROL, r3 = LR */ 77 | " \n" 78 | " msr psplim, r1 \n" /* Restore the PSPLIM register value for the task. */ 79 | " msr psp, r0 \n" /* restore stacks */ 80 | " ldr r0, MSPStackTop \n" 81 | " msr msp, r0 \n" 82 | " msr CONTROL, r2 \n" 83 | " isb \n" 84 | " bx r3 \n" 85 | " \n" 86 | " .align 4 \n" 87 | "pxCurrentTCBConstE1: .word pxCurrentTCB \n" 88 | "MSPStackTop: .word Image$$ARM_LIB_STACK$$ZI$$Limit \n" 89 | ); 90 | } 91 | FREERTOS_COMMON_SECTION_END 92 | /*-----------------------------------------------------------*/ 93 | -------------------------------------------------------------------------------- /Source/portable/COMPONENT_CM33/TOOLCHAIN_ARM/portdsram.h: -------------------------------------------------------------------------------- 1 | /* 2 | * FreeRTOS Kernel V10.5.0 3 | * Copyright (C) 2021 Amazon.com, Inc. or its affiliates. All Rights Reserved. 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining a copy of 6 | * this software and associated documentation files (the "Software"), to deal in 7 | * the Software without restriction, including without limitation the rights to 8 | * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 9 | * the Software, and to permit persons to whom the Software is furnished to do so, 10 | * subject to the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be included in all 13 | * copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 17 | * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 18 | * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 19 | * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 20 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | * 22 | * https://www.FreeRTOS.org 23 | * https://github.com/FreeRTOS 24 | * 25 | * 1 tab == 4 spaces! 26 | */ 27 | 28 | #ifndef __PORT_DSRAM_H__ 29 | #define __PORT_DSRAM_H__ 30 | 31 | /** 32 | * @brief Store the context before entering DS-RAM and enter WFI 33 | */ 34 | void vStoreDSRAMContextWithWFI( void ); 35 | 36 | /** 37 | * @brief Restore the context after wake up from DS-RAM(System will go through Warm boot) 38 | */ 39 | void vRestoreDSRAMContext( void ); 40 | 41 | 42 | #endif /* __PORT_DSRAM_H__ */ 43 | -------------------------------------------------------------------------------- /Source/portable/COMPONENT_CM33/TOOLCHAIN_ARM/portmacro.h: -------------------------------------------------------------------------------- 1 | /* 2 | * FreeRTOS Kernel V10.5.0 3 | * Copyright (C) 2021 Amazon.com, Inc. or its affiliates. All Rights Reserved. 4 | * 5 | * SPDX-License-Identifier: MIT 6 | * 7 | * Permission is hereby granted, free of charge, to any person obtaining a copy of 8 | * this software and associated documentation files (the "Software"), to deal in 9 | * the Software without restriction, including without limitation the rights to 10 | * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 11 | * the Software, and to permit persons to whom the Software is furnished to do so, 12 | * subject to the following conditions: 13 | * 14 | * The above copyright notice and this permission notice shall be included in all 15 | * copies or substantial portions of the Software. 16 | * 17 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 19 | * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 20 | * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 21 | * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 22 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 23 | * 24 | * https://www.FreeRTOS.org 25 | * https://github.com/FreeRTOS 26 | * 27 | */ 28 | 29 | #ifndef PORTMACRO_H 30 | #define PORTMACRO_H 31 | 32 | #ifdef __cplusplus 33 | extern "C" { 34 | #endif 35 | 36 | #include "portmacrocommon.h" 37 | 38 | /*------------------------------------------------------------------------------ 39 | * Port specific definitions. 40 | * 41 | * The settings in this file configure FreeRTOS correctly for the given hardware 42 | * and compiler. 43 | * 44 | * These settings should not be altered. 45 | *------------------------------------------------------------------------------ 46 | */ 47 | 48 | /** 49 | * Architecture specifics. 50 | */ 51 | #define portARCH_NAME "Cortex-M33" 52 | #define portDONT_DISCARD __attribute__( ( used ) ) 53 | /*-----------------------------------------------------------*/ 54 | 55 | /** 56 | * @brief Critical section management. 57 | */ 58 | #define portDISABLE_INTERRUPTS() ulSetInterruptMask() 59 | #define portENABLE_INTERRUPTS() vClearInterruptMask( 0 ) 60 | /*-----------------------------------------------------------*/ 61 | 62 | #ifdef __cplusplus 63 | } 64 | #endif 65 | 66 | #endif /* PORTMACRO_H */ 67 | -------------------------------------------------------------------------------- /Source/portable/COMPONENT_CM33/TOOLCHAIN_GCC_ARM/portasm.h: -------------------------------------------------------------------------------- 1 | /* 2 | * FreeRTOS Kernel V10.5.0 3 | * Copyright (C) 2021 Amazon.com, Inc. or its affiliates. All Rights Reserved. 4 | * 5 | * SPDX-License-Identifier: MIT 6 | * 7 | * Permission is hereby granted, free of charge, to any person obtaining a copy of 8 | * this software and associated documentation files (the "Software"), to deal in 9 | * the Software without restriction, including without limitation the rights to 10 | * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 11 | * the Software, and to permit persons to whom the Software is furnished to do so, 12 | * subject to the following conditions: 13 | * 14 | * The above copyright notice and this permission notice shall be included in all 15 | * copies or substantial portions of the Software. 16 | * 17 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 19 | * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 20 | * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 21 | * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 22 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 23 | * 24 | * https://www.FreeRTOS.org 25 | * https://github.com/FreeRTOS 26 | * 27 | */ 28 | 29 | #ifndef __PORT_ASM_H__ 30 | #define __PORT_ASM_H__ 31 | 32 | /* Scheduler includes. */ 33 | #include "FreeRTOS.h" 34 | 35 | /* MPU wrappers includes. */ 36 | #include "mpu_wrappers.h" 37 | 38 | /** 39 | * @brief Restore the context of the first task so that the first task starts 40 | * executing. 41 | */ 42 | void vRestoreContextOfFirstTask( void ) __attribute__( ( naked ) ) PRIVILEGED_FUNCTION; 43 | 44 | /** 45 | * @brief Checks whether or not the processor is privileged. 46 | * 47 | * @return 1 if the processor is already privileged, 0 otherwise. 48 | */ 49 | BaseType_t xIsPrivileged( void ) __attribute__( ( naked ) ); 50 | 51 | /** 52 | * @brief Raises the privilege level by clearing the bit 0 of the CONTROL 53 | * register. 54 | * 55 | * @note This is a privileged function and should only be called from the kenrel 56 | * code. 57 | * 58 | * Bit 0 of the CONTROL register defines the privilege level of Thread Mode. 59 | * Bit[0] = 0 --> The processor is running privileged 60 | * Bit[0] = 1 --> The processor is running unprivileged. 61 | */ 62 | void vRaisePrivilege( void ) __attribute__( ( naked ) ) PRIVILEGED_FUNCTION; 63 | 64 | /** 65 | * @brief Lowers the privilege level by setting the bit 0 of the CONTROL 66 | * register. 67 | * 68 | * Bit 0 of the CONTROL register defines the privilege level of Thread Mode. 69 | * Bit[0] = 0 --> The processor is running privileged 70 | * Bit[0] = 1 --> The processor is running unprivileged. 71 | */ 72 | void vResetPrivilege( void ) __attribute__( ( naked ) ); 73 | 74 | /** 75 | * @brief Starts the first task. 76 | */ 77 | void vStartFirstTask( void ) __attribute__( ( naked ) ) PRIVILEGED_FUNCTION; 78 | 79 | /** 80 | * @brief Disables interrupts. 81 | */ 82 | uint32_t ulSetInterruptMask( void ) __attribute__( ( naked ) ) PRIVILEGED_FUNCTION; 83 | 84 | /** 85 | * @brief Enables interrupts. 86 | */ 87 | void vClearInterruptMask( uint32_t ulMask ) __attribute__( ( naked ) ) PRIVILEGED_FUNCTION; 88 | 89 | /** 90 | * @brief PendSV Exception handler. 91 | */ 92 | void PendSV_Handler( void ) __attribute__( ( naked ) ) PRIVILEGED_FUNCTION; 93 | 94 | /** 95 | * @brief SVC Handler. 96 | */ 97 | void SVC_Handler( void ) __attribute__( ( naked ) ) PRIVILEGED_FUNCTION; 98 | 99 | /** 100 | * @brief Allocate a Secure context for the calling task. 101 | * 102 | * @param[in] ulSecureStackSize The size of the stack to be allocated on the 103 | * secure side for the calling task. 104 | */ 105 | void vPortAllocateSecureContext( uint32_t ulSecureStackSize ) __attribute__( ( naked ) ); 106 | 107 | /** 108 | * @brief Free the task's secure context. 109 | * 110 | * @param[in] pulTCB Pointer to the Task Control Block (TCB) of the task. 111 | */ 112 | void vPortFreeSecureContext( uint32_t * pulTCB ) __attribute__( ( naked ) ) PRIVILEGED_FUNCTION; 113 | 114 | #endif /* __PORT_ASM_H__ */ 115 | -------------------------------------------------------------------------------- /Source/portable/COMPONENT_CM33/TOOLCHAIN_GCC_ARM/portdsram.c: -------------------------------------------------------------------------------- 1 | /* 2 | * FreeRTOS Kernel V10.5.0 3 | * Copyright (C) 2021 Amazon.com, Inc. or its affiliates. All Rights Reserved. 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining a copy of 6 | * this software and associated documentation files (the "Software"), to deal in 7 | * the Software without restriction, including without limitation the rights to 8 | * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 9 | * the Software, and to permit persons to whom the Software is furnished to do so, 10 | * subject to the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be included in all 13 | * copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 17 | * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 18 | * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 19 | * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 20 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | * 22 | * https://www.FreeRTOS.org 23 | * https://github.com/FreeRTOS 24 | * 25 | * 1 tab == 4 spaces! 26 | */ 27 | 28 | /* Standard includes. */ 29 | #include "portdsram.h" 30 | /* Defining MPU_WRAPPERS_INCLUDED_FROM_API_FILE ensures that PRIVILEGED_FUNCTION 31 | * is defined correctly and privileged functions are placed in correct sections. */ 32 | #define MPU_WRAPPERS_INCLUDED_FROM_API_FILE 33 | 34 | /* Portasm includes. */ 35 | #include "portasm.h" 36 | 37 | /* MPU_WRAPPERS_INCLUDED_FROM_API_FILE is needed to be defined only for the 38 | * header files. */ 39 | #undef MPU_WRAPPERS_INCLUDED_FROM_API_FILE 40 | 41 | FREERTOS_COMMON_SECTION_BEGIN 42 | void vStoreDSRAMContextWithWFI( void ) /* __attribute__ (( naked )) PRIVILEGED_FUNCTION */ 43 | { 44 | __asm volatile 45 | ( 46 | " .syntax unified \n" 47 | " stmdb sp!, {r1-r11, lr} \n" /* Store reg on the stack*/ 48 | " mrs r1, psplim \n" /* r1 = PSPLIM. */ 49 | " mrs r2, control \n" /* r2 = Control. */ 50 | " adr r3,wfi_exit + 1 \n" 51 | " stmdb sp!, {r1-r3} \n" /* Store on the stack - PSPLIM, Control Return Address */ 52 | " \n" 53 | " ldr r2, =pxCurrentTCB \n" /* Read the location of pxCurrentTCB i.e. &( pxCurrentTCB ). */ 54 | " ldr r1, [r2] \n" /* Read pxCurrentTCB. */ 55 | " mrs r0, psp \n" /* Read PSP in r0. */ 56 | " str r0, [r1] \n" /* Save the new top of stack in TCB. */ 57 | " wfi \n" 58 | " isb \n" 59 | " add sp, sp, #12 \n" /* We we do not enter DSRAM pop-out PSPLIM, Control Return Address*/ 60 | "wfi_exit: dsb \n" 61 | " ldmia sp!, {r1-r11, pc} \n" 62 | ); 63 | } 64 | FREERTOS_COMMON_SECTION_END 65 | 66 | FREERTOS_COMMON_SECTION_BEGIN 67 | void vRestoreDSRAMContext( void ) 68 | { 69 | __asm volatile 70 | ( 71 | " ldr r2, pxCurrentTCBConstE1 \n" /* Read the location of pxCurrentTCB i.e. &( pxCurrentTCB ). */ 72 | " ldr r1, [r2] \n" /* Read pxCurrentTCB. */ 73 | " ldr r0, [r1] \n" /* The first item in pxCurrentTCB is the task top of stack. r0 now points to the top of stack. */ 74 | " \n" 75 | " ldmia r0!, {r1-r3} \n" /* Read from stack - r1 = PSPLIM, r2 = CONTROL, r3 = LR */ 76 | " \n" 77 | " msr psplim, r1 \n" /* Restore the PSPLIM register value for the task. */ 78 | " msr psp, r0 \n" /* restore stacks */ 79 | " ldr r0, MSPStackTop \n" 80 | " msr msp, r0 \n" 81 | " msr CONTROL, r2 \n" 82 | " isb \n" 83 | " bx r3 \n" 84 | " \n" 85 | " .align 4 \n" 86 | "pxCurrentTCBConstE1: .word pxCurrentTCB \n" 87 | "MSPStackTop: .word __StackTop \n" 88 | ); 89 | } 90 | FREERTOS_COMMON_SECTION_END 91 | /*-----------------------------------------------------------*/ 92 | -------------------------------------------------------------------------------- /Source/portable/COMPONENT_CM33/TOOLCHAIN_GCC_ARM/portdsram.h: -------------------------------------------------------------------------------- 1 | /* 2 | * FreeRTOS Kernel V10.5.0 3 | * Copyright (C) 2021 Amazon.com, Inc. or its affiliates. All Rights Reserved. 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining a copy of 6 | * this software and associated documentation files (the "Software"), to deal in 7 | * the Software without restriction, including without limitation the rights to 8 | * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 9 | * the Software, and to permit persons to whom the Software is furnished to do so, 10 | * subject to the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be included in all 13 | * copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 17 | * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 18 | * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 19 | * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 20 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | * 22 | * https://www.FreeRTOS.org 23 | * https://github.com/FreeRTOS 24 | * 25 | * 1 tab == 4 spaces! 26 | */ 27 | 28 | #ifndef __PORT_DSRAM_H__ 29 | #define __PORT_DSRAM_H__ 30 | 31 | /** 32 | * @brief Store the context before entering DS-RAM and enter WFI 33 | */ 34 | void vStoreDSRAMContextWithWFI( void ); 35 | 36 | /** 37 | * @brief Restore the context after wake up from DS-RAM(System will go through Warm boot) 38 | */ 39 | void vRestoreDSRAMContext( void ); 40 | 41 | 42 | #endif /* __PORT_DSRAM_H__ */ 43 | -------------------------------------------------------------------------------- /Source/portable/COMPONENT_CM33/TOOLCHAIN_GCC_ARM/portmacro.h: -------------------------------------------------------------------------------- 1 | /* 2 | * FreeRTOS Kernel V10.5.0 3 | * Copyright (C) 2021 Amazon.com, Inc. or its affiliates. All Rights Reserved. 4 | * 5 | * SPDX-License-Identifier: MIT 6 | * 7 | * Permission is hereby granted, free of charge, to any person obtaining a copy of 8 | * this software and associated documentation files (the "Software"), to deal in 9 | * the Software without restriction, including without limitation the rights to 10 | * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 11 | * the Software, and to permit persons to whom the Software is furnished to do so, 12 | * subject to the following conditions: 13 | * 14 | * The above copyright notice and this permission notice shall be included in all 15 | * copies or substantial portions of the Software. 16 | * 17 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 19 | * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 20 | * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 21 | * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 22 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 23 | * 24 | * https://www.FreeRTOS.org 25 | * https://github.com/FreeRTOS 26 | * 27 | */ 28 | 29 | #ifndef PORTMACRO_H 30 | #define PORTMACRO_H 31 | 32 | #ifdef __cplusplus 33 | extern "C" { 34 | #endif 35 | 36 | #include "portmacrocommon.h" 37 | 38 | /*------------------------------------------------------------------------------ 39 | * Port specific definitions. 40 | * 41 | * The settings in this file configure FreeRTOS correctly for the given hardware 42 | * and compiler. 43 | * 44 | * These settings should not be altered. 45 | *------------------------------------------------------------------------------ 46 | */ 47 | 48 | /** 49 | * Architecture specifics. 50 | */ 51 | #define portARCH_NAME "Cortex-M33" 52 | #define portDONT_DISCARD __attribute__( ( used ) ) 53 | /*-----------------------------------------------------------*/ 54 | 55 | /** 56 | * @brief Critical section management. 57 | */ 58 | #define portDISABLE_INTERRUPTS() ulSetInterruptMask() 59 | #define portENABLE_INTERRUPTS() vClearInterruptMask( 0 ) 60 | /*-----------------------------------------------------------*/ 61 | 62 | #ifdef __cplusplus 63 | } 64 | #endif 65 | 66 | #endif /* PORTMACRO_H */ 67 | -------------------------------------------------------------------------------- /Source/portable/COMPONENT_CM33/TOOLCHAIN_IAR/portasm.h: -------------------------------------------------------------------------------- 1 | /* 2 | * FreeRTOS Kernel V10.5.0 3 | * Copyright (C) 2021 Amazon.com, Inc. or its affiliates. All Rights Reserved. 4 | * 5 | * SPDX-License-Identifier: MIT 6 | * 7 | * Permission is hereby granted, free of charge, to any person obtaining a copy of 8 | * this software and associated documentation files (the "Software"), to deal in 9 | * the Software without restriction, including without limitation the rights to 10 | * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 11 | * the Software, and to permit persons to whom the Software is furnished to do so, 12 | * subject to the following conditions: 13 | * 14 | * The above copyright notice and this permission notice shall be included in all 15 | * copies or substantial portions of the Software. 16 | * 17 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 19 | * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 20 | * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 21 | * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 22 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 23 | * 24 | * https://www.FreeRTOS.org 25 | * https://github.com/FreeRTOS 26 | * 27 | */ 28 | 29 | #ifndef __PORT_ASM_H__ 30 | #define __PORT_ASM_H__ 31 | 32 | /* Scheduler includes. */ 33 | #include "FreeRTOS.h" 34 | 35 | /* MPU wrappers includes. */ 36 | #include "mpu_wrappers.h" 37 | 38 | /** 39 | * @brief Restore the context of the first task so that the first task starts 40 | * executing. 41 | */ 42 | void vRestoreContextOfFirstTask( void ) __attribute__( ( naked ) ) PRIVILEGED_FUNCTION; 43 | 44 | /** 45 | * @brief Checks whether or not the processor is privileged. 46 | * 47 | * @return 1 if the processor is already privileged, 0 otherwise. 48 | */ 49 | BaseType_t xIsPrivileged( void ) __attribute__( ( naked ) ); 50 | 51 | /** 52 | * @brief Raises the privilege level by clearing the bit 0 of the CONTROL 53 | * register. 54 | * 55 | * @note This is a privileged function and should only be called from the kenrel 56 | * code. 57 | * 58 | * Bit 0 of the CONTROL register defines the privilege level of Thread Mode. 59 | * Bit[0] = 0 --> The processor is running privileged 60 | * Bit[0] = 1 --> The processor is running unprivileged. 61 | */ 62 | void vRaisePrivilege( void ) __attribute__( ( naked ) ) PRIVILEGED_FUNCTION; 63 | 64 | /** 65 | * @brief Lowers the privilege level by setting the bit 0 of the CONTROL 66 | * register. 67 | * 68 | * Bit 0 of the CONTROL register defines the privilege level of Thread Mode. 69 | * Bit[0] = 0 --> The processor is running privileged 70 | * Bit[0] = 1 --> The processor is running unprivileged. 71 | */ 72 | void vResetPrivilege( void ) __attribute__( ( naked ) ); 73 | 74 | /** 75 | * @brief Starts the first task. 76 | */ 77 | void vStartFirstTask( void ) __attribute__( ( naked ) ) PRIVILEGED_FUNCTION; 78 | 79 | /** 80 | * @brief Disables interrupts. 81 | */ 82 | uint32_t ulSetInterruptMask( void ) __attribute__( ( naked ) ) PRIVILEGED_FUNCTION; 83 | 84 | /** 85 | * @brief Enables interrupts. 86 | */ 87 | void vClearInterruptMask( uint32_t ulMask ) __attribute__( ( naked ) ) PRIVILEGED_FUNCTION; 88 | 89 | /** 90 | * @brief PendSV Exception handler. 91 | */ 92 | void PendSV_Handler( void ) __attribute__( ( naked ) ) PRIVILEGED_FUNCTION; 93 | 94 | /** 95 | * @brief SVC Handler. 96 | */ 97 | void SVC_Handler( void ) __attribute__( ( naked ) ) PRIVILEGED_FUNCTION; 98 | 99 | /** 100 | * @brief Allocate a Secure context for the calling task. 101 | * 102 | * @param[in] ulSecureStackSize The size of the stack to be allocated on the 103 | * secure side for the calling task. 104 | */ 105 | void vPortAllocateSecureContext( uint32_t ulSecureStackSize ) __attribute__( ( naked ) ); 106 | 107 | /** 108 | * @brief Free the task's secure context. 109 | * 110 | * @param[in] pulTCB Pointer to the Task Control Block (TCB) of the task. 111 | */ 112 | void vPortFreeSecureContext( uint32_t * pulTCB ) __attribute__( ( naked ) ) PRIVILEGED_FUNCTION; 113 | 114 | #endif /* __PORT_ASM_H__ */ 115 | -------------------------------------------------------------------------------- /Source/portable/COMPONENT_CM33/TOOLCHAIN_IAR/portdsram.s: -------------------------------------------------------------------------------- 1 | /* 2 | * FreeRTOS Kernel V10.5.0 3 | * Copyright (C) 2021 Amazon.com, Inc. or its affiliates. All Rights Reserved. 4 | * 5 | * SPDX-License-Identifier: MIT 6 | * 7 | * Permission is hereby granted, free of charge, to any person obtaining a copy of 8 | * this software and associated documentation files (the "Software"), to deal in 9 | * the Software without restriction, including without limitation the rights to 10 | * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 11 | * the Software, and to permit persons to whom the Software is furnished to do so, 12 | * subject to the following conditions: 13 | * 14 | * The above copyright notice and this permission notice shall be included in all 15 | * copies or substantial portions of the Software. 16 | * 17 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 19 | * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 20 | * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 21 | * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 22 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 23 | * 24 | * https://www.FreeRTOS.org 25 | * https://github.com/FreeRTOS 26 | * 27 | */ 28 | /* Including FreeRTOSConfig.h here will cause build errors if the header file 29 | contains code not understood by the assembler - for example the 'extern' keyword. 30 | To avoid errors place any such code inside a #ifdef __ICCARM__/#endif block so 31 | the code is included in C files but excluded by the preprocessor in assembly 32 | files (__ICCARM__ is defined by the IAR C compiler but not by the IAR assembler. */ 33 | #include "FreeRTOSConfig.h" 34 | 35 | EXTERN pxCurrentTCB 36 | EXTERN CSTACK$$Limit 37 | EXTERN CSTACK$$Base 38 | 39 | PUBLIC vStoreDSRAMContextWithWFI 40 | PUBLIC vRestoreDSRAMContext 41 | 42 | /*-----------------------------------------------------------*/ 43 | 44 | SECTION .cy_os_common:CODE:NOROOT(2) 45 | THUMB 46 | /*-----------------------------------------------------------*/ 47 | vStoreDSRAMContextWithWFI: 48 | stmdb sp!, {r1-r11, lr} /* Store reg on the stack*/ 49 | mrs r1, psplim /* r1 = PSPLIM. */ 50 | mrs r2, control /* r2 = Control. */ 51 | adr r3, wfi_exit+4 52 | stmdb sp!, {r1-r3} /* Store on the stack - PSPLIM, Control and Return Address */ 53 | ldr r2, =pxCurrentTCB /* Read the location of pxCurrentTCB i.e. &( pxCurrentTCB ). */ 54 | ldr r1, [r2] /* Read pxCurrentTCB. */ 55 | mrs r0, psp /* Read PSP in r0 */ 56 | str r0, [r1] /* Save the new top of stack in TCB. */ 57 | wfi 58 | isb 59 | add sp, sp, #12 /* We do not enter DSRAM pop-out PSPLIM, Control, Return Address*/ 60 | wfi_exit: 61 | dsb 62 | ldmia sp!, {r1-r11, pc} 63 | /*-----------------------------------------------------------*/ 64 | 65 | vRestoreDSRAMContext: 66 | ldr r2, =pxCurrentTCB /* Read the location of pxCurrentTCB i.e. &( pxCurrentTCB ). */ 67 | ldr r1, [r2] /* Read pxCurrentTCB. */ 68 | ldr r0, [r1] /* The first item in pxCurrentTCB is the task top of stack. r0 now points to the top of stack. */ 69 | ldmia r0!, {r1-r3} /* Read from stack - r1 = PSPLIM, r2 = CONTROL, r3 = LR */ 70 | msr psplim, r1 /* Restore the PSPLIM register value for the task. */ 71 | msr psp, r0 /* restore stacks */ 72 | ldr r0, =CSTACK$$Limit 73 | msr msp, r0 74 | ldr r1, =CSTACK$$Base 75 | msr msplim, r1 76 | msr CONTROL, r2 77 | isb 78 | bx r3 79 | /*-----------------------------------------------------------*/ 80 | 81 | END 82 | -------------------------------------------------------------------------------- /Source/portable/COMPONENT_CM33/TOOLCHAIN_IAR/portmacro.h: -------------------------------------------------------------------------------- 1 | /* 2 | * FreeRTOS Kernel V10.5.0 3 | * Copyright (C) 2021 Amazon.com, Inc. or its affiliates. All Rights Reserved. 4 | * 5 | * SPDX-License-Identifier: MIT 6 | * 7 | * Permission is hereby granted, free of charge, to any person obtaining a copy of 8 | * this software and associated documentation files (the "Software"), to deal in 9 | * the Software without restriction, including without limitation the rights to 10 | * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 11 | * the Software, and to permit persons to whom the Software is furnished to do so, 12 | * subject to the following conditions: 13 | * 14 | * The above copyright notice and this permission notice shall be included in all 15 | * copies or substantial portions of the Software. 16 | * 17 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 19 | * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 20 | * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 21 | * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 22 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 23 | * 24 | * https://www.FreeRTOS.org 25 | * https://github.com/FreeRTOS 26 | * 27 | */ 28 | 29 | #ifndef PORTMACRO_H 30 | #define PORTMACRO_H 31 | 32 | #ifdef __cplusplus 33 | extern "C" { 34 | #endif 35 | 36 | #include "portmacrocommon.h" 37 | 38 | /*------------------------------------------------------------------------------ 39 | * Port specific definitions. 40 | * 41 | * The settings in this file configure FreeRTOS correctly for the given hardware 42 | * and compiler. 43 | * 44 | * These settings should not be altered. 45 | *------------------------------------------------------------------------------ 46 | */ 47 | 48 | /** 49 | * Architecture specifics. 50 | */ 51 | #define portARCH_NAME "Cortex-M33" 52 | #define portDONT_DISCARD __root 53 | /*-----------------------------------------------------------*/ 54 | 55 | #if( configTOTAL_MPU_REGIONS == 16 ) 56 | #error 16 MPU regions are not yet supported for this port. 57 | #endif 58 | /*-----------------------------------------------------------*/ 59 | 60 | /** 61 | * @brief Critical section management. 62 | */ 63 | #define portDISABLE_INTERRUPTS() ulSetInterruptMask() 64 | #define portENABLE_INTERRUPTS() vClearInterruptMask( 0 ) 65 | /*-----------------------------------------------------------*/ 66 | 67 | /* Suppress warnings that are generated by the IAR tools, but cannot be fixed in 68 | * the source code because to do so would cause other compilers to generate 69 | * warnings. */ 70 | #pragma diag_suppress=Be006 71 | #pragma diag_suppress=Pa082 72 | /*-----------------------------------------------------------*/ 73 | 74 | #ifdef __cplusplus 75 | } 76 | #endif 77 | 78 | #endif /* PORTMACRO_H */ 79 | -------------------------------------------------------------------------------- /Source/portable/COMPONENT_CM4/TOOLCHAIN_IAR/portasm.s: -------------------------------------------------------------------------------- 1 | /* 2 | * FreeRTOS Kernel V10.5.0 3 | * Copyright (C) 2021 Amazon.com, Inc. or its affiliates. All Rights Reserved. 4 | * 5 | * SPDX-License-Identifier: MIT 6 | * Copyright (C) 2019-2024 Cypress Semiconductor Corporation, or a subsidiary of 7 | * Cypress Semiconductor Corporation. All Rights Reserved. 8 | * 9 | * Updated function names to be compliant with CMSIS standard names. 10 | * 11 | * Permission is hereby granted, free of charge, to any person obtaining a copy of 12 | * this software and associated documentation files (the "Software"), to deal in 13 | * the Software without restriction, including without limitation the rights to 14 | * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 15 | * the Software, and to permit persons to whom the Software is furnished to do so, 16 | * subject to the following conditions: 17 | * 18 | * The above copyright notice and this permission notice shall be included in all 19 | * copies or substantial portions of the Software. 20 | * 21 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 22 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 23 | * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 24 | * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 25 | * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 26 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 27 | * 28 | * https://www.FreeRTOS.org 29 | * https://github.com/FreeRTOS 30 | * http://www.cypress.com 31 | * 32 | */ 33 | 34 | RSEG CODE:CODE(2) 35 | thumb 36 | 37 | EXTERN pxCurrentTCB 38 | EXTERN vTaskSwitchContext 39 | 40 | PUBLIC PendSV_Handler 41 | PUBLIC SVC_Handler 42 | PUBLIC vPortStartFirstTask 43 | PUBLIC vPortEnableVFP 44 | 45 | 46 | /*-----------------------------------------------------------*/ 47 | 48 | PendSV_Handler: 49 | mrs r0, psp 50 | isb 51 | /* Get the location of the current TCB. */ 52 | ldr r3, =pxCurrentTCB 53 | ldr r2, [r3] 54 | 55 | /* Is the task using the FPU context? If so, push high vfp registers. */ 56 | tst r14, #0x10 57 | it eq 58 | vstmdbeq r0!, {s16-s31} 59 | 60 | /* Save the core registers. */ 61 | stmdb r0!, {r4-r11, r14} 62 | 63 | /* Save the new top of stack into the first member of the TCB. */ 64 | str r0, [r2] 65 | 66 | stmdb sp!, {r0, r3} 67 | /* value MUST be equal to configMAX_SYSCALL_INTERRUPT_PRIORITY */ 68 | mov r0, #0x3F 69 | msr basepri, r0 70 | dsb 71 | isb 72 | bl vTaskSwitchContext 73 | mov r0, #0 74 | msr basepri, r0 75 | ldmia sp!, {r0, r3} 76 | 77 | /* The first item in pxCurrentTCB is the task top of stack. */ 78 | ldr r1, [r3] 79 | ldr r0, [r1] 80 | 81 | /* Pop the core registers. */ 82 | ldmia r0!, {r4-r11, r14} 83 | 84 | /* Is the task using the FPU context? If so, pop the high vfp registers 85 | too. */ 86 | tst r14, #0x10 87 | it eq 88 | vldmiaeq r0!, {s16-s31} 89 | 90 | msr psp, r0 91 | isb 92 | #ifdef WORKAROUND_PMU_CM001 /* XMC4000 specific errata */ 93 | #if WORKAROUND_PMU_CM001 == 1 94 | push { r14 } 95 | pop { pc } 96 | #endif 97 | #endif 98 | 99 | bx r14 100 | 101 | 102 | /*-----------------------------------------------------------*/ 103 | 104 | SVC_Handler: 105 | /* Get the location of the current TCB. */ 106 | ldr r3, =pxCurrentTCB 107 | ldr r1, [r3] 108 | ldr r0, [r1] 109 | /* Pop the core registers. */ 110 | ldmia r0!, {r4-r11, r14} 111 | msr psp, r0 112 | isb 113 | mov r0, #0 114 | msr basepri, r0 115 | bx r14 116 | 117 | /*-----------------------------------------------------------*/ 118 | 119 | vPortStartFirstTask 120 | /* Use the NVIC offset register to locate the stack. */ 121 | ldr r0, =0xE000ED08 122 | ldr r0, [r0] 123 | ldr r0, [r0] 124 | /* Set the msp back to the start of the stack. */ 125 | msr msp, r0 126 | /* Clear the bit that indicates the FPU is in use in case the FPU was used 127 | before the scheduler was started - which would otherwise result in the 128 | unnecessary leaving of space in the SVC stack for lazy saving of FPU 129 | registers. */ 130 | mov r0, #0 131 | msr control, r0 132 | /* Call SVC to start the first task. */ 133 | cpsie i 134 | cpsie f 135 | dsb 136 | isb 137 | svc 0 138 | 139 | /*-----------------------------------------------------------*/ 140 | 141 | vPortEnableVFP: 142 | /* The FPU enable bits are in the CPACR. */ 143 | ldr.w r0, =0xE000ED88 144 | ldr r1, [r0] 145 | 146 | /* Enable CP10 and CP11 coprocessors, then save back. */ 147 | orr r1, r1, #( 0xf << 20 ) 148 | str r1, [r0] 149 | bx r14 150 | 151 | 152 | 153 | END 154 | 155 | -------------------------------------------------------------------------------- /Source/portable/COMPONENT_CM55/TOOLCHAIN_ARM/portasm.h: -------------------------------------------------------------------------------- 1 | /* 2 | * FreeRTOS Kernel V10.5.0 3 | * Copyright (C) 2021 Amazon.com, Inc. or its affiliates. All Rights Reserved. 4 | * 5 | * SPDX-License-Identifier: MIT 6 | * 7 | * Permission is hereby granted, free of charge, to any person obtaining a copy of 8 | * this software and associated documentation files (the "Software"), to deal in 9 | * the Software without restriction, including without limitation the rights to 10 | * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 11 | * the Software, and to permit persons to whom the Software is furnished to do so, 12 | * subject to the following conditions: 13 | * 14 | * The above copyright notice and this permission notice shall be included in all 15 | * copies or substantial portions of the Software. 16 | * 17 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 19 | * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 20 | * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 21 | * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 22 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 23 | * 24 | * https://www.FreeRTOS.org 25 | * https://github.com/FreeRTOS 26 | * 27 | */ 28 | 29 | #ifndef __PORT_ASM_H__ 30 | #define __PORT_ASM_H__ 31 | 32 | /* Scheduler includes. */ 33 | #include "FreeRTOS.h" 34 | 35 | /* MPU wrappers includes. */ 36 | #include "mpu_wrappers.h" 37 | 38 | /** 39 | * @brief Restore the context of the first task so that the first task starts 40 | * executing. 41 | */ 42 | void vRestoreContextOfFirstTask( void ) __attribute__( ( naked ) ) PRIVILEGED_FUNCTION; 43 | 44 | /** 45 | * @brief Checks whether or not the processor is privileged. 46 | * 47 | * @return 1 if the processor is already privileged, 0 otherwise. 48 | */ 49 | BaseType_t xIsPrivileged( void ) __attribute__( ( naked ) ); 50 | 51 | /** 52 | * @brief Raises the privilege level by clearing the bit 0 of the CONTROL 53 | * register. 54 | * 55 | * @note This is a privileged function and should only be called from the kenrel 56 | * code. 57 | * 58 | * Bit 0 of the CONTROL register defines the privilege level of Thread Mode. 59 | * Bit[0] = 0 --> The processor is running privileged 60 | * Bit[0] = 1 --> The processor is running unprivileged. 61 | */ 62 | void vRaisePrivilege( void ) __attribute__( ( naked ) ) PRIVILEGED_FUNCTION; 63 | 64 | /** 65 | * @brief Lowers the privilege level by setting the bit 0 of the CONTROL 66 | * register. 67 | * 68 | * Bit 0 of the CONTROL register defines the privilege level of Thread Mode. 69 | * Bit[0] = 0 --> The processor is running privileged 70 | * Bit[0] = 1 --> The processor is running unprivileged. 71 | */ 72 | void vResetPrivilege( void ) __attribute__( ( naked ) ); 73 | 74 | /** 75 | * @brief Starts the first task. 76 | */ 77 | void vStartFirstTask( void ) __attribute__( ( naked ) ) PRIVILEGED_FUNCTION; 78 | 79 | /** 80 | * @brief Disables interrupts. 81 | */ 82 | uint32_t ulSetInterruptMask( void ) __attribute__( ( naked ) ) PRIVILEGED_FUNCTION; 83 | 84 | /** 85 | * @brief Enables interrupts. 86 | */ 87 | void vClearInterruptMask( uint32_t ulMask ) __attribute__( ( naked ) ) PRIVILEGED_FUNCTION; 88 | 89 | /** 90 | * @brief PendSV Exception handler. 91 | */ 92 | void PendSV_Handler( void ) __attribute__( ( naked ) ) PRIVILEGED_FUNCTION; 93 | 94 | /** 95 | * @brief SVC Handler. 96 | */ 97 | void SVC_Handler( void ) __attribute__( ( naked ) ) PRIVILEGED_FUNCTION; 98 | 99 | /** 100 | * @brief Allocate a Secure context for the calling task. 101 | * 102 | * @param[in] ulSecureStackSize The size of the stack to be allocated on the 103 | * secure side for the calling task. 104 | */ 105 | void vPortAllocateSecureContext( uint32_t ulSecureStackSize ) __attribute__( ( naked ) ); 106 | 107 | /** 108 | * @brief Free the task's secure context. 109 | * 110 | * @param[in] pulTCB Pointer to the Task Control Block (TCB) of the task. 111 | */ 112 | void vPortFreeSecureContext( uint32_t * pulTCB ) __attribute__( ( naked ) ) PRIVILEGED_FUNCTION; 113 | 114 | #endif /* __PORT_ASM_H__ */ 115 | -------------------------------------------------------------------------------- /Source/portable/COMPONENT_CM55/TOOLCHAIN_ARM/portmacro.h: -------------------------------------------------------------------------------- 1 | /* 2 | * FreeRTOS Kernel V10.5.0 3 | * Copyright (C) 2021 Amazon.com, Inc. or its affiliates. All Rights Reserved. 4 | * 5 | * SPDX-License-Identifier: MIT 6 | * 7 | * Permission is hereby granted, free of charge, to any person obtaining a copy of 8 | * this software and associated documentation files (the "Software"), to deal in 9 | * the Software without restriction, including without limitation the rights to 10 | * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 11 | * the Software, and to permit persons to whom the Software is furnished to do so, 12 | * subject to the following conditions: 13 | * 14 | * The above copyright notice and this permission notice shall be included in all 15 | * copies or substantial portions of the Software. 16 | * 17 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 19 | * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 20 | * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 21 | * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 22 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 23 | * 24 | * https://www.FreeRTOS.org 25 | * https://github.com/FreeRTOS 26 | * 27 | */ 28 | 29 | #ifndef PORTMACRO_H 30 | #define PORTMACRO_H 31 | 32 | #ifdef __cplusplus 33 | extern "C" { 34 | #endif 35 | 36 | #include "portmacrocommon.h" 37 | 38 | /*------------------------------------------------------------------------------ 39 | * Port specific definitions. 40 | * 41 | * The settings in this file configure FreeRTOS correctly for the given hardware 42 | * and compiler. 43 | * 44 | * These settings should not be altered. 45 | *------------------------------------------------------------------------------ 46 | */ 47 | 48 | #ifndef configENABLE_MVE 49 | #error configENABLE_MVE must be defined in FreeRTOSConfig.h. Set configENABLE_MVE to 1 to enable the MVE or 0 to disable the MVE. 50 | #endif /* configENABLE_MVE */ 51 | /*-----------------------------------------------------------*/ 52 | 53 | /** 54 | * Architecture specifics. 55 | */ 56 | #define portARCH_NAME "Cortex-M55" 57 | #define portDONT_DISCARD __attribute__( ( used ) ) 58 | /*-----------------------------------------------------------*/ 59 | 60 | /** 61 | * @brief Critical section management. 62 | */ 63 | #define portDISABLE_INTERRUPTS() ulSetInterruptMask() 64 | #define portENABLE_INTERRUPTS() vClearInterruptMask( 0 ) 65 | /*-----------------------------------------------------------*/ 66 | 67 | #ifdef __cplusplus 68 | } 69 | #endif 70 | 71 | #endif /* PORTMACRO_H */ 72 | -------------------------------------------------------------------------------- /Source/portable/COMPONENT_CM55/TOOLCHAIN_GCC_ARM/portasm.h: -------------------------------------------------------------------------------- 1 | /* 2 | * FreeRTOS Kernel V10.5.0 3 | * Copyright (C) 2021 Amazon.com, Inc. or its affiliates. All Rights Reserved. 4 | * 5 | * SPDX-License-Identifier: MIT 6 | * 7 | * Permission is hereby granted, free of charge, to any person obtaining a copy of 8 | * this software and associated documentation files (the "Software"), to deal in 9 | * the Software without restriction, including without limitation the rights to 10 | * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 11 | * the Software, and to permit persons to whom the Software is furnished to do so, 12 | * subject to the following conditions: 13 | * 14 | * The above copyright notice and this permission notice shall be included in all 15 | * copies or substantial portions of the Software. 16 | * 17 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 19 | * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 20 | * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 21 | * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 22 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 23 | * 24 | * https://www.FreeRTOS.org 25 | * https://github.com/FreeRTOS 26 | * 27 | */ 28 | 29 | #ifndef __PORT_ASM_H__ 30 | #define __PORT_ASM_H__ 31 | 32 | /* Scheduler includes. */ 33 | #include "FreeRTOS.h" 34 | 35 | /* MPU wrappers includes. */ 36 | #include "mpu_wrappers.h" 37 | 38 | /** 39 | * @brief Restore the context of the first task so that the first task starts 40 | * executing. 41 | */ 42 | void vRestoreContextOfFirstTask( void ) __attribute__( ( naked ) ) PRIVILEGED_FUNCTION; 43 | 44 | /** 45 | * @brief Checks whether or not the processor is privileged. 46 | * 47 | * @return 1 if the processor is already privileged, 0 otherwise. 48 | */ 49 | BaseType_t xIsPrivileged( void ) __attribute__( ( naked ) ); 50 | 51 | /** 52 | * @brief Raises the privilege level by clearing the bit 0 of the CONTROL 53 | * register. 54 | * 55 | * @note This is a privileged function and should only be called from the kenrel 56 | * code. 57 | * 58 | * Bit 0 of the CONTROL register defines the privilege level of Thread Mode. 59 | * Bit[0] = 0 --> The processor is running privileged 60 | * Bit[0] = 1 --> The processor is running unprivileged. 61 | */ 62 | void vRaisePrivilege( void ) __attribute__( ( naked ) ) PRIVILEGED_FUNCTION; 63 | 64 | /** 65 | * @brief Lowers the privilege level by setting the bit 0 of the CONTROL 66 | * register. 67 | * 68 | * Bit 0 of the CONTROL register defines the privilege level of Thread Mode. 69 | * Bit[0] = 0 --> The processor is running privileged 70 | * Bit[0] = 1 --> The processor is running unprivileged. 71 | */ 72 | void vResetPrivilege( void ) __attribute__( ( naked ) ); 73 | 74 | /** 75 | * @brief Starts the first task. 76 | */ 77 | void vStartFirstTask( void ) __attribute__( ( naked ) ) PRIVILEGED_FUNCTION; 78 | 79 | /** 80 | * @brief Disables interrupts. 81 | */ 82 | uint32_t ulSetInterruptMask( void ) __attribute__( ( naked ) ) PRIVILEGED_FUNCTION; 83 | 84 | /** 85 | * @brief Enables interrupts. 86 | */ 87 | void vClearInterruptMask( uint32_t ulMask ) __attribute__( ( naked ) ) PRIVILEGED_FUNCTION; 88 | 89 | /** 90 | * @brief PendSV Exception handler. 91 | */ 92 | void PendSV_Handler( void ) __attribute__( ( naked ) ) PRIVILEGED_FUNCTION; 93 | 94 | /** 95 | * @brief SVC Handler. 96 | */ 97 | void SVC_Handler( void ) __attribute__( ( naked ) ) PRIVILEGED_FUNCTION; 98 | 99 | /** 100 | * @brief Allocate a Secure context for the calling task. 101 | * 102 | * @param[in] ulSecureStackSize The size of the stack to be allocated on the 103 | * secure side for the calling task. 104 | */ 105 | void vPortAllocateSecureContext( uint32_t ulSecureStackSize ) __attribute__( ( naked ) ); 106 | 107 | /** 108 | * @brief Free the task's secure context. 109 | * 110 | * @param[in] pulTCB Pointer to the Task Control Block (TCB) of the task. 111 | */ 112 | void vPortFreeSecureContext( uint32_t * pulTCB ) __attribute__( ( naked ) ) PRIVILEGED_FUNCTION; 113 | 114 | #endif /* __PORT_ASM_H__ */ 115 | -------------------------------------------------------------------------------- /Source/portable/COMPONENT_CM55/TOOLCHAIN_GCC_ARM/portmacro.h: -------------------------------------------------------------------------------- 1 | /* 2 | * FreeRTOS Kernel V10.5.0 3 | * Copyright (C) 2021 Amazon.com, Inc. or its affiliates. All Rights Reserved. 4 | * 5 | * SPDX-License-Identifier: MIT 6 | * 7 | * Permission is hereby granted, free of charge, to any person obtaining a copy of 8 | * this software and associated documentation files (the "Software"), to deal in 9 | * the Software without restriction, including without limitation the rights to 10 | * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 11 | * the Software, and to permit persons to whom the Software is furnished to do so, 12 | * subject to the following conditions: 13 | * 14 | * The above copyright notice and this permission notice shall be included in all 15 | * copies or substantial portions of the Software. 16 | * 17 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 19 | * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 20 | * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 21 | * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 22 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 23 | * 24 | * https://www.FreeRTOS.org 25 | * https://github.com/FreeRTOS 26 | * 27 | */ 28 | 29 | #ifndef PORTMACRO_H 30 | #define PORTMACRO_H 31 | 32 | #ifdef __cplusplus 33 | extern "C" { 34 | #endif 35 | 36 | #include "portmacrocommon.h" 37 | 38 | /*------------------------------------------------------------------------------ 39 | * Port specific definitions. 40 | * 41 | * The settings in this file configure FreeRTOS correctly for the given hardware 42 | * and compiler. 43 | * 44 | * These settings should not be altered. 45 | *------------------------------------------------------------------------------ 46 | */ 47 | 48 | #ifndef configENABLE_MVE 49 | #error configENABLE_MVE must be defined in FreeRTOSConfig.h. Set configENABLE_MVE to 1 to enable the MVE or 0 to disable the MVE. 50 | #endif /* configENABLE_MVE */ 51 | /*-----------------------------------------------------------*/ 52 | 53 | /** 54 | * Architecture specifics. 55 | */ 56 | #define portARCH_NAME "Cortex-M55" 57 | #define portDONT_DISCARD __attribute__( ( used ) ) 58 | /*-----------------------------------------------------------*/ 59 | 60 | /** 61 | * @brief Critical section management. 62 | */ 63 | #define portDISABLE_INTERRUPTS() ulSetInterruptMask() 64 | #define portENABLE_INTERRUPTS() vClearInterruptMask( 0 ) 65 | /*-----------------------------------------------------------*/ 66 | 67 | #ifdef __cplusplus 68 | } 69 | #endif 70 | 71 | #endif /* PORTMACRO_H */ 72 | -------------------------------------------------------------------------------- /Source/portable/COMPONENT_CM55/TOOLCHAIN_IAR/portasm.h: -------------------------------------------------------------------------------- 1 | /* 2 | * FreeRTOS Kernel V10.5.0 3 | * Copyright (C) 2021 Amazon.com, Inc. or its affiliates. All Rights Reserved. 4 | * 5 | * SPDX-License-Identifier: MIT 6 | * 7 | * Permission is hereby granted, free of charge, to any person obtaining a copy of 8 | * this software and associated documentation files (the "Software"), to deal in 9 | * the Software without restriction, including without limitation the rights to 10 | * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 11 | * the Software, and to permit persons to whom the Software is furnished to do so, 12 | * subject to the following conditions: 13 | * 14 | * The above copyright notice and this permission notice shall be included in all 15 | * copies or substantial portions of the Software. 16 | * 17 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 19 | * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 20 | * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 21 | * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 22 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 23 | * 24 | * https://www.FreeRTOS.org 25 | * https://github.com/FreeRTOS 26 | * 27 | */ 28 | 29 | #ifndef __PORT_ASM_H__ 30 | #define __PORT_ASM_H__ 31 | 32 | /* Scheduler includes. */ 33 | #include "FreeRTOS.h" 34 | 35 | /* MPU wrappers includes. */ 36 | #include "mpu_wrappers.h" 37 | 38 | /** 39 | * @brief Restore the context of the first task so that the first task starts 40 | * executing. 41 | */ 42 | void vRestoreContextOfFirstTask( void ) __attribute__( ( naked ) ) PRIVILEGED_FUNCTION; 43 | 44 | /** 45 | * @brief Checks whether or not the processor is privileged. 46 | * 47 | * @return 1 if the processor is already privileged, 0 otherwise. 48 | */ 49 | BaseType_t xIsPrivileged( void ) __attribute__( ( naked ) ); 50 | 51 | /** 52 | * @brief Raises the privilege level by clearing the bit 0 of the CONTROL 53 | * register. 54 | * 55 | * @note This is a privileged function and should only be called from the kenrel 56 | * code. 57 | * 58 | * Bit 0 of the CONTROL register defines the privilege level of Thread Mode. 59 | * Bit[0] = 0 --> The processor is running privileged 60 | * Bit[0] = 1 --> The processor is running unprivileged. 61 | */ 62 | void vRaisePrivilege( void ) __attribute__( ( naked ) ) PRIVILEGED_FUNCTION; 63 | 64 | /** 65 | * @brief Lowers the privilege level by setting the bit 0 of the CONTROL 66 | * register. 67 | * 68 | * Bit 0 of the CONTROL register defines the privilege level of Thread Mode. 69 | * Bit[0] = 0 --> The processor is running privileged 70 | * Bit[0] = 1 --> The processor is running unprivileged. 71 | */ 72 | void vResetPrivilege( void ) __attribute__( ( naked ) ); 73 | 74 | /** 75 | * @brief Starts the first task. 76 | */ 77 | void vStartFirstTask( void ) __attribute__( ( naked ) ) PRIVILEGED_FUNCTION; 78 | 79 | /** 80 | * @brief Disables interrupts. 81 | */ 82 | uint32_t ulSetInterruptMask( void ) __attribute__( ( naked ) ) PRIVILEGED_FUNCTION; 83 | 84 | /** 85 | * @brief Enables interrupts. 86 | */ 87 | void vClearInterruptMask( uint32_t ulMask ) __attribute__( ( naked ) ) PRIVILEGED_FUNCTION; 88 | 89 | /** 90 | * @brief PendSV Exception handler. 91 | */ 92 | void PendSV_Handler( void ) __attribute__( ( naked ) ) PRIVILEGED_FUNCTION; 93 | 94 | /** 95 | * @brief SVC Handler. 96 | */ 97 | void SVC_Handler( void ) __attribute__( ( naked ) ) PRIVILEGED_FUNCTION; 98 | 99 | /** 100 | * @brief Allocate a Secure context for the calling task. 101 | * 102 | * @param[in] ulSecureStackSize The size of the stack to be allocated on the 103 | * secure side for the calling task. 104 | */ 105 | void vPortAllocateSecureContext( uint32_t ulSecureStackSize ) __attribute__( ( naked ) ); 106 | 107 | /** 108 | * @brief Free the task's secure context. 109 | * 110 | * @param[in] pulTCB Pointer to the Task Control Block (TCB) of the task. 111 | */ 112 | void vPortFreeSecureContext( uint32_t * pulTCB ) __attribute__( ( naked ) ) PRIVILEGED_FUNCTION; 113 | 114 | #endif /* __PORT_ASM_H__ */ 115 | -------------------------------------------------------------------------------- /Source/portable/COMPONENT_CM55/TOOLCHAIN_IAR/portmacro.h: -------------------------------------------------------------------------------- 1 | /* 2 | * FreeRTOS Kernel V10.5.0 3 | * Copyright (C) 2021 Amazon.com, Inc. or its affiliates. All Rights Reserved. 4 | * 5 | * SPDX-License-Identifier: MIT 6 | * 7 | * Permission is hereby granted, free of charge, to any person obtaining a copy of 8 | * this software and associated documentation files (the "Software"), to deal in 9 | * the Software without restriction, including without limitation the rights to 10 | * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 11 | * the Software, and to permit persons to whom the Software is furnished to do so, 12 | * subject to the following conditions: 13 | * 14 | * The above copyright notice and this permission notice shall be included in all 15 | * copies or substantial portions of the Software. 16 | * 17 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 19 | * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 20 | * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 21 | * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 22 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 23 | * 24 | * https://www.FreeRTOS.org 25 | * https://github.com/FreeRTOS 26 | * 27 | */ 28 | 29 | #ifndef PORTMACRO_H 30 | #define PORTMACRO_H 31 | 32 | #ifdef __cplusplus 33 | extern "C" { 34 | #endif 35 | 36 | #include "portmacrocommon.h" 37 | 38 | /*------------------------------------------------------------------------------ 39 | * Port specific definitions. 40 | * 41 | * The settings in this file configure FreeRTOS correctly for the given hardware 42 | * and compiler. 43 | * 44 | * These settings should not be altered. 45 | *------------------------------------------------------------------------------ 46 | */ 47 | 48 | #ifndef configENABLE_MVE 49 | #error configENABLE_MVE must be defined in FreeRTOSConfig.h. Set configENABLE_MVE to 1 to enable the MVE or 0 to disable the MVE. 50 | #endif /* configENABLE_MVE */ 51 | /*-----------------------------------------------------------*/ 52 | 53 | /** 54 | * Architecture specifics. 55 | */ 56 | #define portARCH_NAME "Cortex-M55" 57 | #define portDONT_DISCARD __root 58 | /*-----------------------------------------------------------*/ 59 | 60 | #if( configTOTAL_MPU_REGIONS == 16 ) 61 | #error 16 MPU regions are not yet supported for this port. 62 | #endif 63 | /*-----------------------------------------------------------*/ 64 | 65 | /** 66 | * @brief Critical section management. 67 | */ 68 | #define portDISABLE_INTERRUPTS() ulSetInterruptMask() 69 | #define portENABLE_INTERRUPTS() vClearInterruptMask( 0 ) 70 | /*-----------------------------------------------------------*/ 71 | 72 | /* Suppress warnings that are generated by the IAR tools, but cannot be fixed in 73 | * the source code because to do so would cause other compilers to generate 74 | * warnings. */ 75 | #pragma diag_suppress=Be006 76 | #pragma diag_suppress=Pa082 77 | /*-----------------------------------------------------------*/ 78 | 79 | #ifdef __cplusplus 80 | } 81 | #endif 82 | 83 | #endif /* PORTMACRO_H */ 84 | -------------------------------------------------------------------------------- /Source/portable/COMPONENT_CM7/TOOLCHAIN_IAR/portasm.s: -------------------------------------------------------------------------------- 1 | /* 2 | * FreeRTOS Kernel V10.5.0 3 | * Copyright (C) 2021 Amazon.com, Inc. or its affiliates. All Rights Reserved. 4 | * 5 | * SPDX-License-Identifier: MIT 6 | * 7 | * Copyright (C) 2019-2024 Cypress Semiconductor Corporation, or a subsidiary of 8 | * Cypress Semiconductor Corporation. All Rights Reserved. 9 | * 10 | * Updated function names to be compliant with CMSIS standard names. 11 | * 12 | * Permission is hereby granted, free of charge, to any person obtaining a copy of 13 | * this software and associated documentation files (the "Software"), to deal in 14 | * the Software without restriction, including without limitation the rights to 15 | * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 16 | * the Software, and to permit persons to whom the Software is furnished to do so, 17 | * subject to the following conditions: 18 | * 19 | * The above copyright notice and this permission notice shall be included in all 20 | * copies or substantial portions of the Software. 21 | * 22 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 23 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 24 | * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 25 | * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 26 | * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 27 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 28 | * 29 | * https://www.FreeRTOS.org 30 | * https://github.com/FreeRTOS 31 | * http://www.cypress.com 32 | * 33 | */ 34 | 35 | RSEG CODE:CODE(2) 36 | thumb 37 | 38 | EXTERN pxCurrentTCB 39 | EXTERN vTaskSwitchContext 40 | 41 | PUBLIC PendSV_Handler 42 | PUBLIC SVC_Handler 43 | PUBLIC vPortStartFirstTask 44 | PUBLIC vPortEnableVFP 45 | 46 | 47 | /*-----------------------------------------------------------*/ 48 | 49 | PendSV_Handler: 50 | mrs r0, psp 51 | isb 52 | /* Get the location of the current TCB. */ 53 | ldr r3, =pxCurrentTCB 54 | ldr r2, [r3] 55 | 56 | /* Is the task using the FPU context? If so, push high vfp registers. */ 57 | tst r14, #0x10 58 | it eq 59 | vstmdbeq r0!, {s16-s31} 60 | 61 | /* Save the core registers. */ 62 | stmdb r0!, {r4-r11, r14} 63 | 64 | /* Save the new top of stack into the first member of the TCB. */ 65 | str r0, [r2] 66 | 67 | stmdb sp!, {r0, r3} 68 | /* value MUST be equal to configMAX_SYSCALL_INTERRUPT_PRIORITY */ 69 | mov r0, #0x3F 70 | cpsid i 71 | msr basepri, r0 72 | dsb 73 | isb 74 | cpsie i 75 | bl vTaskSwitchContext 76 | mov r0, #0 77 | msr basepri, r0 78 | ldmia sp!, {r0, r3} 79 | 80 | /* The first item in pxCurrentTCB is the task top of stack. */ 81 | ldr r1, [r3] 82 | ldr r0, [r1] 83 | 84 | /* Pop the core registers. */ 85 | ldmia r0!, {r4-r11, r14} 86 | 87 | /* Is the task using the FPU context? If so, pop the high vfp registers 88 | too. */ 89 | tst r14, #0x10 90 | it eq 91 | vldmiaeq r0!, {s16-s31} 92 | 93 | msr psp, r0 94 | isb 95 | #ifdef WORKAROUND_PMU_CM001 /* XMC4000 specific errata */ 96 | #if WORKAROUND_PMU_CM001 == 1 97 | push { r14 } 98 | pop { pc } 99 | #endif 100 | #endif 101 | 102 | bx r14 103 | 104 | 105 | /*-----------------------------------------------------------*/ 106 | 107 | SVC_Handler: 108 | /* Get the location of the current TCB. */ 109 | ldr r3, =pxCurrentTCB 110 | ldr r1, [r3] 111 | ldr r0, [r1] 112 | /* Pop the core registers. */ 113 | ldmia r0!, {r4-r11, r14} 114 | msr psp, r0 115 | isb 116 | mov r0, #0 117 | msr basepri, r0 118 | bx r14 119 | 120 | /*-----------------------------------------------------------*/ 121 | 122 | vPortStartFirstTask 123 | /* Use the NVIC offset register to locate the stack. */ 124 | ldr r0, =0xE000ED08 125 | ldr r0, [r0] 126 | ldr r0, [r0] 127 | /* Set the msp back to the start of the stack. */ 128 | msr msp, r0 129 | /* Clear the bit that indicates the FPU is in use in case the FPU was used 130 | before the scheduler was started - which would otherwise result in the 131 | unnecessary leaving of space in the SVC stack for lazy saving of FPU 132 | registers. */ 133 | mov r0, #0 134 | msr control, r0 135 | /* Call SVC to start the first task. */ 136 | cpsie i 137 | cpsie f 138 | dsb 139 | isb 140 | svc 0 141 | 142 | /*-----------------------------------------------------------*/ 143 | 144 | vPortEnableVFP: 145 | /* The FPU enable bits are in the CPACR. */ 146 | ldr.w r0, =0xE000ED88 147 | ldr r1, [r0] 148 | 149 | /* Enable CP10 and CP11 coprocessors, then save back. */ 150 | orr r1, r1, #( 0xf << 20 ) 151 | str r1, [r0] 152 | bx r14 153 | 154 | 155 | 156 | END 157 | 158 | -------------------------------------------------------------------------------- /Source/portable/COMPONENT_CR4/TOOLCHAIN_GCC_ARM/portASM.S: -------------------------------------------------------------------------------- 1 | /* 2 | * FreeRTOS Kernel V10.5.0 3 | * Copyright (C) 2021 Amazon.com, Inc. or its affiliates. All Rights Reserved. 4 | * 5 | * SPDX-License-Identifier: MIT 6 | * 7 | * Permission is hereby granted, free of charge, to any person obtaining a copy of 8 | * this software and associated documentation files (the "Software"), to deal in 9 | * the Software without restriction, including without limitation the rights to 10 | * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 11 | * the Software, and to permit persons to whom the Software is furnished to do so, 12 | * subject to the following conditions: 13 | * 14 | * The above copyright notice and this permission notice shall be included in all 15 | * copies or substantial portions of the Software. 16 | * 17 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 19 | * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 20 | * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 21 | * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 22 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 23 | * 24 | * https://www.FreeRTOS.org 25 | * https://github.com/FreeRTOS 26 | * 27 | */ 28 | 29 | .text 30 | .arm 31 | 32 | .set SYS_MODE, 0x1f 33 | .set SVC_MODE, 0x13 34 | .set IRQ_MODE, 0x12 35 | 36 | /* Variables and functions. */ 37 | .extern ulMaxAPIPriorityMask 38 | .extern _freertos_vector_table 39 | .extern pxCurrentTCB 40 | .extern vTaskSwitchContext 41 | .extern vApplicationIRQHandler 42 | .extern ulPortInterruptNesting 43 | .extern ulPortTaskHasFPUContext 44 | .extern ulICCEOIR 45 | .extern ulPortYieldRequired 46 | 47 | .global FreeRTOS_IRQ_Handler 48 | .global FreeRTOS_SVC_Handler 49 | .global vPortRestoreTaskContext 50 | 51 | 52 | .macro portSAVE_CONTEXT 53 | 54 | /* Save the LR and SPSR onto the system mode stack before switching to 55 | system mode to save the remaining system mode registers. */ 56 | SRSDB sp!, #SYS_MODE 57 | CPS #SYS_MODE 58 | PUSH {R0-R12, R14} 59 | 60 | /* Push the critical nesting count. */ 61 | LDR R2, ulCriticalNestingConst 62 | LDR R1, [R2] 63 | PUSH {R1} 64 | 65 | /* Does the task have a floating point context that needs saving? If 66 | ulPortTaskHasFPUContext is 0 then no. */ 67 | LDR R2, ulPortTaskHasFPUContextConst 68 | LDR R3, [R2] 69 | CMP R3, #0 70 | 71 | #if configFPU == 1 72 | /* Save the floating point context, if any. */ 73 | FMRXNE R1, FPSCR 74 | VPUSHNE {D0-D15} 75 | #if configFPU_D32 == 1 76 | VPUSHNE {D16-D31} 77 | #endif /* configFPU_D32 */ 78 | PUSHNE {R1} 79 | #endif 80 | 81 | /* Save ulPortTaskHasFPUContext itself. */ 82 | PUSH {R3} 83 | 84 | /* Save the stack pointer in the TCB. */ 85 | LDR R0, pxCurrentTCBConst 86 | LDR R1, [R0] 87 | STR SP, [R1] 88 | 89 | .endm 90 | 91 | ; /**********************************************************************/ 92 | 93 | .macro portRESTORE_CONTEXT 94 | 95 | /* Set the SP to point to the stack of the task being restored. */ 96 | LDR R0, pxCurrentTCBConst 97 | LDR R1, [R0] 98 | LDR SP, [R1] 99 | 100 | /* Is there a floating point context to restore? If the restored 101 | ulPortTaskHasFPUContext is zero then no. */ 102 | LDR R0, ulPortTaskHasFPUContextConst 103 | POP {R1} 104 | STR R1, [R0] 105 | CMP R1, #0 106 | 107 | #if configFPU == 1 108 | /* Restore the floating point context, if any. */ 109 | POPNE {R0} 110 | #if configFPU_D32 == 1 111 | VPOPNE {D16-D31} 112 | #endif /* configFPU_D32 */ 113 | VPOPNE {D0-D15} 114 | VMSRNE FPSCR, R0 115 | #endif 116 | 117 | /* Restore the critical section nesting depth. */ 118 | LDR R0, ulCriticalNestingConst 119 | POP {R1} 120 | STR R1, [R0] 121 | 122 | /* Restore all system mode registers other than the SP (which is already 123 | being used). */ 124 | POP {R0-R12, R14} 125 | 126 | /* Return to the task code, loading CPSR on the way. */ 127 | RFEIA sp! 128 | 129 | .endm 130 | 131 | 132 | 133 | 134 | /****************************************************************************** 135 | * SVC handler is used to yield. 136 | *****************************************************************************/ 137 | .align 4 138 | .type FreeRTOS_SVC_Handler, %function 139 | FreeRTOS_SVC_Handler: 140 | /* Save the context of the current task and select a new task to run. */ 141 | portSAVE_CONTEXT 142 | LDR R0, vTaskSwitchContextConst 143 | BLX R0 144 | portRESTORE_CONTEXT 145 | 146 | 147 | /****************************************************************************** 148 | * vPortRestoreTaskContext is used to start the scheduler. 149 | *****************************************************************************/ 150 | .align 4 151 | .type vPortRestoreTaskContext, %function 152 | vPortRestoreTaskContext: 153 | /* Switch to system mode. */ 154 | CPS #SYS_MODE 155 | portRESTORE_CONTEXT 156 | 157 | .align 4 158 | .type FreeRTOS_IRQ_Handler, %function 159 | FreeRTOS_IRQ_Handler: 160 | /* Return to the interrupted instruction. */ 161 | SUB lr, lr, #4 162 | 163 | /* Push the return address and SPSR. */ 164 | PUSH {lr} 165 | MRS lr, SPSR 166 | PUSH {lr} 167 | 168 | /* Change to supervisor mode to allow reentry. */ 169 | CPS #0x13 170 | 171 | /* Push used registers. */ 172 | PUSH {r0-r3, r12} 173 | 174 | /* Increment nesting count. r3 holds the address of ulPortInterruptNesting 175 | for future use. r1 holds the original ulPortInterruptNesting value for 176 | future use. */ 177 | LDR r3, ulPortInterruptNestingConst 178 | LDR r1, [r3] 179 | ADD r0, r1, #1 180 | STR r0, [r3] 181 | 182 | /* Ensure bit 2 of the stack pointer is clear. r2 holds the bit 2 value for 183 | future use. */ 184 | MOV r0, sp 185 | AND r2, r0, #4 186 | SUB sp, sp, r2 187 | 188 | /* Call the interrupt handler. */ 189 | PUSH {r0-r3, lr} 190 | LDR r1, vApplicationIRQHandlerConst 191 | BLX r1 192 | POP {r0-r3, lr} 193 | ADD sp, sp, r2 194 | 195 | CPSID i 196 | DSB 197 | ISB 198 | 199 | /* Write to the EOI register. */ 200 | LDR r0, ulICCEOIRConst 201 | LDR r2, [r0] 202 | STR r0, [r2] 203 | 204 | /* Restore the old nesting count. */ 205 | STR r1, [r3] 206 | 207 | /* A context switch is never performed if the nesting count is not 0. */ 208 | CMP r1, #0 209 | BNE exit_without_switch 210 | 211 | /* Did the interrupt request a context switch? r1 holds the address of 212 | ulPortYieldRequired and r0 the value of ulPortYieldRequired for future 213 | use. */ 214 | LDR r1, ulPortYieldRequiredConst 215 | LDR r0, [r1] 216 | CMP r0, #0 217 | BNE switch_before_exit 218 | 219 | exit_without_switch: 220 | /* No context switch. Restore used registers, LR_irq and SPSR before 221 | returning. */ 222 | POP {r0-r3, r12} 223 | CPS #IRQ_MODE 224 | POP {LR} 225 | MSR SPSR_cxsf, LR 226 | POP {LR} 227 | MOVS PC, LR 228 | 229 | switch_before_exit: 230 | /* A context swtich is to be performed. Clear the context switch pending 231 | flag. */ 232 | MOV r0, #0 233 | STR r0, [r1] 234 | 235 | /* Restore used registers, LR-irq and SPSR before saving the context 236 | to the task stack. */ 237 | POP {r0-r3, r12} 238 | CPS #IRQ_MODE 239 | POP {LR} 240 | MSR SPSR_cxsf, LR 241 | POP {LR} 242 | portSAVE_CONTEXT 243 | 244 | /* Call the function that selects the new task to execute. 245 | vTaskSwitchContext() if vTaskSwitchContext() uses LDRD or STRD 246 | instructions, or 8 byte aligned stack allocated data. LR does not need 247 | saving as a new LR will be loaded by portRESTORE_CONTEXT anyway. */ 248 | LDR R0, vTaskSwitchContextConst 249 | BLX R0 250 | 251 | /* Restore the context of, and branch to, the task selected to execute 252 | next. */ 253 | portRESTORE_CONTEXT 254 | 255 | ulICCEOIRConst: .word ulICCEOIR 256 | pxCurrentTCBConst: .word pxCurrentTCB 257 | ulCriticalNestingConst: .word ulCriticalNesting 258 | ulPortTaskHasFPUContextConst: .word ulPortTaskHasFPUContext 259 | vTaskSwitchContextConst: .word vTaskSwitchContext 260 | vApplicationIRQHandlerConst: .word vApplicationIRQHandler 261 | ulPortInterruptNestingConst: .word ulPortInterruptNesting 262 | ulPortYieldRequiredConst: .word ulPortYieldRequired 263 | 264 | .end 265 | 266 | 267 | 268 | 269 | 270 | -------------------------------------------------------------------------------- /Source/portable/COMPONENT_CR4/TOOLCHAIN_GCC_ARM/portmacro.h: -------------------------------------------------------------------------------- 1 | /* 2 | * FreeRTOS Kernel V10.5.0 3 | * Copyright (C) 2021 Amazon.com, Inc. or its affiliates. All Rights Reserved. 4 | * 5 | * SPDX-License-Identifier: MIT 6 | * 7 | * Permission is hereby granted, free of charge, to any person obtaining a copy of 8 | * this software and associated documentation files (the "Software"), to deal in 9 | * the Software without restriction, including without limitation the rights to 10 | * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 11 | * the Software, and to permit persons to whom the Software is furnished to do so, 12 | * subject to the following conditions: 13 | * 14 | * The above copyright notice and this permission notice shall be included in all 15 | * copies or substantial portions of the Software. 16 | * 17 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 19 | * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 20 | * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 21 | * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 22 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 23 | * 24 | * https://www.FreeRTOS.org 25 | * https://github.com/FreeRTOS 26 | * 27 | */ 28 | 29 | #ifndef PORTMACRO_H 30 | #define PORTMACRO_H 31 | 32 | #ifdef __cplusplus 33 | extern "C" { 34 | #endif 35 | 36 | /*----------------------------------------------------------- 37 | * Port specific definitions. 38 | * 39 | * The settings in this file configure FreeRTOS correctly for the given hardware 40 | * and compiler. 41 | * 42 | * These settings should not be altered. 43 | *----------------------------------------------------------- 44 | */ 45 | 46 | /* Type definitions. */ 47 | #define portCHAR char 48 | #define portFLOAT float 49 | #define portDOUBLE double 50 | #define portLONG long 51 | #define portSHORT short 52 | #define portSTACK_TYPE uint32_t 53 | #define portBASE_TYPE long 54 | 55 | typedef portSTACK_TYPE StackType_t; 56 | typedef long BaseType_t; 57 | typedef unsigned long UBaseType_t; 58 | 59 | typedef uint32_t TickType_t; 60 | #define portMAX_DELAY ( TickType_t ) 0xffffffffUL 61 | 62 | /* 32-bit tick type on a 32-bit architecture, so reads of the tick count do 63 | not need to be guarded with a critical section. */ 64 | #define portTICK_TYPE_IS_ATOMIC 1 65 | 66 | /*-----------------------------------------------------------*/ 67 | 68 | /* Hardware specifics. */ 69 | #define portSTACK_GROWTH ( -1 ) 70 | #define portTICK_PERIOD_MS ( ( TickType_t ) 1000 / configTICK_RATE_HZ ) 71 | #define portBYTE_ALIGNMENT 8 72 | 73 | /*-----------------------------------------------------------*/ 74 | 75 | /* Task utilities. */ 76 | 77 | /* Called at the end of an ISR that can cause a context switch. */ 78 | #define portEND_SWITCHING_ISR( xSwitchRequired )\ 79 | { \ 80 | extern volatile uint32_t ulPortYieldRequired; \ 81 | \ 82 | if( xSwitchRequired != pdFALSE ) \ 83 | { \ 84 | ulPortYieldRequired = pdTRUE; \ 85 | } \ 86 | } 87 | 88 | #define portYIELD_FROM_ISR( x ) portEND_SWITCHING_ISR( x ) 89 | #define portYIELD() __asm volatile ( "SWI 0 \n" \ 90 | "ISB " ::: "memory" ); 91 | 92 | 93 | /*----------------------------------------------------------- 94 | * Critical section control 95 | *----------------------------------------------------------*/ 96 | 97 | extern void vPortEnterCritical( void ); 98 | extern void vPortExitCritical( void ); 99 | extern uint32_t ulPortSetInterruptMask( void ); 100 | extern void vPortClearInterruptMask( uint32_t ulNewMaskValue ); 101 | extern void vPortInstallFreeRTOSVectorTable( void ); 102 | 103 | /* The I bit within the CPSR. */ 104 | #define portINTERRUPT_ENABLE_BIT ( 1 << 7 ) 105 | 106 | /* In the absence of a priority mask register, these functions and macros 107 | globally enable and disable interrupts. */ 108 | #define portENTER_CRITICAL() vPortEnterCritical(); 109 | #define portEXIT_CRITICAL() vPortExitCritical(); 110 | #define portENABLE_INTERRUPTS() __asm volatile ( "CPSIE i \n" ::: "memory" ); 111 | #define portDISABLE_INTERRUPTS() __asm volatile ( "CPSID i \n" \ 112 | "DSB \n" \ 113 | "ISB " ::: "memory" ); 114 | 115 | __attribute__( ( always_inline ) ) static __inline uint32_t portINLINE_SET_INTERRUPT_MASK_FROM_ISR( void ) 116 | { 117 | volatile uint32_t ulCPSR; 118 | 119 | __asm volatile ( "MRS %0, CPSR" : "=r" (ulCPSR) :: "memory" ); 120 | ulCPSR &= portINTERRUPT_ENABLE_BIT; 121 | portDISABLE_INTERRUPTS(); 122 | return ulCPSR; 123 | } 124 | 125 | #define portSET_INTERRUPT_MASK_FROM_ISR() portINLINE_SET_INTERRUPT_MASK_FROM_ISR() 126 | #define portCLEAR_INTERRUPT_MASK_FROM_ISR(x) do { if( x == 0 ) portENABLE_INTERRUPTS(); } while( 0 ) 127 | 128 | /*-----------------------------------------------------------*/ 129 | 130 | /* Task function macros as described on the FreeRTOS.org WEB site. These are 131 | not required for this port but included in case common demo code that uses these 132 | macros is used. */ 133 | #define portTASK_FUNCTION_PROTO( vFunction, pvParameters ) void vFunction( void *pvParameters ) 134 | #define portTASK_FUNCTION( vFunction, pvParameters ) void vFunction( void *pvParameters ) 135 | 136 | /* Tickless idle/low power functionality. */ 137 | #ifndef portSUPPRESS_TICKS_AND_SLEEP 138 | extern void vPortSuppressTicksAndSleep( TickType_t xExpectedIdleTime ); 139 | #define portSUPPRESS_TICKS_AND_SLEEP( xExpectedIdleTime ) vPortSuppressTicksAndSleep( xExpectedIdleTime ) 140 | #endif 141 | 142 | /* Prototype of the FreeRTOS tick handler. This must be installed as the 143 | handler for whichever peripheral is used to generate the RTOS tick. */ 144 | void FreeRTOS_Tick_Handler( void ); 145 | 146 | /* Any task that uses the floating point unit MUST call vPortTaskUsesFPU() 147 | before any floating point instructions are executed. */ 148 | void vPortTaskUsesFPU( void ); 149 | #define portTASK_USES_FLOATING_POINT() vPortTaskUsesFPU() 150 | 151 | #define portLOWEST_INTERRUPT_PRIORITY ( ( ( uint32_t ) configUNIQUE_INTERRUPT_PRIORITIES ) - 1UL ) 152 | #define portLOWEST_USABLE_INTERRUPT_PRIORITY ( portLOWEST_INTERRUPT_PRIORITY - 1UL ) 153 | 154 | /* Architecture specific optimisations. */ 155 | #ifndef configUSE_PORT_OPTIMISED_TASK_SELECTION 156 | #define configUSE_PORT_OPTIMISED_TASK_SELECTION 1 157 | #endif 158 | 159 | #if configUSE_PORT_OPTIMISED_TASK_SELECTION == 1 160 | 161 | /* Store/clear the ready priorities in a bit map. */ 162 | #define portRECORD_READY_PRIORITY( uxPriority, uxReadyPriorities ) ( uxReadyPriorities ) |= ( 1UL << ( uxPriority ) ) 163 | #define portRESET_READY_PRIORITY( uxPriority, uxReadyPriorities ) ( uxReadyPriorities ) &= ~( 1UL << ( uxPriority ) ) 164 | 165 | /*-----------------------------------------------------------*/ 166 | 167 | #define portGET_HIGHEST_PRIORITY( uxTopPriority, uxReadyPriorities ) uxTopPriority = ( 31UL - ( uint32_t ) __builtin_clz( uxReadyPriorities ) ) 168 | 169 | #endif /* configUSE_PORT_OPTIMISED_TASK_SELECTION */ 170 | 171 | #define portNOP() __asm volatile( "NOP" ) 172 | #define portINLINE __inline 173 | 174 | #define portMEMORY_BARRIER() __asm volatile( "" ::: "memory" ) 175 | 176 | #ifdef __cplusplus 177 | } /* extern C */ 178 | #endif 179 | 180 | 181 | #endif /* PORTMACRO_H */ 182 | 183 | -------------------------------------------------------------------------------- /Source/portable/COMPONENT_CR4/low_level_init.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2024, Cypress Semiconductor Corporation or a subsidiary of 3 | * Cypress Semiconductor Corporation. All Rights Reserved. 4 | * 5 | * This software, associated documentation and materials ("Software"), 6 | * is owned by Cypress Semiconductor Corporation 7 | * or one of its subsidiaries ("Cypress") and is protected by and subject to 8 | * worldwide patent protection (United States and foreign), 9 | * United States copyright laws and international treaty provisions. 10 | * Therefore, you may use this Software only as provided in the license 11 | * agreement accompanying the software package from which you 12 | * obtained this Software ("EULA"). 13 | * If no EULA applies, Cypress hereby grants you a personal, non-exclusive, 14 | * non-transferable license to copy, modify, and compile the Software 15 | * source code solely for use in connection with Cypress's 16 | * integrated circuit products. Any reproduction, modification, translation, 17 | * compilation, or representation of this Software except as specified 18 | * above is prohibited without the express written permission of Cypress. 19 | * 20 | * Disclaimer: THIS SOFTWARE IS PROVIDED AS-IS, WITH NO WARRANTY OF ANY KIND, 21 | * EXPRESS OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, NONINFRINGEMENT, IMPLIED 22 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. Cypress 23 | * reserves the right to make changes to the Software without notice. Cypress 24 | * does not assume any liability arising out of the application or use of the 25 | * Software or any product or circuit described in the Software. Cypress does 26 | * not authorize its products for use in any products where a malfunction or 27 | * failure of the Cypress product may reasonably be expected to result in 28 | * significant property damage, injury or death ("High Risk Product"). By 29 | * including Cypress's product in a High Risk Product, the manufacturer 30 | * of such system or application assumes all risk of such use and in doing 31 | * so agrees to indemnify Cypress against all liability. 32 | */ 33 | #include "FreeRTOS.h" 34 | #include "platform_isr.h" 35 | #include "portmacro.h" 36 | #include "cyhal_timer.h" 37 | 38 | extern void _cyhal_timer_irq_handler(void); 39 | extern void platform_irq_demuxer(void); 40 | /** @file 41 | * Implementation of IRQ handling functions for CR4. 42 | */ 43 | 44 | /****************************************************** 45 | * Macros 46 | ******************************************************/ 47 | 48 | /****************************************************** 49 | * Constants 50 | ******************************************************/ 51 | 52 | /****************************************************** 53 | * Enumerations 54 | ******************************************************/ 55 | 56 | /****************************************************** 57 | * Type Definitions 58 | ******************************************************/ 59 | 60 | /****************************************************** 61 | * Structures 62 | ******************************************************/ 63 | 64 | /****************************************************** 65 | * Static Function Declarations 66 | ******************************************************/ 67 | void irq_vector_external_interrupt( void ) __attribute__((naked)); 68 | void irq_vector_software_interrupt( void ) __attribute__((naked)); 69 | 70 | /****************************************************** 71 | * Variable Definitions 72 | ******************************************************/ 73 | 74 | /****************************************************** 75 | * Function Definitions 76 | ******************************************************/ 77 | 78 | /* Initial entry point for external interrupts */ 79 | void irq_vector_external_interrupt( void ) 80 | { 81 | __asm volatile ( 82 | "B FreeRTOS_IRQ_Handler \t\n" 83 | ); 84 | } 85 | 86 | /* Initial entry point for software interrupts */ 87 | void irq_vector_software_interrupt( void ) 88 | { 89 | __asm volatile ( 90 | "B FreeRTOS_SVC_Handler \t\n" 91 | ); 92 | } 93 | 94 | static void timer_isr(void *callback_arg, cyhal_timer_event_t event) 95 | { 96 | (void) (callback_arg); 97 | (void) (event); 98 | FreeRTOS_Tick_Handler( ); 99 | } 100 | 101 | extern void platform_tick_start() 102 | { 103 | cy_rslt_t result; 104 | static bool tick_timer_initialized = false; 105 | static cyhal_timer_t timer; 106 | const cyhal_timer_cfg_t TimerCfg = {true, CYHAL_TIMER_DIR_UP, true, configCPU_CLOCK_HZ/configTICK_RATE_HZ, (configCPU_CLOCK_HZ/configTICK_RATE_HZ)/2, 0}; 107 | (void) result; 108 | if( !tick_timer_initialized ) 109 | { 110 | result = cyhal_timer_init(&timer, 0, NULL); 111 | CY_ASSERT(result == CY_RSLT_SUCCESS); 112 | 113 | result = cyhal_timer_set_frequency(&timer, configCPU_CLOCK_HZ); 114 | CY_ASSERT(result == CY_RSLT_SUCCESS); 115 | 116 | cyhal_timer_configure(&timer, &TimerCfg); 117 | 118 | cyhal_timer_register_callback(&timer, timer_isr, NULL); 119 | cyhal_timer_enable_event(&timer, CYHAL_TIMER_IRQ_CAPTURE_COMPARE, 0, true); 120 | 121 | result = cyhal_timer_start(&timer); 122 | CY_ASSERT(result == CY_RSLT_SUCCESS); 123 | 124 | tick_timer_initialized = true; 125 | } 126 | } 127 | 128 | PLATFORM_DEFINE_ISR(platform_irq_demuxer_wrapper) 129 | { 130 | platform_irq_demuxer(); 131 | } 132 | 133 | PLATFORM_MAP_ISR(platform_irq_demuxer_wrapper, vApplicationIRQHandler); 134 | 135 | /* This empty function is needed just to allow the linker to discard the symbol from the binary. Without this, the weak function platform_irq_demuxer_default defined in BSP will not be discarded by the linker. */ 136 | void platform_irq_demuxer_default(void) 137 | { 138 | return; 139 | } 140 | -------------------------------------------------------------------------------- /Source/portable/MemMang/ReadMe.url: -------------------------------------------------------------------------------- 1 | [{000214A0-0000-0000-C000-000000000046}] 2 | Prop3=19,2 3 | [InternetShortcut] 4 | URL=https://www.FreeRTOS.org/a00111.html 5 | IDList= 6 | -------------------------------------------------------------------------------- /Source/portable/MemMang/heap_1.c: -------------------------------------------------------------------------------- 1 | /* 2 | * FreeRTOS Kernel V10.5.0 3 | * Copyright (C) 2021 Amazon.com, Inc. or its affiliates. All Rights Reserved. 4 | * 5 | * SPDX-License-Identifier: MIT 6 | * 7 | * Copyright (C) 2019-2024 Cypress Semiconductor Corporation, or a subsidiary of 8 | * Cypress Semiconductor Corporation. All Rights Reserved. 9 | * 10 | * Added support of memory allocation scheme selection from the FreeRTOSConfig.h 11 | * file using configHEAP_ALLOCATION_SCHEME macro. 12 | * 13 | * Permission is hereby granted, free of charge, to any person obtaining a copy of 14 | * this software and associated documentation files (the "Software"), to deal in 15 | * the Software without restriction, including without limitation the rights to 16 | * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 17 | * the Software, and to permit persons to whom the Software is furnished to do so, 18 | * subject to the following conditions: 19 | * 20 | * The above copyright notice and this permission notice shall be included in all 21 | * copies or substantial portions of the Software. 22 | * 23 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 24 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 25 | * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 26 | * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 27 | * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 28 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 29 | * 30 | * https://www.FreeRTOS.org 31 | * https://github.com/FreeRTOS 32 | * http://www.cypress.com 33 | * 34 | */ 35 | 36 | 37 | /* 38 | * The simplest possible implementation of pvPortMalloc(). Note that this 39 | * implementation does NOT allow allocated memory to be freed again. 40 | * 41 | * See heap_2.c, heap_3.c and heap_4.c for alternative implementations, and the 42 | * memory management pages of https://www.FreeRTOS.org for more information. 43 | */ 44 | #includeFreeRTOS is supplied as standard C source files built along with the other C files in your project. This repository contains a port of FreeRTOS kernel for Infineon MCUs based on Arm® Cortex®-M0 (CM0), Cortex®-M0+ (CM0P), Cortex®-M4 (CM4), Cortex®-M33 (CM33), Cortex®-R4 (CR4) and Cortex®-M7 (CM7) cores.
Additional information about using this library in ModusToolbox™ software including a Quick Start guide can be found in the library's README.md file.
83 |To configure FreeRTOS, copy the pre-configured FreeRTOSConfig.h file from the freertos/Source/portable folder to your project and modify the copied configuration file as needed. See Configuration Consideration section of the README.md file.
89 |