13818a63 by 张亚玄

generate LED

1 parent e8af8df8
Showing 47 changed files with 2005 additions and 58 deletions
...@@ -39,11 +39,14 @@ ...@@ -39,11 +39,14 @@
39 <listOptionValue builtIn="false" value="DEBUG"/> 39 <listOptionValue builtIn="false" value="DEBUG"/>
40 </option> 40 </option>
41 <option IS_BUILTIN_EMPTY="false" IS_VALUE_EMPTY="false" id="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.c.compiler.option.includepaths.1419173599" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.c.compiler.option.includepaths" useByScannerDiscovery="false" valueType="includePath"> 41 <option IS_BUILTIN_EMPTY="false" IS_VALUE_EMPTY="false" id="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.c.compiler.option.includepaths.1419173599" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.c.compiler.option.includepaths" useByScannerDiscovery="false" valueType="includePath">
42 <listOptionValue builtIn="false" value="../Middlewares/Third_Party/FreeRTOS/Source/include"/>
42 <listOptionValue builtIn="false" value="../Drivers/STM32F0xx_HAL_Driver/Inc"/> 43 <listOptionValue builtIn="false" value="../Drivers/STM32F0xx_HAL_Driver/Inc"/>
43 <listOptionValue builtIn="false" value="../Drivers/CMSIS/Include"/> 44 <listOptionValue builtIn="false" value="../Drivers/CMSIS/Include"/>
44 <listOptionValue builtIn="false" value="../Core/Inc"/> 45 <listOptionValue builtIn="false" value="../Core/Inc"/>
45 <listOptionValue builtIn="false" value="../Drivers/STM32F0xx_HAL_Driver/Inc/Legacy"/> 46 <listOptionValue builtIn="false" value="../Drivers/STM32F0xx_HAL_Driver/Inc/Legacy"/>
46 <listOptionValue builtIn="false" value="../Drivers/CMSIS/Device/ST/STM32F0xx/Include"/> 47 <listOptionValue builtIn="false" value="../Drivers/CMSIS/Device/ST/STM32F0xx/Include"/>
48 <listOptionValue builtIn="false" value="../Middlewares/Third_Party/FreeRTOS/Source/CMSIS_RTOS_V2"/>
49 <listOptionValue builtIn="false" value="../Middlewares/Third_Party/FreeRTOS/Source/portable/GCC/ARM_CM0"/>
47 </option> 50 </option>
48 <inputType id="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.c.compiler.input.c.6350984" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.c.compiler.input.c"/> 51 <inputType id="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.c.compiler.input.c.6350984" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.c.compiler.input.c"/>
49 </tool> 52 </tool>
...@@ -74,6 +77,7 @@ ...@@ -74,6 +77,7 @@
74 </folderInfo> 77 </folderInfo>
75 <sourceEntries> 78 <sourceEntries>
76 <entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="Core"/> 79 <entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="Core"/>
80 <entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="Middlewares"/>
77 <entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="Drivers"/> 81 <entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="Drivers"/>
78 </sourceEntries> 82 </sourceEntries>
79 </configuration> 83 </configuration>
...@@ -101,7 +105,7 @@ ...@@ -101,7 +105,7 @@
101 <option id="com.st.stm32cube.ide.mcu.gnu.managedbuild.option.target_cpuid.1335569211" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.option.target_cpuid" value="0" valueType="string"/> 105 <option id="com.st.stm32cube.ide.mcu.gnu.managedbuild.option.target_cpuid.1335569211" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.option.target_cpuid" value="0" valueType="string"/>
102 <option id="com.st.stm32cube.ide.mcu.gnu.managedbuild.option.target_coreid.49416475" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.option.target_coreid" value="0" valueType="string"/> 106 <option id="com.st.stm32cube.ide.mcu.gnu.managedbuild.option.target_coreid.49416475" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.option.target_coreid" value="0" valueType="string"/>
103 <option id="com.st.stm32cube.ide.mcu.gnu.managedbuild.option.target_board.104846597" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.option.target_board" value="genericBoard" valueType="string"/> 107 <option id="com.st.stm32cube.ide.mcu.gnu.managedbuild.option.target_board.104846597" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.option.target_board" value="genericBoard" valueType="string"/>
104 <option id="com.st.stm32cube.ide.mcu.gnu.managedbuild.option.defaults.642021960" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.option.defaults" value="com.st.stm32cube.ide.common.services.build.inputs.revA.1.0.3 || Release || false || Executable || com.st.stm32cube.ide.mcu.gnu.managedbuild.toolchain.base.gnu-tools-for-stm32 || STM32F030C8Tx || 0 || 0 || arm-none-eabi- || ${gnu_tools_for_stm32_compiler_path} || ../Drivers/STM32F0xx_HAL_Driver/Inc | ../Drivers/CMSIS/Include | ../Core/Inc | ../Drivers/STM32F0xx_HAL_Driver/Inc/Legacy | ../Drivers/CMSIS/Device/ST/STM32F0xx/Include || || || USE_HAL_DRIVER | STM32F030x8 || || Drivers | Core/Startup | Core || || || ${workspace_loc:/${ProjName}/STM32F030C8TX_FLASH.ld} || true || NonSecure || || secure_nsclib.o || " valueType="string"/> 108 <option id="com.st.stm32cube.ide.mcu.gnu.managedbuild.option.defaults.642021960" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.option.defaults" value="com.st.stm32cube.ide.common.services.build.inputs.revA.1.0.3 || Release || false || Executable || com.st.stm32cube.ide.mcu.gnu.managedbuild.toolchain.base.gnu-tools-for-stm32 || STM32F030C8Tx || 0 || 0 || arm-none-eabi- || ${gnu_tools_for_stm32_compiler_path} || ../Middlewares/Third_Party/FreeRTOS/Source/include | ../Drivers/STM32F0xx_HAL_Driver/Inc | ../Drivers/CMSIS/Include | ../Core/Inc | ../Drivers/STM32F0xx_HAL_Driver/Inc/Legacy | ../Drivers/CMSIS/Device/ST/STM32F0xx/Include | ../Middlewares/Third_Party/FreeRTOS/Source/CMSIS_RTOS_V2 | ../Middlewares/Third_Party/FreeRTOS/Source/portable/GCC/ARM_CM0 || || || USE_HAL_DRIVER | STM32F030x8 || || Drivers | Core/Startup | Middlewares | Core || || || ${workspace_loc:/${ProjName}/STM32F030C8TX_FLASH.ld} || true || NonSecure || || secure_nsclib.o || " valueType="string"/>
105 <targetPlatform archList="all" binaryParser="org.eclipse.cdt.core.ELF" id="com.st.stm32cube.ide.mcu.gnu.managedbuild.targetplatform.2048779008" isAbstract="false" osList="all" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.targetplatform"/> 109 <targetPlatform archList="all" binaryParser="org.eclipse.cdt.core.ELF" id="com.st.stm32cube.ide.mcu.gnu.managedbuild.targetplatform.2048779008" isAbstract="false" osList="all" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.targetplatform"/>
106 <builder buildPath="${workspace_loc:/STM32Test}/Release" id="com.st.stm32cube.ide.mcu.gnu.managedbuild.builder.1035798352" managedBuildOn="true" name="Gnu Make Builder.Release" parallelBuildOn="true" parallelizationNumber="optimal" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.builder"/> 110 <builder buildPath="${workspace_loc:/STM32Test}/Release" id="com.st.stm32cube.ide.mcu.gnu.managedbuild.builder.1035798352" managedBuildOn="true" name="Gnu Make Builder.Release" parallelBuildOn="true" parallelizationNumber="optimal" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.builder"/>
107 <tool id="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.assembler.59085921" name="MCU GCC Assembler" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.assembler"> 111 <tool id="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.assembler.59085921" name="MCU GCC Assembler" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.assembler">
...@@ -117,11 +121,14 @@ ...@@ -117,11 +121,14 @@
117 <listOptionValue builtIn="false" value="STM32F030x8"/> 121 <listOptionValue builtIn="false" value="STM32F030x8"/>
118 </option> 122 </option>
119 <option IS_BUILTIN_EMPTY="false" IS_VALUE_EMPTY="false" id="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.c.compiler.option.includepaths.483038406" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.c.compiler.option.includepaths" useByScannerDiscovery="false" valueType="includePath"> 123 <option IS_BUILTIN_EMPTY="false" IS_VALUE_EMPTY="false" id="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.c.compiler.option.includepaths.483038406" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.c.compiler.option.includepaths" useByScannerDiscovery="false" valueType="includePath">
124 <listOptionValue builtIn="false" value="../Middlewares/Third_Party/FreeRTOS/Source/include"/>
120 <listOptionValue builtIn="false" value="../Drivers/STM32F0xx_HAL_Driver/Inc"/> 125 <listOptionValue builtIn="false" value="../Drivers/STM32F0xx_HAL_Driver/Inc"/>
121 <listOptionValue builtIn="false" value="../Drivers/CMSIS/Include"/> 126 <listOptionValue builtIn="false" value="../Drivers/CMSIS/Include"/>
122 <listOptionValue builtIn="false" value="../Core/Inc"/> 127 <listOptionValue builtIn="false" value="../Core/Inc"/>
123 <listOptionValue builtIn="false" value="../Drivers/STM32F0xx_HAL_Driver/Inc/Legacy"/> 128 <listOptionValue builtIn="false" value="../Drivers/STM32F0xx_HAL_Driver/Inc/Legacy"/>
124 <listOptionValue builtIn="false" value="../Drivers/CMSIS/Device/ST/STM32F0xx/Include"/> 129 <listOptionValue builtIn="false" value="../Drivers/CMSIS/Device/ST/STM32F0xx/Include"/>
130 <listOptionValue builtIn="false" value="../Middlewares/Third_Party/FreeRTOS/Source/CMSIS_RTOS_V2"/>
131 <listOptionValue builtIn="false" value="../Middlewares/Third_Party/FreeRTOS/Source/portable/GCC/ARM_CM0"/>
125 </option> 132 </option>
126 <inputType id="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.c.compiler.input.c.1595798722" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.c.compiler.input.c"/> 133 <inputType id="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.c.compiler.input.c.1595798722" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.c.compiler.input.c"/>
127 </tool> 134 </tool>
...@@ -152,6 +159,7 @@ ...@@ -152,6 +159,7 @@
152 </folderInfo> 159 </folderInfo>
153 <sourceEntries> 160 <sourceEntries>
154 <entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="Core"/> 161 <entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="Core"/>
162 <entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="Middlewares"/>
155 <entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="Drivers"/> 163 <entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="Drivers"/>
156 </sourceEntries> 164 </sourceEntries>
157 </configuration> 165 </configuration>
...@@ -172,4 +180,5 @@ ...@@ -172,4 +180,5 @@
172 <autodiscovery enabled="false" problemReportingEnabled="true" selectedProfileId=""/> 180 <autodiscovery enabled="false" problemReportingEnabled="true" selectedProfileId=""/>
173 </scannerConfigBuildInfo> 181 </scannerConfigBuildInfo>
174 </storageModule> 182 </storageModule>
183 <storageModule moduleId="org.eclipse.cdt.make.core.buildtargets"/>
175 </cproject> 184 </cproject>
......
1 /* USER CODE BEGIN Header */
2 /*
3 * FreeRTOS Kernel V10.0.1
4 * Copyright (C) 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
5 *
6 * Permission is hereby granted, free of charge, to any person obtaining a copy of
7 * this software and associated documentation files (the "Software"), to deal in
8 * the Software without restriction, including without limitation the rights to
9 * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
10 * the Software, and to permit persons to whom the Software is furnished to do so,
11 * subject to the following conditions:
12 *
13 * The above copyright notice and this permission notice shall be included in all
14 * copies or substantial portions of the Software.
15 *
16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
18 * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
19 * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
20 * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
21 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
22 *
23 * http://www.FreeRTOS.org
24 * http://aws.amazon.com/freertos
25 *
26 * 1 tab == 4 spaces!
27 */
28 /* USER CODE END Header */
29
30 #ifndef FREERTOS_CONFIG_H
31 #define FREERTOS_CONFIG_H
32
33 /*-----------------------------------------------------------
34 * Application specific definitions.
35 *
36 * These definitions should be adjusted for your particular hardware and
37 * application requirements.
38 *
39 * These parameters and more are described within the 'configuration' section of the
40 * FreeRTOS API documentation available on the FreeRTOS.org web site.
41 *
42 * See http://www.freertos.org/a00110.html
43 *----------------------------------------------------------*/
44
45 /* USER CODE BEGIN Includes */
46 /* Section where include file can be added */
47 /* USER CODE END Includes */
48
49 /* Ensure definitions are only used by the compiler, and not by the assembler. */
50 #if defined(__ICCARM__) || defined(__CC_ARM) || defined(__GNUC__)
51 #include <stdint.h>
52 extern uint32_t SystemCoreClock;
53 #endif
54 #define configUSE_PREEMPTION 1
55 #define configSUPPORT_STATIC_ALLOCATION 1
56 #define configSUPPORT_DYNAMIC_ALLOCATION 1
57 #define configUSE_IDLE_HOOK 0
58 #define configUSE_TICK_HOOK 0
59 #define configCPU_CLOCK_HZ ( SystemCoreClock )
60 #define configTICK_RATE_HZ ((TickType_t)1000)
61 #define configMAX_PRIORITIES ( 56 )
62 #define configMINIMAL_STACK_SIZE ((uint16_t)128)
63 #define configTOTAL_HEAP_SIZE ((size_t)3072)
64 #define configMAX_TASK_NAME_LEN ( 16 )
65 #define configUSE_TRACE_FACILITY 1
66 #define configUSE_16_BIT_TICKS 0
67 #define configUSE_MUTEXES 1
68 #define configQUEUE_REGISTRY_SIZE 8
69 #define configUSE_RECURSIVE_MUTEXES 1
70 #define configUSE_COUNTING_SEMAPHORES 1
71 #define configUSE_PORT_OPTIMISED_TASK_SELECTION 0
72
73 /* Co-routine definitions. */
74 #define configUSE_CO_ROUTINES 0
75 #define configMAX_CO_ROUTINE_PRIORITIES ( 2 )
76
77 /* Software timer definitions. */
78 #define configUSE_TIMERS 1
79 #define configTIMER_TASK_PRIORITY ( 2 )
80 #define configTIMER_QUEUE_LENGTH 10
81 #define configTIMER_TASK_STACK_DEPTH 256
82
83 /* Set the following definitions to 1 to include the API function, or zero
84 to exclude the API function. */
85 #define INCLUDE_vTaskPrioritySet 1
86 #define INCLUDE_uxTaskPriorityGet 1
87 #define INCLUDE_vTaskDelete 1
88 #define INCLUDE_vTaskCleanUpResources 0
89 #define INCLUDE_vTaskSuspend 1
90 #define INCLUDE_vTaskDelayUntil 1
91 #define INCLUDE_vTaskDelay 1
92 #define INCLUDE_xTaskGetSchedulerState 1
93 #define INCLUDE_xTimerPendFunctionCall 1
94 #define INCLUDE_xQueueGetMutexHolder 1
95 #define INCLUDE_uxTaskGetStackHighWaterMark 1
96 #define INCLUDE_eTaskGetState 1
97
98 /*
99 * The CMSIS-RTOS V2 FreeRTOS wrapper is dependent on the heap implementation used
100 * by the application thus the correct define need to be enabled below
101 */
102 #define USE_FreeRTOS_HEAP_4
103
104 /* Normal assert() semantics without relying on the provision of an assert.h
105 header file. */
106 /* USER CODE BEGIN 1 */
107 #define configASSERT( x ) if ((x) == 0) {taskDISABLE_INTERRUPTS(); for( ;; );}
108 /* USER CODE END 1 */
109
110 /* Definitions that map the FreeRTOS port interrupt handlers to their CMSIS
111 standard names. */
112 #define vPortSVCHandler SVC_Handler
113 #define xPortPendSVHandler PendSV_Handler
114
115 /* IMPORTANT: This define is commented when used with STM32Cube firmware, when the timebase source is SysTick,
116 to prevent overwriting SysTick_Handler defined within STM32Cube HAL */
117
118 #define xPortSysTickHandler SysTick_Handler
119
120 /* USER CODE BEGIN Defines */
121 /* Section where parameter definitions can be added (for instance, to override default ones in FreeRTOS.h) */
122 /* USER CODE END Defines */
123
124 #endif /* FREERTOS_CONFIG_H */
1 /**
2 ******************************************************************************
3 * File Name : gpio.h
4 * Description : This file contains all the functions prototypes for
5 * the gpio
6 ******************************************************************************
7 * @attention
8 *
9 * <h2><center>&copy; Copyright (c) 2019 STMicroelectronics.
10 * All rights reserved.</center></h2>
11 *
12 * This software component is licensed by ST under Ultimate Liberty license
13 * SLA0044, the "License"; You may not use this file except in compliance with
14 * the License. You may obtain a copy of the License at:
15 * www.st.com/SLA0044
16 *
17 ******************************************************************************
18 */
19
20 /* Define to prevent recursive inclusion -------------------------------------*/
21 #ifndef __gpio_H
22 #define __gpio_H
23 #ifdef __cplusplus
24 extern "C" {
25 #endif
26
27 /* Includes ------------------------------------------------------------------*/
28 #include "main.h"
29
30 /* USER CODE BEGIN Includes */
31
32 /* USER CODE END Includes */
33
34 /* USER CODE BEGIN Private defines */
35
36 /* USER CODE END Private defines */
37
38 void MX_GPIO_Init(void);
39
40 /* USER CODE BEGIN Prototypes */
41
42 /* USER CODE END Prototypes */
43
44 #ifdef __cplusplus
45 }
46 #endif
47 #endif /*__ pinoutConfig_H */
48
49 /**
50 * @}
51 */
52
53 /**
54 * @}
55 */
56
57 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
...@@ -58,6 +58,8 @@ void Error_Handler(void); ...@@ -58,6 +58,8 @@ void Error_Handler(void);
58 /* USER CODE END EFP */ 58 /* USER CODE END EFP */
59 59
60 /* Private defines -----------------------------------------------------------*/ 60 /* Private defines -----------------------------------------------------------*/
61 #define LED1_Pin GPIO_PIN_7
62 #define LED1_GPIO_Port GPIOB
61 /* USER CODE BEGIN Private defines */ 63 /* USER CODE BEGIN Private defines */
62 64
63 /* USER CODE END Private defines */ 65 /* USER CODE END Private defines */
......
...@@ -48,7 +48,7 @@ ...@@ -48,7 +48,7 @@
48 /*#define HAL_RNG_MODULE_ENABLED */ 48 /*#define HAL_RNG_MODULE_ENABLED */
49 /*#define HAL_RTC_MODULE_ENABLED */ 49 /*#define HAL_RTC_MODULE_ENABLED */
50 /*#define HAL_SPI_MODULE_ENABLED */ 50 /*#define HAL_SPI_MODULE_ENABLED */
51 /*#define HAL_TIM_MODULE_ENABLED */ 51 #define HAL_TIM_MODULE_ENABLED
52 /*#define HAL_UART_MODULE_ENABLED */ 52 /*#define HAL_UART_MODULE_ENABLED */
53 /*#define HAL_USART_MODULE_ENABLED */ 53 /*#define HAL_USART_MODULE_ENABLED */
54 /*#define HAL_IRDA_MODULE_ENABLED */ 54 /*#define HAL_IRDA_MODULE_ENABLED */
......
...@@ -49,9 +49,7 @@ ...@@ -49,9 +49,7 @@
49 /* Exported functions prototypes ---------------------------------------------*/ 49 /* Exported functions prototypes ---------------------------------------------*/
50 void NMI_Handler(void); 50 void NMI_Handler(void);
51 void HardFault_Handler(void); 51 void HardFault_Handler(void);
52 void SVC_Handler(void); 52 void TIM1_BRK_UP_TRG_COM_IRQHandler(void);
53 void PendSV_Handler(void);
54 void SysTick_Handler(void);
55 /* USER CODE BEGIN EFP */ 53 /* USER CODE BEGIN EFP */
56 54
57 /* USER CODE END EFP */ 55 /* USER CODE END EFP */
......
1 /**
2 ******************************************************************************
3 * File Name : SYS.h
4 * Description : This file provides code for the configuration
5 * of the SYS instances.
6 ******************************************************************************
7 * @attention
8 *
9 * <h2><center>&copy; Copyright (c) 2019 STMicroelectronics.
10 * All rights reserved.</center></h2>
11 *
12 * This software component is licensed by ST under Ultimate Liberty license
13 * SLA0044, the "License"; You may not use this file except in compliance with
14 * the License. You may obtain a copy of the License at:
15 * www.st.com/SLA0044
16 *
17 ******************************************************************************
18 */
19 /* Define to prevent recursive inclusion -------------------------------------*/
20 #ifndef __sys_H
21 #define __sys_H
22 #ifdef __cplusplus
23 extern "C" {
24 #endif
25
26 /* Includes ------------------------------------------------------------------*/
27 #include "main.h"
28
29 /* USER CODE BEGIN Includes */
30
31 /* USER CODE END Includes */
32
33 /* USER CODE BEGIN Private defines */
34
35 /* USER CODE END Private defines */
36
37 void MX_SYS_Init(void);
38
39 /* USER CODE BEGIN Prototypes */
40
41 /* USER CODE END Prototypes */
42
43 #ifdef __cplusplus
44 }
45 #endif
46 #endif /*__ sys_H */
47
48 /**
49 * @}
50 */
51
52 /**
53 * @}
54 */
55
56 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
1 /* USER CODE BEGIN Header */
2 /**
3 ******************************************************************************
4 * File Name : freertos.c
5 * Description : Code for freertos applications
6 ******************************************************************************
7 * @attention
8 *
9 * <h2><center>&copy; Copyright (c) 2019 STMicroelectronics.
10 * All rights reserved.</center></h2>
11 *
12 * This software component is licensed by ST under Ultimate Liberty license
13 * SLA0044, the "License"; You may not use this file except in compliance with
14 * the License. You may obtain a copy of the License at:
15 * www.st.com/SLA0044
16 *
17 ******************************************************************************
18 */
19 /* USER CODE END Header */
20
21 /* Includes ------------------------------------------------------------------*/
22 #include "FreeRTOS.h"
23 #include "task.h"
24 #include "main.h"
25 #include "cmsis_os.h"
26
27 /* Private includes ----------------------------------------------------------*/
28 /* USER CODE BEGIN Includes */
29
30 /* USER CODE END Includes */
31
32 /* Private typedef -----------------------------------------------------------*/
33 /* USER CODE BEGIN PTD */
34
35 /* USER CODE END PTD */
36
37 /* Private define ------------------------------------------------------------*/
38 /* USER CODE BEGIN PD */
39
40 /* USER CODE END PD */
41
42 /* Private macro -------------------------------------------------------------*/
43 /* USER CODE BEGIN PM */
44
45 /* USER CODE END PM */
46
47 /* Private variables ---------------------------------------------------------*/
48 /* USER CODE BEGIN Variables */
49
50 /* USER CODE END Variables */
51 osThreadId_t defaultTaskHandle;
52
53 /* Private function prototypes -----------------------------------------------*/
54 /* USER CODE BEGIN FunctionPrototypes */
55
56 /* USER CODE END FunctionPrototypes */
57
58 void StartDefaultTask(void *argument);
59
60 void MX_FREERTOS_Init(void); /* (MISRA C 2004 rule 8.1) */
61
62 /**
63 * @brief FreeRTOS initialization
64 * @param None
65 * @retval None
66 */
67 void MX_FREERTOS_Init(void) {
68 /* USER CODE BEGIN Init */
69
70 /* USER CODE END Init */
71 osKernelInitialize();
72
73 /* USER CODE BEGIN RTOS_MUTEX */
74 /* add mutexes, ... */
75 /* USER CODE END RTOS_MUTEX */
76
77 /* USER CODE BEGIN RTOS_SEMAPHORES */
78 /* add semaphores, ... */
79 /* USER CODE END RTOS_SEMAPHORES */
80
81 /* USER CODE BEGIN RTOS_TIMERS */
82 /* start timers, add new ones, ... */
83 /* USER CODE END RTOS_TIMERS */
84
85 /* USER CODE BEGIN RTOS_QUEUES */
86 /* add queues, ... */
87 /* USER CODE END RTOS_QUEUES */
88
89 /* Create the thread(s) */
90 /* definition and creation of defaultTask */
91 const osThreadAttr_t defaultTask_attributes = {
92 .name = "defaultTask",
93 .priority = (osPriority_t) osPriorityNormal,
94 .stack_size = 128
95 };
96 defaultTaskHandle = osThreadNew(StartDefaultTask, NULL, &defaultTask_attributes);
97
98 /* USER CODE BEGIN RTOS_THREADS */
99 /* add threads, ... */
100 /* USER CODE END RTOS_THREADS */
101
102 }
103
104 /* USER CODE BEGIN Header_StartDefaultTask */
105 /**
106 * @brief Function implementing the defaultTask thread.
107 * @param argument: Not used
108 * @retval None
109 */
110 /* USER CODE END Header_StartDefaultTask */
111 void StartDefaultTask(void *argument)
112 {
113 /* USER CODE BEGIN StartDefaultTask */
114 /* Infinite loop */
115 for(;;)
116 {
117 osDelay(1);
118 }
119 /* USER CODE END StartDefaultTask */
120 }
121
122 /* Private application code --------------------------------------------------*/
123 /* USER CODE BEGIN Application */
124
125 /* USER CODE END Application */
126
127 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
1 /**
2 ******************************************************************************
3 * File Name : gpio.c
4 * Description : This file provides code for the configuration
5 * of all used GPIO pins.
6 ******************************************************************************
7 * @attention
8 *
9 * <h2><center>&copy; Copyright (c) 2019 STMicroelectronics.
10 * All rights reserved.</center></h2>
11 *
12 * This software component is licensed by ST under Ultimate Liberty license
13 * SLA0044, the "License"; You may not use this file except in compliance with
14 * the License. You may obtain a copy of the License at:
15 * www.st.com/SLA0044
16 *
17 ******************************************************************************
18 */
19
20 /* Includes ------------------------------------------------------------------*/
21 #include "gpio.h"
22 /* USER CODE BEGIN 0 */
23
24 /* USER CODE END 0 */
25
26 /*----------------------------------------------------------------------------*/
27 /* Configure GPIO */
28 /*----------------------------------------------------------------------------*/
29 /* USER CODE BEGIN 1 */
30
31 /* USER CODE END 1 */
32
33 /** Configure pins as
34 * Analog
35 * Input
36 * Output
37 * EVENT_OUT
38 * EXTI
39 */
40 void MX_GPIO_Init(void)
41 {
42
43 GPIO_InitTypeDef GPIO_InitStruct = {0};
44
45 /* GPIO Ports Clock Enable */
46 __HAL_RCC_GPIOC_CLK_ENABLE();
47 __HAL_RCC_GPIOF_CLK_ENABLE();
48 __HAL_RCC_GPIOA_CLK_ENABLE();
49 __HAL_RCC_GPIOB_CLK_ENABLE();
50
51 /*Configure GPIO pin Output Level */
52 HAL_GPIO_WritePin(LED1_GPIO_Port, LED1_Pin, GPIO_PIN_RESET);
53
54 /*Configure GPIO pin : PtPin */
55 GPIO_InitStruct.Pin = LED1_Pin;
56 GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
57 GPIO_InitStruct.Pull = GPIO_NOPULL;
58 GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
59 HAL_GPIO_Init(LED1_GPIO_Port, &GPIO_InitStruct);
60
61 }
62
63 /* USER CODE BEGIN 2 */
64
65 /* USER CODE END 2 */
66
67 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
...@@ -20,6 +20,8 @@ ...@@ -20,6 +20,8 @@
20 20
21 /* Includes ------------------------------------------------------------------*/ 21 /* Includes ------------------------------------------------------------------*/
22 #include "main.h" 22 #include "main.h"
23 #include "cmsis_os.h"
24 #include "gpio.h"
23 25
24 /* Private includes ----------------------------------------------------------*/ 26 /* Private includes ----------------------------------------------------------*/
25 /* USER CODE BEGIN Includes */ 27 /* USER CODE BEGIN Includes */
...@@ -48,6 +50,7 @@ ...@@ -48,6 +50,7 @@
48 50
49 /* Private function prototypes -----------------------------------------------*/ 51 /* Private function prototypes -----------------------------------------------*/
50 void SystemClock_Config(void); 52 void SystemClock_Config(void);
53 void MX_FREERTOS_Init(void);
51 /* USER CODE BEGIN PFP */ 54 /* USER CODE BEGIN PFP */
52 55
53 /* USER CODE END PFP */ 56 /* USER CODE END PFP */
...@@ -85,10 +88,19 @@ int main(void) ...@@ -85,10 +88,19 @@ int main(void)
85 /* USER CODE END SysInit */ 88 /* USER CODE END SysInit */
86 89
87 /* Initialize all configured peripherals */ 90 /* Initialize all configured peripherals */
91 MX_GPIO_Init();
88 /* USER CODE BEGIN 2 */ 92 /* USER CODE BEGIN 2 */
89 93
90 /* USER CODE END 2 */ 94 /* USER CODE END 2 */
91 95
96 /* Call init function for freertos objects (in freertos.c) */
97 MX_FREERTOS_Init();
98
99 /* Start scheduler */
100 osKernelStart();
101
102 /* We should never get here as control is now taken by the scheduler */
103
92 /* Infinite loop */ 104 /* Infinite loop */
93 /* USER CODE BEGIN WHILE */ 105 /* USER CODE BEGIN WHILE */
94 while (1) 106 while (1)
...@@ -114,7 +126,10 @@ void SystemClock_Config(void) ...@@ -114,7 +126,10 @@ void SystemClock_Config(void)
114 RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSI; 126 RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSI;
115 RCC_OscInitStruct.HSIState = RCC_HSI_ON; 127 RCC_OscInitStruct.HSIState = RCC_HSI_ON;
116 RCC_OscInitStruct.HSICalibrationValue = RCC_HSICALIBRATION_DEFAULT; 128 RCC_OscInitStruct.HSICalibrationValue = RCC_HSICALIBRATION_DEFAULT;
117 RCC_OscInitStruct.PLL.PLLState = RCC_PLL_NONE; 129 RCC_OscInitStruct.PLL.PLLState = RCC_PLL_ON;
130 RCC_OscInitStruct.PLL.PLLSource = RCC_PLLSOURCE_HSI;
131 RCC_OscInitStruct.PLL.PLLMUL = RCC_PLL_MUL12;
132 RCC_OscInitStruct.PLL.PREDIV = RCC_PREDIV_DIV1;
118 if (HAL_RCC_OscConfig(&RCC_OscInitStruct) != HAL_OK) 133 if (HAL_RCC_OscConfig(&RCC_OscInitStruct) != HAL_OK)
119 { 134 {
120 Error_Handler(); 135 Error_Handler();
...@@ -123,11 +138,11 @@ void SystemClock_Config(void) ...@@ -123,11 +138,11 @@ void SystemClock_Config(void)
123 */ 138 */
124 RCC_ClkInitStruct.ClockType = RCC_CLOCKTYPE_HCLK|RCC_CLOCKTYPE_SYSCLK 139 RCC_ClkInitStruct.ClockType = RCC_CLOCKTYPE_HCLK|RCC_CLOCKTYPE_SYSCLK
125 |RCC_CLOCKTYPE_PCLK1; 140 |RCC_CLOCKTYPE_PCLK1;
126 RCC_ClkInitStruct.SYSCLKSource = RCC_SYSCLKSOURCE_HSI; 141 RCC_ClkInitStruct.SYSCLKSource = RCC_SYSCLKSOURCE_PLLCLK;
127 RCC_ClkInitStruct.AHBCLKDivider = RCC_SYSCLK_DIV1; 142 RCC_ClkInitStruct.AHBCLKDivider = RCC_SYSCLK_DIV1;
128 RCC_ClkInitStruct.APB1CLKDivider = RCC_HCLK_DIV1; 143 RCC_ClkInitStruct.APB1CLKDivider = RCC_HCLK_DIV1;
129 144
130 if (HAL_RCC_ClockConfig(&RCC_ClkInitStruct, FLASH_LATENCY_0) != HAL_OK) 145 if (HAL_RCC_ClockConfig(&RCC_ClkInitStruct, FLASH_LATENCY_1) != HAL_OK)
131 { 146 {
132 Error_Handler(); 147 Error_Handler();
133 } 148 }
...@@ -138,6 +153,27 @@ void SystemClock_Config(void) ...@@ -138,6 +153,27 @@ void SystemClock_Config(void)
138 /* USER CODE END 4 */ 153 /* USER CODE END 4 */
139 154
140 /** 155 /**
156 * @brief Period elapsed callback in non blocking mode
157 * @note This function is called when TIM1 interrupt took place, inside
158 * HAL_TIM_IRQHandler(). It makes a direct call to HAL_IncTick() to increment
159 * a global variable "uwTick" used as application time base.
160 * @param htim : TIM handle
161 * @retval None
162 */
163 void HAL_TIM_PeriodElapsedCallback(TIM_HandleTypeDef *htim)
164 {
165 /* USER CODE BEGIN Callback 0 */
166
167 /* USER CODE END Callback 0 */
168 if (htim->Instance == TIM1) {
169 HAL_IncTick();
170 }
171 /* USER CODE BEGIN Callback 1 */
172
173 /* USER CODE END Callback 1 */
174 }
175
176 /**
141 * @brief This function is executed in case of error occurrence. 177 * @brief This function is executed in case of error occurrence.
142 * @retval None 178 * @retval None
143 */ 179 */
......
...@@ -71,6 +71,8 @@ void HAL_MspInit(void) ...@@ -71,6 +71,8 @@ void HAL_MspInit(void)
71 __HAL_RCC_PWR_CLK_ENABLE(); 71 __HAL_RCC_PWR_CLK_ENABLE();
72 72
73 /* System interrupt init*/ 73 /* System interrupt init*/
74 /* PendSV_IRQn interrupt configuration */
75 HAL_NVIC_SetPriority(PendSV_IRQn, 3, 0);
74 76
75 /* USER CODE BEGIN MspInit 1 */ 77 /* USER CODE BEGIN MspInit 1 */
76 78
......
1 /* USER CODE BEGIN Header */
2 /**
3 ******************************************************************************
4 * @file stm32f0xx_hal_timebase_TIM.c
5 * @brief HAL time base based on the hardware TIM.
6 ******************************************************************************
7 * @attention
8 *
9 * <h2><center>&copy; Copyright (c) 2019 STMicroelectronics.
10 * All rights reserved.</center></h2>
11 *
12 * This software component is licensed by ST under Ultimate Liberty license
13 * SLA0044, the "License"; You may not use this file except in compliance with
14 * the License. You may obtain a copy of the License at:
15 * www.st.com/SLA0044
16 *
17 ******************************************************************************
18 */
19 /* USER CODE END Header */
20
21 /* Includes ------------------------------------------------------------------*/
22 #include "stm32f0xx_hal.h"
23 #include "stm32f0xx_hal_tim.h"
24
25 /* Private typedef -----------------------------------------------------------*/
26 /* Private define ------------------------------------------------------------*/
27 /* Private macro -------------------------------------------------------------*/
28 /* Private variables ---------------------------------------------------------*/
29 TIM_HandleTypeDef htim1;
30 /* Private function prototypes -----------------------------------------------*/
31 /* Private functions ---------------------------------------------------------*/
32
33 /**
34 * @brief This function configures the TIM1 as a time base source.
35 * The time source is configured to have 1ms time base with a dedicated
36 * Tick interrupt priority.
37 * @note This function is called automatically at the beginning of program after
38 * reset by HAL_Init() or at any time when clock is configured, by HAL_RCC_ClockConfig().
39 * @param TickPriority: Tick interrupt priority.
40 * @retval HAL status
41 */
42 HAL_StatusTypeDef HAL_InitTick(uint32_t TickPriority)
43 {
44 RCC_ClkInitTypeDef clkconfig;
45 uint32_t uwTimclock = 0;
46 uint32_t uwPrescalerValue = 0;
47 uint32_t pFLatency;
48
49 /*Configure the TIM1 IRQ priority */
50 HAL_NVIC_SetPriority(TIM1_BRK_UP_TRG_COM_IRQn, TickPriority ,0);
51
52 /* Enable the TIM1 global Interrupt */
53 HAL_NVIC_EnableIRQ(TIM1_BRK_UP_TRG_COM_IRQn);
54
55 /* Enable TIM1 clock */
56 __HAL_RCC_TIM1_CLK_ENABLE();
57
58 /* Get clock configuration */
59 HAL_RCC_GetClockConfig(&clkconfig, &pFLatency);
60
61 /* Compute TIM1 clock */
62 uwTimclock = HAL_RCC_GetPCLK1Freq();
63
64 /* Compute the prescaler value to have TIM1 counter clock equal to 1MHz */
65 uwPrescalerValue = (uint32_t) ((uwTimclock / 1000000) - 1);
66
67 /* Initialize TIM1 */
68 htim1.Instance = TIM1;
69
70 /* Initialize TIMx peripheral as follow:
71 + Period = [(TIM1CLK/1000) - 1]. to have a (1/1000) s time base.
72 + Prescaler = (uwTimclock/1000000 - 1) to have a 1MHz counter clock.
73 + ClockDivision = 0
74 + Counter direction = Up
75 */
76 htim1.Init.Period = (1000000 / 1000) - 1;
77 htim1.Init.Prescaler = uwPrescalerValue;
78 htim1.Init.ClockDivision = 0;
79 htim1.Init.CounterMode = TIM_COUNTERMODE_UP;
80 if(HAL_TIM_Base_Init(&htim1) == HAL_OK)
81 {
82 /* Start the TIM time Base generation in interrupt mode */
83 return HAL_TIM_Base_Start_IT(&htim1);
84 }
85
86 /* Return function status */
87 return HAL_ERROR;
88 }
89
90 /**
91 * @brief Suspend Tick increment.
92 * @note Disable the tick increment by disabling TIM1 update interrupt.
93 * @param None
94 * @retval None
95 */
96 void HAL_SuspendTick(void)
97 {
98 /* Disable TIM1 update Interrupt */
99 __HAL_TIM_DISABLE_IT(&htim1, TIM_IT_UPDATE);
100 }
101
102 /**
103 * @brief Resume Tick increment.
104 * @note Enable the tick increment by Enabling TIM1 update interrupt.
105 * @param None
106 * @retval None
107 */
108 void HAL_ResumeTick(void)
109 {
110 /* Enable TIM1 Update interrupt */
111 __HAL_TIM_ENABLE_IT(&htim1, TIM_IT_UPDATE);
112 }
113
114 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
...@@ -21,6 +21,8 @@ ...@@ -21,6 +21,8 @@
21 /* Includes ------------------------------------------------------------------*/ 21 /* Includes ------------------------------------------------------------------*/
22 #include "main.h" 22 #include "main.h"
23 #include "stm32f0xx_it.h" 23 #include "stm32f0xx_it.h"
24 #include "FreeRTOS.h"
25 #include "task.h"
24 /* Private includes ----------------------------------------------------------*/ 26 /* Private includes ----------------------------------------------------------*/
25 /* USER CODE BEGIN Includes */ 27 /* USER CODE BEGIN Includes */
26 /* USER CODE END Includes */ 28 /* USER CODE END Includes */
...@@ -56,6 +58,7 @@ ...@@ -56,6 +58,7 @@
56 /* USER CODE END 0 */ 58 /* USER CODE END 0 */
57 59
58 /* External variables --------------------------------------------------------*/ 60 /* External variables --------------------------------------------------------*/
61 extern TIM_HandleTypeDef htim1;
59 62
60 /* USER CODE BEGIN EV */ 63 /* USER CODE BEGIN EV */
61 64
...@@ -92,53 +95,27 @@ void HardFault_Handler(void) ...@@ -92,53 +95,27 @@ void HardFault_Handler(void)
92 } 95 }
93 } 96 }
94 97
95 /** 98 /******************************************************************************/
96 * @brief This function handles System service call via SWI instruction. 99 /* STM32F0xx Peripheral Interrupt Handlers */
97 */ 100 /* Add here the Interrupt Handlers for the used peripherals. */
98 void SVC_Handler(void) 101 /* For the available peripheral interrupt handler names, */
99 { 102 /* please refer to the startup file (startup_stm32f0xx.s). */
100 /* USER CODE BEGIN SVC_IRQn 0 */ 103 /******************************************************************************/
101
102 /* USER CODE END SVC_IRQn 0 */
103 /* USER CODE BEGIN SVC_IRQn 1 */
104
105 /* USER CODE END SVC_IRQn 1 */
106 }
107
108 /**
109 * @brief This function handles Pendable request for system service.
110 */
111 void PendSV_Handler(void)
112 {
113 /* USER CODE BEGIN PendSV_IRQn 0 */
114
115 /* USER CODE END PendSV_IRQn 0 */
116 /* USER CODE BEGIN PendSV_IRQn 1 */
117
118 /* USER CODE END PendSV_IRQn 1 */
119 }
120 104
121 /** 105 /**
122 * @brief This function handles System tick timer. 106 * @brief This function handles TIM1 break, update, trigger and commutation interrupts.
123 */ 107 */
124 void SysTick_Handler(void) 108 void TIM1_BRK_UP_TRG_COM_IRQHandler(void)
125 { 109 {
126 /* USER CODE BEGIN SysTick_IRQn 0 */ 110 /* USER CODE BEGIN TIM1_BRK_UP_TRG_COM_IRQn 0 */
127 111
128 /* USER CODE END SysTick_IRQn 0 */ 112 /* USER CODE END TIM1_BRK_UP_TRG_COM_IRQn 0 */
129 HAL_IncTick(); 113 HAL_TIM_IRQHandler(&htim1);
130 /* USER CODE BEGIN SysTick_IRQn 1 */ 114 /* USER CODE BEGIN TIM1_BRK_UP_TRG_COM_IRQn 1 */
131 115
132 /* USER CODE END SysTick_IRQn 1 */ 116 /* USER CODE END TIM1_BRK_UP_TRG_COM_IRQn 1 */
133 } 117 }
134 118
135 /******************************************************************************/
136 /* STM32F0xx Peripheral Interrupt Handlers */
137 /* Add here the Interrupt Handlers for the used peripherals. */
138 /* For the available peripheral interrupt handler names, */
139 /* please refer to the startup file (startup_stm32f0xx.s). */
140 /******************************************************************************/
141
142 /* USER CODE BEGIN 1 */ 119 /* USER CODE BEGIN 1 */
143 120
144 /* USER CODE END 1 */ 121 /* USER CODE END 1 */
......
1 /**
2 ******************************************************************************
3 * File Name : SYS.c
4 * Description : This file provides code for the configuration
5 * of the SYS instances.
6 ******************************************************************************
7 * @attention
8 *
9 * <h2><center>&copy; Copyright (c) 2019 STMicroelectronics.
10 * All rights reserved.</center></h2>
11 *
12 * This software component is licensed by ST under Ultimate Liberty license
13 * SLA0044, the "License"; You may not use this file except in compliance with
14 * the License. You may obtain a copy of the License at:
15 * www.st.com/SLA0044
16 *
17 ******************************************************************************
18 */
19
20 /* Includes ------------------------------------------------------------------*/
21 #include "sys.h"
22
23 /* USER CODE BEGIN 0 */
24
25 /* USER CODE END 0 */
26
27 /* SYS init function */
28 void MX_SYS_Init(void)
29 {
30
31 }
32
33 /* USER CODE BEGIN 1 */
34
35 /* USER CODE END 1 */
36
37 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
1 /*
2 * FreeRTOS Kernel V10.0.1
3 * Copyright (C) 2017 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 * http://www.FreeRTOS.org
23 * http://aws.amazon.com/freertos
24 *
25 * 1 tab == 4 spaces!
26 */
27
28 #ifndef STACK_MACROS_H
29 #define STACK_MACROS_H
30
31 #ifndef _MSC_VER /* Visual Studio doesn't support #warning. */
32 #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 future released.
33 #endif
34
35 /*
36 * Call the stack overflow hook function if the stack of the task being swapped
37 * out is currently overflowed, or looks like it might have overflowed in the
38 * past.
39 *
40 * Setting configCHECK_FOR_STACK_OVERFLOW to 1 will cause the macro to check
41 * the current stack state only - comparing the current top of stack value to
42 * the stack limit. Setting configCHECK_FOR_STACK_OVERFLOW to greater than 1
43 * will also cause the last few stack bytes to be checked to ensure the value
44 * to which the bytes were set when the task was created have not been
45 * overwritten. Note this second test does not guarantee that an overflowed
46 * stack will always be recognised.
47 */
48
49 /*-----------------------------------------------------------*/
50
51 #if( ( configCHECK_FOR_STACK_OVERFLOW == 1 ) && ( portSTACK_GROWTH < 0 ) )
52
53 /* Only the current stack state is to be checked. */
54 #define taskCHECK_FOR_STACK_OVERFLOW() \
55 { \
56 /* Is the currently saved stack pointer within the stack limit? */ \
57 if( pxCurrentTCB->pxTopOfStack <= pxCurrentTCB->pxStack ) \
58 { \
59 vApplicationStackOverflowHook( ( TaskHandle_t ) pxCurrentTCB, pxCurrentTCB->pcTaskName ); \
60 } \
61 }
62
63 #endif /* configCHECK_FOR_STACK_OVERFLOW == 1 */
64 /*-----------------------------------------------------------*/
65
66 #if( ( configCHECK_FOR_STACK_OVERFLOW == 1 ) && ( portSTACK_GROWTH > 0 ) )
67
68 /* Only the current stack state is to be checked. */
69 #define taskCHECK_FOR_STACK_OVERFLOW() \
70 { \
71 \
72 /* Is the currently saved stack pointer within the stack limit? */ \
73 if( pxCurrentTCB->pxTopOfStack >= pxCurrentTCB->pxEndOfStack ) \
74 { \
75 vApplicationStackOverflowHook( ( TaskHandle_t ) pxCurrentTCB, pxCurrentTCB->pcTaskName ); \
76 } \
77 }
78
79 #endif /* configCHECK_FOR_STACK_OVERFLOW == 1 */
80 /*-----------------------------------------------------------*/
81
82 #if( ( configCHECK_FOR_STACK_OVERFLOW > 1 ) && ( portSTACK_GROWTH < 0 ) )
83
84 #define taskCHECK_FOR_STACK_OVERFLOW() \
85 { \
86 const uint32_t * const pulStack = ( uint32_t * ) pxCurrentTCB->pxStack; \
87 const uint32_t ulCheckValue = ( uint32_t ) 0xa5a5a5a5; \
88 \
89 if( ( pulStack[ 0 ] != ulCheckValue ) || \
90 ( pulStack[ 1 ] != ulCheckValue ) || \
91 ( pulStack[ 2 ] != ulCheckValue ) || \
92 ( pulStack[ 3 ] != ulCheckValue ) ) \
93 { \
94 vApplicationStackOverflowHook( ( TaskHandle_t ) pxCurrentTCB, pxCurrentTCB->pcTaskName ); \
95 } \
96 }
97
98 #endif /* #if( configCHECK_FOR_STACK_OVERFLOW > 1 ) */
99 /*-----------------------------------------------------------*/
100
101 #if( ( configCHECK_FOR_STACK_OVERFLOW > 1 ) && ( portSTACK_GROWTH > 0 ) )
102
103 #define taskCHECK_FOR_STACK_OVERFLOW() \
104 { \
105 int8_t *pcEndOfStack = ( int8_t * ) pxCurrentTCB->pxEndOfStack; \
106 static const uint8_t ucExpectedStackBytes[] = { tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, \
107 tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, \
108 tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, \
109 tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, \
110 tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE }; \
111 \
112 \
113 pcEndOfStack -= sizeof( ucExpectedStackBytes ); \
114 \
115 /* Has the extremity of the task stack ever been written over? */ \
116 if( memcmp( ( void * ) pcEndOfStack, ( void * ) ucExpectedStackBytes, sizeof( ucExpectedStackBytes ) ) != 0 ) \
117 { \
118 vApplicationStackOverflowHook( ( TaskHandle_t ) pxCurrentTCB, pxCurrentTCB->pcTaskName ); \
119 } \
120 }
121
122 #endif /* #if( configCHECK_FOR_STACK_OVERFLOW > 1 ) */
123 /*-----------------------------------------------------------*/
124
125 /* Remove stack overflow macro if not being used. */
126 #ifndef taskCHECK_FOR_STACK_OVERFLOW
127 #define taskCHECK_FOR_STACK_OVERFLOW()
128 #endif
129
130
131
132 #endif /* STACK_MACROS_H */
133
1 /*
2 * FreeRTOS Kernel V10.0.1
3 * Copyright (C) 2017 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 * http://www.FreeRTOS.org
23 * http://aws.amazon.com/freertos
24 *
25 * 1 tab == 4 spaces!
26 */
27
28 #ifndef DEPRECATED_DEFINITIONS_H
29 #define DEPRECATED_DEFINITIONS_H
30
31
32 /* Each FreeRTOS port has a unique portmacro.h header file. Originally a
33 pre-processor definition was used to ensure the pre-processor found the correct
34 portmacro.h file for the port being used. That scheme was deprecated in favour
35 of setting the compiler's include path such that it found the correct
36 portmacro.h file - removing the need for the constant and allowing the
37 portmacro.h file to be located anywhere in relation to the port being used. The
38 definitions below remain in the code for backward compatibility only. New
39 projects should not use them. */
40
41 #ifdef OPEN_WATCOM_INDUSTRIAL_PC_PORT
42 #include "..\..\Source\portable\owatcom\16bitdos\pc\portmacro.h"
43 typedef void ( __interrupt __far *pxISR )();
44 #endif
45
46 #ifdef OPEN_WATCOM_FLASH_LITE_186_PORT
47 #include "..\..\Source\portable\owatcom\16bitdos\flsh186\portmacro.h"
48 typedef void ( __interrupt __far *pxISR )();
49 #endif
50
51 #ifdef GCC_MEGA_AVR
52 #include "../portable/GCC/ATMega323/portmacro.h"
53 #endif
54
55 #ifdef IAR_MEGA_AVR
56 #include "../portable/IAR/ATMega323/portmacro.h"
57 #endif
58
59 #ifdef MPLAB_PIC24_PORT
60 #include "../../Source/portable/MPLAB/PIC24_dsPIC/portmacro.h"
61 #endif
62
63 #ifdef MPLAB_DSPIC_PORT
64 #include "../../Source/portable/MPLAB/PIC24_dsPIC/portmacro.h"
65 #endif
66
67 #ifdef MPLAB_PIC18F_PORT
68 #include "../../Source/portable/MPLAB/PIC18F/portmacro.h"
69 #endif
70
71 #ifdef MPLAB_PIC32MX_PORT
72 #include "../../Source/portable/MPLAB/PIC32MX/portmacro.h"
73 #endif
74
75 #ifdef _FEDPICC
76 #include "libFreeRTOS/Include/portmacro.h"
77 #endif
78
79 #ifdef SDCC_CYGNAL
80 #include "../../Source/portable/SDCC/Cygnal/portmacro.h"
81 #endif
82
83 #ifdef GCC_ARM7
84 #include "../../Source/portable/GCC/ARM7_LPC2000/portmacro.h"
85 #endif
86
87 #ifdef GCC_ARM7_ECLIPSE
88 #include "portmacro.h"
89 #endif
90
91 #ifdef ROWLEY_LPC23xx
92 #include "../../Source/portable/GCC/ARM7_LPC23xx/portmacro.h"
93 #endif
94
95 #ifdef IAR_MSP430
96 #include "..\..\Source\portable\IAR\MSP430\portmacro.h"
97 #endif
98
99 #ifdef GCC_MSP430
100 #include "../../Source/portable/GCC/MSP430F449/portmacro.h"
101 #endif
102
103 #ifdef ROWLEY_MSP430
104 #include "../../Source/portable/Rowley/MSP430F449/portmacro.h"
105 #endif
106
107 #ifdef ARM7_LPC21xx_KEIL_RVDS
108 #include "..\..\Source\portable\RVDS\ARM7_LPC21xx\portmacro.h"
109 #endif
110
111 #ifdef SAM7_GCC
112 #include "../../Source/portable/GCC/ARM7_AT91SAM7S/portmacro.h"
113 #endif
114
115 #ifdef SAM7_IAR
116 #include "..\..\Source\portable\IAR\AtmelSAM7S64\portmacro.h"
117 #endif
118
119 #ifdef SAM9XE_IAR
120 #include "..\..\Source\portable\IAR\AtmelSAM9XE\portmacro.h"
121 #endif
122
123 #ifdef LPC2000_IAR
124 #include "..\..\Source\portable\IAR\LPC2000\portmacro.h"
125 #endif
126
127 #ifdef STR71X_IAR
128 #include "..\..\Source\portable\IAR\STR71x\portmacro.h"
129 #endif
130
131 #ifdef STR75X_IAR
132 #include "..\..\Source\portable\IAR\STR75x\portmacro.h"
133 #endif
134
135 #ifdef STR75X_GCC
136 #include "..\..\Source\portable\GCC\STR75x\portmacro.h"
137 #endif
138
139 #ifdef STR91X_IAR
140 #include "..\..\Source\portable\IAR\STR91x\portmacro.h"
141 #endif
142
143 #ifdef GCC_H8S
144 #include "../../Source/portable/GCC/H8S2329/portmacro.h"
145 #endif
146
147 #ifdef GCC_AT91FR40008
148 #include "../../Source/portable/GCC/ARM7_AT91FR40008/portmacro.h"
149 #endif
150
151 #ifdef RVDS_ARMCM3_LM3S102
152 #include "../../Source/portable/RVDS/ARM_CM3/portmacro.h"
153 #endif
154
155 #ifdef GCC_ARMCM3_LM3S102
156 #include "../../Source/portable/GCC/ARM_CM3/portmacro.h"
157 #endif
158
159 #ifdef GCC_ARMCM3
160 #include "../../Source/portable/GCC/ARM_CM3/portmacro.h"
161 #endif
162
163 #ifdef IAR_ARM_CM3
164 #include "../../Source/portable/IAR/ARM_CM3/portmacro.h"
165 #endif
166
167 #ifdef IAR_ARMCM3_LM
168 #include "../../Source/portable/IAR/ARM_CM3/portmacro.h"
169 #endif
170
171 #ifdef HCS12_CODE_WARRIOR
172 #include "../../Source/portable/CodeWarrior/HCS12/portmacro.h"
173 #endif
174
175 #ifdef MICROBLAZE_GCC
176 #include "../../Source/portable/GCC/MicroBlaze/portmacro.h"
177 #endif
178
179 #ifdef TERN_EE
180 #include "..\..\Source\portable\Paradigm\Tern_EE\small\portmacro.h"
181 #endif
182
183 #ifdef GCC_HCS12
184 #include "../../Source/portable/GCC/HCS12/portmacro.h"
185 #endif
186
187 #ifdef GCC_MCF5235
188 #include "../../Source/portable/GCC/MCF5235/portmacro.h"
189 #endif
190
191 #ifdef COLDFIRE_V2_GCC
192 #include "../../../Source/portable/GCC/ColdFire_V2/portmacro.h"
193 #endif
194
195 #ifdef COLDFIRE_V2_CODEWARRIOR
196 #include "../../Source/portable/CodeWarrior/ColdFire_V2/portmacro.h"
197 #endif
198
199 #ifdef GCC_PPC405
200 #include "../../Source/portable/GCC/PPC405_Xilinx/portmacro.h"
201 #endif
202
203 #ifdef GCC_PPC440
204 #include "../../Source/portable/GCC/PPC440_Xilinx/portmacro.h"
205 #endif
206
207 #ifdef _16FX_SOFTUNE
208 #include "..\..\Source\portable\Softune\MB96340\portmacro.h"
209 #endif
210
211 #ifdef BCC_INDUSTRIAL_PC_PORT
212 /* A short file name has to be used in place of the normal
213 FreeRTOSConfig.h when using the Borland compiler. */
214 #include "frconfig.h"
215 #include "..\portable\BCC\16BitDOS\PC\prtmacro.h"
216 typedef void ( __interrupt __far *pxISR )();
217 #endif
218
219 #ifdef BCC_FLASH_LITE_186_PORT
220 /* A short file name has to be used in place of the normal
221 FreeRTOSConfig.h when using the Borland compiler. */
222 #include "frconfig.h"
223 #include "..\portable\BCC\16BitDOS\flsh186\prtmacro.h"
224 typedef void ( __interrupt __far *pxISR )();
225 #endif
226
227 #ifdef __GNUC__
228 #ifdef __AVR32_AVR32A__
229 #include "portmacro.h"
230 #endif
231 #endif
232
233 #ifdef __ICCAVR32__
234 #ifdef __CORE__
235 #if __CORE__ == __AVR32A__
236 #include "portmacro.h"
237 #endif
238 #endif
239 #endif
240
241 #ifdef __91467D
242 #include "portmacro.h"
243 #endif
244
245 #ifdef __96340
246 #include "portmacro.h"
247 #endif
248
249
250 #ifdef __IAR_V850ES_Fx3__
251 #include "../../Source/portable/IAR/V850ES/portmacro.h"
252 #endif
253
254 #ifdef __IAR_V850ES_Jx3__
255 #include "../../Source/portable/IAR/V850ES/portmacro.h"
256 #endif
257
258 #ifdef __IAR_V850ES_Jx3_L__
259 #include "../../Source/portable/IAR/V850ES/portmacro.h"
260 #endif
261
262 #ifdef __IAR_V850ES_Jx2__
263 #include "../../Source/portable/IAR/V850ES/portmacro.h"
264 #endif
265
266 #ifdef __IAR_V850ES_Hx2__
267 #include "../../Source/portable/IAR/V850ES/portmacro.h"
268 #endif
269
270 #ifdef __IAR_78K0R_Kx3__
271 #include "../../Source/portable/IAR/78K0R/portmacro.h"
272 #endif
273
274 #ifdef __IAR_78K0R_Kx3L__
275 #include "../../Source/portable/IAR/78K0R/portmacro.h"
276 #endif
277
278 #endif /* DEPRECATED_DEFINITIONS_H */
279
1 /*
2 * FreeRTOS Kernel V10.0.1
3 * Copyright (C) 2017 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 * http://www.FreeRTOS.org
23 * http://aws.amazon.com/freertos
24 *
25 * 1 tab == 4 spaces!
26 */
27
28 #ifndef MPU_WRAPPERS_H
29 #define MPU_WRAPPERS_H
30
31 /* This file redefines API functions to be called through a wrapper macro, but
32 only for ports that are using the MPU. */
33 #ifdef portUSING_MPU_WRAPPERS
34
35 /* MPU_WRAPPERS_INCLUDED_FROM_API_FILE will be defined when this file is
36 included from queue.c or task.c to prevent it from having an effect within
37 those files. */
38 #ifndef MPU_WRAPPERS_INCLUDED_FROM_API_FILE
39
40 /*
41 * Map standard (non MPU) API functions to equivalents that start
42 * "MPU_". This will cause the application code to call the MPU_
43 * version, which wraps the non-MPU version with privilege promoting
44 * then demoting code, so the kernel code always runs will full
45 * privileges.
46 */
47
48 /* Map standard tasks.h API functions to the MPU equivalents. */
49 #define xTaskCreate MPU_xTaskCreate
50 #define xTaskCreateStatic MPU_xTaskCreateStatic
51 #define xTaskCreateRestricted MPU_xTaskCreateRestricted
52 #define vTaskAllocateMPURegions MPU_vTaskAllocateMPURegions
53 #define vTaskDelete MPU_vTaskDelete
54 #define vTaskDelay MPU_vTaskDelay
55 #define vTaskDelayUntil MPU_vTaskDelayUntil
56 #define xTaskAbortDelay MPU_xTaskAbortDelay
57 #define uxTaskPriorityGet MPU_uxTaskPriorityGet
58 #define eTaskGetState MPU_eTaskGetState
59 #define vTaskGetInfo MPU_vTaskGetInfo
60 #define vTaskPrioritySet MPU_vTaskPrioritySet
61 #define vTaskSuspend MPU_vTaskSuspend
62 #define vTaskResume MPU_vTaskResume
63 #define vTaskSuspendAll MPU_vTaskSuspendAll
64 #define xTaskResumeAll MPU_xTaskResumeAll
65 #define xTaskGetTickCount MPU_xTaskGetTickCount
66 #define uxTaskGetNumberOfTasks MPU_uxTaskGetNumberOfTasks
67 #define pcTaskGetName MPU_pcTaskGetName
68 #define xTaskGetHandle MPU_xTaskGetHandle
69 #define uxTaskGetStackHighWaterMark MPU_uxTaskGetStackHighWaterMark
70 #define vTaskSetApplicationTaskTag MPU_vTaskSetApplicationTaskTag
71 #define xTaskGetApplicationTaskTag MPU_xTaskGetApplicationTaskTag
72 #define vTaskSetThreadLocalStoragePointer MPU_vTaskSetThreadLocalStoragePointer
73 #define pvTaskGetThreadLocalStoragePointer MPU_pvTaskGetThreadLocalStoragePointer
74 #define xTaskCallApplicationTaskHook MPU_xTaskCallApplicationTaskHook
75 #define xTaskGetIdleTaskHandle MPU_xTaskGetIdleTaskHandle
76 #define uxTaskGetSystemState MPU_uxTaskGetSystemState
77 #define vTaskList MPU_vTaskList
78 #define vTaskGetRunTimeStats MPU_vTaskGetRunTimeStats
79 #define xTaskGenericNotify MPU_xTaskGenericNotify
80 #define xTaskNotifyWait MPU_xTaskNotifyWait
81 #define ulTaskNotifyTake MPU_ulTaskNotifyTake
82 #define xTaskNotifyStateClear MPU_xTaskNotifyStateClear
83
84 #define xTaskGetCurrentTaskHandle MPU_xTaskGetCurrentTaskHandle
85 #define vTaskSetTimeOutState MPU_vTaskSetTimeOutState
86 #define xTaskCheckForTimeOut MPU_xTaskCheckForTimeOut
87 #define xTaskGetSchedulerState MPU_xTaskGetSchedulerState
88
89 /* Map standard queue.h API functions to the MPU equivalents. */
90 #define xQueueGenericSend MPU_xQueueGenericSend
91 #define xQueueReceive MPU_xQueueReceive
92 #define xQueuePeek MPU_xQueuePeek
93 #define xQueueSemaphoreTake MPU_xQueueSemaphoreTake
94 #define uxQueueMessagesWaiting MPU_uxQueueMessagesWaiting
95 #define uxQueueSpacesAvailable MPU_uxQueueSpacesAvailable
96 #define vQueueDelete MPU_vQueueDelete
97 #define xQueueCreateMutex MPU_xQueueCreateMutex
98 #define xQueueCreateMutexStatic MPU_xQueueCreateMutexStatic
99 #define xQueueCreateCountingSemaphore MPU_xQueueCreateCountingSemaphore
100 #define xQueueCreateCountingSemaphoreStatic MPU_xQueueCreateCountingSemaphoreStatic
101 #define xQueueGetMutexHolder MPU_xQueueGetMutexHolder
102 #define xQueueTakeMutexRecursive MPU_xQueueTakeMutexRecursive
103 #define xQueueGiveMutexRecursive MPU_xQueueGiveMutexRecursive
104 #define xQueueGenericCreate MPU_xQueueGenericCreate
105 #define xQueueGenericCreateStatic MPU_xQueueGenericCreateStatic
106 #define xQueueCreateSet MPU_xQueueCreateSet
107 #define xQueueAddToSet MPU_xQueueAddToSet
108 #define xQueueRemoveFromSet MPU_xQueueRemoveFromSet
109 #define xQueueSelectFromSet MPU_xQueueSelectFromSet
110 #define xQueueGenericReset MPU_xQueueGenericReset
111
112 #if( configQUEUE_REGISTRY_SIZE > 0 )
113 #define vQueueAddToRegistry MPU_vQueueAddToRegistry
114 #define vQueueUnregisterQueue MPU_vQueueUnregisterQueue
115 #define pcQueueGetName MPU_pcQueueGetName
116 #endif
117
118 /* Map standard timer.h API functions to the MPU equivalents. */
119 #define xTimerCreate MPU_xTimerCreate
120 #define xTimerCreateStatic MPU_xTimerCreateStatic
121 #define pvTimerGetTimerID MPU_pvTimerGetTimerID
122 #define vTimerSetTimerID MPU_vTimerSetTimerID
123 #define xTimerIsTimerActive MPU_xTimerIsTimerActive
124 #define xTimerGetTimerDaemonTaskHandle MPU_xTimerGetTimerDaemonTaskHandle
125 #define xTimerPendFunctionCall MPU_xTimerPendFunctionCall
126 #define pcTimerGetName MPU_pcTimerGetName
127 #define xTimerGetPeriod MPU_xTimerGetPeriod
128 #define xTimerGetExpiryTime MPU_xTimerGetExpiryTime
129 #define xTimerGenericCommand MPU_xTimerGenericCommand
130
131 /* Map standard event_group.h API functions to the MPU equivalents. */
132 #define xEventGroupCreate MPU_xEventGroupCreate
133 #define xEventGroupCreateStatic MPU_xEventGroupCreateStatic
134 #define xEventGroupWaitBits MPU_xEventGroupWaitBits
135 #define xEventGroupClearBits MPU_xEventGroupClearBits
136 #define xEventGroupSetBits MPU_xEventGroupSetBits
137 #define xEventGroupSync MPU_xEventGroupSync
138 #define vEventGroupDelete MPU_vEventGroupDelete
139
140 /* Map standard message/stream_buffer.h API functions to the MPU
141 equivalents. */
142 #define xStreamBufferSend MPU_xStreamBufferSend
143 #define xStreamBufferSendFromISR MPU_xStreamBufferSendFromISR
144 #define xStreamBufferReceive MPU_xStreamBufferReceive
145 #define xStreamBufferReceiveFromISR MPU_xStreamBufferReceiveFromISR
146 #define vStreamBufferDelete MPU_vStreamBufferDelete
147 #define xStreamBufferIsFull MPU_xStreamBufferIsFull
148 #define xStreamBufferIsEmpty MPU_xStreamBufferIsEmpty
149 #define xStreamBufferReset MPU_xStreamBufferReset
150 #define xStreamBufferSpacesAvailable MPU_xStreamBufferSpacesAvailable
151 #define xStreamBufferBytesAvailable MPU_xStreamBufferBytesAvailable
152 #define xStreamBufferSetTriggerLevel MPU_xStreamBufferSetTriggerLevel
153 #define xStreamBufferGenericCreate MPU_xStreamBufferGenericCreate
154 #define xStreamBufferGenericCreateStatic MPU_xStreamBufferGenericCreateStatic
155
156
157 /* Remove the privileged function macro, but keep the PRIVILEGED_DATA
158 macro so applications can place data in privileged access sections
159 (useful when using statically allocated objects). */
160 #define PRIVILEGED_FUNCTION
161 #define PRIVILEGED_DATA __attribute__((section("privileged_data")))
162
163 #else /* MPU_WRAPPERS_INCLUDED_FROM_API_FILE */
164
165 /* Ensure API functions go in the privileged execution section. */
166 #define PRIVILEGED_FUNCTION __attribute__((section("privileged_functions")))
167 #define PRIVILEGED_DATA __attribute__((section("privileged_data")))
168
169 #endif /* MPU_WRAPPERS_INCLUDED_FROM_API_FILE */
170
171 #else /* portUSING_MPU_WRAPPERS */
172
173 #define PRIVILEGED_FUNCTION
174 #define PRIVILEGED_DATA
175 #define portUSING_MPU_WRAPPERS 0
176
177 #endif /* portUSING_MPU_WRAPPERS */
178
179
180 #endif /* MPU_WRAPPERS_H */
181
1 /*
2 * FreeRTOS Kernel V10.0.1
3 * Copyright (C) 2017 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 * http://www.FreeRTOS.org
23 * http://aws.amazon.com/freertos
24 *
25 * 1 tab == 4 spaces!
26 */
27
28 /*-----------------------------------------------------------
29 * Portable layer API. Each function must be defined for each port.
30 *----------------------------------------------------------*/
31
32 #ifndef PORTABLE_H
33 #define PORTABLE_H
34
35 /* Each FreeRTOS port has a unique portmacro.h header file. Originally a
36 pre-processor definition was used to ensure the pre-processor found the correct
37 portmacro.h file for the port being used. That scheme was deprecated in favour
38 of setting the compiler's include path such that it found the correct
39 portmacro.h file - removing the need for the constant and allowing the
40 portmacro.h file to be located anywhere in relation to the port being used.
41 Purely for reasons of backward compatibility the old method is still valid, but
42 to make it clear that new projects should not use it, support for the port
43 specific constants has been moved into the deprecated_definitions.h header
44 file. */
45 #include "deprecated_definitions.h"
46
47 /* If portENTER_CRITICAL is not defined then including deprecated_definitions.h
48 did not result in a portmacro.h header file being included - and it should be
49 included here. In this case the path to the correct portmacro.h header file
50 must be set in the compiler's include path. */
51 #ifndef portENTER_CRITICAL
52 #include "portmacro.h"
53 #endif
54
55 #if portBYTE_ALIGNMENT == 32
56 #define portBYTE_ALIGNMENT_MASK ( 0x001f )
57 #endif
58
59 #if portBYTE_ALIGNMENT == 16
60 #define portBYTE_ALIGNMENT_MASK ( 0x000f )
61 #endif
62
63 #if portBYTE_ALIGNMENT == 8
64 #define portBYTE_ALIGNMENT_MASK ( 0x0007 )
65 #endif
66
67 #if portBYTE_ALIGNMENT == 4
68 #define portBYTE_ALIGNMENT_MASK ( 0x0003 )
69 #endif
70
71 #if portBYTE_ALIGNMENT == 2
72 #define portBYTE_ALIGNMENT_MASK ( 0x0001 )
73 #endif
74
75 #if portBYTE_ALIGNMENT == 1
76 #define portBYTE_ALIGNMENT_MASK ( 0x0000 )
77 #endif
78
79 #ifndef portBYTE_ALIGNMENT_MASK
80 #error "Invalid portBYTE_ALIGNMENT definition"
81 #endif
82
83 #ifndef portNUM_CONFIGURABLE_REGIONS
84 #define portNUM_CONFIGURABLE_REGIONS 1
85 #endif
86
87 #ifdef __cplusplus
88 extern "C" {
89 #endif
90
91 #include "mpu_wrappers.h"
92
93 /*
94 * Setup the stack of a new task so it is ready to be placed under the
95 * scheduler control. The registers have to be placed on the stack in
96 * the order that the port expects to find them.
97 *
98 */
99 #if( portUSING_MPU_WRAPPERS == 1 )
100 StackType_t *pxPortInitialiseStack( StackType_t *pxTopOfStack, TaskFunction_t pxCode, void *pvParameters, BaseType_t xRunPrivileged ) PRIVILEGED_FUNCTION;
101 #else
102 StackType_t *pxPortInitialiseStack( StackType_t *pxTopOfStack, TaskFunction_t pxCode, void *pvParameters ) PRIVILEGED_FUNCTION;
103 #endif
104
105 /* Used by heap_5.c. */
106 typedef struct HeapRegion
107 {
108 uint8_t *pucStartAddress;
109 size_t xSizeInBytes;
110 } HeapRegion_t;
111
112 /*
113 * Used to define multiple heap regions for use by heap_5.c. This function
114 * must be called before any calls to pvPortMalloc() - not creating a task,
115 * queue, semaphore, mutex, software timer, event group, etc. will result in
116 * pvPortMalloc being called.
117 *
118 * pxHeapRegions passes in an array of HeapRegion_t structures - each of which
119 * defines a region of memory that can be used as the heap. The array is
120 * terminated by a HeapRegions_t structure that has a size of 0. The region
121 * with the lowest start address must appear first in the array.
122 */
123 void vPortDefineHeapRegions( const HeapRegion_t * const pxHeapRegions ) PRIVILEGED_FUNCTION;
124
125
126 /*
127 * Map to the memory management routines required for the port.
128 */
129 void *pvPortMalloc( size_t xSize ) PRIVILEGED_FUNCTION;
130 void vPortFree( void *pv ) PRIVILEGED_FUNCTION;
131 void vPortInitialiseBlocks( void ) PRIVILEGED_FUNCTION;
132 size_t xPortGetFreeHeapSize( void ) PRIVILEGED_FUNCTION;
133 size_t xPortGetMinimumEverFreeHeapSize( void ) PRIVILEGED_FUNCTION;
134
135 /*
136 * Setup the hardware ready for the scheduler to take control. This generally
137 * sets up a tick interrupt and sets timers for the correct tick frequency.
138 */
139 BaseType_t xPortStartScheduler( void ) PRIVILEGED_FUNCTION;
140
141 /*
142 * Undo any hardware/ISR setup that was performed by xPortStartScheduler() so
143 * the hardware is left in its original condition after the scheduler stops
144 * executing.
145 */
146 void vPortEndScheduler( void ) PRIVILEGED_FUNCTION;
147
148 /*
149 * The structures and methods of manipulating the MPU are contained within the
150 * port layer.
151 *
152 * Fills the xMPUSettings structure with the memory region information
153 * contained in xRegions.
154 */
155 #if( portUSING_MPU_WRAPPERS == 1 )
156 struct xMEMORY_REGION;
157 void vPortStoreTaskMPUSettings( xMPU_SETTINGS *xMPUSettings, const struct xMEMORY_REGION * const xRegions, StackType_t *pxBottomOfStack, uint32_t ulStackDepth ) PRIVILEGED_FUNCTION;
158 #endif
159
160 #ifdef __cplusplus
161 }
162 #endif
163
164 #endif /* PORTABLE_H */
165
1 /*
2 * FreeRTOS Kernel V10.0.1
3 * Copyright (C) 2017 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 * http://www.FreeRTOS.org
23 * http://aws.amazon.com/freertos
24 *
25 * 1 tab == 4 spaces!
26 */
27
28 #ifndef PROJDEFS_H
29 #define PROJDEFS_H
30
31 /*
32 * Defines the prototype to which task functions must conform. Defined in this
33 * file to ensure the type is known before portable.h is included.
34 */
35 typedef void (*TaskFunction_t)( void * );
36
37 /* Converts a time in milliseconds to a time in ticks. This macro can be
38 overridden by a macro of the same name defined in FreeRTOSConfig.h in case the
39 definition here is not suitable for your application. */
40 #ifndef pdMS_TO_TICKS
41 #define pdMS_TO_TICKS( xTimeInMs ) ( ( TickType_t ) ( ( ( TickType_t ) ( xTimeInMs ) * ( TickType_t ) configTICK_RATE_HZ ) / ( TickType_t ) 1000 ) )
42 #endif
43
44 #define pdFALSE ( ( BaseType_t ) 0 )
45 #define pdTRUE ( ( BaseType_t ) 1 )
46
47 #define pdPASS ( pdTRUE )
48 #define pdFAIL ( pdFALSE )
49 #define errQUEUE_EMPTY ( ( BaseType_t ) 0 )
50 #define errQUEUE_FULL ( ( BaseType_t ) 0 )
51
52 /* FreeRTOS error definitions. */
53 #define errCOULD_NOT_ALLOCATE_REQUIRED_MEMORY ( -1 )
54 #define errQUEUE_BLOCKED ( -4 )
55 #define errQUEUE_YIELD ( -5 )
56
57 /* Macros used for basic data corruption checks. */
58 #ifndef configUSE_LIST_DATA_INTEGRITY_CHECK_BYTES
59 #define configUSE_LIST_DATA_INTEGRITY_CHECK_BYTES 0
60 #endif
61
62 #if( configUSE_16_BIT_TICKS == 1 )
63 #define pdINTEGRITY_CHECK_VALUE 0x5a5a
64 #else
65 #define pdINTEGRITY_CHECK_VALUE 0x5a5a5a5aUL
66 #endif
67
68 /* The following errno values are used by FreeRTOS+ components, not FreeRTOS
69 itself. */
70 #define pdFREERTOS_ERRNO_NONE 0 /* No errors */
71 #define pdFREERTOS_ERRNO_ENOENT 2 /* No such file or directory */
72 #define pdFREERTOS_ERRNO_EINTR 4 /* Interrupted system call */
73 #define pdFREERTOS_ERRNO_EIO 5 /* I/O error */
74 #define pdFREERTOS_ERRNO_ENXIO 6 /* No such device or address */
75 #define pdFREERTOS_ERRNO_EBADF 9 /* Bad file number */
76 #define pdFREERTOS_ERRNO_EAGAIN 11 /* No more processes */
77 #define pdFREERTOS_ERRNO_EWOULDBLOCK 11 /* Operation would block */
78 #define pdFREERTOS_ERRNO_ENOMEM 12 /* Not enough memory */
79 #define pdFREERTOS_ERRNO_EACCES 13 /* Permission denied */
80 #define pdFREERTOS_ERRNO_EFAULT 14 /* Bad address */
81 #define pdFREERTOS_ERRNO_EBUSY 16 /* Mount device busy */
82 #define pdFREERTOS_ERRNO_EEXIST 17 /* File exists */
83 #define pdFREERTOS_ERRNO_EXDEV 18 /* Cross-device link */
84 #define pdFREERTOS_ERRNO_ENODEV 19 /* No such device */
85 #define pdFREERTOS_ERRNO_ENOTDIR 20 /* Not a directory */
86 #define pdFREERTOS_ERRNO_EISDIR 21 /* Is a directory */
87 #define pdFREERTOS_ERRNO_EINVAL 22 /* Invalid argument */
88 #define pdFREERTOS_ERRNO_ENOSPC 28 /* No space left on device */
89 #define pdFREERTOS_ERRNO_ESPIPE 29 /* Illegal seek */
90 #define pdFREERTOS_ERRNO_EROFS 30 /* Read only file system */
91 #define pdFREERTOS_ERRNO_EUNATCH 42 /* Protocol driver not attached */
92 #define pdFREERTOS_ERRNO_EBADE 50 /* Invalid exchange */
93 #define pdFREERTOS_ERRNO_EFTYPE 79 /* Inappropriate file type or format */
94 #define pdFREERTOS_ERRNO_ENMFILE 89 /* No more files */
95 #define pdFREERTOS_ERRNO_ENOTEMPTY 90 /* Directory not empty */
96 #define pdFREERTOS_ERRNO_ENAMETOOLONG 91 /* File or path name too long */
97 #define pdFREERTOS_ERRNO_EOPNOTSUPP 95 /* Operation not supported on transport endpoint */
98 #define pdFREERTOS_ERRNO_ENOBUFS 105 /* No buffer space available */
99 #define pdFREERTOS_ERRNO_ENOPROTOOPT 109 /* Protocol not available */
100 #define pdFREERTOS_ERRNO_EADDRINUSE 112 /* Address already in use */
101 #define pdFREERTOS_ERRNO_ETIMEDOUT 116 /* Connection timed out */
102 #define pdFREERTOS_ERRNO_EINPROGRESS 119 /* Connection already in progress */
103 #define pdFREERTOS_ERRNO_EALREADY 120 /* Socket already connected */
104 #define pdFREERTOS_ERRNO_EADDRNOTAVAIL 125 /* Address not available */
105 #define pdFREERTOS_ERRNO_EISCONN 127 /* Socket is already connected */
106 #define pdFREERTOS_ERRNO_ENOTCONN 128 /* Socket is not connected */
107 #define pdFREERTOS_ERRNO_ENOMEDIUM 135 /* No medium inserted */
108 #define pdFREERTOS_ERRNO_EILSEQ 138 /* An invalid UTF-16 sequence was encountered. */
109 #define pdFREERTOS_ERRNO_ECANCELED 140 /* Operation canceled. */
110
111 /* The following endian values are used by FreeRTOS+ components, not FreeRTOS
112 itself. */
113 #define pdFREERTOS_LITTLE_ENDIAN 0
114 #define pdFREERTOS_BIG_ENDIAN 1
115
116 /* Re-defining endian values for generic naming. */
117 #define pdLITTLE_ENDIAN pdFREERTOS_LITTLE_ENDIAN
118 #define pdBIG_ENDIAN pdFREERTOS_BIG_ENDIAN
119
120
121 #endif /* PROJDEFS_H */
122
123
124
1 /*
2 * FreeRTOS Kernel V10.0.1
3 * Copyright (C) 2017 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 * http://www.FreeRTOS.org
23 * http://aws.amazon.com/freertos
24 *
25 * 1 tab == 4 spaces!
26 */
27
28 #ifndef STACK_MACROS_H
29 #define STACK_MACROS_H
30
31 /*
32 * Call the stack overflow hook function if the stack of the task being swapped
33 * out is currently overflowed, or looks like it might have overflowed in the
34 * past.
35 *
36 * Setting configCHECK_FOR_STACK_OVERFLOW to 1 will cause the macro to check
37 * the current stack state only - comparing the current top of stack value to
38 * the stack limit. Setting configCHECK_FOR_STACK_OVERFLOW to greater than 1
39 * will also cause the last few stack bytes to be checked to ensure the value
40 * to which the bytes were set when the task was created have not been
41 * overwritten. Note this second test does not guarantee that an overflowed
42 * stack will always be recognised.
43 */
44
45 /*-----------------------------------------------------------*/
46
47 #if( ( configCHECK_FOR_STACK_OVERFLOW == 1 ) && ( portSTACK_GROWTH < 0 ) )
48
49 /* Only the current stack state is to be checked. */
50 #define taskCHECK_FOR_STACK_OVERFLOW() \
51 { \
52 /* Is the currently saved stack pointer within the stack limit? */ \
53 if( pxCurrentTCB->pxTopOfStack <= pxCurrentTCB->pxStack ) \
54 { \
55 vApplicationStackOverflowHook( ( TaskHandle_t ) pxCurrentTCB, pxCurrentTCB->pcTaskName ); \
56 } \
57 }
58
59 #endif /* configCHECK_FOR_STACK_OVERFLOW == 1 */
60 /*-----------------------------------------------------------*/
61
62 #if( ( configCHECK_FOR_STACK_OVERFLOW == 1 ) && ( portSTACK_GROWTH > 0 ) )
63
64 /* Only the current stack state is to be checked. */
65 #define taskCHECK_FOR_STACK_OVERFLOW() \
66 { \
67 \
68 /* Is the currently saved stack pointer within the stack limit? */ \
69 if( pxCurrentTCB->pxTopOfStack >= pxCurrentTCB->pxEndOfStack ) \
70 { \
71 vApplicationStackOverflowHook( ( TaskHandle_t ) pxCurrentTCB, pxCurrentTCB->pcTaskName ); \
72 } \
73 }
74
75 #endif /* configCHECK_FOR_STACK_OVERFLOW == 1 */
76 /*-----------------------------------------------------------*/
77
78 #if( ( configCHECK_FOR_STACK_OVERFLOW > 1 ) && ( portSTACK_GROWTH < 0 ) )
79
80 #define taskCHECK_FOR_STACK_OVERFLOW() \
81 { \
82 const uint32_t * const pulStack = ( uint32_t * ) pxCurrentTCB->pxStack; \
83 const uint32_t ulCheckValue = ( uint32_t ) 0xa5a5a5a5; \
84 \
85 if( ( pulStack[ 0 ] != ulCheckValue ) || \
86 ( pulStack[ 1 ] != ulCheckValue ) || \
87 ( pulStack[ 2 ] != ulCheckValue ) || \
88 ( pulStack[ 3 ] != ulCheckValue ) ) \
89 { \
90 vApplicationStackOverflowHook( ( TaskHandle_t ) pxCurrentTCB, pxCurrentTCB->pcTaskName ); \
91 } \
92 }
93
94 #endif /* #if( configCHECK_FOR_STACK_OVERFLOW > 1 ) */
95 /*-----------------------------------------------------------*/
96
97 #if( ( configCHECK_FOR_STACK_OVERFLOW > 1 ) && ( portSTACK_GROWTH > 0 ) )
98
99 #define taskCHECK_FOR_STACK_OVERFLOW() \
100 { \
101 int8_t *pcEndOfStack = ( int8_t * ) pxCurrentTCB->pxEndOfStack; \
102 static const uint8_t ucExpectedStackBytes[] = { tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, \
103 tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, \
104 tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, \
105 tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, \
106 tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE }; \
107 \
108 \
109 pcEndOfStack -= sizeof( ucExpectedStackBytes ); \
110 \
111 /* Has the extremity of the task stack ever been written over? */ \
112 if( memcmp( ( void * ) pcEndOfStack, ( void * ) ucExpectedStackBytes, sizeof( ucExpectedStackBytes ) ) != 0 ) \
113 { \
114 vApplicationStackOverflowHook( ( TaskHandle_t ) pxCurrentTCB, pxCurrentTCB->pcTaskName ); \
115 } \
116 }
117
118 #endif /* #if( configCHECK_FOR_STACK_OVERFLOW > 1 ) */
119 /*-----------------------------------------------------------*/
120
121 /* Remove stack overflow macro if not being used. */
122 #ifndef taskCHECK_FOR_STACK_OVERFLOW
123 #define taskCHECK_FOR_STACK_OVERFLOW()
124 #endif
125
126
127
128 #endif /* STACK_MACROS_H */
129
1 /*
2 * FreeRTOS Kernel V10.0.1
3 * Copyright (C) 2017 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 * http://www.FreeRTOS.org
23 * http://aws.amazon.com/freertos
24 *
25 * 1 tab == 4 spaces!
26 */
27
28
29 #include <stdlib.h>
30 #include "FreeRTOS.h"
31 #include "list.h"
32
33 /*-----------------------------------------------------------
34 * PUBLIC LIST API documented in list.h
35 *----------------------------------------------------------*/
36
37 void vListInitialise( List_t * const pxList )
38 {
39 /* The list structure contains a list item which is used to mark the
40 end of the list. To initialise the list the list end is inserted
41 as the only list entry. */
42 pxList->pxIndex = ( ListItem_t * ) &( pxList->xListEnd ); /*lint !e826 !e740 The mini list structure is used as the list end to save RAM. This is checked and valid. */
43
44 /* The list end value is the highest possible value in the list to
45 ensure it remains at the end of the list. */
46 pxList->xListEnd.xItemValue = portMAX_DELAY;
47
48 /* The list end next and previous pointers point to itself so we know
49 when the list is empty. */
50 pxList->xListEnd.pxNext = ( ListItem_t * ) &( pxList->xListEnd ); /*lint !e826 !e740 The mini list structure is used as the list end to save RAM. This is checked and valid. */
51 pxList->xListEnd.pxPrevious = ( ListItem_t * ) &( pxList->xListEnd );/*lint !e826 !e740 The mini list structure is used as the list end to save RAM. This is checked and valid. */
52
53 pxList->uxNumberOfItems = ( UBaseType_t ) 0U;
54
55 /* Write known values into the list if
56 configUSE_LIST_DATA_INTEGRITY_CHECK_BYTES is set to 1. */
57 listSET_LIST_INTEGRITY_CHECK_1_VALUE( pxList );
58 listSET_LIST_INTEGRITY_CHECK_2_VALUE( pxList );
59 }
60 /*-----------------------------------------------------------*/
61
62 void vListInitialiseItem( ListItem_t * const pxItem )
63 {
64 /* Make sure the list item is not recorded as being on a list. */
65 pxItem->pvContainer = NULL;
66
67 /* Write known values into the list item if
68 configUSE_LIST_DATA_INTEGRITY_CHECK_BYTES is set to 1. */
69 listSET_FIRST_LIST_ITEM_INTEGRITY_CHECK_VALUE( pxItem );
70 listSET_SECOND_LIST_ITEM_INTEGRITY_CHECK_VALUE( pxItem );
71 }
72 /*-----------------------------------------------------------*/
73
74 void vListInsertEnd( List_t * const pxList, ListItem_t * const pxNewListItem )
75 {
76 ListItem_t * const pxIndex = pxList->pxIndex;
77
78 /* Only effective when configASSERT() is also defined, these tests may catch
79 the list data structures being overwritten in memory. They will not catch
80 data errors caused by incorrect configuration or use of FreeRTOS. */
81 listTEST_LIST_INTEGRITY( pxList );
82 listTEST_LIST_ITEM_INTEGRITY( pxNewListItem );
83
84 /* Insert a new list item into pxList, but rather than sort the list,
85 makes the new list item the last item to be removed by a call to
86 listGET_OWNER_OF_NEXT_ENTRY(). */
87 pxNewListItem->pxNext = pxIndex;
88 pxNewListItem->pxPrevious = pxIndex->pxPrevious;
89
90 /* Only used during decision coverage testing. */
91 mtCOVERAGE_TEST_DELAY();
92
93 pxIndex->pxPrevious->pxNext = pxNewListItem;
94 pxIndex->pxPrevious = pxNewListItem;
95
96 /* Remember which list the item is in. */
97 pxNewListItem->pvContainer = ( void * ) pxList;
98
99 ( pxList->uxNumberOfItems )++;
100 }
101 /*-----------------------------------------------------------*/
102
103 void vListInsert( List_t * const pxList, ListItem_t * const pxNewListItem )
104 {
105 ListItem_t *pxIterator;
106 const TickType_t xValueOfInsertion = pxNewListItem->xItemValue;
107
108 /* Only effective when configASSERT() is also defined, these tests may catch
109 the list data structures being overwritten in memory. They will not catch
110 data errors caused by incorrect configuration or use of FreeRTOS. */
111 listTEST_LIST_INTEGRITY( pxList );
112 listTEST_LIST_ITEM_INTEGRITY( pxNewListItem );
113
114 /* Insert the new list item into the list, sorted in xItemValue order.
115
116 If the list already contains a list item with the same item value then the
117 new list item should be placed after it. This ensures that TCB's which are
118 stored in ready lists (all of which have the same xItemValue value) get a
119 share of the CPU. However, if the xItemValue is the same as the back marker
120 the iteration loop below will not end. Therefore the value is checked
121 first, and the algorithm slightly modified if necessary. */
122 if( xValueOfInsertion == portMAX_DELAY )
123 {
124 pxIterator = pxList->xListEnd.pxPrevious;
125 }
126 else
127 {
128 /* *** NOTE ***********************************************************
129 If you find your application is crashing here then likely causes are
130 listed below. In addition see http://www.freertos.org/FAQHelp.html for
131 more tips, and ensure configASSERT() is defined!
132 http://www.freertos.org/a00110.html#configASSERT
133
134 1) Stack overflow -
135 see http://www.freertos.org/Stacks-and-stack-overflow-checking.html
136 2) Incorrect interrupt priority assignment, especially on Cortex-M
137 parts where numerically high priority values denote low actual
138 interrupt priorities, which can seem counter intuitive. See
139 http://www.freertos.org/RTOS-Cortex-M3-M4.html and the definition
140 of configMAX_SYSCALL_INTERRUPT_PRIORITY on
141 http://www.freertos.org/a00110.html
142 3) Calling an API function from within a critical section or when
143 the scheduler is suspended, or calling an API function that does
144 not end in "FromISR" from an interrupt.
145 4) Using a queue or semaphore before it has been initialised or
146 before the scheduler has been started (are interrupts firing
147 before vTaskStartScheduler() has been called?).
148 **********************************************************************/
149
150 for( pxIterator = ( ListItem_t * ) &( pxList->xListEnd ); pxIterator->pxNext->xItemValue <= xValueOfInsertion; pxIterator = pxIterator->pxNext ) /*lint !e826 !e740 The mini list structure is used as the list end to save RAM. This is checked and valid. */
151 {
152 /* There is nothing to do here, just iterating to the wanted
153 insertion position. */
154 }
155 }
156
157 pxNewListItem->pxNext = pxIterator->pxNext;
158 pxNewListItem->pxNext->pxPrevious = pxNewListItem;
159 pxNewListItem->pxPrevious = pxIterator;
160 pxIterator->pxNext = pxNewListItem;
161
162 /* Remember which list the item is in. This allows fast removal of the
163 item later. */
164 pxNewListItem->pvContainer = ( void * ) pxList;
165
166 ( pxList->uxNumberOfItems )++;
167 }
168 /*-----------------------------------------------------------*/
169
170 UBaseType_t uxListRemove( ListItem_t * const pxItemToRemove )
171 {
172 /* The list item knows which list it is in. Obtain the list from the list
173 item. */
174 List_t * const pxList = ( List_t * ) pxItemToRemove->pvContainer;
175
176 pxItemToRemove->pxNext->pxPrevious = pxItemToRemove->pxPrevious;
177 pxItemToRemove->pxPrevious->pxNext = pxItemToRemove->pxNext;
178
179 /* Only used during decision coverage testing. */
180 mtCOVERAGE_TEST_DELAY();
181
182 /* Make sure the index is left pointing to a valid item. */
183 if( pxList->pxIndex == pxItemToRemove )
184 {
185 pxList->pxIndex = pxItemToRemove->pxPrevious;
186 }
187 else
188 {
189 mtCOVERAGE_TEST_MARKER();
190 }
191
192 pxItemToRemove->pvContainer = NULL;
193 ( pxList->uxNumberOfItems )--;
194
195 return pxList->uxNumberOfItems;
196 }
197 /*-----------------------------------------------------------*/
198
1 /*
2 * FreeRTOS Kernel V10.0.1
3 * Copyright (C) 2017 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 * http://www.FreeRTOS.org
23 * http://aws.amazon.com/freertos
24 *
25 * 1 tab == 4 spaces!
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
40 * given hardware 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 #if( configUSE_16_BIT_TICKS == 1 )
60 typedef uint16_t TickType_t;
61 #define portMAX_DELAY ( TickType_t ) 0xffff
62 #else
63 typedef uint32_t TickType_t;
64 #define portMAX_DELAY ( TickType_t ) 0xffffffffUL
65
66 /* 32-bit tick type on a 32-bit architecture, so reads of the tick count do
67 not need to be guarded with a critical section. */
68 #define portTICK_TYPE_IS_ATOMIC 1
69 #endif
70 /*-----------------------------------------------------------*/
71
72 /* Architecture specifics. */
73 #define portSTACK_GROWTH ( -1 )
74 #define portTICK_PERIOD_MS ( ( TickType_t ) 1000 / configTICK_RATE_HZ )
75 #define portBYTE_ALIGNMENT 8
76 /*-----------------------------------------------------------*/
77
78
79 /* Scheduler utilities. */
80 extern void vPortYield( void );
81 #define portNVIC_INT_CTRL_REG ( * ( ( volatile uint32_t * ) 0xe000ed04 ) )
82 #define portNVIC_PENDSVSET_BIT ( 1UL << 28UL )
83 #define portYIELD() vPortYield()
84 #define portEND_SWITCHING_ISR( xSwitchRequired ) if( xSwitchRequired ) portNVIC_INT_CTRL_REG = portNVIC_PENDSVSET_BIT
85 #define portYIELD_FROM_ISR( x ) portEND_SWITCHING_ISR( x )
86 /*-----------------------------------------------------------*/
87
88
89 /* Critical section management. */
90 extern void vPortEnterCritical( void );
91 extern void vPortExitCritical( void );
92 extern uint32_t ulSetInterruptMaskFromISR( void ) __attribute__((naked));
93 extern void vClearInterruptMaskFromISR( uint32_t ulMask ) __attribute__((naked));
94
95 #define portSET_INTERRUPT_MASK_FROM_ISR() ulSetInterruptMaskFromISR()
96 #define portCLEAR_INTERRUPT_MASK_FROM_ISR(x) vClearInterruptMaskFromISR( x )
97 #define portDISABLE_INTERRUPTS() __asm volatile ( " cpsid i " ::: "memory" )
98 #define portENABLE_INTERRUPTS() __asm volatile ( " cpsie i " ::: "memory" )
99 #define portENTER_CRITICAL() vPortEnterCritical()
100 #define portEXIT_CRITICAL() vPortExitCritical()
101
102 /*-----------------------------------------------------------*/
103
104 /* Tickless idle/low power functionality. */
105 #ifndef portSUPPRESS_TICKS_AND_SLEEP
106 extern void vPortSuppressTicksAndSleep( TickType_t xExpectedIdleTime );
107 #define portSUPPRESS_TICKS_AND_SLEEP( xExpectedIdleTime ) vPortSuppressTicksAndSleep( xExpectedIdleTime )
108 #endif
109
110 /*-----------------------------------------------------------*/
111
112 /* Task function macros as described on the FreeRTOS.org WEB site. */
113 #define portTASK_FUNCTION_PROTO( vFunction, pvParameters ) void vFunction( void *pvParameters )
114 #define portTASK_FUNCTION( vFunction, pvParameters ) void vFunction( void *pvParameters )
115
116 #define portNOP()
117
118 #ifdef __cplusplus
119 }
120 #endif
121
122 #endif /* PORTMACRO_H */
123
This diff could not be displayed because it is too large.
...@@ -55,8 +55,8 @@ ENTRY(Reset_Handler) ...@@ -55,8 +55,8 @@ ENTRY(Reset_Handler)
55 /* Highest address of the user mode stack */ 55 /* Highest address of the user mode stack */
56 _estack = ORIGIN(RAM) + LENGTH(RAM); /* end of "RAM" Ram type memory */ 56 _estack = ORIGIN(RAM) + LENGTH(RAM); /* end of "RAM" Ram type memory */
57 57
58 _Min_Heap_Size = 0x200; /* required amount of heap */ 58 _Min_Heap_Size = 0x200 ; /* required amount of heap */
59 _Min_Stack_Size = 0x400; /* required amount of stack */ 59 _Min_Stack_Size = 0x400 ; /* required amount of stack */
60 60
61 /* Memories definition */ 61 /* Memories definition */
62 MEMORY 62 MEMORY
......
...@@ -15,10 +15,12 @@ Mcu.Pin0=PC14-OSC32_IN ...@@ -15,10 +15,12 @@ Mcu.Pin0=PC14-OSC32_IN
15 Mcu.Pin1=PC15-OSC32_OUT 15 Mcu.Pin1=PC15-OSC32_OUT
16 Mcu.Pin2=PF0-OSC_IN 16 Mcu.Pin2=PF0-OSC_IN
17 Mcu.Pin3=PF1-OSC_OUT 17 Mcu.Pin3=PF1-OSC_OUT
18 Mcu.Pin4=PB7 18 Mcu.Pin4=PA13
19 Mcu.Pin5=VP_FREERTOS_VS_CMSIS_V2 19 Mcu.Pin5=PA14
20 Mcu.Pin6=VP_SYS_VS_Systick 20 Mcu.Pin6=PB7
21 Mcu.PinsNb=7 21 Mcu.Pin7=VP_FREERTOS_VS_CMSIS_V2
22 Mcu.Pin8=VP_SYS_VS_tim1
23 Mcu.PinsNb=9
22 Mcu.ThirdPartyNb=0 24 Mcu.ThirdPartyNb=0
23 Mcu.UserConstants= 25 Mcu.UserConstants=
24 Mcu.UserName=STM32F030C8Tx 26 Mcu.UserName=STM32F030C8Tx
...@@ -29,7 +31,14 @@ NVIC.HardFault_IRQn=true\:0\:0\:false\:false\:true\:false\:false\:false ...@@ -29,7 +31,14 @@ NVIC.HardFault_IRQn=true\:0\:0\:false\:false\:true\:false\:false\:false
29 NVIC.NonMaskableInt_IRQn=true\:0\:0\:false\:false\:true\:false\:false\:false 31 NVIC.NonMaskableInt_IRQn=true\:0\:0\:false\:false\:true\:false\:false\:false
30 NVIC.PendSV_IRQn=true\:3\:0\:false\:false\:false\:true\:false\:false 32 NVIC.PendSV_IRQn=true\:3\:0\:false\:false\:false\:true\:false\:false
31 NVIC.SVC_IRQn=true\:0\:0\:false\:false\:false\:false\:false\:false 33 NVIC.SVC_IRQn=true\:0\:0\:false\:false\:false\:false\:false\:false
32 NVIC.SysTick_IRQn=true\:3\:0\:false\:false\:true\:true\:false\:true 34 NVIC.SysTick_IRQn=true\:3\:0\:false\:false\:false\:true\:false\:false
35 NVIC.TIM1_BRK_UP_TRG_COM_IRQn=true\:0\:0\:false\:false\:true\:false\:false\:true
36 NVIC.TimeBase=TIM1_BRK_UP_TRG_COM_IRQn
37 NVIC.TimeBaseIP=TIM1
38 PA13.Mode=Serial_Wire
39 PA13.Signal=SYS_SWDIO
40 PA14.Mode=Serial_Wire
41 PA14.Signal=SYS_SWCLK
33 PB7.GPIOParameters=GPIO_Label 42 PB7.GPIOParameters=GPIO_Label
34 PB7.GPIO_Label=LED1 43 PB7.GPIO_Label=LED1
35 PB7.Locked=true 44 PB7.Locked=true
...@@ -55,7 +64,7 @@ ProjectManager.AskForMigrate=true ...@@ -55,7 +64,7 @@ ProjectManager.AskForMigrate=true
55 ProjectManager.BackupPrevious=false 64 ProjectManager.BackupPrevious=false
56 ProjectManager.CompilerOptimize=6 65 ProjectManager.CompilerOptimize=6
57 ProjectManager.ComputerToolchain=false 66 ProjectManager.ComputerToolchain=false
58 ProjectManager.CoupleFile=false 67 ProjectManager.CoupleFile=true
59 ProjectManager.CustomerFirmwarePackage= 68 ProjectManager.CustomerFirmwarePackage=
60 ProjectManager.DefaultFWLocation=true 69 ProjectManager.DefaultFWLocation=true
61 ProjectManager.DeletePrevious=true 70 ProjectManager.DeletePrevious=true
...@@ -77,7 +86,7 @@ ProjectManager.StackSize=0x400 ...@@ -77,7 +86,7 @@ ProjectManager.StackSize=0x400
77 ProjectManager.TargetToolchain=STM32CubeIDE 86 ProjectManager.TargetToolchain=STM32CubeIDE
78 ProjectManager.ToolChainLocation= 87 ProjectManager.ToolChainLocation=
79 ProjectManager.UnderRoot=true 88 ProjectManager.UnderRoot=true
80 ProjectManager.functionlistsort=1-SystemClock_Config-RCC-false-HAL-false 89 ProjectManager.functionlistsort=2-SystemClock_Config-RCC-false-HAL-false,1-MX_GPIO_Init-GPIO-false-HAL-true
81 RCC.AHBFreq_Value=48000000 90 RCC.AHBFreq_Value=48000000
82 RCC.APB1Freq_Value=48000000 91 RCC.APB1Freq_Value=48000000
83 RCC.APB1TimFreq_Value=48000000 92 RCC.APB1TimFreq_Value=48000000
...@@ -95,7 +104,7 @@ RCC.TimSysFreq_Value=48000000 ...@@ -95,7 +104,7 @@ RCC.TimSysFreq_Value=48000000
95 RCC.USART1Freq_Value=48000000 104 RCC.USART1Freq_Value=48000000
96 VP_FREERTOS_VS_CMSIS_V2.Mode=CMSIS_V2 105 VP_FREERTOS_VS_CMSIS_V2.Mode=CMSIS_V2
97 VP_FREERTOS_VS_CMSIS_V2.Signal=FREERTOS_VS_CMSIS_V2 106 VP_FREERTOS_VS_CMSIS_V2.Signal=FREERTOS_VS_CMSIS_V2
98 VP_SYS_VS_Systick.Mode=SysTick 107 VP_SYS_VS_tim1.Mode=TIM1
99 VP_SYS_VS_Systick.Signal=SYS_VS_Systick 108 VP_SYS_VS_tim1.Signal=SYS_VS_tim1
100 board=custom 109 board=custom
101 isbadioc=false 110 isbadioc=false
......