flash: renames only
allowFlashWhileRunning() -> mcuCanFlashWhileRunning() - true if MCU can flash while continue code execution. Dual bank mode on STM32. New allowFlashWhileRunning() return true if MCU can write its own flash while keep runnig OR settings are stored in external storage.
This commit is contained in:
parent
73414d5766
commit
3557d96d3b
|
@ -90,12 +90,19 @@ static void flashWriteThread(void*) {
|
|||
}
|
||||
#endif // EFI_FLASH_WRITE_THREAD
|
||||
|
||||
// Allow saving setting to flash while engine is runnig.
|
||||
bool allowFlashWhileRunning() {
|
||||
// either MCU supports flashing while executing
|
||||
// either we store settings in external storage
|
||||
return (mcuCanFlashWhileRunning() || (EFI_STORAGE_MFS_EXTERNAL == TRUE));
|
||||
}
|
||||
|
||||
void setNeedToWriteConfiguration() {
|
||||
efiPrintf("Scheduling configuration write");
|
||||
needToWriteConfiguration = true;
|
||||
|
||||
#if (EFI_FLASH_WRITE_THREAD == TRUE)
|
||||
if (allowFlashWhileRunning() || (EFI_STORAGE_MFS_EXTERNAL == TRUE)) {
|
||||
if (allowFlashWhileRunning()) {
|
||||
// Signal the flash writer thread to wake up and write at its leisure
|
||||
flashWriteSemaphore.signal();
|
||||
}
|
||||
|
@ -401,7 +408,7 @@ void initFlash() {
|
|||
addConsoleAction("rewriteconfig", rewriteConfig);
|
||||
|
||||
#if (EFI_FLASH_WRITE_THREAD == TRUE)
|
||||
if (allowFlashWhileRunning() || (EFI_STORAGE_MFS_EXTERNAL == TRUE)) {
|
||||
if (allowFlashWhileRunning()) {
|
||||
chThdCreateStatic(flashWriteStack, sizeof(flashWriteStack), PRIO_FLASH_WRITE, flashWriteThread, nullptr);
|
||||
} else {
|
||||
efiPrintf("EFI_FLASH_WRITE_THREAD is enabled, but not used");
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
#include "pch.h"
|
||||
#include "flash_int.h"
|
||||
|
||||
bool allowFlashWhileRunning() {
|
||||
bool mcuCanFlashWhileRunning() {
|
||||
/* TODO: check for actual flash configuration? */
|
||||
/* currently we support only AT32F43X with dual-bank flash, so allow flashing to second bank */
|
||||
/* TODO: Seems AT32 is still freezes even write is happen to second bank, while executing code from first */
|
||||
|
|
|
@ -218,7 +218,7 @@ void canHwInfo(CANDriver* cand)
|
|||
|
||||
#endif /* EFI_CAN_SUPPORT */
|
||||
|
||||
bool allowFlashWhileRunning() {
|
||||
bool mcuCanFlashWhileRunning() {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -211,7 +211,7 @@ void canHwInfo(CANDriver* cand)
|
|||
|
||||
#endif /* EFI_CAN_SUPPORT */
|
||||
|
||||
bool allowFlashWhileRunning() {
|
||||
bool mcuCanFlashWhileRunning() {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -14,7 +14,9 @@ void jump_to_bootloader();
|
|||
void jump_to_openblt();
|
||||
#endif
|
||||
void causeHardFault();
|
||||
bool allowFlashWhileRunning();
|
||||
|
||||
// If mcu can erase/write part of its internal memory without stalling CPU
|
||||
bool mcuCanFlashWhileRunning();
|
||||
|
||||
bool ramReadProbe(volatile const char *read_address);
|
||||
#if defined(STM32F4)
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
#include "pch.h"
|
||||
#include "flash_int.h"
|
||||
|
||||
bool allowFlashWhileRunning() {
|
||||
bool mcuCanFlashWhileRunning() {
|
||||
// Never allow flash while running on F4, dual bank not implemented.
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -50,7 +50,7 @@ static DeviceType determineDevice() {
|
|||
return DeviceType::Unknown;
|
||||
}
|
||||
|
||||
bool allowFlashWhileRunning() {
|
||||
bool mcuCanFlashWhileRunning() {
|
||||
// Allow flash-while-running if dual bank mode is enabled, and we're a 2MB device (ie, no code located in second bank)
|
||||
return determineDevice() == DeviceType::DualBank2MB;
|
||||
}
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
|
||||
#include "flash_int.h"
|
||||
|
||||
bool allowFlashWhileRunning() {
|
||||
bool mcuCanFlashWhileRunning() {
|
||||
// We only support dual bank H7, so always allow flash while running.
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -18,7 +18,7 @@ uint32_t getTimeNowLowerNt(void) {
|
|||
CANDriver* detectCanDevice(brain_pin_e pinRx, brain_pin_e pinTx);
|
||||
#endif // HAL_USE_CAN
|
||||
|
||||
bool allowFlashWhileRunning() { return true; }
|
||||
bool mcuCanFlashWhileRunning() { return true; }
|
||||
//void causeHardFault() { }
|
||||
|
||||
|
||||
|
|
|
@ -7,7 +7,7 @@ inline bool isValidCanRxPin(brain_pin_e) { return true; }
|
|||
inline void canHwInfo(CANDriver*) { return; }
|
||||
#endif // HAL_USE_CAN
|
||||
|
||||
bool allowFlashWhileRunning() ;
|
||||
bool mcuCanFlashWhileRunning() ;
|
||||
void causeHardFault() ;
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue