STM32F1: SD EEPROM fallback (#17715)

This commit is contained in:
Jason Smith 2020-04-27 21:45:20 -07:00 committed by GitHub
parent 9fa5119333
commit f709c565a1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 50 additions and 38 deletions

View file

@ -58,6 +58,7 @@ jobs:
- ARMED - ARMED
- FYSETC_S6 - FYSETC_S6
- malyan_M300 - malyan_M300
- mks_robin_lite
# Put lengthy tests last # Put lengthy tests last
@ -75,7 +76,6 @@ jobs:
#- at90usb1286_cdc #- at90usb1286_cdc
#- at90usb1286_dfu #- at90usb1286_dfu
#- STM32F103CB_malyan #- STM32F103CB_malyan
#- mks_robin_lite
#- mks_robin_mini #- mks_robin_mini
#- mks_robin_nano #- mks_robin_nano

View file

@ -22,6 +22,6 @@
#pragma once #pragma once
// If no real EEPROM, Flash emulation, or SRAM emulation is available fall back to SD emulation // If no real EEPROM, Flash emulation, or SRAM emulation is available fall back to SD emulation
#if ENABLED(EEPROM_SETTINGS) && NONE(USE_WIRED_EEPROM, FLASH_EEPROM_EMULATION, SRAM_EEPROM_EMULATION) #if USE_FALLBACK_EEPROM
#define SDCARD_EEPROM_EMULATION #define SDCARD_EEPROM_EMULATION
#endif #endif

View file

@ -35,3 +35,11 @@
#if ENABLED(FAST_PWM_FAN) #if ENABLED(FAST_PWM_FAN)
#error "FAST_PWM_FAN is not yet implemented for this platform." #error "FAST_PWM_FAN is not yet implemented for this platform."
#endif #endif
#if ENABLED(SDCARD_EEPROM_EMULATION) && DISABLED(SDSUPPORT)
#undef SDCARD_EEPROM_EMULATION // Avoid additional error noise
#if USE_FALLBACK_EEPROM
#warning "EEPROM type not specified. Fallback is SDCARD_EEPROM_EMULATION."
#endif
#error "SDCARD_EEPROM_EMULATION requires SDSUPPORT. Enable SDSUPPORT or choose another EEPROM emulation."
#endif

View file

@ -32,6 +32,7 @@
#if ENABLED(SDCARD_EEPROM_EMULATION) #if ENABLED(SDCARD_EEPROM_EMULATION)
#include "../shared/eeprom_api.h" #include "../shared/eeprom_api.h"
#include "../../sd/cardreader.h"
#ifndef E2END #ifndef E2END
#define E2END 0xFFF // 4KB #define E2END 0xFFF // 4KB
@ -41,10 +42,6 @@
#define _ALIGN(x) __attribute__ ((aligned(x))) // SDIO uint32_t* compat. #define _ALIGN(x) __attribute__ ((aligned(x))) // SDIO uint32_t* compat.
static char _ALIGN(4) HAL_eeprom_data[HAL_EEPROM_SIZE]; static char _ALIGN(4) HAL_eeprom_data[HAL_EEPROM_SIZE];
#if ENABLED(SDSUPPORT)
#include "../../sd/cardreader.h"
#define EEPROM_FILENAME "eeprom.dat" #define EEPROM_FILENAME "eeprom.dat"
bool PersistentStore::access_start() { bool PersistentStore::access_start() {
@ -74,12 +71,6 @@ static char _ALIGN(4) HAL_eeprom_data[HAL_EEPROM_SIZE];
return (bytes_written == HAL_EEPROM_SIZE); return (bytes_written == HAL_EEPROM_SIZE);
} }
#else // !SDSUPPORT
#error "Please define SPI_EEPROM (in Configuration.h) or disable EEPROM_SETTINGS."
#endif // !SDSUPPORT
bool PersistentStore::write_data(int &pos, const uint8_t *value, size_t size, uint16_t *crc) { bool PersistentStore::write_data(int &pos, const uint8_t *value, size_t size, uint16_t *crc) {
for (size_t i = 0; i < size; i++) for (size_t i = 0; i < size; i++)
HAL_eeprom_data[pos + i] = value[i]; HAL_eeprom_data[pos + i] = value[i];

View file

@ -20,3 +20,8 @@
* *
*/ */
#pragma once #pragma once
// If no real EEPROM, Flash emulation, or SRAM emulation is available fall back to SD emulation
#if USE_FALLBACK_EEPROM
#define SDCARD_EEPROM_EMULATION
#endif

View file

@ -41,3 +41,11 @@
#warning "With TMC2208/9 consider using SoftwareSerialM with HAVE_SW_SERIAL and appropriate SS_TIMER." #warning "With TMC2208/9 consider using SoftwareSerialM with HAVE_SW_SERIAL and appropriate SS_TIMER."
#error "Missing SoftwareSerial implementation." #error "Missing SoftwareSerial implementation."
#endif #endif
#if ENABLED(SDCARD_EEPROM_EMULATION) && DISABLED(SDSUPPORT)
#undef SDCARD_EEPROM_EMULATION // Avoid additional error noise
#if USE_FALLBACK_EEPROM
#warning "EEPROM type not specified. Fallback is SDCARD_EEPROM_EMULATION."
#endif
#error "SDCARD_EEPROM_EMULATION requires SDSUPPORT. Enable SDSUPPORT or choose another EEPROM emulation."
#endif

View file

@ -6,12 +6,12 @@
# exit on first failure # exit on first failure
set -e set -e
use_example_configs Mks/Robin restore_configs
opt_set MOTHERBOARD BOARD_MKS_ROBIN_LITE opt_set MOTHERBOARD BOARD_MKS_ROBIN_LITE
opt_set EXTRUDERS 1 opt_set SERIAL_PORT -1
opt_set TEMP_SENSOR_1 0 opt_enable EEPROM_SETTINGS
opt_disable FSMC_GRAPHICAL_TFT opt_enable SDSUPPORT
exec_test $1 $2 "Default Configuration" exec_test $1 $2 "Default Configuration with Fallback SD EEPROM"
# cleanup # cleanup
restore_configs restore_configs