Skip to content

Commit 76c7915

Browse files
authored
Merge pull request #190 from fpistm/pr-178
Changes for FreeRTOS Library
2 parents 390deaf + 37539b5 commit 76c7915

File tree

5 files changed

+17
-178
lines changed

5 files changed

+17
-178
lines changed

cores/arduino/Arduino.h

+3-2
Original file line numberDiff line numberDiff line change
@@ -32,12 +32,13 @@
3232
#include "wiring.h"
3333

3434
/* sketch */
35-
extern void setup( void ) ;
36-
extern void loop( void ) ;
3735

3836
#ifdef __cplusplus
3937
extern "C"{
4038
#endif // __cplusplus
39+
extern void setup( void ) ;
40+
extern void loop( void ) ;
41+
4142
void yield(void);
4243
#ifdef __cplusplus
4344
} // extern "C"

cores/arduino/main.cpp

+7-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,13 @@ void initVariant() { }
2929
// Force init to be called *first*, i.e. before static object allocation.
3030
// Otherwise, statically allocated objects that need HAL may fail.
3131
__attribute__(( constructor (101))) void premain() {
32-
init();
32+
33+
// Required by FreeRTOS, see http://www.freertos.org/RTOS-Cortex-M3-M4.html
34+
#ifdef NVIC_PRIORITYGROUP_4
35+
HAL_NVIC_SetPriorityGrouping(NVIC_PRIORITYGROUP_4);
36+
#endif
37+
38+
init();
3339
}
3440

3541
/*

cores/arduino/stm32/clock.c

+6
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,11 @@ uint32_t GetCurrentMilli(void)
125125
return HAL_GetTick();
126126
}
127127

128+
void noOsSystickHandler(){
129+
130+
}
131+
132+
void osSystickHandler() __attribute__((weak, alias("noOsSystickHandler")));
128133
/**
129134
* @brief Function called when t he tick interruption falls
130135
* @param None
@@ -134,6 +139,7 @@ void SysTick_Handler(void)
134139
{
135140
HAL_IncTick();
136141
HAL_SYSTICK_IRQHandler();
142+
osSystickHandler();
137143
}
138144

139145
/**

cores/arduino/stm32/hw_config.c

-174
Original file line numberDiff line numberDiff line change
@@ -35,71 +35,13 @@
3535
*
3636
******************************************************************************
3737
*/
38-
/** @addtogroup CMSIS
39-
* @{
40-
*/
41-
42-
/** @addtogroup stm32f4xx_system
43-
* @{
44-
*/
45-
46-
/** @addtogroup STM32F4xx_System_Private_Includes
47-
* @{
48-
*/
4938
#include "stm32_def.h"
5039
#include "hw_config.h"
5140

5241
#ifdef __cplusplus
5342
extern "C" {
5443
#endif
5544

56-
/**
57-
* @}
58-
*/
59-
60-
/** @addtogroup STM32F4xx_System_Private_TypesDefinitions
61-
* @{
62-
*/
63-
64-
/**
65-
* @}
66-
*/
67-
68-
/** @addtogroup STM32F4xx_System_Private_Defines
69-
* @{
70-
*/
71-
/**
72-
* @}
73-
*/
74-
75-
/** @addtogroup STM32F4xx_System_Private_Macros
76-
* @{
77-
*/
78-
79-
/**
80-
* @}
81-
*/
82-
83-
/** @addtogroup STM32F4xx_System_Private_Variables
84-
* @{
85-
*/
86-
87-
/**
88-
* @}
89-
*/
90-
91-
/** @addtogroup STM32F4xx_System_Private_FunctionPrototypes
92-
* @{
93-
*/
94-
95-
/**
96-
* @}
97-
*/
98-
99-
/** @addtogroup STM32F4xx_System_Private_Functions
100-
* @{
101-
*/
102-
10345
/**
10446
* @brief This function performs the global init of the system (HAL, IOs...)
10547
* @param None
@@ -113,122 +55,6 @@ void hw_config_init(void)
11355
// Configure the system clock
11456
SystemClock_Config();
11557
}
116-
117-
/******************************************************************************/
118-
/* Cortex-M4 Processor Interruption and Exception Handlers */
119-
/******************************************************************************/
120-
121-
/**
122-
* @brief This function handles Non maskable interrupt.
123-
*/
124-
void NMI_Handler(void)
125-
{
126-
/* USER CODE BEGIN NonMaskableInt_IRQn 0 */
127-
128-
/* USER CODE END NonMaskableInt_IRQn 0 */
129-
130-
/* USER CODE BEGIN NonMaskableInt_IRQn 1 */
131-
132-
/* USER CODE END NonMaskableInt_IRQn 1 */
133-
134-
}
135-
136-
/**
137-
* @brief This function handles Hard fault interrupt.
138-
*/
139-
void HardFault_Handler(void)
140-
{
141-
/* USER CODE BEGIN HardFault_IRQn 0 */
142-
143-
/* USER CODE END HardFault_IRQn 0 */
144-
while (1)
145-
{
146-
}
147-
/* USER CODE BEGIN HardFault_IRQn 1 */
148-
149-
/* USER CODE END HardFault_IRQn 1 */
150-
}
151-
152-
/**
153-
* @brief This function handles Memory management fault.
154-
*/
155-
void MemManage_Handler(void)
156-
{
157-
158-
/* USER CODE BEGIN MemoryManagement_IRQn 0 */
159-
160-
/* USER CODE END MemoryManagement_IRQn 0 */
161-
while (1)
162-
{
163-
}
164-
/* USER CODE BEGIN MemoryManagement_IRQn 1 */
165-
166-
/* USER CODE END MemoryManagement_IRQn 1 */
167-
}
168-
169-
/**
170-
* @brief This function handles Pre-fetch fault, memory access fault.
171-
*/
172-
void BusFault_Handler(void)
173-
{
174-
175-
/* USER CODE BEGIN BusFault_IRQn 0 */
176-
177-
/* USER CODE END BusFault_IRQn 0 */
178-
while (1)
179-
{
180-
}
181-
/* USER CODE BEGIN BusFault_IRQn 1 */
182-
183-
/* USER CODE END BusFault_IRQn 1 */
184-
}
185-
186-
/**
187-
* @brief This function handles Undefined instruction or illegal state.
188-
*/
189-
void UsageFault_Handler(void)
190-
{
191-
192-
/* USER CODE BEGIN UsageFault_IRQn 0 */
193-
194-
/* USER CODE END UsageFault_IRQn 0 */
195-
while (1)
196-
{
197-
}
198-
/* USER CODE BEGIN UsageFault_IRQn 1 */
199-
200-
/* USER CODE END UsageFault_IRQn 1 */
201-
}
202-
203-
/**
204-
* @brief This function handles Debug monitor.
205-
*/
206-
void DebugMon_Handler(void)
207-
{
208-
209-
/* USER CODE BEGIN DebugMonitor_IRQn 0 */
210-
211-
/* USER CODE END DebugMonitor_IRQn 0 */
212-
while (1)
213-
{
214-
}
215-
/* USER CODE BEGIN DebugMonitor_IRQn 1 */
216-
217-
/* USER CODE END DebugMonitor_IRQn 1 */
218-
}
219-
220-
221-
/**
222-
* @}
223-
*/
224-
225-
/**
226-
* @}
227-
*/
228-
229-
/**
230-
* @}
231-
*/
23258
#ifdef __cplusplus
23359
}
23460
#endif

platform.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ version=1.0.0
99

1010
# STM compile variables
1111
# ----------------------
12-
compiler.stm.extra_include="-I{build.core.path}/avr" "-I{build.core.path}/stm32" "-I{build.system.path}/Drivers/{build.series}_HAL_Driver/Inc/" "-I{build.system.path}/Drivers/{build.series}_HAL_Driver/Src/" "-I{build.system.path}/{build.series}/" "-I{build.variant.path}/usb" "-I{build.variant.path}/Ethernet" "-I{build.system.path}/Middlewares/ST/STM32_USB_Device_Library/Core/Inc" "-I{build.system.path}/Middlewares/ST/STM32_USB_Device_Library/Core/Src"
12+
compiler.stm.extra_include="-I{build.source.path}" "-I{build.core.path}/avr" "-I{build.core.path}/stm32" "-I{build.system.path}/Drivers/{build.series}_HAL_Driver/Inc/" "-I{build.system.path}/Drivers/{build.series}_HAL_Driver/Src/" "-I{build.system.path}/{build.series}/" "-I{build.variant.path}/usb" "-I{build.variant.path}/Ethernet" "-I{build.system.path}/Middlewares/ST/STM32_USB_Device_Library/Core/Inc" "-I{build.system.path}/Middlewares/ST/STM32_USB_Device_Library/Core/Src"
1313

1414
# "-I{build.system.path}/Drivers/BSP/Components" "-I{build.system.path}/Middlewares/Third_Party/FatFs/src" "-I{build.system.path}/Middlewares/ST/STM32_USB_Device_Library/Core/Src" "-I{build.system.path}/Middlewares/ST/STM32_USB_Device_Library/Class/HID/Inc"
1515

0 commit comments

Comments
 (0)