Looking around the code, I noticed some code in premain that seems duplicate:
|
// Required by FreeRTOS, see http://www.freertos.org/RTOS-Cortex-M3-M4.html |
|
#ifdef NVIC_PRIORITYGROUP_4 |
|
HAL_NVIC_SetPriorityGrouping(NVIC_PRIORITYGROUP_4); |
|
#endif |
|
#if (__CORTEX_M == 0x07U) |
|
// Defined in CMSIS core_cm7.h |
|
#ifndef I_CACHE_DISABLED |
|
SCB_EnableICache(); |
|
#endif |
|
#ifndef D_CACHE_DISABLED |
|
SCB_EnableDCache(); |
|
#endif |
|
#endif |
The same things seem to be done by HAL_Init() already, e.g. on F4:
|
#if (INSTRUCTION_CACHE_ENABLE != 0U) |
|
__HAL_FLASH_INSTRUCTION_CACHE_ENABLE(); |
|
#endif /* INSTRUCTION_CACHE_ENABLE */ |
|
|
|
#if (DATA_CACHE_ENABLE != 0U) |
|
__HAL_FLASH_DATA_CACHE_ENABLE(); |
|
#endif /* DATA_CACHE_ENABLE */ |
|
|
|
#if (PREFETCH_ENABLE != 0U) |
|
__HAL_FLASH_PREFETCH_BUFFER_ENABLE(); |
|
#endif /* PREFETCH_ENABLE */ |
|
|
|
/* Set Interrupt Group Priority */ |
|
HAL_NVIC_SetPriorityGrouping(NVIC_PRIORITYGROUP_4); |
This seems rather pointless, though perhaps when using RTOS the init() function might be replaced and HAL_Init() is not called? But then maybe the RTOS init() should just set up this NVIC stuff it needs by itself?
For the caches, it seems there are now two separate macros to control them, which could also be a bit confusing?
Looking around the code, I noticed some code in premain that seems duplicate:
Arduino_Core_STM32/cores/arduino/main.cpp
Lines 34 to 46 in db1b90f
The same things seem to be done by
HAL_Init()already, e.g. on F4:Arduino_Core_STM32/system/Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal.c
Lines 160 to 173 in db1b90f
This seems rather pointless, though perhaps when using RTOS the
init()function might be replaced andHAL_Init()is not called? But then maybe the RTOSinit()should just set up this NVIC stuff it needs by itself?For the caches, it seems there are now two separate macros to control them, which could also be a bit confusing?