Skip to content

Changes for FreeRTOS Library #190

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Jan 12, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions cores/arduino/Arduino.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,13 @@
#include "wiring.h"

/* sketch */
extern void setup( void ) ;
extern void loop( void ) ;

#ifdef __cplusplus
extern "C"{
#endif // __cplusplus
extern void setup( void ) ;
extern void loop( void ) ;

void yield(void);
#ifdef __cplusplus
} // extern "C"
Expand Down
8 changes: 7 additions & 1 deletion cores/arduino/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,13 @@ void initVariant() { }
// Force init to be called *first*, i.e. before static object allocation.
// Otherwise, statically allocated objects that need HAL may fail.
__attribute__(( constructor (101))) void premain() {
init();

// Required by FreeRTOS, see http://www.freertos.org/RTOS-Cortex-M3-M4.html
#ifdef NVIC_PRIORITYGROUP_4
HAL_NVIC_SetPriorityGrouping(NVIC_PRIORITYGROUP_4);
#endif

init();
}

/*
Expand Down
6 changes: 6 additions & 0 deletions cores/arduino/stm32/clock.c
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,11 @@ uint32_t GetCurrentMilli(void)
return HAL_GetTick();
}

void noOsSystickHandler(){

}

void osSystickHandler() __attribute__((weak, alias("noOsSystickHandler")));
/**
* @brief Function called when t he tick interruption falls
* @param None
Expand All @@ -134,6 +139,7 @@ void SysTick_Handler(void)
{
HAL_IncTick();
HAL_SYSTICK_IRQHandler();
osSystickHandler();
}

/**
Expand Down
174 changes: 0 additions & 174 deletions cores/arduino/stm32/hw_config.c
Original file line number Diff line number Diff line change
Expand Up @@ -35,71 +35,13 @@
*
******************************************************************************
*/
/** @addtogroup CMSIS
* @{
*/

/** @addtogroup stm32f4xx_system
* @{
*/

/** @addtogroup STM32F4xx_System_Private_Includes
* @{
*/
#include "stm32_def.h"
#include "hw_config.h"

#ifdef __cplusplus
extern "C" {
#endif

/**
* @}
*/

/** @addtogroup STM32F4xx_System_Private_TypesDefinitions
* @{
*/

/**
* @}
*/

/** @addtogroup STM32F4xx_System_Private_Defines
* @{
*/
/**
* @}
*/

/** @addtogroup STM32F4xx_System_Private_Macros
* @{
*/

/**
* @}
*/

/** @addtogroup STM32F4xx_System_Private_Variables
* @{
*/

/**
* @}
*/

/** @addtogroup STM32F4xx_System_Private_FunctionPrototypes
* @{
*/

/**
* @}
*/

/** @addtogroup STM32F4xx_System_Private_Functions
* @{
*/

/**
* @brief This function performs the global init of the system (HAL, IOs...)
* @param None
Expand All @@ -113,122 +55,6 @@ void hw_config_init(void)
// Configure the system clock
SystemClock_Config();
}

/******************************************************************************/
/* Cortex-M4 Processor Interruption and Exception Handlers */
/******************************************************************************/

/**
* @brief This function handles Non maskable interrupt.
*/
void NMI_Handler(void)
{
/* USER CODE BEGIN NonMaskableInt_IRQn 0 */

/* USER CODE END NonMaskableInt_IRQn 0 */

/* USER CODE BEGIN NonMaskableInt_IRQn 1 */

/* USER CODE END NonMaskableInt_IRQn 1 */

}

/**
* @brief This function handles Hard fault interrupt.
*/
void HardFault_Handler(void)
{
/* USER CODE BEGIN HardFault_IRQn 0 */

/* USER CODE END HardFault_IRQn 0 */
while (1)
{
}
/* USER CODE BEGIN HardFault_IRQn 1 */

/* USER CODE END HardFault_IRQn 1 */
}

/**
* @brief This function handles Memory management fault.
*/
void MemManage_Handler(void)
{

/* USER CODE BEGIN MemoryManagement_IRQn 0 */

/* USER CODE END MemoryManagement_IRQn 0 */
while (1)
{
}
/* USER CODE BEGIN MemoryManagement_IRQn 1 */

/* USER CODE END MemoryManagement_IRQn 1 */
}

/**
* @brief This function handles Pre-fetch fault, memory access fault.
*/
void BusFault_Handler(void)
{

/* USER CODE BEGIN BusFault_IRQn 0 */

/* USER CODE END BusFault_IRQn 0 */
while (1)
{
}
/* USER CODE BEGIN BusFault_IRQn 1 */

/* USER CODE END BusFault_IRQn 1 */
}

/**
* @brief This function handles Undefined instruction or illegal state.
*/
void UsageFault_Handler(void)
{

/* USER CODE BEGIN UsageFault_IRQn 0 */

/* USER CODE END UsageFault_IRQn 0 */
while (1)
{
}
/* USER CODE BEGIN UsageFault_IRQn 1 */

/* USER CODE END UsageFault_IRQn 1 */
}

/**
* @brief This function handles Debug monitor.
*/
void DebugMon_Handler(void)
{

/* USER CODE BEGIN DebugMonitor_IRQn 0 */

/* USER CODE END DebugMonitor_IRQn 0 */
while (1)
{
}
/* USER CODE BEGIN DebugMonitor_IRQn 1 */

/* USER CODE END DebugMonitor_IRQn 1 */
}


/**
* @}
*/

/**
* @}
*/

/**
* @}
*/
#ifdef __cplusplus
}
#endif
Expand Down
2 changes: 1 addition & 1 deletion platform.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ version=1.0.0

# STM compile variables
# ----------------------
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"
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"

# "-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"

Expand Down