Browse Source

Use MARLIN_EEPROM_SIZE with E2END as fallback (#18059)

vanilla_fb_2.0.x
Scott Lahteine 5 years ago
committed by GitHub
parent
commit
461647fcee
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 5
      Marlin/src/HAL/AVR/eeprom.cpp
  2. 9
      Marlin/src/HAL/DUE/eeprom_flash.cpp
  3. 5
      Marlin/src/HAL/DUE/eeprom_wired.cpp
  4. 17
      Marlin/src/HAL/ESP32/eeprom.cpp
  5. 15
      Marlin/src/HAL/LINUX/eeprom.cpp
  6. 25
      Marlin/src/HAL/LPC1768/eeprom_flash.cpp
  7. 5
      Marlin/src/HAL/LPC1768/eeprom_sdcard.cpp
  8. 12
      Marlin/src/HAL/LPC1768/eeprom_wired.cpp
  9. 12
      Marlin/src/HAL/SAMD51/eeprom_wired.cpp
  10. 39
      Marlin/src/HAL/STM32/eeprom_flash.cpp
  11. 65
      Marlin/src/HAL/STM32/eeprom_sdcard.cpp
  12. 6
      Marlin/src/HAL/STM32/eeprom_sram.cpp
  13. 12
      Marlin/src/HAL/STM32/eeprom_wired.cpp
  14. 18
      Marlin/src/HAL/STM32F1/eeprom_flash.cpp
  15. 22
      Marlin/src/HAL/STM32F1/eeprom_sdcard.cpp
  16. 8
      Marlin/src/HAL/STM32F1/eeprom_wired.cpp
  17. 8
      Marlin/src/HAL/STM32_F4_F7/eeprom_flash.cpp
  18. 12
      Marlin/src/HAL/STM32_F4_F7/eeprom_wired.cpp
  19. 8
      Marlin/src/HAL/TEENSY31_32/eeprom.cpp
  20. 6
      Marlin/src/HAL/TEENSY35_36/eeprom.cpp
  21. 2
      Marlin/src/module/configuration_store.cpp
  22. 4
      Marlin/src/pins/linux/pins_RAMPS_LINUX.h
  23. 2
      Marlin/src/pins/sam/pins_RADDS.h
  24. 2
      Marlin/src/pins/sam/pins_RAMPS_FD_V2.h
  25. 2
      Marlin/src/pins/sam/pins_RAMPS_SMART.h
  26. 2
      Marlin/src/pins/sam/pins_RURAMPS4D_11.h
  27. 2
      Marlin/src/pins/sam/pins_RURAMPS4D_13.h
  28. 2
      Marlin/src/pins/samd/pins_RAMPS_144.h
  29. 6
      Marlin/src/pins/stm32f1/pins_BTT_SKR_E3_DIP.h
  30. 3
      Marlin/src/pins/stm32f1/pins_BTT_SKR_MINI_E3.h
  31. 2
      Marlin/src/pins/stm32f1/pins_BTT_SKR_MINI_V1_1.h
  32. 3
      Marlin/src/pins/stm32f1/pins_FYSETC_AIO_II.h
  33. 3
      Marlin/src/pins/stm32f1/pins_FYSETC_CHEETAH.h
  34. 2
      Marlin/src/pins/stm32f1/pins_GTM32_MINI.h
  35. 2
      Marlin/src/pins/stm32f1/pins_GTM32_MINI_A30.h
  36. 2
      Marlin/src/pins/stm32f1/pins_GTM32_PRO_VB.h
  37. 2
      Marlin/src/pins/stm32f1/pins_GTM32_REV_B.h
  38. 6
      Marlin/src/pins/stm32f1/pins_JGAURORA_A5S_A1.h
  39. 7
      Marlin/src/pins/stm32f1/pins_LONGER3D_LK.h
  40. 2
      Marlin/src/pins/stm32f1/pins_MKS_ROBIN_MINI.h
  41. 4
      Marlin/src/pins/stm32f4/pins_ARMED.h
  42. 2
      Marlin/src/pins/stm32f4/pins_BLACK_STM32F407VE.h
  43. 3
      Marlin/src/pins/stm32f4/pins_BTT_GTR_V1_0.h
  44. 3
      Marlin/src/pins/stm32f4/pins_FLYF407ZG.h
  45. 3
      Marlin/src/pins/stm32f4/pins_FYSETC_S6.h
  46. 4
      Marlin/src/pins/stm32f4/pins_GENERIC_STM32F4.h
  47. 5
      Marlin/src/pins/stm32f4/pins_RUMBA32_common.h
  48. 3
      Marlin/src/pins/stm32f4/pins_VAKE403D.h
  49. 4
      Marlin/src/pins/stm32f7/pins_THE_BORG.h

5
Marlin/src/HAL/AVR/eeprom.cpp

@ -32,7 +32,10 @@
#include "../shared/eeprom_api.h" #include "../shared/eeprom_api.h"
size_t PersistentStore::capacity() { return E2END + 1; } #ifndef MARLIN_EEPROM_SIZE
#define MARLIN_EEPROM_SIZE size_t(E2END + 1)
#endif
size_t PersistentStore::capacity() { return MARLIN_EEPROM_SIZE; }
bool PersistentStore::access_start() { return true; } bool PersistentStore::access_start() { return true; }
bool PersistentStore::access_finish() { return true; } bool PersistentStore::access_finish() { return true; }

9
Marlin/src/HAL/DUE/eeprom_flash.cpp

@ -26,10 +26,6 @@
#if ENABLED(FLASH_EEPROM_EMULATION) #if ENABLED(FLASH_EEPROM_EMULATION)
#ifndef E2END
#define E2END 0xFFF // Default to Flash emulated EEPROM size (eeprom_emul.cpp)
#endif
/* EEPROM emulation over flash with reduced wear /* EEPROM emulation over flash with reduced wear
* *
* We will use 2 contiguous groups of pages as main and alternate. * We will use 2 contiguous groups of pages as main and alternate.
@ -973,7 +969,10 @@ static void ee_Init() {
#include "../shared/eeprom_api.h" #include "../shared/eeprom_api.h"
size_t PersistentStore::capacity() { return E2END + 1; } #ifndef MARLIN_EEPROM_SIZE
#define MARLIN_EEPROM_SIZE 0x1000 // 4KB
#endif
size_t PersistentStore::capacity() { return MARLIN_EEPROM_SIZE; }
bool PersistentStore::access_start() { ee_Init(); return true; } bool PersistentStore::access_start() { ee_Init(); return true; }
bool PersistentStore::access_finish() { ee_Flush(); return true; } bool PersistentStore::access_finish() { ee_Flush(); return true; }

5
Marlin/src/HAL/DUE/eeprom_wired.cpp

@ -34,7 +34,10 @@
#include "../shared/eeprom_if.h" #include "../shared/eeprom_if.h"
#include "../shared/eeprom_api.h" #include "../shared/eeprom_api.h"
size_t PersistentStore::capacity() { return E2END + 1; } #ifndef MARLIN_EEPROM_SIZE
#error "MARLIN_EEPROM_SIZE is required for I2C / SPI EEPROM."
#endif
size_t PersistentStore::capacity() { return MARLIN_EEPROM_SIZE; }
bool PersistentStore::access_start() { return true; } bool PersistentStore::access_start() { return true; }
bool PersistentStore::access_finish() { return true; } bool PersistentStore::access_finish() { return true; }

17
Marlin/src/HAL/ESP32/eeprom.cpp

@ -28,16 +28,13 @@
#include "../shared/eeprom_api.h" #include "../shared/eeprom_api.h"
#include <EEPROM.h> #include <EEPROM.h>
#define EEPROM_SIZE 4096 #ifndef MARLIN_EEPROM_SIZE
#define MARLIN_EEPROM_SIZE 0x1000 // 4KB
#endif
size_t PersistentStore::capacity() { return MARLIN_EEPROM_SIZE; }
bool PersistentStore::access_start() { bool PersistentStore::access_start() { return EEPROM.begin(MARLIN_EEPROM_SIZE); }
return EEPROM.begin(EEPROM_SIZE); bool PersistentStore::access_finish() { EEPROM.end(); return true; }
}
bool PersistentStore::access_finish() {
EEPROM.end();
return true;
}
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++) {
@ -56,7 +53,5 @@ bool PersistentStore::read_data(int &pos, uint8_t* value, size_t size, uint16_t
return false; return false;
} }
size_t PersistentStore::capacity() { return EEPROM_SIZE; }
#endif // EEPROM_SETTINGS #endif // EEPROM_SETTINGS
#endif // ARDUINO_ARCH_ESP32 #endif // ARDUINO_ARCH_ESP32

15
Marlin/src/HAL/LINUX/eeprom.cpp

@ -28,10 +28,15 @@
#include "../shared/eeprom_api.h" #include "../shared/eeprom_api.h"
#include <stdio.h> #include <stdio.h>
#define LINUX_EEPROM_SIZE (E2END + 1) #ifndef MARLIN_EEPROM_SIZE
uint8_t buffer[LINUX_EEPROM_SIZE]; #define MARLIN_EEPROM_SIZE 0x1000 // 4KB of Emulated EEPROM
#endif
uint8_t buffer[MARLIN_EEPROM_SIZE];
char filename[] = "eeprom.dat"; char filename[] = "eeprom.dat";
size_t PersistentStore::capacity() { return MARLIN_EEPROM_SIZE; }
bool PersistentStore::access_start() { bool PersistentStore::access_start() {
const char eeprom_erase_value = 0xFF; const char eeprom_erase_value = 0xFF;
FILE * eeprom_file = fopen(filename, "rb"); FILE * eeprom_file = fopen(filename, "rb");
@ -40,8 +45,8 @@ bool PersistentStore::access_start() {
fseek(eeprom_file, 0L, SEEK_END); fseek(eeprom_file, 0L, SEEK_END);
std::size_t file_size = ftell(eeprom_file); std::size_t file_size = ftell(eeprom_file);
if (file_size < LINUX_EEPROM_SIZE) { if (file_size < MARLIN_EEPROM_SIZE) {
memset(buffer + file_size, eeprom_erase_value, LINUX_EEPROM_SIZE - file_size); memset(buffer + file_size, eeprom_erase_value, MARLIN_EEPROM_SIZE - file_size);
} }
else { else {
fseek(eeprom_file, 0L, SEEK_SET); fseek(eeprom_file, 0L, SEEK_SET);
@ -95,7 +100,5 @@ bool PersistentStore::read_data(int &pos, uint8_t* value, const size_t size, uin
return bytes_read != size; // return true for any error return bytes_read != size; // return true for any error
} }
size_t PersistentStore::capacity() { return 4096; } // 4KiB of Emulated EEPROM
#endif // EEPROM_SETTINGS #endif // EEPROM_SETTINGS
#endif // __PLAT_LINUX__ #endif // __PLAT_LINUX__

25
Marlin/src/HAL/LPC1768/eeprom_flash.cpp

@ -46,19 +46,22 @@ extern "C" {
#include <lpc17xx_iap.h> #include <lpc17xx_iap.h>
} }
#define SECTOR_START(sector) ((sector < 16) ? (sector * 0x1000) : ((sector - 14) * 0x8000)) #ifndef MARLIN_EEPROM_SIZE
#define MARLIN_EEPROM_SIZE 0x1000 // 4KB
#endif
#define SECTOR_START(sector) ((sector < 16) ? (sector << 12) : ((sector - 14) << 15))
#define EEPROM_SECTOR 29 #define EEPROM_SECTOR 29
#define EEPROM_SIZE (4096) #define SECTOR_SIZE 32768
#define SECTOR_SIZE (32768) #define EEPROM_SLOTS ((SECTOR_SIZE)/(MARLIN_EEPROM_SIZE))
#define EEPROM_SLOTS (SECTOR_SIZE/EEPROM_SIZE) #define EEPROM_ERASE 0xFF
#define EEPROM_ERASE (0xFF) #define SLOT_ADDRESS(sector, slot) (((uint8_t *)SECTOR_START(sector)) + slot * (MARLIN_EEPROM_SIZE))
#define SLOT_ADDRESS(sector, slot) (((uint8_t *)SECTOR_START(sector)) + slot * EEPROM_SIZE)
static uint8_t ram_eeprom[EEPROM_SIZE] __attribute__((aligned(4))) = {0}; static uint8_t ram_eeprom[MARLIN_EEPROM_SIZE] __attribute__((aligned(4))) = {0};
static bool eeprom_dirty = false; static bool eeprom_dirty = false;
static int current_slot = 0; static int current_slot = 0;
size_t PersistentStore::capacity() { return EEPROM_SIZE; } size_t PersistentStore::capacity() { return MARLIN_EEPROM_SIZE; }
bool PersistentStore::access_start() { bool PersistentStore::access_start() {
uint32_t first_nblank_loc, first_nblank_val; uint32_t first_nblank_loc, first_nblank_val;
@ -71,15 +74,15 @@ bool PersistentStore::access_start() {
if (status == CMD_SUCCESS) { if (status == CMD_SUCCESS) {
// sector is blank so nothing stored yet // sector is blank so nothing stored yet
for (int i = 0; i < EEPROM_SIZE; i++) ram_eeprom[i] = EEPROM_ERASE; for (int i = 0; i < MARLIN_EEPROM_SIZE; i++) ram_eeprom[i] = EEPROM_ERASE;
current_slot = EEPROM_SLOTS; current_slot = EEPROM_SLOTS;
} }
else { else {
// current slot is the first non blank one // current slot is the first non blank one
current_slot = first_nblank_loc / EEPROM_SIZE; current_slot = first_nblank_loc / (MARLIN_EEPROM_SIZE);
uint8_t *eeprom_data = SLOT_ADDRESS(EEPROM_SECTOR, current_slot); uint8_t *eeprom_data = SLOT_ADDRESS(EEPROM_SECTOR, current_slot);
// load current settings // load current settings
for (int i = 0; i < EEPROM_SIZE; i++) ram_eeprom[i] = eeprom_data[i]; for (int i = 0; i < MARLIN_EEPROM_SIZE; i++) ram_eeprom[i] = eeprom_data[i];
} }
eeprom_dirty = false; eeprom_dirty = false;

5
Marlin/src/HAL/LPC1768/eeprom_sdcard.cpp

@ -38,7 +38,10 @@ FATFS fat_fs;
FIL eeprom_file; FIL eeprom_file;
bool eeprom_file_open = false; bool eeprom_file_open = false;
size_t PersistentStore::capacity() { return 4096; } // 4KiB of Emulated EEPROM #ifndef MARLIN_EEPROM_SIZE
#define MARLIN_EEPROM_SIZE size_t(0x1000) // 4KiB of Emulated EEPROM
#endif
size_t PersistentStore::capacity() { return MARLIN_EEPROM_SIZE; }
bool PersistentStore::access_start() { bool PersistentStore::access_start() {
const char eeprom_erase_value = 0xFF; const char eeprom_erase_value = 0xFF;

12
Marlin/src/HAL/LPC1768/eeprom_wired.cpp

@ -33,18 +33,14 @@
#include "../shared/eeprom_if.h" #include "../shared/eeprom_if.h"
#include "../shared/eeprom_api.h" #include "../shared/eeprom_api.h"
#ifndef EEPROM_SIZE #ifndef MARLIN_EEPROM_SIZE
#define EEPROM_SIZE 0x8000 // 32kB‬ #define MARLIN_EEPROM_SIZE 0x8000 // 32KB‬
#endif #endif
size_t PersistentStore::capacity() { return MARLIN_EEPROM_SIZE; }
size_t PersistentStore::capacity() { return EEPROM_SIZE; } bool PersistentStore::access_start() { eeprom_init(); return true; }
bool PersistentStore::access_finish() { return true; } bool PersistentStore::access_finish() { return true; }
bool PersistentStore::access_start() {
eeprom_init();
return true;
}
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) {
while (size--) { while (size--) {
uint8_t v = *value; uint8_t v = *value;

12
Marlin/src/HAL/SAMD51/eeprom_wired.cpp

@ -32,13 +32,13 @@
#include "../shared/eeprom_if.h" #include "../shared/eeprom_if.h"
#include "../shared/eeprom_api.h" #include "../shared/eeprom_api.h"
size_t PersistentStore::capacity() { return E2END + 1; } #ifndef MARLIN_EEPROM_SIZE
bool PersistentStore::access_finish() { return true; } #error "MARLIN_EEPROM_SIZE is required for I2C / SPI EEPROM."
#endif
size_t PersistentStore::capacity() { return MARLIN_EEPROM_SIZE; }
bool PersistentStore::access_start() { bool PersistentStore::access_start() { eeprom_init(); return true; }
eeprom_init(); bool PersistentStore::access_finish() { return true; }
return true;
}
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) {
while (size--) { while (size--) {

39
Marlin/src/HAL/STM32/eeprom_flash.cpp

@ -32,7 +32,7 @@
#include "Servo.h" #include "Servo.h"
#define PAUSE_SERVO_OUTPUT() libServo::pause_all_servos() #define PAUSE_SERVO_OUTPUT() libServo::pause_all_servos()
#define RESUME_SERVO_OUTPUT() libServo::resume_all_servos() #define RESUME_SERVO_OUTPUT() libServo::resume_all_servos()
#else #else
#define PAUSE_SERVO_OUTPUT() #define PAUSE_SERVO_OUTPUT()
#define RESUME_SERVO_OUTPUT() #define RESUME_SERVO_OUTPUT()
#endif #endif
@ -59,8 +59,8 @@
#define DEBUG_OUT ENABLED(EEPROM_CHITCHAT) #define DEBUG_OUT ENABLED(EEPROM_CHITCHAT)
#include "src/core/debug_out.h" #include "src/core/debug_out.h"
#ifndef EEPROM_SIZE #ifndef MARLIN_EEPROM_SIZE
#define EEPROM_SIZE 0x1000 // 4kB #define MARLIN_EEPROM_SIZE 0x1000 // 4KB
#endif #endif
#ifndef FLASH_SECTOR #ifndef FLASH_SECTOR
@ -70,11 +70,11 @@
#define FLASH_UNIT_SIZE 0x20000 // 128kB #define FLASH_UNIT_SIZE 0x20000 // 128kB
#endif #endif
#define FLASH_ADDRESS_START (FLASH_END - ((FLASH_SECTOR_TOTAL - FLASH_SECTOR) * FLASH_UNIT_SIZE) + 1) #define FLASH_ADDRESS_START (FLASH_END - ((FLASH_SECTOR_TOTAL - (FLASH_SECTOR)) * (FLASH_UNIT_SIZE)) + 1)
#define FLASH_ADDRESS_END (FLASH_ADDRESS_START + FLASH_UNIT_SIZE - 1) #define FLASH_ADDRESS_END (FLASH_ADDRESS_START + FLASH_UNIT_SIZE - 1)
#define EEPROM_SLOTS (FLASH_UNIT_SIZE/EEPROM_SIZE) #define EEPROM_SLOTS ((FLASH_UNIT_SIZE) / (MARLIN_EEPROM_SIZE))
#define SLOT_ADDRESS(slot) (FLASH_ADDRESS_START + (slot * EEPROM_SIZE)) #define SLOT_ADDRESS(slot) (FLASH_ADDRESS_START + (slot * (MARLIN_EEPROM_SIZE)))
#define UNLOCK_FLASH() if (!flash_unlocked) { \ #define UNLOCK_FLASH() if (!flash_unlocked) { \
HAL_FLASH_Unlock(); \ HAL_FLASH_Unlock(); \
@ -87,12 +87,12 @@
#define EMPTY_UINT32 ((uint32_t)-1) #define EMPTY_UINT32 ((uint32_t)-1)
#define EMPTY_UINT8 ((uint8_t)-1) #define EMPTY_UINT8 ((uint8_t)-1)
static uint8_t ram_eeprom[EEPROM_SIZE] __attribute__((aligned(4))) = {0}; static uint8_t ram_eeprom[MARLIN_EEPROM_SIZE] __attribute__((aligned(4))) = {0};
static int current_slot = -1; static int current_slot = -1;
static_assert(0 == EEPROM_SIZE % 4, "EEPROM_SIZE must be a multiple of 4"); // Ensure copying as uint32_t is safe static_assert(0 == MARLIN_EEPROM_SIZE % 4, "MARLIN_EEPROM_SIZE must be a multiple of 4"); // Ensure copying as uint32_t is safe
static_assert(0 == FLASH_UNIT_SIZE % EEPROM_SIZE, "EEPROM_SIZE must divide evenly into your FLASH_UNIT_SIZE"); static_assert(0 == FLASH_UNIT_SIZE % MARLIN_EEPROM_SIZE, "MARLIN_EEPROM_SIZE must divide evenly into your FLASH_UNIT_SIZE");
static_assert(FLASH_UNIT_SIZE >= EEPROM_SIZE, "FLASH_UNIT_SIZE must be greater than or equal to your EEPROM_SIZE"); static_assert(FLASH_UNIT_SIZE >= MARLIN_EEPROM_SIZE, "FLASH_UNIT_SIZE must be greater than or equal to your MARLIN_EEPROM_SIZE");
static_assert(IS_FLASH_SECTOR(FLASH_SECTOR), "FLASH_SECTOR is invalid"); static_assert(IS_FLASH_SECTOR(FLASH_SECTOR), "FLASH_SECTOR is invalid");
static_assert(IS_POWER_OF_2(FLASH_UNIT_SIZE), "FLASH_UNIT_SIZE should be a power of 2, please check your chip's spec sheet"); static_assert(IS_POWER_OF_2(FLASH_UNIT_SIZE), "FLASH_UNIT_SIZE should be a power of 2, please check your chip's spec sheet");
@ -100,6 +100,11 @@
static bool eeprom_data_written = false; static bool eeprom_data_written = false;
#ifndef MARLIN_EEPROM_SIZE
#define MARLIN_EEPROM_SIZE size_t(E2END + 1)
#endif
size_t PersistentStore::capacity() { return MARLIN_EEPROM_SIZE; }
bool PersistentStore::access_start() { bool PersistentStore::access_start() {
#if ENABLED(FLASH_EEPROM_LEVELING) #if ENABLED(FLASH_EEPROM_LEVELING)
@ -113,20 +118,20 @@ bool PersistentStore::access_start() {
while (address <= FLASH_ADDRESS_END) { while (address <= FLASH_ADDRESS_END) {
uint32_t address_value = (*(__IO uint32_t*)address); uint32_t address_value = (*(__IO uint32_t*)address);
if (address_value != EMPTY_UINT32) { if (address_value != EMPTY_UINT32) {
current_slot = (address - FLASH_ADDRESS_START) / EEPROM_SIZE; current_slot = (address - (FLASH_ADDRESS_START)) / (MARLIN_EEPROM_SIZE);
break; break;
} }
address += sizeof(uint32_t); address += sizeof(uint32_t);
} }
if (current_slot == -1) { if (current_slot == -1) {
// We didn't find anything, so we'll just intialize to empty // We didn't find anything, so we'll just intialize to empty
for (int i = 0; i < EEPROM_SIZE; i++) ram_eeprom[i] = EMPTY_UINT8; for (int i = 0; i < MARLIN_EEPROM_SIZE; i++) ram_eeprom[i] = EMPTY_UINT8;
current_slot = EEPROM_SLOTS; current_slot = EEPROM_SLOTS;
} }
else { else {
// load current settings // load current settings
uint8_t *eeprom_data = (uint8_t *)SLOT_ADDRESS(current_slot); uint8_t *eeprom_data = (uint8_t *)SLOT_ADDRESS(current_slot);
for (int i = 0; i < EEPROM_SIZE; i++) ram_eeprom[i] = eeprom_data[i]; for (int i = 0; i < MARLIN_EEPROM_SIZE; i++) ram_eeprom[i] = eeprom_data[i];
DEBUG_ECHOLNPAIR("EEPROM loaded from slot ", current_slot, "."); DEBUG_ECHOLNPAIR("EEPROM loaded from slot ", current_slot, ".");
} }
eeprom_data_written = false; eeprom_data_written = false;
@ -146,7 +151,7 @@ bool PersistentStore::access_finish() {
// MCU may come up with flash error bits which prevent some flash operations. // MCU may come up with flash error bits which prevent some flash operations.
// Clear flags prior to flash operations to prevent errors. // Clear flags prior to flash operations to prevent errors.
__HAL_FLASH_CLEAR_FLAG(FLASH_FLAG_OPERR | FLASH_FLAG_WRPERR | FLASH_FLAG_PGAERR | FLASH_FLAG_PGPERR | FLASH_FLAG_PGSERR); __HAL_FLASH_CLEAR_FLAG(FLASH_FLAG_OPERR | FLASH_FLAG_WRPERR | FLASH_FLAG_PGAERR | FLASH_FLAG_PGPERR | FLASH_FLAG_PGSERR);
#endif #endif
#if ENABLED(FLASH_EEPROM_LEVELING) #if ENABLED(FLASH_EEPROM_LEVELING)
@ -185,7 +190,7 @@ bool PersistentStore::access_finish() {
uint32_t offset = 0; uint32_t offset = 0;
uint32_t address = SLOT_ADDRESS(current_slot); uint32_t address = SLOT_ADDRESS(current_slot);
uint32_t address_end = address + EEPROM_SIZE; uint32_t address_end = address + MARLIN_EEPROM_SIZE;
uint32_t data = 0; uint32_t data = 0;
bool success = true; bool success = true;
@ -267,9 +272,5 @@ bool PersistentStore::read_data(int &pos, uint8_t* value, size_t size, uint16_t
return false; return false;
} }
size_t PersistentStore::capacity() {
return TERN(FLASH_EEPROM_LEVELING, EEPROM_SIZE, E2END + 1);
}
#endif // FLASH_EEPROM_EMULATION #endif // FLASH_EEPROM_EMULATION
#endif // ARDUINO_ARCH_STM32 && !STM32GENERIC #endif // ARDUINO_ARCH_STM32 && !STM32GENERIC

65
Marlin/src/HAL/STM32/eeprom_sdcard.cpp

@ -31,53 +31,44 @@
#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 #define EEPROM_FILENAME "eeprom.dat"
#define E2END 0xFFF // 4KB
#ifndef MARLIN_EEPROM_SIZE
#define MARLIN_EEPROM_SIZE 0x1000 // 4KB
#endif #endif
#define HAL_EEPROM_SIZE int(E2END + 1) size_t PersistentStore::capacity() { return MARLIN_EEPROM_SIZE; }
#define _ALIGN(x) __attribute__ ((aligned(x))) #define _ALIGN(x) __attribute__ ((aligned(x)))
static char _ALIGN(4) HAL_eeprom_data[HAL_EEPROM_SIZE]; static char _ALIGN(4) HAL_eeprom_data[MARLIN_EEPROM_SIZE];
#if ENABLED(SDSUPPORT)
#include "../../sd/cardreader.h" bool PersistentStore::access_start() {
if (!card.isMounted()) return false;
#define EEPROM_FILENAME "eeprom.dat" SdFile file, root = card.getroot();
if (!file.open(&root, EEPROM_FILENAME, O_RDONLY))
return true;
bool PersistentStore::access_start() { int bytes_read = file.read(HAL_eeprom_data, MARLIN_EEPROM_SIZE);
if (!card.isMounted()) return false; if (bytes_read < 0) return false;
for (; bytes_read < MARLIN_EEPROM_SIZE; bytes_read++)
HAL_eeprom_data[bytes_read] = 0xFF;
file.close();
return true;
}
SdFile file, root = card.getroot(); bool PersistentStore::access_finish() {
if (!file.open(&root, EEPROM_FILENAME, O_RDONLY)) if (!card.isMounted()) return false;
return true;
int bytes_read = file.read(HAL_eeprom_data, HAL_EEPROM_SIZE); SdFile file, root = card.getroot();
if (bytes_read < 0) return false; int bytes_written = 0;
for (; bytes_read < HAL_EEPROM_SIZE; bytes_read++) if (file.open(&root, EEPROM_FILENAME, O_CREAT | O_WRITE | O_TRUNC)) {
HAL_eeprom_data[bytes_read] = 0xFF; bytes_written = file.write(HAL_eeprom_data, MARLIN_EEPROM_SIZE);
file.close(); file.close();
return true;
} }
return (bytes_written == MARLIN_EEPROM_SIZE);
bool PersistentStore::access_finish() { }
if (!card.isMounted()) return false;
SdFile file, root = card.getroot();
int bytes_written = 0;
if (file.open(&root, EEPROM_FILENAME, O_CREAT | O_WRITE | O_TRUNC)) {
bytes_written = file.write(HAL_eeprom_data, HAL_EEPROM_SIZE);
file.close();
}
return (bytes_written == HAL_EEPROM_SIZE);
}
#else // !SDSUPPORT
#error "Please define an EEPROM, a SDCARD 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++)
@ -97,7 +88,5 @@ bool PersistentStore::read_data(int &pos, uint8_t* value, const size_t size, uin
return false; return false;
} }
size_t PersistentStore::capacity() { return HAL_EEPROM_SIZE; }
#endif // SDCARD_EEPROM_EMULATION #endif // SDCARD_EEPROM_EMULATION
#endif // STM32 && !STM32GENERIC #endif // STM32 && !STM32GENERIC

6
Marlin/src/HAL/STM32/eeprom_sram.cpp

@ -29,7 +29,11 @@
#include "../shared/eeprom_if.h" #include "../shared/eeprom_if.h"
#include "../shared/eeprom_api.h" #include "../shared/eeprom_api.h"
size_t PersistentStore::capacity() { return 4096; } // 4K of SRAM #ifndef MARLIN_EEPROM_SIZE
#define MARLIN_EEPROM_SIZE 0x1000 // 4KB
#endif
size_t PersistentStore::capacity() { return MARLIN_EEPROM_SIZE; }
bool PersistentStore::access_start() { return true; } bool PersistentStore::access_start() { return true; }
bool PersistentStore::access_finish() { return true; } bool PersistentStore::access_finish() { return true; }

12
Marlin/src/HAL/STM32/eeprom_wired.cpp

@ -34,13 +34,13 @@
#include "../shared/eeprom_if.h" #include "../shared/eeprom_if.h"
#include "../shared/eeprom_api.h" #include "../shared/eeprom_api.h"
size_t PersistentStore::capacity() { return E2END + 1; } #ifndef MARLIN_EEPROM_SIZE
bool PersistentStore::access_finish() { return true; } #define MARLIN_EEPROM_SIZE size_t(E2END + 1)
#endif
size_t PersistentStore::capacity() { return MARLIN_EEPROM_SIZE; }
bool PersistentStore::access_start() { bool PersistentStore::access_start() { eeprom_init(); return true; }
eeprom_init(); bool PersistentStore::access_finish() { return true; }
return true;
}
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) {
while (size--) { while (size--) {

18
Marlin/src/HAL/STM32F1/eeprom_flash.cpp

@ -39,18 +39,20 @@
#include <EEPROM.h> #include <EEPROM.h>
// Store settings in the last two pages // Store settings in the last two pages
#define EEPROM_SIZE (EEPROM_PAGE_SIZE * 2) #ifndef MARLIN_EEPROM_SIZE
#define ACCESS_FINISHED(TF) do{ FLASH_Lock(); eeprom_dirty = false; return TF; }while(0) #define MARLIN_EEPROM_SIZE ((EEPROM_PAGE_SIZE) * 2)
#endif
size_t PersistentStore::capacity() { return MARLIN_EEPROM_SIZE; }
static uint8_t ram_eeprom[EEPROM_SIZE] __attribute__((aligned(4))) = {0}; static uint8_t ram_eeprom[MARLIN_EEPROM_SIZE] __attribute__((aligned(4))) = {0};
static bool eeprom_dirty = false; static bool eeprom_dirty = false;
bool PersistentStore::access_start() { bool PersistentStore::access_start() {
const uint32_t* source = reinterpret_cast<const uint32_t*>(EEPROM_PAGE0_BASE); const uint32_t* source = reinterpret_cast<const uint32_t*>(EEPROM_PAGE0_BASE);
uint32_t* destination = reinterpret_cast<uint32_t*>(ram_eeprom); uint32_t* destination = reinterpret_cast<uint32_t*>(ram_eeprom);
static_assert(0 == EEPROM_SIZE % 4, "EEPROM_SIZE is corrupted. (Must be a multiple of 4.)"); // Ensure copying as uint32_t is safe static_assert(0 == (MARLIN_EEPROM_SIZE) % 4, "MARLIN_EEPROM_SIZE is corrupted. (Must be a multiple of 4.)"); // Ensure copying as uint32_t is safe
constexpr size_t eeprom_size_u32 = EEPROM_SIZE / 4; constexpr size_t eeprom_size_u32 = (MARLIN_EEPROM_SIZE) / 4;
for (size_t i = 0; i < eeprom_size_u32; ++i, ++destination, ++source) for (size_t i = 0; i < eeprom_size_u32; ++i, ++destination, ++source)
*destination = *source; *destination = *source;
@ -72,13 +74,15 @@ bool PersistentStore::access_finish() {
// page changes...either way, something to look at later. // page changes...either way, something to look at later.
FLASH_Unlock(); FLASH_Unlock();
#define ACCESS_FINISHED(TF) { FLASH_Lock(); eeprom_dirty = false; return TF; }
status = FLASH_ErasePage(EEPROM_PAGE0_BASE); status = FLASH_ErasePage(EEPROM_PAGE0_BASE);
if (status != FLASH_COMPLETE) ACCESS_FINISHED(true); if (status != FLASH_COMPLETE) ACCESS_FINISHED(true);
status = FLASH_ErasePage(EEPROM_PAGE1_BASE); status = FLASH_ErasePage(EEPROM_PAGE1_BASE);
if (status != FLASH_COMPLETE) ACCESS_FINISHED(true); if (status != FLASH_COMPLETE) ACCESS_FINISHED(true);
const uint16_t *source = reinterpret_cast<const uint16_t*>(ram_eeprom); const uint16_t *source = reinterpret_cast<const uint16_t*>(ram_eeprom);
for (size_t i = 0; i < EEPROM_SIZE; i += 2, ++source) { for (size_t i = 0; i < MARLIN_EEPROM_SIZE; i += 2, ++source) {
if (FLASH_ProgramHalfWord(EEPROM_PAGE0_BASE + i, *source) != FLASH_COMPLETE) if (FLASH_ProgramHalfWord(EEPROM_PAGE0_BASE + i, *source) != FLASH_COMPLETE)
ACCESS_FINISHED(false); ACCESS_FINISHED(false);
} }
@ -105,7 +109,5 @@ bool PersistentStore::read_data(int &pos, uint8_t* value, const size_t size, uin
return false; // return true for any error return false; // return true for any error
} }
size_t PersistentStore::capacity() { return EEPROM_SIZE; }
#endif // FLASH_EEPROM_EMULATION #endif // FLASH_EEPROM_EMULATION
#endif // __STM32F1__ #endif // __STM32F1__

22
Marlin/src/HAL/STM32F1/eeprom_sdcard.cpp

@ -34,15 +34,15 @@
#include "../shared/eeprom_api.h" #include "../shared/eeprom_api.h"
#include "../../sd/cardreader.h" #include "../../sd/cardreader.h"
#ifndef E2END #define EEPROM_FILENAME "eeprom.dat"
#define E2END 0xFFF // 4KB
#ifndef MARLIN_EEPROM_SIZE
#define MARLIN_EEPROM_SIZE 0x1000 // 4KB
#endif #endif
#define HAL_EEPROM_SIZE (E2END + 1) size_t PersistentStore::capacity() { return MARLIN_EEPROM_SIZE; }
#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[MARLIN_EEPROM_SIZE];
#define EEPROM_FILENAME "eeprom.dat"
bool PersistentStore::access_start() { bool PersistentStore::access_start() {
if (!card.isMounted()) return false; if (!card.isMounted()) return false;
@ -51,9 +51,9 @@ bool PersistentStore::access_start() {
if (!file.open(&root, EEPROM_FILENAME, O_RDONLY)) if (!file.open(&root, EEPROM_FILENAME, O_RDONLY))
return true; // false aborts the save return true; // false aborts the save
int bytes_read = file.read(HAL_eeprom_data, HAL_EEPROM_SIZE); int bytes_read = file.read(HAL_eeprom_data, MARLIN_EEPROM_SIZE);
if (bytes_read < 0) return false; if (bytes_read < 0) return false;
for (; bytes_read < HAL_EEPROM_SIZE; bytes_read++) for (; bytes_read < MARLIN_EEPROM_SIZE; bytes_read++)
HAL_eeprom_data[bytes_read] = 0xFF; HAL_eeprom_data[bytes_read] = 0xFF;
file.close(); file.close();
return true; return true;
@ -65,10 +65,10 @@ bool PersistentStore::access_finish() {
SdFile file, root = card.getroot(); SdFile file, root = card.getroot();
int bytes_written = 0; int bytes_written = 0;
if (file.open(&root, EEPROM_FILENAME, O_CREAT | O_WRITE | O_TRUNC)) { if (file.open(&root, EEPROM_FILENAME, O_CREAT | O_WRITE | O_TRUNC)) {
bytes_written = file.write(HAL_eeprom_data, HAL_EEPROM_SIZE); bytes_written = file.write(HAL_eeprom_data, MARLIN_EEPROM_SIZE);
file.close(); file.close();
} }
return (bytes_written == HAL_EEPROM_SIZE); return (bytes_written == MARLIN_EEPROM_SIZE);
} }
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) {
@ -89,7 +89,5 @@ bool PersistentStore::read_data(int &pos, uint8_t* value, const size_t size, uin
return false; return false;
} }
size_t PersistentStore::capacity() { return HAL_EEPROM_SIZE; }
#endif // SDCARD_EEPROM_EMULATION #endif // SDCARD_EEPROM_EMULATION
#endif // __STM32F1__ #endif // __STM32F1__

8
Marlin/src/HAL/STM32F1/eeprom_wired.cpp

@ -31,7 +31,12 @@
#include "../shared/eeprom_if.h" #include "../shared/eeprom_if.h"
#include "../shared/eeprom_api.h" #include "../shared/eeprom_api.h"
size_t PersistentStore::capacity() { return E2END + 1; } #ifndef MARLIN_EEPROM_SIZE
#error "MARLIN_EEPROM_SIZE is required for I2C / SPI EEPROM."
#endif
size_t PersistentStore::capacity() { return MARLIN_EEPROM_SIZE; }
bool PersistentStore::access_finish() { return true; }
bool PersistentStore::access_start() { bool PersistentStore::access_start() {
#if ENABLED(SPI_EEPROM) #if ENABLED(SPI_EEPROM)
@ -45,7 +50,6 @@ bool PersistentStore::access_start() {
#endif #endif
return true; return true;
} }
bool PersistentStore::access_finish() { return true; }
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) {
while (size--) { while (size--) {

8
Marlin/src/HAL/STM32_F4_F7/eeprom_flash.cpp

@ -52,10 +52,14 @@ uint8_t ee_read_byte(uint8_t *pos) {
return uint8_t(data); return uint8_t(data);
} }
size_t PersistentStore::capacity() { return E2END + 1; } #ifndef MARLIN_EEPROM_SIZE
#error "MARLIN_EEPROM_SIZE is required for Flash-based EEPROM."
#endif
size_t PersistentStore::capacity() { return MARLIN_EEPROM_SIZE; }
bool PersistentStore::access_finish() { return true; } bool PersistentStore::access_finish() { return true; }
bool PersistentStore::access_start() { bool PersistentStore::access_start() {
static bool ee_initialized = false; static bool ee_initialized = false;
if (!ee_initialized) { if (!ee_initialized) {
HAL_FLASH_Unlock(); HAL_FLASH_Unlock();

12
Marlin/src/HAL/STM32_F4_F7/eeprom_wired.cpp

@ -34,13 +34,13 @@
#include "../shared/eeprom_if.h" #include "../shared/eeprom_if.h"
#include "../shared/eeprom_api.h" #include "../shared/eeprom_api.h"
size_t PersistentStore::capacity() { return E2END + 1; } #ifndef MARLIN_EEPROM_SIZE
bool PersistentStore::access_finish() { return true; } #error "MARLIN_EEPROM_SIZE is required for I2C / SPI EEPROM."
#endif
size_t PersistentStore::capacity() { return MARLIN_EEPROM_SIZE; }
bool PersistentStore::access_start() { bool PersistentStore::access_start() { eeprom_init(); return true; }
eeprom_init(); bool PersistentStore::access_finish() { return true; }
return true;
}
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) {
while (size--) { while (size--) {

8
Marlin/src/HAL/TEENSY31_32/eeprom.cpp

@ -28,8 +28,14 @@
*/ */
#include "../shared/eeprom_api.h" #include "../shared/eeprom_api.h"
#include <avr/eeprom.h>
bool PersistentStore::access_start() { return true; } #ifndef MARLIN_EEPROM_SIZE
#define MARLIN_EEPROM_SIZE size_t(E2END + 1)
#endif
size_t PersistentStore::capacity() { return MARLIN_EEPROM_SIZE; }
bool PersistentStore::access_start() { return true; }
bool PersistentStore::access_finish() { return true; } bool PersistentStore::access_finish() { return true; }
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) {

6
Marlin/src/HAL/TEENSY35_36/eeprom.cpp

@ -34,7 +34,11 @@
#include "../shared/eeprom_api.h" #include "../shared/eeprom_api.h"
#include <avr/eeprom.h> #include <avr/eeprom.h>
size_t PersistentStore::capacity() { return E2END + 1; } #ifndef MARLIN_EEPROM_SIZE
#define MARLIN_EEPROM_SIZE size_t(E2END + 1)
#endif
size_t PersistentStore::capacity() { return MARLIN_EEPROM_SIZE; }
bool PersistentStore::access_start() { return true; } bool PersistentStore::access_start() { return true; }
bool PersistentStore::access_finish() { return true; } bool PersistentStore::access_finish() { return true; }

2
Marlin/src/module/configuration_store.cpp

@ -389,7 +389,7 @@ typedef struct SettingsDataStruct {
} SettingsData; } SettingsData;
//static_assert(sizeof(SettingsData) <= E2END + 1, "EEPROM too small to contain SettingsData!"); //static_assert(sizeof(SettingsData) <= MARLIN_EEPROM_SIZE, "EEPROM too small to contain SettingsData!");
MarlinSettings settings; MarlinSettings settings;

4
Marlin/src/pins/linux/pins_RAMPS_LINUX.h

@ -49,7 +49,9 @@
#define BOARD_INFO_NAME "RAMPS 1.4" #define BOARD_INFO_NAME "RAMPS 1.4"
#endif #endif
#define E2END 0xFFF // 4KB #ifndef MARLIN_EEPROM_SIZE
#define MARLIN_EEPROM_SIZE 0x1000 // 4KB
#endif
#define IS_RAMPS_EFB #define IS_RAMPS_EFB

2
Marlin/src/pins/sam/pins_RADDS.h

@ -206,7 +206,7 @@
#endif #endif
#define I2C_EEPROM #define I2C_EEPROM
#define E2END 0x1FFF // 8KB #define MARLIN_EEPROM_SIZE 0x2000 // 8KB
// //
// M3/M4/M5 - Spindle/Laser Control // M3/M4/M5 - Spindle/Laser Control

2
Marlin/src/pins/sam/pins_RAMPS_FD_V2.h

@ -41,7 +41,7 @@
#undef INVERTED_FAN_PINS #undef INVERTED_FAN_PINS
#define I2C_EEPROM #define I2C_EEPROM
#define E2END 0xFFFF // 64K in a 24C512 #define MARLIN_EEPROM_SIZE 0x10000 // 64K in a 24C512
#ifndef PS_ON_PIN #ifndef PS_ON_PIN
#define PS_ON_PIN 12 #define PS_ON_PIN 12

2
Marlin/src/pins/sam/pins_RAMPS_SMART.h

@ -70,7 +70,7 @@
// I2C EEPROM with 4K of space // I2C EEPROM with 4K of space
#define I2C_EEPROM #define I2C_EEPROM
#define E2END 0xFFF #define MARLIN_EEPROM_SIZE 0x1000
#define RESET_PIN 42 // Resets the board if the jumper is attached #define RESET_PIN 42 // Resets the board if the jumper is attached

2
Marlin/src/pins/sam/pins_RURAMPS4D_11.h

@ -186,7 +186,7 @@
// //
// EEPROM // EEPROM
// //
#define E2END 0x7FFF // 32Kb (24lc256) #define MARLIN_EEPROM_SIZE 0x8000 // 32Kb (24lc256)
#define I2C_EEPROM // EEPROM on I2C-0 #define I2C_EEPROM // EEPROM on I2C-0
//#define EEPROM_SD // EEPROM on SDCARD //#define EEPROM_SD // EEPROM on SDCARD
//#define SPI_EEPROM // EEPROM on SPI-0 //#define SPI_EEPROM // EEPROM on SPI-0

2
Marlin/src/pins/sam/pins_RURAMPS4D_13.h

@ -172,7 +172,7 @@
// //
// EEPROM // EEPROM
// //
#define E2END 0x7FFF // 32Kb (24lc256) #define MARLIN_EEPROM_SIZE 0x8000 // 32Kb (24lc256)
#define I2C_EEPROM // EEPROM on I2C-0 #define I2C_EEPROM // EEPROM on I2C-0
//#define EEPROM_SD // EEPROM on SDCARD //#define EEPROM_SD // EEPROM on SDCARD
//#define SPI_EEPROM // EEPROM on SPI-0 //#define SPI_EEPROM // EEPROM on SPI-0

2
Marlin/src/pins/samd/pins_RAMPS_144.h

@ -46,7 +46,7 @@
// //
//#define QSPI_EEPROM // Use AGCM4 onboard QSPI EEPROM (Uses 4K of RAM) //#define QSPI_EEPROM // Use AGCM4 onboard QSPI EEPROM (Uses 4K of RAM)
#define I2C_EEPROM // EEPROM on I2C-0 #define I2C_EEPROM // EEPROM on I2C-0
#define E2END 0x7FFF // 32K (24lc256) #define MARLIN_EEPROM_SIZE 0x8000 // 32K (24lc256)
// //
// Limit Switches // Limit Switches

6
Marlin/src/pins/stm32f1/pins_BTT_SKR_E3_DIP.h

@ -37,8 +37,7 @@
#define FLASH_EEPROM_EMULATION #define FLASH_EEPROM_EMULATION
#define EEPROM_PAGE_SIZE (0x800U) // 2KB #define EEPROM_PAGE_SIZE (0x800U) // 2KB
#define EEPROM_START_ADDRESS (0x8000000UL + (STM32_FLASH_SIZE) * 1024UL - (EEPROM_PAGE_SIZE) * 2UL) #define EEPROM_START_ADDRESS (0x8000000UL + (STM32_FLASH_SIZE) * 1024UL - (EEPROM_PAGE_SIZE) * 2UL)
#undef E2END #define MARLIN_EEPROM_SIZE EEPROM_PAGE_SIZE // 2KB
#define E2END (EEPROM_PAGE_SIZE - 1) // 2KB
#endif #endif
// //
@ -172,7 +171,6 @@
* EXP1 * EXP1
*/ */
#if HAS_SPI_LCD #if HAS_SPI_LCD
#if ENABLED(CR10_STOCKDISPLAY) #if ENABLED(CR10_STOCKDISPLAY)
@ -276,7 +274,7 @@
// //
#ifndef SDCARD_CONNECTION #ifndef SDCARD_CONNECTION
#define SDCARD_CONNECTION ONBOARD #define SDCARD_CONNECTION ONBOARD
#endif #endif
#if SD_CONNECTION_IS(ONBOARD) #if SD_CONNECTION_IS(ONBOARD)

3
Marlin/src/pins/stm32f1/pins_BTT_SKR_MINI_E3.h

@ -35,8 +35,7 @@
#define FLASH_EEPROM_EMULATION #define FLASH_EEPROM_EMULATION
#define EEPROM_PAGE_SIZE (0x800U) // 2KB #define EEPROM_PAGE_SIZE (0x800U) // 2KB
#define EEPROM_START_ADDRESS (0x8000000UL + (STM32_FLASH_SIZE) * 1024UL - (EEPROM_PAGE_SIZE) * 2UL) #define EEPROM_START_ADDRESS (0x8000000UL + (STM32_FLASH_SIZE) * 1024UL - (EEPROM_PAGE_SIZE) * 2UL)
#undef E2END #define MARLIN_EEPROM_SIZE EEPROM_PAGE_SIZE // 2KB
#define E2END (EEPROM_PAGE_SIZE - 1) // 2KB
#endif #endif
// //

2
Marlin/src/pins/stm32f1/pins_BTT_SKR_MINI_V1_1.h

@ -37,7 +37,7 @@
#define FLASH_EEPROM_EMULATION #define FLASH_EEPROM_EMULATION
#define EEPROM_PAGE_SIZE (0x800U) // 2KB #define EEPROM_PAGE_SIZE (0x800U) // 2KB
#define EEPROM_START_ADDRESS (0x8000000UL + (STM32_FLASH_SIZE) * 1024UL - (EEPROM_PAGE_SIZE) * 2UL) #define EEPROM_START_ADDRESS (0x8000000UL + (STM32_FLASH_SIZE) * 1024UL - (EEPROM_PAGE_SIZE) * 2UL)
#define E2END (EEPROM_PAGE_SIZE - 1) #define MARLIN_EEPROM_SIZE EEPROM_PAGE_SIZE // 2KB
#endif #endif
// //

3
Marlin/src/pins/stm32f1/pins_FYSETC_AIO_II.h

@ -42,8 +42,7 @@
#define FLASH_EEPROM_EMULATION #define FLASH_EEPROM_EMULATION
#define EEPROM_PAGE_SIZE (0x800U) // 2KB #define EEPROM_PAGE_SIZE (0x800U) // 2KB
#define EEPROM_START_ADDRESS (0x8000000UL + (STM32_FLASH_SIZE) * 1024UL - (EEPROM_PAGE_SIZE) * 2UL) #define EEPROM_START_ADDRESS (0x8000000UL + (STM32_FLASH_SIZE) * 1024UL - (EEPROM_PAGE_SIZE) * 2UL)
#undef E2END #define MARLIN_EEPROM_SIZE EEPROM_PAGE_SIZE // 2KB
#define E2END (EEPROM_PAGE_SIZE - 1) // 2KB
#endif #endif
// //

3
Marlin/src/pins/stm32f1/pins_FYSETC_CHEETAH.h

@ -40,8 +40,7 @@
#define FLASH_EEPROM_EMULATION #define FLASH_EEPROM_EMULATION
#define EEPROM_PAGE_SIZE (0x800U) // 2KB #define EEPROM_PAGE_SIZE (0x800U) // 2KB
#define EEPROM_START_ADDRESS (0x8000000UL + (STM32_FLASH_SIZE) * 1024UL - (EEPROM_PAGE_SIZE) * 2UL) #define EEPROM_START_ADDRESS (0x8000000UL + (STM32_FLASH_SIZE) * 1024UL - (EEPROM_PAGE_SIZE) * 2UL)
#undef E2END #define MARLIN_EEPROM_SIZE EEPROM_PAGE_SIZE // 2KB
#define E2END (EEPROM_PAGE_SIZE - 1) // 2KB
#endif #endif
// //

2
Marlin/src/pins/stm32f1/pins_GTM32_MINI.h

@ -54,7 +54,7 @@
// Enable EEPROM Emulation for this board as it doesn't have EEPROM // Enable EEPROM Emulation for this board as it doesn't have EEPROM
#if EITHER(NO_EEPROM_SELECTED, FLASH_EEPROM_EMULATION) #if EITHER(NO_EEPROM_SELECTED, FLASH_EEPROM_EMULATION)
#define FLASH_EEPROM_EMULATION #define FLASH_EEPROM_EMULATION
#define E2END 0xFFF // 4KB #define MARLIN_EEPROM_SIZE 0x1000 // 4KB
#endif #endif
// //

2
Marlin/src/pins/stm32f1/pins_GTM32_MINI_A30.h

@ -54,7 +54,7 @@
// Enable EEPROM Emulation for this board as it doesn't have EEPROM // Enable EEPROM Emulation for this board as it doesn't have EEPROM
#if EITHER(NO_EEPROM_SELECTED, FLASH_EEPROM_EMULATION) #if EITHER(NO_EEPROM_SELECTED, FLASH_EEPROM_EMULATION)
#define FLASH_EEPROM_EMULATION #define FLASH_EEPROM_EMULATION
#define E2END 0xFFF // 4KB #define MARLIN_EEPROM_SIZE 0x1000 // 4KB
#endif #endif
// //

2
Marlin/src/pins/stm32f1/pins_GTM32_PRO_VB.h

@ -54,7 +54,7 @@
// Enable EEPROM Emulation for this board as it doesn't have EEPROM // Enable EEPROM Emulation for this board as it doesn't have EEPROM
#if EITHER(NO_EEPROM_SELECTED, FLASH_EEPROM_EMULATION) #if EITHER(NO_EEPROM_SELECTED, FLASH_EEPROM_EMULATION)
#define FLASH_EEPROM_EMULATION #define FLASH_EEPROM_EMULATION
#define E2END 0xFFF // 4KB #define MARLIN_EEPROM_SIZE 0x1000 // 4KB
#endif #endif
// //

2
Marlin/src/pins/stm32f1/pins_GTM32_REV_B.h

@ -54,7 +54,7 @@
// Enable EEPROM Emulation for this board as it doesn't have EEPROM // Enable EEPROM Emulation for this board as it doesn't have EEPROM
#if EITHER(NO_EEPROM_SELECTED, FLASH_EEPROM_EMULATION) #if EITHER(NO_EEPROM_SELECTED, FLASH_EEPROM_EMULATION)
#define FLASH_EEPROM_EMULATION #define FLASH_EEPROM_EMULATION
#define E2END 0xFFF // 4KB #define MARLIN_EEPROM_SIZE 0x1000 // 4KB
#endif #endif
// //

6
Marlin/src/pins/stm32f1/pins_JGAURORA_A5S_A1.h

@ -43,11 +43,11 @@
// Enable EEPROM Emulation for this board, so that we don't overwrite factory data // Enable EEPROM Emulation for this board, so that we don't overwrite factory data
//#define I2C_EEPROM // AT24C64 //#define I2C_EEPROM // AT24C64
//#define E2END 0x7FFFUL // 64KB //#define MARLIN_EEPROM_SIZE 0x8000UL // 64KB
//#define FLASH_EEPROM_EMULATION //#define FLASH_EEPROM_EMULATION
//#define E2END 0xFFFUL // 4KB //#define MARLIN_EEPROM_SIZE 0x1000UL // 4KB
//#define E2END (EEPROM_START_ADDRESS + (EEPROM_PAGE_SIZE) * 2UL - 1UL) //#define MARLIN_EEPROM_SIZE (EEPROM_START_ADDRESS + (EEPROM_PAGE_SIZE) * 2UL)
//#define EEPROM_CHITCHAT //#define EEPROM_CHITCHAT
//#define DEBUG_EEPROM_READWRITE //#define DEBUG_EEPROM_READWRITE

7
Marlin/src/pins/stm32f1/pins_LONGER3D_LK.h

@ -152,7 +152,6 @@
#define FLASH_EEPROM_EMULATION #define FLASH_EEPROM_EMULATION
#endif #endif
#undef E2END
#if ENABLED(SPI_EEPROM) #if ENABLED(SPI_EEPROM)
// SPI1 EEPROM Winbond W25Q64 (8MB/64Mbits) // SPI1 EEPROM Winbond W25Q64 (8MB/64Mbits)
#define SPI_CHAN_EEPROM1 1 #define SPI_CHAN_EEPROM1 1
@ -161,12 +160,12 @@
#define EEPROM_MISO BOARD_SPI1_MISO_PIN // PA6 pin 31 #define EEPROM_MISO BOARD_SPI1_MISO_PIN // PA6 pin 31
#define EEPROM_MOSI BOARD_SPI1_MOSI_PIN // PA7 pin 32 #define EEPROM_MOSI BOARD_SPI1_MOSI_PIN // PA7 pin 32
#define EEPROM_PAGE_SIZE 0x1000U // 4KB (from datasheet) #define EEPROM_PAGE_SIZE 0x1000U // 4KB (from datasheet)
#define E2END (16UL * (EEPROM_PAGE_SIZE) - 1UL) // Limit to 64KB for now... #define MARLIN_EEPROM_SIZE 16UL * (EEPROM_PAGE_SIZE) // Limit to 64KB for now...
#elif ENABLED(FLASH_EEPROM_EMULATION) #elif ENABLED(FLASH_EEPROM_EMULATION)
// SoC Flash (framework-arduinoststm32-maple/STM32F1/libraries/EEPROM/EEPROM.h) // SoC Flash (framework-arduinoststm32-maple/STM32F1/libraries/EEPROM/EEPROM.h)
#define EEPROM_PAGE_SIZE (0x800U) // 2KB #define EEPROM_PAGE_SIZE (0x800U) // 2KB
#define EEPROM_START_ADDRESS (0x8000000UL + (STM32_FLASH_SIZE) * 1024UL - (EEPROM_PAGE_SIZE) * 2UL) #define EEPROM_START_ADDRESS (0x8000000UL + (STM32_FLASH_SIZE) * 1024UL - (EEPROM_PAGE_SIZE) * 2UL)
#define E2END (EEPROM_PAGE_SIZE - 1) #define MARLIN_EEPROM_SIZE (EEPROM_PAGE_SIZE)
#else #else
#define E2END (0x7FFU) // On SD, Limit to 2KB, require this amount of RAM #define MARLIN_EEPROM_SIZE 0x800U // On SD, Limit to 2KB, require this amount of RAM
#endif #endif

2
Marlin/src/pins/stm32f1/pins_MKS_ROBIN_MINI.h

@ -43,7 +43,7 @@
// 2K in a AT24C16N // 2K in a AT24C16N
#define EEPROM_PAGE_SIZE (0x800U) // 2KB #define EEPROM_PAGE_SIZE (0x800U) // 2KB
#define EEPROM_START_ADDRESS (0x8000000UL + (STM32_FLASH_SIZE) * 1024UL - (EEPROM_PAGE_SIZE) * 2UL) #define EEPROM_START_ADDRESS (0x8000000UL + (STM32_FLASH_SIZE) * 1024UL - (EEPROM_PAGE_SIZE) * 2UL)
#define E2END (EEPROM_PAGE_SIZE - 1) #define MARLIN_EEPROM_SIZE EEPROM_PAGE_SIZE // 2KB
#endif #endif
// //

4
Marlin/src/pins/stm32f4/pins_ARMED.h

@ -39,9 +39,7 @@
#define DEFAULT_MACHINE_NAME BOARD_INFO_NAME #define DEFAULT_MACHINE_NAME BOARD_INFO_NAME
#define I2C_EEPROM #define I2C_EEPROM
#define MARLIN_EEPROM_SIZE 0x1000 // 4KB
#undef E2END // Defined in Arduino Core STM32 to be used with EEPROM emulation. This board uses a real EEPROM.
#define E2END 0xFFF // 4KB
// //
// Limit Switches // Limit Switches

2
Marlin/src/pins/stm32f4/pins_BLACK_STM32F407VE.h

@ -40,8 +40,8 @@
#define DEFAULT_MACHINE_NAME "STM32F407VET6" #define DEFAULT_MACHINE_NAME "STM32F407VET6"
//#define I2C_EEPROM //#define I2C_EEPROM
//#define E2END 0x1FFF // 8KB
#define SRAM_EEPROM_EMULATION #define SRAM_EEPROM_EMULATION
#define MARLIN_EEPROM_SIZE 0x2000 // 8KB
// //
// Servos // Servos

3
Marlin/src/pins/stm32f4/pins_BTT_GTR_V1_0.h

@ -33,8 +33,7 @@
// Onboard I2C EEPROM // Onboard I2C EEPROM
#define I2C_EEPROM #define I2C_EEPROM
#undef E2END #define MARLIN_EEPROM_SIZE 0x2000 // 8KB (24C64 ... 64Kb = 8KB)
#define E2END 0x1FFF // EEPROM end address 24C64 (64Kb = 8KB)
#define TP // Enable to define servo and probe pins #define TP // Enable to define servo and probe pins

3
Marlin/src/pins/stm32f4/pins_FLYF407ZG.h

@ -31,8 +31,7 @@
#define BOARD_WEBSITE_URL "github.com/FLYmaker/FLYF407ZG" #define BOARD_WEBSITE_URL "github.com/FLYmaker/FLYF407ZG"
#define DEFAULT_MACHINE_NAME BOARD_INFO_NAME #define DEFAULT_MACHINE_NAME BOARD_INFO_NAME
#undef E2END #define MARLIN_EEPROM_SIZE 0x1000 // 4KB
#define E2END 0xFFF // 4KB
// //
// Servos // Servos

3
Marlin/src/pins/stm32f4/pins_FYSETC_S6.h

@ -51,8 +51,7 @@
// 128 kB sector allocated for EEPROM emulation. // 128 kB sector allocated for EEPROM emulation.
#define FLASH_EEPROM_LEVELING #define FLASH_EEPROM_LEVELING
#elif ENABLED(I2C_EEPROM) #elif ENABLED(I2C_EEPROM)
#undef E2END // Defined in Arduino Core STM32 to be used with EEPROM emulation. This board uses a real EEPROM. #define MARLIN_EEPROM_SIZE 0x1000 // 4KB
#define E2END 0xFFF // 4KB
#endif #endif
// //

4
Marlin/src/pins/stm32f4/pins_GENERIC_STM32F4.h

@ -36,8 +36,8 @@
//#define I2C_EEPROM //#define I2C_EEPROM
#ifndef E2END #ifndef MARLIN_EEPROM_SIZE
#define E2END 0xFFF // 4KB #define MARLIN_EEPROM_SIZE 0x1000 // 4KB
#endif #endif
// Ignore temp readings during development. // Ignore temp readings during development.

5
Marlin/src/pins/stm32f4/pins_RUMBA32_common.h

@ -35,10 +35,7 @@
#define DEFAULT_MACHINE_NAME BOARD_INFO_NAME #define DEFAULT_MACHINE_NAME BOARD_INFO_NAME
//#define I2C_EEPROM //#define I2C_EEPROM
#ifdef E2END #define MARLIN_EEPROM_SIZE 0x1000 // 4KB
#undef E2END
#endif
#define E2END 0xFFF // 4KB
// //
// Limit Switches // Limit Switches

3
Marlin/src/pins/stm32f4/pins_VAKE403D.h

@ -31,8 +31,7 @@
#define BOARD_INFO_NAME "STM32F4 VAkE" #define BOARD_INFO_NAME "STM32F4 VAkE"
//#define I2C_EEPROM //#define I2C_EEPROM
#define MARLIN_EEPROM_SIZE 0x1000 // 4KB
#define E2END 0xFFF // EEPROM end address (4kB)
// //
// Servos // Servos

4
Marlin/src/pins/stm32f7/pins_THE_BORG.h

@ -30,8 +30,8 @@
#define BOARD_INFO_NAME "The-Borge" #define BOARD_INFO_NAME "The-Borge"
#define DEFAULT_MACHINE_NAME BOARD_INFO_NAME #define DEFAULT_MACHINE_NAME BOARD_INFO_NAME
#ifndef E2END #ifndef MARLIN_EEPROM_SIZE
#define E2END 0xFFF // EEPROM end address #define MARLIN_EEPROM_SIZE 0x1000
#endif #endif
// Ignore temp readings during development. // Ignore temp readings during development.

Loading…
Cancel
Save