stm32 FLASH allow non blocking operation on constrained devices
On a very memory constrained device with a single task. The sem_wait and sem_post operations can be disabled, to save space. The default is blocking enabled.
This commit is contained in:
parent
27cfde9968
commit
ad2ef95ddf
@ -2832,6 +2832,14 @@ config STM32_FLASH_PREFETCH
|
||||
on F1 parts). Some early revisions of F4 parts do not support FLASH pre-fetch
|
||||
properly and enabling this option may interfere with ADC accuracy.
|
||||
|
||||
config STM32_FLASH_NONBLOCKING
|
||||
bool "Remove Blocking operation in FLASH driver"
|
||||
default n
|
||||
---help---
|
||||
Enable this on single task platforms to conserve code space.
|
||||
It removes the sem_wait and post operations that are not
|
||||
needed in a single task environment.
|
||||
|
||||
config STM32_FLASH_WORKAROUND_DATA_CACHE_CORRUPTION_ON_RWW
|
||||
bool "Workaround for FLASH data cache corruption"
|
||||
default n
|
||||
|
@ -100,23 +100,29 @@
|
||||
* Private Data
|
||||
************************************************************************************/
|
||||
|
||||
#if !defined(CONFIG_STM32_FLASH_NONBLOCKING)
|
||||
static sem_t g_sem = SEM_INITIALIZER(1);
|
||||
#endif
|
||||
|
||||
/************************************************************************************
|
||||
* Private Functions
|
||||
************************************************************************************/
|
||||
|
||||
static void sem_lock(void)
|
||||
static inline void sem_lock(void)
|
||||
{
|
||||
#if !defined(CONFIG_STM32_FLASH_NONBLOCKING)
|
||||
while (sem_wait(&g_sem) < 0)
|
||||
{
|
||||
DEBUGASSERT(errno == EINTR);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
static inline void sem_unlock(void)
|
||||
{
|
||||
#if !defined(CONFIG_STM32_FLASH_NONBLOCKING)
|
||||
sem_post(&g_sem);
|
||||
#endif
|
||||
}
|
||||
|
||||
#if !defined(CONFIG_STM32_STM32L15XX)
|
||||
|
Loading…
x
Reference in New Issue
Block a user