feat: SPI flash driver (#4012)

Co-authored-by: Richard Li <richard.li@ces.hk>
This commit is contained in:
Raphael Coeffic
2023-10-13 19:51:11 +10:00
committed by GitHub
co-authored by Richard Li
parent 7400a598a1
commit cb16786a74
17 changed files with 1977 additions and 31 deletions
@@ -78,6 +78,11 @@ if(PCB STREQUAL X10 OR PCB STREQUAL X12S OR PCB STREQUAL NV14)
../../../../../thirdparty/libopenui/thirdparty/lz4/lz4.c
../../../../../targets/common/arm/stm32/diskio_sdio.cpp
../../../../../targets/common/arm/stm32/rtc_driver.cpp
../../../../../targets/common/arm/stm32/diskio_spi_flash.cpp
../../../../../targets/common/arm/stm32/spi_flash.cpp
../../../../../targets/common/arm/stm32/stm32_spi.cpp
../../../../../drivers/frftl.cpp
../../../../../crc.cpp
../../../../../targets/${TARGET_DIR}/sdram_driver.c
../../../../../targets/${TARGET_DIR}/haptic_driver.cpp
)
@@ -41,15 +41,21 @@ UINT BlockCount;
void sdInit(void)
{
static FATFS fatFS __DMA;
storageInit();
static FATFS fatFS __DMA;
if (f_mount(&fatFS, "", 1) == FR_OK) {
f_chdir("/");
}
}
void sdDone()
{
// unmount
f_mount(0, "", 0);
storageDeInit();
}
FRESULT openBinDir(MemoryType mt)
{
FRESULT fr = f_chdir(getBinaryPath(mt));
@@ -550,11 +550,13 @@ int bootloaderMain()
if (state != ST_FLASHING && state != ST_USB) {
if (pwrOffPressed()) {
sdDone();
boardOff();
}
}
if (state == ST_REBOOT) {
sdDone();
#if !defined(SIMU)
#if defined(RTC_BACKUP_RAM)
rtcInit();