at_start_f435: enable MFS for internal flash (#5687)
* Rename EFI_INTERNAL_FLASH to EFI_STORAGE_INT_FLASH This define enables use of RE custom flash driver for storing settings to internal flash. * at_start_f435: enable MFS for settings storing in internal flash * MRE: fix special build * kinetis: fix flash_int.cpp vs flash_int.c mess * at32: allow allowFlashWhileRunning() * flash_main: supress warning
This commit is contained in:
parent
3b6c9feea5
commit
ed8af771ac
|
@ -6,7 +6,7 @@ rem https://github.com/rusefi/rusefi/issues/684
|
||||||
rem this board has only 512K flash so using custom FLASH_ADDR
|
rem this board has only 512K flash so using custom FLASH_ADDR
|
||||||
rem You probably want "flash0 : org = 0x08000000, len = 450K" in the .ld file
|
rem You probably want "flash0 : org = 0x08000000, len = 450K" in the .ld file
|
||||||
set EXTRA_PARAMS=-DDUMMY -DEFI_COMMUNICATION_PIN=Gpio::B9 -DSTM32_RTCPRE_VALUE=25 ^
|
set EXTRA_PARAMS=-DDUMMY -DEFI_COMMUNICATION_PIN=Gpio::B9 -DSTM32_RTCPRE_VALUE=25 ^
|
||||||
-DEFI_INTERNAL_FLASH=FALSE ^
|
-DEFI_STORAGE_INT_FLASH=FALSE ^
|
||||||
-DHAL_USE_RTC=FALSE ^
|
-DHAL_USE_RTC=FALSE ^
|
||||||
-DBOARD_OTG_NOVBUSSENS ^
|
-DBOARD_OTG_NOVBUSSENS ^
|
||||||
-DFLASH_ADDR=0x08075000
|
-DFLASH_ADDR=0x08075000
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
# List of all the board related files.
|
# List of all the board related files.
|
||||||
BOARDCPPSRC = $(BOARD_DIR)/board_configuration.cpp
|
BOARDCPPSRC = $(BOARD_DIR)/board_configuration.cpp \
|
||||||
|
$(BOARD_DIR)/board_storage.cpp
|
||||||
|
|
||||||
DDEFS += -DLED_CRITICAL_ERROR_BRAIN_PIN=Gpio::D13
|
DDEFS += -DLED_CRITICAL_ERROR_BRAIN_PIN=Gpio::D13
|
||||||
DDEFS += -DLED_PIN_MODE=OM_INVERTED
|
DDEFS += -DLED_PIN_MODE=OM_INVERTED
|
||||||
|
|
||||||
|
@ -18,6 +20,11 @@ BOARDINC = $(CHIBIOS)/os/hal/boards/AT_START_F435/
|
||||||
# Configuration directorys
|
# Configuration directorys
|
||||||
CONFDIR = $(PROJECT_DIR)/hw_layer/ports/at32/at32f4/cfg
|
CONFDIR = $(PROJECT_DIR)/hw_layer/ports/at32/at32f4/cfg
|
||||||
|
|
||||||
|
# This board uses ChibiOS MFS driver on internal flash
|
||||||
|
DDEFS += -DEFI_STORAGE_INT_FLASH=FLASE -DHAL_USE_EFL=TRUE -DEFI_STORAGE_MFS=TRUE
|
||||||
|
# This board has chip with dual-bank flash, bank 2 can be flashed in background
|
||||||
|
DDEFS += -DEFI_FLASH_WRITE_THREAD=TRUE
|
||||||
|
|
||||||
DDEFS += -DFIRMWARE_ID=\"at_start_f435\"
|
DDEFS += -DFIRMWARE_ID=\"at_start_f435\"
|
||||||
DDEFS += -DDEFAULT_ENGINE_TYPE=engine_type_e::MINIMAL_PINS
|
DDEFS += -DDEFAULT_ENGINE_TYPE=engine_type_e::MINIMAL_PINS
|
||||||
DDEFS += -DSHORT_BOARD_NAME=at_start_f435 -DSTATIC_BOARD_ID=STATIC_BOARD_ID_AT_START_F435
|
DDEFS += -DSHORT_BOARD_NAME=at_start_f435 -DSTATIC_BOARD_ID=STATIC_BOARD_ID_AT_START_F435
|
||||||
|
|
|
@ -0,0 +1,39 @@
|
||||||
|
/**
|
||||||
|
* @file boards/subaru_eg33/board_storage.h
|
||||||
|
*
|
||||||
|
* @brief Storage configuration file
|
||||||
|
*
|
||||||
|
* @date Nov 03, 2023
|
||||||
|
* @author Andrey Gusakov, 2023
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "pch.h"
|
||||||
|
|
||||||
|
/* This board stores settings in internal flash bank 2 */
|
||||||
|
#if EFI_STORAGE_MFS == TRUE
|
||||||
|
|
||||||
|
#include "hal_mfs.h"
|
||||||
|
|
||||||
|
/* use 128K + 128K on bank 2 for settings */
|
||||||
|
const MFSConfig mfscfg1 = {
|
||||||
|
.flashp = (BaseFlash *)&EFLD2,
|
||||||
|
.erased = 0xFFFFFFFFU,
|
||||||
|
.bank_size = 128U * 1024U,
|
||||||
|
.bank0_start = 0U,
|
||||||
|
.bank0_sectors = 32U,
|
||||||
|
.bank1_start = 32U,
|
||||||
|
.bank1_sectors = 32U
|
||||||
|
};
|
||||||
|
|
||||||
|
void boardInitMfs()
|
||||||
|
{
|
||||||
|
/* Starting EFL driver.*/
|
||||||
|
eflStart(&EFLD2, NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
const MFSConfig *boardGetMfsConfig()
|
||||||
|
{
|
||||||
|
return &mfscfg1;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif /* EFI_STORAGE_MFS == TRUE */
|
|
@ -83,7 +83,7 @@
|
||||||
|
|
||||||
#define TRIGGER_EXTREME_LOGGING FALSE
|
#define TRIGGER_EXTREME_LOGGING FALSE
|
||||||
|
|
||||||
#define EFI_INTERNAL_FLASH TRUE
|
#define EFI_STORAGE_INT_FLASH TRUE
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Flex Non Volatile Memory is faster than flash
|
* Flex Non Volatile Memory is faster than flash
|
||||||
|
|
|
@ -90,7 +90,7 @@
|
||||||
|
|
||||||
#define TRIGGER_EXTREME_LOGGING FALSE
|
#define TRIGGER_EXTREME_LOGGING FALSE
|
||||||
|
|
||||||
#define EFI_INTERNAL_FLASH TRUE
|
#define EFI_STORAGE_INT_FLASH TRUE
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Usually you need shaft position input, but maybe you do not need it?
|
* Usually you need shaft position input, but maybe you do not need it?
|
||||||
|
|
|
@ -158,10 +158,15 @@
|
||||||
|
|
||||||
#define TRIGGER_EXTREME_LOGGING FALSE
|
#define TRIGGER_EXTREME_LOGGING FALSE
|
||||||
|
|
||||||
#ifndef EFI_INTERNAL_FLASH
|
#ifndef EFI_STORAGE_INT_FLASH
|
||||||
#define EFI_INTERNAL_FLASH TRUE
|
#define EFI_STORAGE_INT_FLASH TRUE
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifndef EFI_STORAGE_MFS
|
||||||
|
#define EFI_STORAGE_MFS FALSE
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Usually you need shaft position input, but maybe you do not need it?
|
* Usually you need shaft position input, but maybe you do not need it?
|
||||||
*/
|
*/
|
||||||
|
@ -449,14 +454,6 @@
|
||||||
#define GPS_SERIAL_DEVICE &SD1
|
#define GPS_SERIAL_DEVICE &SD1
|
||||||
#define GPS_SERIAL_SPEED 38400
|
#define GPS_SERIAL_SPEED 38400
|
||||||
|
|
||||||
#ifndef EFI_STORAGE_INT_FLASH
|
|
||||||
#define EFI_STORAGE_INT_FLASH TRUE
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef EFI_STORAGE_MFS
|
|
||||||
#define EFI_STORAGE_MFS FALSE
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef EFI_SENT_SUPPORT
|
#ifndef EFI_SENT_SUPPORT
|
||||||
#define EFI_SENT_SUPPORT FALSE
|
#define EFI_SENT_SUPPORT FALSE
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -316,9 +316,9 @@ void requestBurn() {
|
||||||
#if !EFI_UNIT_TEST
|
#if !EFI_UNIT_TEST
|
||||||
onBurnRequest();
|
onBurnRequest();
|
||||||
|
|
||||||
#if EFI_INTERNAL_FLASH
|
#if (EFI_STORAGE_INT_FLASH == TRUE) || (EFI_STORAGE_MFS == TRUE)
|
||||||
setNeedToWriteConfiguration();
|
setNeedToWriteConfiguration();
|
||||||
#endif
|
#endif /* (EFI_STORAGE_INT_FLASH == TRUE) || (EFI_STORAGE_MFS == TRUE) */
|
||||||
#endif // !EFI_UNIT_TEST
|
#endif // !EFI_UNIT_TEST
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -66,7 +66,7 @@
|
||||||
#include "periodic_task.h"
|
#include "periodic_task.h"
|
||||||
#endif /* EFI_PROD_CODE */
|
#endif /* EFI_PROD_CODE */
|
||||||
|
|
||||||
#if EFI_INTERNAL_FLASH
|
#if (EFI_STORAGE_INT_FLASH == TRUE) || (EFI_STORAGE_MFS == TRUE)
|
||||||
#include "flash_main.h"
|
#include "flash_main.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -307,10 +307,10 @@ extern int totalLoggedBytes;
|
||||||
} else if (consoleByteArrived) {
|
} else if (consoleByteArrived) {
|
||||||
offTimeMs = 100;
|
offTimeMs = 100;
|
||||||
onTimeMs = 33;
|
onTimeMs = 33;
|
||||||
#if EFI_INTERNAL_FLASH
|
#if (EFI_STORAGE_INT_FLASH == TRUE) || (EFI_STORAGE_MFS == TRUE)
|
||||||
} else if (getNeedToWriteConfiguration()) {
|
} else if (getNeedToWriteConfiguration()) {
|
||||||
offTimeMs = onTimeMs = 500;
|
offTimeMs = onTimeMs = 500;
|
||||||
#endif // EFI_INTERNAL_FLASH
|
#endif /* (EFI_STORAGE_INT_FLASH == TRUE) || (EFI_STORAGE_MFS == TRUE) */
|
||||||
} else {
|
} else {
|
||||||
onTimeMs =
|
onTimeMs =
|
||||||
#if EFI_USB_SERIAL
|
#if EFI_USB_SERIAL
|
||||||
|
@ -567,9 +567,9 @@ static void updateFlags() {
|
||||||
engine->outputChannels.isTriggerError = isTriggerErrorNow();
|
engine->outputChannels.isTriggerError = isTriggerErrorNow();
|
||||||
#endif // EFI_PROD_CODE
|
#endif // EFI_PROD_CODE
|
||||||
|
|
||||||
#if EFI_INTERNAL_FLASH
|
#if (EFI_STORAGE_INT_FLASH == TRUE) || (EFI_STORAGE_MFS == TRUE)
|
||||||
engine->outputChannels.needBurn = getNeedToWriteConfiguration();
|
engine->outputChannels.needBurn = getNeedToWriteConfiguration();
|
||||||
#endif /* EFI_INTERNAL_FLASH */
|
#endif /* (EFI_STORAGE_INT_FLASH == TRUE) || (EFI_STORAGE_MFS == TRUE) */
|
||||||
}
|
}
|
||||||
|
|
||||||
// sensor state for EFI Analytics Tuner Studio
|
// sensor state for EFI Analytics Tuner Studio
|
||||||
|
|
|
@ -644,7 +644,8 @@ void loadConfiguration() {
|
||||||
prepareVoidConfiguration(&activeConfiguration);
|
prepareVoidConfiguration(&activeConfiguration);
|
||||||
#endif /* EFI_ACTIVE_CONFIGURATION_IN_FLASH */
|
#endif /* EFI_ACTIVE_CONFIGURATION_IN_FLASH */
|
||||||
|
|
||||||
#if EFI_INTERNAL_FLASH
|
/* If board have any storage */
|
||||||
|
#if (EFI_STORAGE_INT_FLASH == TRUE) || (EFI_STORAGE_MFS == TRUE)
|
||||||
if (IGNORE_FLASH_CONFIGURATION) {
|
if (IGNORE_FLASH_CONFIGURATION) {
|
||||||
engineConfiguration->engineType = DEFAULT_ENGINE_TYPE;
|
engineConfiguration->engineType = DEFAULT_ENGINE_TYPE;
|
||||||
resetConfigurationExt(engineConfiguration->engineType);
|
resetConfigurationExt(engineConfiguration->engineType);
|
||||||
|
@ -654,11 +655,11 @@ void loadConfiguration() {
|
||||||
// if flash state does not look right.
|
// if flash state does not look right.
|
||||||
readFromFlash();
|
readFromFlash();
|
||||||
}
|
}
|
||||||
#else // not EFI_INTERNAL_FLASH
|
#else
|
||||||
// This board doesn't load configuration, initialize the default
|
// This board doesn't load configuration, initialize the default
|
||||||
engineConfiguration->engineType = DEFAULT_ENGINE_TYPE;
|
engineConfiguration->engineType = DEFAULT_ENGINE_TYPE;
|
||||||
resetConfigurationExt(engineConfiguration->engineType);
|
resetConfigurationExt(engineConfiguration->engineType);
|
||||||
#endif /* EFI_INTERNAL_FLASH */
|
#endif /* (EFI_STORAGE_INT_FLASH == TRUE) || (EFI_STORAGE_MFS == TRUE) */
|
||||||
|
|
||||||
// Force any board configuration options that humans shouldn't be able to change
|
// Force any board configuration options that humans shouldn't be able to change
|
||||||
setBoardConfigOverrides();
|
setBoardConfigOverrides();
|
||||||
|
|
|
@ -459,9 +459,9 @@ static void handleCommandX14(uint16_t index) {
|
||||||
return;
|
return;
|
||||||
case TS_WRITE_FLASH:
|
case TS_WRITE_FLASH:
|
||||||
// cmd_write_config
|
// cmd_write_config
|
||||||
#if EFI_INTERNAL_FLASH
|
#if (EFI_STORAGE_INT_FLASH == TRUE) || (EFI_STORAGE_MFS == TRUE)
|
||||||
writeToFlashNow();
|
writeToFlashNow();
|
||||||
#endif /* EFI_INTERNAL_FLASH */
|
#endif /* (EFI_STORAGE_INT_FLASH == TRUE) || (EFI_STORAGE_MFS == TRUE) */
|
||||||
return;
|
return;
|
||||||
#if EFI_EMULATE_POSITION_SENSORS
|
#if EFI_EMULATE_POSITION_SENSORS
|
||||||
case 0xD:
|
case 0xD:
|
||||||
|
@ -502,8 +502,10 @@ static void handleCommandX14(uint16_t index) {
|
||||||
return;
|
return;
|
||||||
case 0x15:
|
case 0x15:
|
||||||
#if EFI_PROD_CODE
|
#if EFI_PROD_CODE
|
||||||
|
#if (EFI_STORAGE_INT_FLASH == TRUE) || (EFI_STORAGE_MFS == TRUE)
|
||||||
extern bool burnWithoutFlash;
|
extern bool burnWithoutFlash;
|
||||||
burnWithoutFlash = true;
|
burnWithoutFlash = true;
|
||||||
|
#endif /* (EFI_STORAGE_INT_FLASH == TRUE) || (EFI_STORAGE_MFS == TRUE) */
|
||||||
#endif // EFI_PROD_CODE
|
#endif // EFI_PROD_CODE
|
||||||
return;
|
return;
|
||||||
default:
|
default:
|
||||||
|
|
|
@ -192,9 +192,9 @@ static void doPeriodicSlowCallback() {
|
||||||
*
|
*
|
||||||
* todo: allow writing if 2nd bank of flash is used
|
* todo: allow writing if 2nd bank of flash is used
|
||||||
*/
|
*/
|
||||||
#if EFI_INTERNAL_FLASH
|
#if (EFI_STORAGE_INT_FLASH == TRUE) || (EFI_STORAGE_MFS == TRUE)
|
||||||
writeToFlashIfPending();
|
writeToFlashIfPending();
|
||||||
#endif /* EFI_INTERNAL_FLASH */
|
#endif /* (EFI_STORAGE_INT_FLASH == TRUE) || (EFI_STORAGE_MFS == TRUE) */
|
||||||
}
|
}
|
||||||
|
|
||||||
if (engine->rpmCalculator.isStopped()) {
|
if (engine->rpmCalculator.isStopped()) {
|
||||||
|
@ -207,9 +207,9 @@ static void doPeriodicSlowCallback() {
|
||||||
|
|
||||||
engine->periodicSlowCallback();
|
engine->periodicSlowCallback();
|
||||||
#else /* if EFI_ENGINE_CONTROL && EFI_SHAFT_POSITION_INPUT */
|
#else /* if EFI_ENGINE_CONTROL && EFI_SHAFT_POSITION_INPUT */
|
||||||
#if EFI_INTERNAL_FLASH
|
#if (EFI_STORAGE_INT_FLASH == TRUE) || (EFI_STORAGE_MFS == TRUE)
|
||||||
writeToFlashIfPending();
|
writeToFlashIfPending();
|
||||||
#endif /* EFI_INTERNAL_FLASH */
|
#endif /* (EFI_STORAGE_INT_FLASH == TRUE) || (EFI_STORAGE_MFS == TRUE) */
|
||||||
#endif /* EFI_SHAFT_POSITION_INPUT */
|
#endif /* EFI_SHAFT_POSITION_INPUT */
|
||||||
|
|
||||||
#if EFI_TCU
|
#if EFI_TCU
|
||||||
|
|
|
@ -9,7 +9,8 @@
|
||||||
|
|
||||||
#include "pch.h"
|
#include "pch.h"
|
||||||
|
|
||||||
#if EFI_INTERNAL_FLASH
|
/* If any setting storage is exist */
|
||||||
|
#if (EFI_STORAGE_INT_FLASH == TRUE) || (EFI_STORAGE_MFS == TRUE)
|
||||||
|
|
||||||
#include "mpu_util.h"
|
#include "mpu_util.h"
|
||||||
#include "flash_main.h"
|
#include "flash_main.h"
|
||||||
|
@ -213,8 +214,9 @@ static FlashState validatePersistentState() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if EFI_STORAGE_INT_FLASH == TRUE
|
||||||
/**
|
/**
|
||||||
* Read single copy of rusEFI configuration from flash
|
* Read single copy of rusEFI configuration from interan flash using custom driver
|
||||||
*/
|
*/
|
||||||
static FlashState readOneConfigurationCopy(flashaddr_t address) {
|
static FlashState readOneConfigurationCopy(flashaddr_t address) {
|
||||||
efiPrintf("readFromFlash %x", address);
|
efiPrintf("readFromFlash %x", address);
|
||||||
|
@ -228,6 +230,7 @@ static FlashState readOneConfigurationCopy(flashaddr_t address) {
|
||||||
|
|
||||||
return validatePersistentState();
|
return validatePersistentState();
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* this method could and should be executed before we have any
|
* this method could and should be executed before we have any
|
||||||
|
@ -357,4 +360,4 @@ void initFlash() {
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* EFI_INTERNAL_FLASH */
|
#endif /* (EFI_STORAGE_INT_FLASH == TRUE) || (EFI_STORAGE_MFS == TRUE) */
|
||||||
|
|
|
@ -31,9 +31,9 @@
|
||||||
#include "electronic_throttle.h"
|
#include "electronic_throttle.h"
|
||||||
#endif // EFI_ELECTRONIC_THROTTLE_BODY
|
#endif // EFI_ELECTRONIC_THROTTLE_BODY
|
||||||
|
|
||||||
#if EFI_INTERNAL_FLASH
|
#if (EFI_STORAGE_INT_FLASH == TRUE) || (EFI_STORAGE_MFS == TRUE)
|
||||||
#include "flash_main.h"
|
#include "flash_main.h"
|
||||||
#endif // EFI_INTERNAL_FLASH
|
#endif /* (EFI_STORAGE_INT_FLASH == TRUE) || (EFI_STORAGE_MFS == TRUE) */
|
||||||
|
|
||||||
#if EFI_ENGINE_SNIFFER
|
#if EFI_ENGINE_SNIFFER
|
||||||
#include "engine_sniffer.h"
|
#include "engine_sniffer.h"
|
||||||
|
@ -1008,11 +1008,11 @@ void setEngineType(int value, bool isWriteToFlash) {
|
||||||
resetConfigurationExt((engine_type_e)value);
|
resetConfigurationExt((engine_type_e)value);
|
||||||
engine->resetEngineSnifferIfInTestMode();
|
engine->resetEngineSnifferIfInTestMode();
|
||||||
|
|
||||||
#if EFI_INTERNAL_FLASH
|
#if (EFI_STORAGE_INT_FLASH == TRUE) || (EFI_STORAGE_MFS == TRUE)
|
||||||
if (isWriteToFlash) {
|
if (isWriteToFlash) {
|
||||||
writeToFlashNow();
|
writeToFlashNow();
|
||||||
}
|
}
|
||||||
#endif // EFI_INTERNAL_FLASH
|
#endif /* (EFI_STORAGE_INT_FLASH == TRUE) || (EFI_STORAGE_MFS == TRUE) */
|
||||||
}
|
}
|
||||||
incrementGlobalConfigurationVersion("engineType");
|
incrementGlobalConfigurationVersion("engineType");
|
||||||
#if ! EFI_UNIT_TEST
|
#if ! EFI_UNIT_TEST
|
||||||
|
|
|
@ -62,7 +62,7 @@
|
||||||
#include "map_averaging.h"
|
#include "map_averaging.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if EFI_INTERNAL_FLASH
|
#if (EFI_STORAGE_INT_FLASH == TRUE) || (EFI_STORAGE_MFS == TRUE)
|
||||||
#include "flash_main.h"
|
#include "flash_main.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -400,7 +400,7 @@ void initHardwareNoConfig() {
|
||||||
initRtc();
|
initRtc();
|
||||||
#endif // EFI_PROD_CODE && EFI_RTC
|
#endif // EFI_PROD_CODE && EFI_RTC
|
||||||
|
|
||||||
#if EFI_INTERNAL_FLASH
|
#if (EFI_STORAGE_INT_FLASH == TRUE) || (EFI_STORAGE_MFS == TRUE)
|
||||||
initFlash();
|
initFlash();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
HW_AT32_PORT_DIR = $(PROJECT_DIR)/hw_layer/ports/at32
|
HW_AT32_PORT_DIR = $(PROJECT_DIR)/hw_layer/ports/at32
|
||||||
|
|
||||||
HW_LAYER_PORT_CPP += \
|
HW_LAYER_PORT_CPP += \
|
||||||
$(HW_AT32_PORT_DIR)/at32_common.cpp
|
$(HW_AT32_PORT_DIR)/at32_common.cpp \
|
||||||
|
$(HW_AT32_PORT_DIR)/at32f4/mpu_util.cpp
|
||||||
|
|
|
@ -0,0 +1,33 @@
|
||||||
|
/**
|
||||||
|
* @file mpu_util.cpp
|
||||||
|
*
|
||||||
|
* @date Nov 3, 2023
|
||||||
|
* @author Andrey Gusakov, (c) 2023
|
||||||
|
*/
|
||||||
|
#include "pch.h"
|
||||||
|
#include "flash_int.h"
|
||||||
|
|
||||||
|
bool allowFlashWhileRunning() {
|
||||||
|
/* TODO: check for actual flash configuration? */
|
||||||
|
/* currently we support only AT32F43X with dual-bank flash, so allow flashing to second bank */
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* TODO: fix name! */
|
||||||
|
void stm32_standby() {
|
||||||
|
// Don't get bothered by interrupts
|
||||||
|
__disable_irq();
|
||||||
|
|
||||||
|
/* TODO: validate! */
|
||||||
|
#if 0
|
||||||
|
SysTick->CTRL = 0;
|
||||||
|
SCB->SCR |= SCB_SCR_SLEEPDEEP_Msk;
|
||||||
|
PWR->CR |= PWR_CR_PDDS; // PDDS = use standby mode (not stop mode)
|
||||||
|
PWR->CR |= PWR_CR_CSBF; // Clear standby flag
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// Do anything the board wants to prepare for standby mode - enabling wakeup sources!
|
||||||
|
boardPrepareForStandby();
|
||||||
|
|
||||||
|
__WFI();
|
||||||
|
}
|
|
@ -7,7 +7,7 @@
|
||||||
|
|
||||||
#include "pch.h"
|
#include "pch.h"
|
||||||
|
|
||||||
#if EFI_INTERNAL_FLASH
|
#if EFI_STORAGE_INT_FLASH
|
||||||
|
|
||||||
#include "flash_int.h"
|
#include "flash_int.h"
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
@ -132,4 +132,4 @@ int intFlashRead(flashaddr_t source, char* destination, size_t size) {
|
||||||
return FLASH_RETURN_SUCCESS;
|
return FLASH_RETURN_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* EFI_INTERNAL_FLASH */
|
#endif /* EFI_STORAGE_INT_FLASH */
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
|
|
||||||
#include "pch.h"
|
#include "pch.h"
|
||||||
|
|
||||||
#if EFI_INTERNAL_FLASH
|
#if EFI_STORAGE_INT_FLASH
|
||||||
|
|
||||||
#include "flash_int.h"
|
#include "flash_int.h"
|
||||||
#include "fsl_ftfx_flexnvm.h"
|
#include "fsl_ftfx_flexnvm.h"
|
||||||
|
@ -202,4 +202,4 @@ int intFlashRead(flashaddr_t source, char* destination, size_t size) {
|
||||||
return FLASH_RETURN_SUCCESS;
|
return FLASH_RETURN_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* EFI_INTERNAL_FLASH */
|
#endif /* EFI_STORAGE_INT_FLASH */
|
||||||
|
|
|
@ -11,6 +11,6 @@ HW_LAYER_PORT_CPP += $(PROJECT_DIR)/hw_layer/ports/kinetis/mpu_util.cpp \
|
||||||
$(PROJECT_DIR)/hw_layer/ports/kinetis/kinetis_common.cpp \
|
$(PROJECT_DIR)/hw_layer/ports/kinetis/kinetis_common.cpp \
|
||||||
$(PROJECT_DIR)/hw_layer/trigger_input_comp.cpp \
|
$(PROJECT_DIR)/hw_layer/trigger_input_comp.cpp \
|
||||||
$(PROJECT_DIR)/hw_layer/microsecond_timer/microsecond_timer_gpt.cpp \
|
$(PROJECT_DIR)/hw_layer/microsecond_timer/microsecond_timer_gpt.cpp \
|
||||||
$(PROJECT_DIR)/hw_layer/ports/kinetis/flash_int.c \
|
$(PROJECT_DIR)/hw_layer/ports/kinetis/flash_int.cpp
|
||||||
|
|
||||||
MCU = cortex-m4
|
MCU = cortex-m4
|
||||||
|
|
|
@ -9,7 +9,7 @@
|
||||||
|
|
||||||
#include "pch.h"
|
#include "pch.h"
|
||||||
|
|
||||||
#if EFI_INTERNAL_FLASH
|
#if EFI_STORAGE_INT_FLASH
|
||||||
|
|
||||||
#include "flash_int.h"
|
#include "flash_int.h"
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
@ -434,4 +434,4 @@ exit:
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif /* EFI_INTERNAL_FLASH */
|
#endif /* EFI_STORAGE_INT_FLASH */
|
||||||
|
|
|
@ -26,8 +26,7 @@ else ifeq ($(IS_AT32F435),yes)
|
||||||
DDEFS += -DAT32F4XX
|
DDEFS += -DAT32F4XX
|
||||||
HW_LAYER_PORT =
|
HW_LAYER_PORT =
|
||||||
# TODO: Artery
|
# TODO: Artery
|
||||||
HW_LAYER_PORT_CPP = $(PROJECT_DIR)/hw_layer/ports/stm32/stm32f4/mpu_util.cpp \
|
HW_LAYER_PORT_CPP = $(PROJECT_DIR)/hw_layer/ports/stm32/stm32_adc_v2.cpp
|
||||||
$(PROJECT_DIR)/hw_layer/ports/stm32/stm32_adc_v2.cpp
|
|
||||||
# TODO: Arterys
|
# TODO: Arterys
|
||||||
LDSCRIPT = $(PROJECT_DIR)/hw_layer/ports/at32/at32f4/AT32F435ZMxx.ld
|
LDSCRIPT = $(PROJECT_DIR)/hw_layer/ports/at32/at32f4/AT32F435ZMxx.ld
|
||||||
else
|
else
|
||||||
|
|
|
@ -143,7 +143,6 @@
|
||||||
|
|
||||||
#define FUEL_MATH_EXTREME_LOGGING FALSE
|
#define FUEL_MATH_EXTREME_LOGGING FALSE
|
||||||
#define EFI_ANALOG_SENSORS TRUE
|
#define EFI_ANALOG_SENSORS TRUE
|
||||||
#define EFI_INTERNAL_FLASH TRUE
|
|
||||||
#define EFI_STORAGE_INT_FLASH TRUE
|
#define EFI_STORAGE_INT_FLASH TRUE
|
||||||
#define EFI_FLASH_WRITE_THREAD TRUE
|
#define EFI_FLASH_WRITE_THREAD TRUE
|
||||||
#define EFI_STORAGE_MFS FALSE
|
#define EFI_STORAGE_MFS FALSE
|
||||||
|
|
Loading…
Reference in New Issue