Browse Source

Refine EEPROM types / flags (#17772)

vanilla_fb_2.0.x
Scott Lahteine 4 years ago
committed by GitHub
parent
commit
5e6faa999d
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/HAL.h
  3. 17
      Marlin/src/HAL/DUE/eeprom_flash.cpp
  4. 1
      Marlin/src/HAL/DUE/eeprom_if_flash.cpp
  5. 69
      Marlin/src/HAL/DUE/eeprom_wired.cpp
  6. 4
      Marlin/src/HAL/DUE/inc/Conditionals_post.h
  7. 6
      Marlin/src/HAL/ESP32/HAL.h
  8. 4
      Marlin/src/HAL/ESP32/eeprom.cpp
  9. 5
      Marlin/src/HAL/ESP32/inc/Conditionals_post.h
  10. 14
      Marlin/src/HAL/LINUX/arduino.cpp
  11. 6
      Marlin/src/HAL/LINUX/include/Arduino.h
  12. 4
      Marlin/src/HAL/LPC1768/eeprom_flash.cpp
  13. 4
      Marlin/src/HAL/LPC1768/eeprom_sdcard.cpp
  14. 7
      Marlin/src/HAL/LPC1768/eeprom_wired.cpp
  15. 2
      Marlin/src/HAL/LPC1768/inc/Conditionals_post.h
  16. 6
      Marlin/src/HAL/SAMD51/HAL.h
  17. 11
      Marlin/src/HAL/SAMD51/eeprom_wired.cpp
  18. 2
      Marlin/src/HAL/SAMD51/inc/Conditionals_post.h
  19. 10
      Marlin/src/HAL/STM32/HAL.h
  20. 20
      Marlin/src/HAL/STM32/eeprom_flash.cpp
  21. 64
      Marlin/src/HAL/STM32/eeprom_sram.cpp
  22. 43
      Marlin/src/HAL/STM32/eeprom_wired.cpp
  23. 2
      Marlin/src/HAL/STM32/inc/Conditionals_post.h
  24. 13
      Marlin/src/HAL/STM32F1/HAL.h
  25. 5
      Marlin/src/HAL/STM32F1/eeprom_wired.cpp
  26. 2
      Marlin/src/HAL/STM32F1/inc/Conditionals_post.h
  27. 19
      Marlin/src/HAL/STM32_F4_F7/HAL.h
  28. 7
      Marlin/src/HAL/STM32_F4_F7/HAL_SPI.cpp
  29. 8
      Marlin/src/HAL/STM32_F4_F7/eeprom.cpp
  30. 7
      Marlin/src/HAL/STM32_F4_F7/eeprom_emul.cpp
  31. 5
      Marlin/src/HAL/STM32_F4_F7/eeprom_if_flash.cpp
  32. 5
      Marlin/src/HAL/TEENSY35_36/eeprom.cpp
  33. 30
      Marlin/src/HAL/shared/eeprom_if.h
  34. 13
      Marlin/src/HAL/shared/eeprom_if_i2c.cpp
  35. 9
      Marlin/src/HAL/shared/eeprom_if_spi.cpp
  36. 5
      Marlin/src/inc/Conditionals_adv.h
  37. 8
      Marlin/src/inc/SanityCheck.h
  38. 10
      Marlin/src/module/printcounter.h
  39. 4
      Marlin/src/pins/stm32f0/pins_MALYAN_M300.h
  40. 12
      Marlin/src/pins/stm32f1/pins_BTT_SKR_E3_DIP.h
  41. 12
      Marlin/src/pins/stm32f1/pins_BTT_SKR_MINI_E3.h
  42. 10
      Marlin/src/pins/stm32f1/pins_BTT_SKR_MINI_V1_1.h
  43. 12
      Marlin/src/pins/stm32f1/pins_FYSETC_AIO_II.h
  44. 12
      Marlin/src/pins/stm32f1/pins_FYSETC_CHEETAH.h
  45. 6
      Marlin/src/pins/stm32f1/pins_GTM32_MINI.h
  46. 6
      Marlin/src/pins/stm32f1/pins_GTM32_MINI_A30.h
  47. 6
      Marlin/src/pins/stm32f1/pins_GTM32_PRO_VB.h
  48. 6
      Marlin/src/pins/stm32f1/pins_GTM32_REV_B.h
  49. 2
      Marlin/src/pins/stm32f1/pins_JGAURORA_A5S_A1.h
  50. 6
      Marlin/src/pins/stm32f1/pins_LONGER3D_LK.h
  51. 8
      Marlin/src/pins/stm32f1/pins_MALYAN_M200.h
  52. 12
      Marlin/src/pins/stm32f1/pins_MKS_ROBIN_MINI.h
  53. 6
      Marlin/src/pins/stm32f1/pins_MKS_ROBIN_NANO.h
  54. 6
      Marlin/src/pins/stm32f4/pins_BTT_BTT002_V1_0.h
  55. 10
      Marlin/src/pins/stm32f4/pins_BTT_GTR_V1_0.h
  56. 6
      Marlin/src/pins/stm32f4/pins_BTT_SKR_PRO_V1_1.h
  57. 14
      Marlin/src/pins/stm32f4/pins_FYSETC_S6.h
  58. 4
      Marlin/src/pins/stm32f7/pins_REMRAM_V1.h

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

@ -27,7 +27,8 @@
#include "../shared/eeprom_api.h"
bool PersistentStore::access_start() { return true; }
size_t PersistentStore::capacity() { return E2END + 1; }
bool PersistentStore::access_start() { return true; }
bool PersistentStore::access_finish() { return true; }
bool PersistentStore::write_data(int &pos, const uint8_t *value, size_t size, uint16_t *crc) {
@ -61,7 +62,5 @@ bool PersistentStore::read_data(int &pos, uint8_t* value, size_t size, uint16_t
return false; // always assume success for AVR's
}
size_t PersistentStore::capacity() { return E2END + 1; }
#endif // EEPROM_SETTINGS || SD_FIRMWARE_UPDATE
#endif // __AVR__

9
Marlin/src/HAL/DUE/HAL.h

@ -30,6 +30,7 @@
#define CPU_32_BIT
#include "../shared/Marduino.h"
#include "../shared/eeprom_if.h"
#include "../shared/math_32bit.h"
#include "../shared/HAL_SPI.h"
#include "fastio.h"
@ -130,14 +131,6 @@ void sei(); // Enable interrupts
void HAL_clear_reset_source(); // clear reset reason
uint8_t HAL_get_reset_source(); // get reset reason
//
// EEPROM
//
void eeprom_write_byte(uint8_t *pos, unsigned char value);
uint8_t eeprom_read_byte(uint8_t *pos);
void eeprom_read_block (void *__dst, const void *__src, size_t __n);
void eeprom_update_block (const void *__src, void *__dst, size_t __n);
//
// ADC
//

17
Marlin/src/HAL/DUE/eeprom.cpp → Marlin/src/HAL/DUE/eeprom_flash.cpp

@ -22,25 +22,26 @@
*/
#ifdef ARDUINO_ARCH_SAM
#include "../../inc/MarlinConfigPre.h"
#include "../../inc/MarlinConfig.h"
#if ENABLED(EEPROM_SETTINGS)
#if ENABLED(FLASH_EEPROM_EMULATION)
#include "../../inc/MarlinConfig.h"
#include "../shared/eeprom_if.h"
#include "../shared/eeprom_api.h"
#if !defined(E2END) && ENABLED(FLASH_EEPROM_EMULATION)
#if !defined(E2END)
#define E2END 0xFFF // Default to Flash emulated EEPROM size (EepromEmulation_Due.cpp)
#endif
extern void eeprom_flush();
bool PersistentStore::access_start() { return true; }
size_t PersistentStore::capacity() { return E2END + 1; }
bool PersistentStore::access_start() { return true; }
bool PersistentStore::access_finish() {
#if ENABLED(FLASH_EEPROM_EMULATION)
eeprom_flush();
#endif
eeprom_flush();
return true;
}
@ -76,7 +77,5 @@ bool PersistentStore::read_data(int &pos, uint8_t* value, size_t size, uint16_t
return false;
}
size_t PersistentStore::capacity() { return E2END + 1; }
#endif // EEPROM_SETTINGS
#endif // ARDUINO_ARCH_SAM

1
Marlin/src/HAL/DUE/EepromEmulation.cpp → Marlin/src/HAL/DUE/eeprom_if_flash.cpp

@ -57,6 +57,7 @@
#if ENABLED(FLASH_EEPROM_EMULATION)
#include "../shared/Marduino.h"
#include "../shared/eeprom_if.h"
#include "../shared/eeprom_api.h"
#define EEPROMSize 4096

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

@ -0,0 +1,69 @@
/**
* Marlin 3D Printer Firmware
*
* Copyright (c) 2020 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
* Copyright (c) 2016 Bob Cousins bobcousins42@googlemail.com
* Copyright (c) 2015-2016 Nico Tonnhofer wurstnase.reprap@gmail.com
* Copyright (c) 2016 Victor Perez victor_pv@hotmail.com
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
#ifdef ARDUINO_ARCH_SAM
#include "../../inc/MarlinConfig.h"
#if USE_WIRED_EEPROM
#include "../shared/eeprom_if.h"
#include "../shared/eeprom_api.h"
size_t PersistentStore::capacity() { return E2END + 1; }
bool PersistentStore::access_start() { return true; }
bool PersistentStore::access_finish() { return true; }
bool PersistentStore::write_data(int &pos, const uint8_t *value, size_t size, uint16_t *crc) {
while (size--) {
uint8_t * const p = (uint8_t * const)pos;
uint8_t v = *value;
// EEPROM has only ~100,000 write cycles,
// so only write bytes that have changed!
if (v != eeprom_read_byte(p)) {
eeprom_write_byte(p, v);
delay(2);
if (eeprom_read_byte(p) != v) {
SERIAL_ECHO_MSG(STR_ERR_EEPROM_WRITE);
return true;
}
}
crc16(crc, &v, 1);
pos++;
value++;
};
return false;
}
bool PersistentStore::read_data(int &pos, uint8_t* value, size_t size, uint16_t *crc, const bool writing/*=true*/) {
do {
uint8_t c = eeprom_read_byte((uint8_t*)pos);
if (writing) *value = c;
crc16(crc, &c, 1);
pos++;
value++;
} while (--size);
return false;
}
#endif // USE_WIRED_EEPROM
#endif // ARDUINO_ARCH_SAM

4
Marlin/src/HAL/DUE/inc/Conditionals_post.h

@ -22,7 +22,7 @@
#pragma once
#if USE_FALLBACK_EEPROM
#undef SRAM_EEPROM_EMULATION
#undef SDCARD_EEPROM_EMULATION
#define FLASH_EEPROM_EMULATION
#elif EITHER(I2C_EEPROM, SPI_EEPROM)
#define USE_SHARED_EEPROM 1
#endif

6
Marlin/src/HAL/ESP32/HAL.h

@ -109,12 +109,6 @@ int freeMemory();
void analogWrite(pin_t pin, int value);
// EEPROM
void eeprom_write_byte(uint8_t *pos, unsigned char value);
uint8_t eeprom_read_byte(uint8_t *pos);
void eeprom_read_block (void *__dst, const void *__src, size_t __n);
void eeprom_update_block (const void *__src, void *__dst, size_t __n);
// ADC
#define HAL_ANALOG_SELECT(pin)

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

@ -23,7 +23,7 @@
#include "../../inc/MarlinConfig.h"
#if USE_WIRED_EEPROM
#if ENABLED(EEPROM_SETTINGS)
#include "../shared/eeprom_api.h"
#include <EEPROM.h>
@ -58,5 +58,5 @@ bool PersistentStore::read_data(int &pos, uint8_t* value, size_t size, uint16_t
size_t PersistentStore::capacity() { return EEPROM_SIZE; }
#endif // USE_WIRED_EEPROM
#endif // EEPROM_SETTINGS
#endif // ARDUINO_ARCH_ESP32

5
Marlin/src/HAL/ESP32/inc/Conditionals_post.h

@ -20,8 +20,3 @@
*
*/
#pragma once
#undef USE_WIRED_EEPROM
#if ENABLED(EEPROM_SETTINGS) && DISABLED(FLASH_EEPROM_EMULATION)
#define USE_WIRED_EEPROM 1
#endif

14
Marlin/src/HAL/LINUX/arduino.cpp

@ -75,20 +75,6 @@ uint16_t analogRead(pin_t adc_pin) {
return Gpio::get(DIGITAL_PIN_TO_ANALOG_PIN(adc_pin));
}
// **************************
// Persistent Config Storage
// **************************
void eeprom_write_byte(unsigned char *pos, unsigned char value) {
}
unsigned char eeprom_read_byte(uint8_t * pos) { return '\0'; }
void eeprom_read_block(void *__dst, const void *__src, size_t __n) { }
void eeprom_update_block(const void *__src, void *__dst, size_t __n) { }
char *dtostrf(double __val, signed char __width, unsigned char __prec, char *__s) {
char format_string[20];
snprintf(format_string, 20, "%%%d.%df", __width, __prec);

6
Marlin/src/HAL/LINUX/include/Arduino.h

@ -106,12 +106,6 @@ bool digitalRead(pin_t);
void analogWrite(pin_t, int);
uint16_t analogRead(pin_t);
// EEPROM
void eeprom_write_byte(unsigned char *pos, unsigned char value);
unsigned char eeprom_read_byte(unsigned char *pos);
void eeprom_read_block(void *__dst, const void *__src, size_t __n);
void eeprom_update_block(const void *__src, void *__dst, size_t __n);
int32_t random(int32_t);
int32_t random(int32_t, int32_t);
void randomSeed(uint32_t);

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

@ -58,6 +58,8 @@ static uint8_t ram_eeprom[EEPROM_SIZE] __attribute__((aligned(4))) = {0};
static bool eeprom_dirty = false;
static int current_slot = 0;
size_t PersistentStore::capacity() { return EEPROM_SIZE; }
bool PersistentStore::access_start() {
uint32_t first_nblank_loc, first_nblank_val;
IAP_STATUS_CODE status;
@ -122,7 +124,5 @@ bool PersistentStore::read_data(int &pos, uint8_t* value, size_t size, uint16_t
return false; // return true for any error
}
size_t PersistentStore::capacity() { return EEPROM_SIZE; }
#endif // FLASH_EEPROM_EMULATION
#endif // TARGET_LPC1768

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

@ -38,6 +38,8 @@ FATFS fat_fs;
FIL eeprom_file;
bool eeprom_file_open = false;
size_t PersistentStore::capacity() { return 4096; } // 4KiB of Emulated EEPROM
bool PersistentStore::access_start() {
const char eeprom_erase_value = 0xFF;
MSC_Aquire_Lock();
@ -168,7 +170,5 @@ bool PersistentStore::read_data(int &pos, uint8_t* value, const size_t size, uin
return bytes_read != size; // return true for any error
}
size_t PersistentStore::capacity() { return 4096; } // 4KiB of Emulated EEPROM
#endif // SDCARD_EEPROM_EMULATION
#endif // TARGET_LPC1768

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

@ -19,19 +19,14 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
/**
* I2C/SPI EEPROM interface for LPC1768
*/
#ifdef TARGET_LPC1768
#include "../../inc/MarlinConfig.h"
#if USE_WIRED_EEPROM
#include "../shared/eeprom_if.h"
#include "../shared/eeprom_api.h"
#include <Wire.h>
#ifndef EEPROM_SIZE
#define EEPROM_SIZE 0x8000 // 32kB‬

2
Marlin/src/HAL/LPC1768/inc/Conditionals_post.h

@ -21,8 +21,6 @@
*/
#pragma once
#undef I2C_EEPROM // Arduino framework provides code for I2C
#if USE_FALLBACK_EEPROM
#define FLASH_EEPROM_EMULATION
#endif

6
Marlin/src/HAL/SAMD51/HAL.h

@ -113,12 +113,6 @@ typedef int8_t pin_t;
void HAL_clear_reset_source(); // clear reset reason
uint8_t HAL_get_reset_source(); // get reset reason
//
// EEPROM
//
void eeprom_write_byte(uint8_t *pos, unsigned char value);
uint8_t eeprom_read_byte(uint8_t *pos);
//
// ADC
//

11
Marlin/src/HAL/SAMD51/eeprom.cpp → Marlin/src/HAL/SAMD51/eeprom_wired.cpp

@ -18,18 +18,17 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
#ifdef __SAMD51__
#include "../../inc/MarlinConfig.h"
#if ENABLED(EEPROM_SETTINGS) && NONE(QSPI_EEPROM, FLASH_EEPROM_EMULATION)
#if USE_WIRED_EEPROM
#include "../shared/eeprom_if.h"
#include "../shared/eeprom_api.h"
size_t PersistentStore::capacity() { return E2END + 1; }
bool PersistentStore::access_start() { return true; }
size_t PersistentStore::capacity() { return E2END + 1; }
bool PersistentStore::access_start() { return true; }
bool PersistentStore::access_finish() { return true; }
bool PersistentStore::write_data(int &pos, const uint8_t *value, size_t size, uint16_t *crc) {
@ -62,5 +61,5 @@ bool PersistentStore::read_data(int &pos, uint8_t* value, size_t size, uint16_t
return false;
}
#endif // EEPROM_SETTINGS && !(QSPI_EEPROM || FLASH_EEPROM_EMULATION)
#endif // USE_WIRED_EEPROM
#endif // __SAMD51__

2
Marlin/src/HAL/SAMD51/inc/Conditionals_post.h

@ -23,4 +23,6 @@
#if USE_FALLBACK_EEPROM
#define FLASH_EEPROM_EMULATION
#elif EITHER(I2C_EEPROM, SPI_EEPROM)
#define USE_SHARED_EEPROM 1
#endif

10
Marlin/src/HAL/STM32/HAL.h

@ -191,16 +191,6 @@ static inline int freeMemory() {
#pragma GCC diagnostic pop
//
// EEPROM
//
// Wire library should work for i2c EEPROMs
void eeprom_write_byte(uint8_t *pos, unsigned char value);
uint8_t eeprom_read_byte(uint8_t *pos);
void eeprom_read_block(void *__dst, const void *__src, size_t __n);
void eeprom_update_block(const void *__src, void *__dst, size_t __n);
//
// ADC
//

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

@ -24,7 +24,7 @@
#include "../../inc/MarlinConfig.h"
#if BOTH(EEPROM_SETTINGS, FLASH_EEPROM_EMULATION)
#if ENABLED(FLASH_EEPROM_EMULATION)
#include "../shared/eeprom_api.h"
@ -235,13 +235,7 @@ bool PersistentStore::write_data(int &pos, const uint8_t *value, size_t size, ui
bool PersistentStore::read_data(int &pos, uint8_t* value, size_t size, uint16_t *crc, const bool writing/*=true*/) {
do {
const uint8_t c = (
#if ENABLED(FLASH_EEPROM_LEVELING)
ram_eeprom[pos]
#else
eeprom_buffered_read_byte(pos)
#endif
);
const uint8_t c = TERN(FLASH_EEPROM_LEVELING, ram_eeprom[pos], eeprom_buffered_read_byte(pos));
if (writing) *value = c;
crc16(crc, &c, 1);
pos++;
@ -251,14 +245,8 @@ bool PersistentStore::read_data(int &pos, uint8_t* value, size_t size, uint16_t
}
size_t PersistentStore::capacity() {
return (
#if ENABLED(FLASH_EEPROM_LEVELING)
EEPROM_SIZE
#else
E2END + 1
#endif
);
return TERN(FLASH_EEPROM_LEVELING, EEPROM_SIZE, E2END + 1);
}
#endif // EEPROM_SETTINGS && FLASH_EEPROM_EMULATION
#endif // FLASH_EEPROM_EMULATION
#endif // ARDUINO_ARCH_STM32 && !STM32GENERIC

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

@ -0,0 +1,64 @@
/**
* Marlin 3D Printer Firmware
*
* Copyright (c) 2020 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
* Copyright (c) 2016 Bob Cousins bobcousins42@googlemail.com
* Copyright (c) 2015-2016 Nico Tonnhofer wurstnase.reprap@gmail.com
* Copyright (c) 2016 Victor Perez victor_pv@hotmail.com
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
#if defined(ARDUINO_ARCH_STM32) && !defined(STM32GENERIC)
#include "../../inc/MarlinConfig.h"
#if ENABLED(SRAM_EEPROM_EMULATION)
#include "../shared/eeprom_if.h"
#include "../shared/eeprom_api.h"
size_t PersistentStore::capacity() { return 4096; } // 4K of SRAM
bool PersistentStore::access_start() { return true; }
bool PersistentStore::access_finish() { return true; }
bool PersistentStore::write_data(int &pos, const uint8_t *value, size_t size, uint16_t *crc) {
while (size--) {
uint8_t v = *value;
// Save to Backup SRAM
*(__IO uint8_t *)(BKPSRAM_BASE + (uint8_t * const)pos) = v;
crc16(crc, &v, 1);
pos++;
value++;
};
return false;
}
bool PersistentStore::read_data(int &pos, uint8_t* value, size_t size, uint16_t *crc, const bool writing/*=true*/) {
do {
// Read from either external EEPROM, program flash or Backup SRAM
const uint8_t c = ( *(__IO uint8_t *)(BKPSRAM_BASE + ((uint8_t*)pos)) );
if (writing) *value = c;
crc16(crc, &c, 1);
pos++;
value++;
} while (--size);
return false;
}
#endif // SRAM_EEPROM_EMULATION
#endif // ARDUINO_ARCH_STM32 && !STM32GENERIC

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

@ -24,10 +24,13 @@
#include "../../inc/MarlinConfig.h"
#if EITHER(USE_WIRED_EEPROM, SRAM_EEPROM_EMULATION)
#if USE_WIRED_EEPROM
#include "../shared/eeprom_if.h"
#include "../shared/eeprom_api.h"
size_t PersistentStore::capacity() { return E2END + 1; }
bool PersistentStore::access_start() { return true; }
bool PersistentStore::access_finish() { return true; }
@ -35,21 +38,16 @@ bool PersistentStore::write_data(int &pos, const uint8_t *value, size_t size, ui
while (size--) {
uint8_t v = *value;
// Save to either external EEPROM, program flash or Backup SRAM
#if USE_WIRED_EEPROM
// EEPROM has only ~100,000 write cycles,
// so only write bytes that have changed!
uint8_t * const p = (uint8_t * const)pos;
if (v != eeprom_read_byte(p)) {
eeprom_write_byte(p, v);
if (eeprom_read_byte(p) != v) {
SERIAL_ECHO_MSG(STR_ERR_EEPROM_WRITE);
return true;
}
// EEPROM has only ~100,000 write cycles,
// so only write bytes that have changed!
uint8_t * const p = (uint8_t * const)pos;
if (v != eeprom_read_byte(p)) {
eeprom_write_byte(p, v);
if (eeprom_read_byte(p) != v) {
SERIAL_ECHO_MSG(STR_ERR_EEPROM_WRITE);
return true;
}
#else
*(__IO uint8_t *)(BKPSRAM_BASE + (uint8_t * const)pos) = v;
#endif
}
crc16(crc, &v, 1);
pos++;
@ -62,14 +60,7 @@ bool PersistentStore::write_data(int &pos, const uint8_t *value, size_t size, ui
bool PersistentStore::read_data(int &pos, uint8_t* value, size_t size, uint16_t *crc, const bool writing/*=true*/) {
do {
// Read from either external EEPROM, program flash or Backup SRAM
const uint8_t c = (
#if USE_WIRED_EEPROM
eeprom_read_byte((uint8_t*)pos)
#else
(*(__IO uint8_t *)(BKPSRAM_BASE + ((uint8_t*)pos)))
#endif
);
const uint8_t c = eeprom_read_byte((uint8_t*)pos);
if (writing) *value = c;
crc16(crc, &c, 1);
pos++;
@ -78,9 +69,5 @@ bool PersistentStore::read_data(int &pos, uint8_t* value, size_t size, uint16_t
return false;
}
size_t PersistentStore::capacity() {
return TERN(USE_WIRED_EEPROM, E2END + 1, 4096); // 4K for emulated
}
#endif // USE_WIRED_EEPROM || SRAM_EEPROM_EMULATION
#endif // USE_WIRED_EEPROM
#endif // ARDUINO_ARCH_STM32 && !STM32GENERIC

2
Marlin/src/HAL/STM32/inc/Conditionals_post.h

@ -24,4 +24,6 @@
// If no real or emulated EEPROM selected, fall back to SD emulation
#if USE_FALLBACK_EEPROM
#define SDCARD_EEPROM_EMULATION
#elif EITHER(I2C_EEPROM, SPI_EEPROM)
#define USE_SHARED_EEPROM 1
#endif

13
Marlin/src/HAL/STM32F1/HAL.h

@ -248,19 +248,6 @@ static int freeMemory() {
#pragma GCC diagnostic pop
//
// EEPROM
//
/**
* TODO: Write all this EEPROM stuff. Can emulate EEPROM in flash as last resort.
* Wire library should work for i2c EEPROMs.
*/
void eeprom_write_byte(uint8_t *pos, unsigned char value);
uint8_t eeprom_read_byte(uint8_t *pos);
void eeprom_read_block(void *__dst, const void *__src, size_t __n);
void eeprom_update_block(const void *__src, void *__dst, size_t __n);
//
// ADC
//

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

@ -23,8 +23,11 @@
#if USE_WIRED_EEPROM
#include "../shared/eeprom_if.h"
#include "../shared/eeprom_api.h"
size_t PersistentStore::capacity() { return E2END + 1; }
bool PersistentStore::access_start() {
#if ENABLED(SPI_EEPROM)
#if SPI_CHAN_EEPROM1 == 1
@ -70,7 +73,5 @@ bool PersistentStore::read_data(int &pos, uint8_t* value, size_t size, uint16_t
return false;
}
size_t PersistentStore::capacity() { return E2END + 1; }
#endif // USE_WIRED_EEPROM
#endif // __STM32F1__

2
Marlin/src/HAL/STM32F1/inc/Conditionals_post.h

@ -24,4 +24,6 @@
// If no real EEPROM, Flash emulation, or SRAM emulation is available fall back to SD emulation
#if USE_FALLBACK_EEPROM
#define SDCARD_EEPROM_EMULATION
#elif EITHER(I2C_EEPROM, SPI_EEPROM)
#define USE_SHARED_EEPROM 1
#endif

19
Marlin/src/HAL/STM32_F4_F7/HAL.h

@ -51,6 +51,8 @@
#error "SERIAL_PORT cannot be 0. (Port 0 does not exist.) Please update your configuration."
#elif SERIAL_PORT == -1
#define MYSERIAL0 SerialUSB
#elif SERIAL_PORT == 0
#define MYSERIAL0 Serial1
#elif SERIAL_PORT == 1
#define MYSERIAL0 SerialUART1
#elif SERIAL_PORT == 2
@ -74,6 +76,8 @@
#error "SERIAL_PORT_2 must be different than SERIAL_PORT. Please update your configuration."
#elif SERIAL_PORT_2 == -1
#define MYSERIAL1 SerialUSB
#elif SERIAL_PORT_2 == 0
#define MYSERIAL1 Serial1
#elif SERIAL_PORT_2 == 1
#define MYSERIAL1 SerialUART1
#elif SERIAL_PORT_2 == 2
@ -103,6 +107,8 @@
#error "DGUS_SERIAL_PORT must be different than SERIAL_PORT_2. Please update your configuration."
#elif DGUS_SERIAL_PORT == -1
#define DGUS_SERIAL SerialUSB
#elif DGUS_SERIAL_PORT == 0
#define DGUS_SERIAL Serial1
#elif DGUS_SERIAL_PORT == 1
#define DGUS_SERIAL SerialUART1
#elif DGUS_SERIAL_PORT == 2
@ -206,19 +212,6 @@ static inline int freeMemory() {
#pragma GCC diagnostic pop
//
// EEPROM
//
/**
* TODO: Write all this EEPROM stuff. Can emulate EEPROM in flash as last resort.
* Wire library should work for i2c EEPROMs.
*/
void eeprom_write_byte(uint8_t *pos, unsigned char value);
uint8_t eeprom_read_byte(uint8_t *pos);
void eeprom_read_block (void *__dst, const void *__src, size_t __n);
void eeprom_update_block (const void *__src, void *__dst, size_t __n);
//
// ADC
//

7
Marlin/src/HAL/STM32_F4_F7/HAL_SPI.cpp

@ -20,6 +20,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
#if defined(STM32GENERIC) && (defined(STM32F4) || defined(STM32F7))
/**
* Software SPI functions originally from Arduino Sd2Card Library
@ -30,8 +31,6 @@
* Adapted to the Marlin STM32F4/7 HAL
*/
#if defined(STM32GENERIC) && (defined(STM32F4) || defined(STM32F7))
#include "../../inc/MarlinConfig.h"
#include <SPI.h>
@ -121,7 +120,7 @@ uint8_t spiRec() {
*/
void spiRead(uint8_t* buf, uint16_t nbyte) {
SPI.beginTransaction(spiConfig);
#ifdef STM32GENERIC
#ifndef STM32GENERIC
SPI.dmaTransfer(0, const_cast<uint8_t*>(buf), nbyte);
#else
SPI.transfer((uint8_t*)buf, nbyte);
@ -153,7 +152,7 @@ void spiSend(uint8_t b) {
void spiSendBlock(uint8_t token, const uint8_t* buf) {
SPI.beginTransaction(spiConfig);
SPI.transfer(token);
#ifdef STM32GENERIC
#ifndef STM32GENERIC
SPI.dmaSend(const_cast<uint8_t*>(buf), 512);
#else
SPI.transfer((uint8_t*)buf, nullptr, 512);

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

@ -22,13 +22,15 @@
*/
#if defined(STM32GENERIC) && (defined(STM32F4) || defined(STM32F7))
#include "../../inc/MarlinConfigPre.h"
#include "../../inc/MarlinConfig.h"
#if ENABLED(EEPROM_SETTINGS)
#include "../shared/eeprom_if.h"
#include "../shared/eeprom_api.h"
bool PersistentStore::access_start() { return true; }
size_t PersistentStore::capacity() { return E2END + 1; }
bool PersistentStore::access_start() { return true; }
bool PersistentStore::access_finish() { return true; }
bool PersistentStore::write_data(int &pos, const uint8_t *value, size_t size, uint16_t *crc) {
@ -62,7 +64,5 @@ bool PersistentStore::read_data(int &pos, uint8_t* value, size_t size, uint16_t
return false;
}
size_t PersistentStore::capacity() { return E2END + 1; }
#endif // EEPROM_SETTINGS
#endif // STM32GENERIC && (STM32F4 || STM32F7)

7
Marlin/src/HAL/STM32_F4_F7/eeprom_emul.cpp

@ -1,6 +1,6 @@
/**
******************************************************************************
* @file EEPROM/EEPROM_Emulation/src/eeprom.c
* @file eeprom_emul.cpp
* @author MCD Application Team
* @version V1.2.6
* @date 04-November-2016
@ -49,6 +49,10 @@
*/
#if defined(STM32GENERIC) && (defined(STM32F4) || defined(STM32F7))
#include "../../inc/MarlinConfigPre.h"
#if ENABLED(FLASH_EEPROM_EMULATION)
/* Includes ------------------------------------------------------------------*/
#include "eeprom_emul.h"
@ -518,6 +522,7 @@ static uint16_t EE_PageTransfer(uint16_t VirtAddress, uint16_t Data) {
return HAL_FLASH_Program(TYPEPROGRAM_HALFWORD, NewPageAddress, VALID_PAGE);
}
#endif // FLASH_EEPROM_EMULATION
#endif // STM32GENERIC && (STM32F4 || STM32F7)
/**

5
Marlin/src/HAL/STM32_F4_F7/EmulatedEeprom.cpp → Marlin/src/HAL/STM32_F4_F7/eeprom_if_flash.cpp

@ -16,12 +16,10 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
#if defined(STM32GENERIC) && (defined(STM32F4) || defined(STM32F7))
/**
* Description: Functions for a Flash emulated EEPROM
* Not platform dependent.
* Arduino-style interface for Flash emulated EEPROM
*/
// Include configs and pins to get all EEPROM flags
@ -35,6 +33,7 @@
#include "HAL.h"
#include "eeprom_emul.h"
#include "../shared/eeprom_if.h"
// ------------------------
// Local defines

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

@ -29,7 +29,8 @@
#include "../shared/eeprom_api.h"
#include <avr/eeprom.h>
bool PersistentStore::access_start() { return true; }
size_t PersistentStore::capacity() { return E2END + 1; }
bool PersistentStore::access_start() { return true; }
bool PersistentStore::access_finish() { return true; }
bool PersistentStore::write_data(int &pos, const uint8_t *value, size_t size, uint16_t *crc) {
@ -63,7 +64,5 @@ bool PersistentStore::read_data(int &pos, uint8_t* value, size_t size, uint16_t
return false;
}
size_t PersistentStore::capacity() { return E2END + 1; }
#endif // USE_WIRED_EEPROM
#endif // __MK64FX512__ || __MK66FX1M0__

30
Marlin/src/HAL/shared/eeprom_if.h

@ -0,0 +1,30 @@
/**
* Marlin 3D Printer Firmware
*
* Copyright (c) 2020 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
* Copyright (c) 2016 Bob Cousins bobcousins42@googlemail.com
* Copyright (c) 2015-2016 Nico Tonnhofer wurstnase.reprap@gmail.com
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
#pragma once
//
// EEPROM
//
void eeprom_write_byte(uint8_t *pos, unsigned char value);
uint8_t eeprom_read_byte(uint8_t *pos);
void eeprom_read_block(void *__dst, const void *__src, size_t __n);
void eeprom_update_block(const void *__src, void *__dst, size_t __n);

13
Marlin/src/HAL/shared/eeprom_i2c.cpp → Marlin/src/HAL/shared/eeprom_if_i2c.cpp

@ -21,20 +21,19 @@
*/
/**
* Description: functions for I2C connected external EEPROM.
* Not platform dependent.
*
* TODO: Some platform Arduino libraries define these functions
* so Marlin needs to add a glue layer to prevent the conflict.
* Platform-independent Arduino functions for I2C EEPROM.
* Enable USE_SHARED_EEPROM if not supplied by the framework.
*/
#include "../../inc/MarlinConfig.h"
#if ENABLED(I2C_EEPROM)
#if BOTH(USE_SHARED_EEPROM, I2C_EEPROM)
#include "../HAL.h"
#include <Wire.h>
#include "eeprom_if.h"
#ifndef EEPROM_WRITE_DELAY
#define EEPROM_WRITE_DELAY 5
#endif
@ -126,4 +125,4 @@ void eeprom_read_block(void* pos, const void *__dst, size_t n) {
if (Wire.available()) *((uint8_t*)pos + c) = Wire.read();
}
#endif // I2C_EEPROM
#endif // USE_SHARED_EEPROM && I2C_EEPROM

9
Marlin/src/HAL/shared/eeprom_spi.cpp → Marlin/src/HAL/shared/eeprom_if_spi.cpp

@ -21,15 +21,16 @@
*/
/**
* Description: functions for SPI connected external EEPROM.
* Not platform dependent.
* Platform-independent Arduino functions for SPI EEPROM.
* Enable USE_SHARED_EEPROM if not supplied by the framework.
*/
#include "../../inc/MarlinConfig.h"
#if ENABLED(SPI_EEPROM)
#if BOTH(USE_SHARED_EEPROM, SPI_EEPROM)
#include "../HAL.h"
#include "eeprom_if.h"
#define CMD_WREN 6 // WREN
#define CMD_READ 2 // WRITE
@ -119,4 +120,4 @@ void eeprom_update_block(const void* src, void* eeprom_address, size_t n) {
delay(EEPROM_WRITE_DELAY); // wait for page write to complete
}
#endif // SPI_EEPROM
#endif // USE_SHARED_EEPROM && I2C_EEPROM

5
Marlin/src/inc/Conditionals_adv.h

@ -337,3 +337,8 @@
#else
#define SD_CONNECTION_IS(...) 0
#endif
// Flag if an EEPROM type is pre-selected
#if ENABLED(EEPROM_SETTINGS) && NONE(I2C_EEPROM, SPI_EEPROM, QSPI_EEPROM, FLASH_EEPROM_EMULATION, SRAM_EEPROM_EMULATION, SDCARD_EEPROM_EMULATION)
#define NO_EEPROM_SELECTED 1
#endif

8
Marlin/src/inc/SanityCheck.h

@ -2054,8 +2054,12 @@ static_assert(hbm[Z_AXIS] >= 0, "HOMING_BUMP_MM.Z must be greater than or equal
/**
* Make sure only one EEPROM type is enabled
*/
#if ENABLED(EEPROM_SETTINGS) && 1 < ENABLED(SDCARD_EEPROM_EMULATION) + ENABLED(FLASH_EEPROM_EMULATION) + ENABLED(SRAM_EEPROM_EMULATION)
#error "Please select only one of SDCARD, FLASH, or SRAM_EEPROM_EMULATION."
#if ENABLED(EEPROM_SETTINGS)
#if 1 < 0 \
+ ENABLED(I2C_EEPROM) + ENABLED(SPI_EEPROM) + ENABLED(QSPI_EEPROM) \
+ ENABLED(SDCARD_EEPROM_EMULATION) + ENABLED(FLASH_EEPROM_EMULATION) + ENABLED(SRAM_EEPROM_EMULATION)
#error "Please select only one method of EEPROM Persistent Storage."
#endif
#endif
/**

10
Marlin/src/module/printcounter.h

@ -28,12 +28,8 @@
// Print debug messages with M111 S2
//#define DEBUG_PRINTCOUNTER
#if USE_WIRED_EEPROM
// round up address to next page boundary (assuming 32 byte pages)
#define STATS_EEPROM_ADDRESS 0x40
#else
#define STATS_EEPROM_ADDRESS 0x32
#endif
// Round up I2C / SPI address to next page boundary (assuming 32 byte pages)
#define STATS_EEPROM_ADDRESS TERN(USE_WIRED_EEPROM, 0x40, 0x32)
struct printStatistics { // 16 bytes
//const uint8_t magic; // Magic header, it will always be 0x16
@ -57,7 +53,7 @@ class PrintCounter: public Stopwatch {
private:
typedef Stopwatch super;
#if USE_WIRED_EEPROM || defined(CPU_32_BIT)
#if EITHER(USE_WIRED_EEPROM, CPU_32_BIT)
typedef uint32_t eeprom_address_t;
#else
typedef uint16_t eeprom_address_t;

4
Marlin/src/pins/stm32f0/pins_MALYAN_M300.h

@ -31,7 +31,9 @@
//
// EEPROM Emulation
//
#define FLASH_EEPROM_EMULATION
#if NO_EEPROM_SELECTED
#define FLASH_EEPROM_EMULATION
#endif
//
// SD CARD SPI

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

@ -33,11 +33,13 @@
// Ignore temp readings during development.
//#define BOGUS_TEMPERATURE_GRACE_PERIOD 2000
#define FLASH_EEPROM_EMULATION
#define EEPROM_PAGE_SIZE (0x800U) // 2KB
#define EEPROM_START_ADDRESS (0x8000000UL + (STM32_FLASH_SIZE) * 1024UL - (EEPROM_PAGE_SIZE) * 2UL)
#undef E2END
#define E2END (EEPROM_PAGE_SIZE - 1) // 2KB
#if EITHER(NO_EEPROM_SELECTED, FLASH_EEPROM_EMULATION)
#define FLASH_EEPROM_EMULATION
#define EEPROM_PAGE_SIZE (0x800U) // 2KB
#define EEPROM_START_ADDRESS (0x8000000UL + (STM32_FLASH_SIZE) * 1024UL - (EEPROM_PAGE_SIZE) * 2UL)
#undef E2END
#define E2END (EEPROM_PAGE_SIZE - 1) // 2KB
#endif
//
// Servos

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

@ -31,11 +31,13 @@
// Ignore temp readings during development.
//#define BOGUS_TEMPERATURE_GRACE_PERIOD 2000
#define FLASH_EEPROM_EMULATION
#define EEPROM_PAGE_SIZE (0x800U) // 2KB
#define EEPROM_START_ADDRESS (0x8000000UL + (STM32_FLASH_SIZE) * 1024UL - (EEPROM_PAGE_SIZE) * 2UL)
#undef E2END
#define E2END (EEPROM_PAGE_SIZE - 1) // 2KB
#if EITHER(NO_EEPROM_SELECTED, FLASH_EEPROM_EMULATION)
#define FLASH_EEPROM_EMULATION
#define EEPROM_PAGE_SIZE (0x800U) // 2KB
#define EEPROM_START_ADDRESS (0x8000000UL + (STM32_FLASH_SIZE) * 1024UL - (EEPROM_PAGE_SIZE) * 2UL)
#undef E2END
#define E2END (EEPROM_PAGE_SIZE - 1) // 2KB
#endif
//
// Servos

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

@ -33,10 +33,12 @@
// Ignore temp readings during development.
//#define BOGUS_TEMPERATURE_GRACE_PERIOD 2000
#define FLASH_EEPROM_EMULATION
#define EEPROM_PAGE_SIZE (0x800U) // 2KB
#define EEPROM_START_ADDRESS (0x8000000UL + (STM32_FLASH_SIZE) * 1024UL - (EEPROM_PAGE_SIZE) * 2UL)
#define E2END (EEPROM_PAGE_SIZE - 1)
#if EITHER(NO_EEPROM_SELECTED, FLASH_EEPROM_EMULATION)
#define FLASH_EEPROM_EMULATION
#define EEPROM_PAGE_SIZE (0x800U) // 2KB
#define EEPROM_START_ADDRESS (0x8000000UL + (STM32_FLASH_SIZE) * 1024UL - (EEPROM_PAGE_SIZE) * 2UL)
#define E2END (EEPROM_PAGE_SIZE - 1)
#endif
//
// Limit Switches

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

@ -38,11 +38,13 @@
//
// Flash EEPROM Emulation
//
#define FLASH_EEPROM_EMULATION
#define EEPROM_PAGE_SIZE (0x800U) // 2KB
#define EEPROM_START_ADDRESS (0x8000000UL + (STM32_FLASH_SIZE) * 1024UL - (EEPROM_PAGE_SIZE) * 2UL)
#undef E2END
#define E2END (EEPROM_PAGE_SIZE - 1) // 2KB
#if EITHER(NO_EEPROM_SELECTED, FLASH_EEPROM_EMULATION)
#define FLASH_EEPROM_EMULATION
#define EEPROM_PAGE_SIZE (0x800U) // 2KB
#define EEPROM_START_ADDRESS (0x8000000UL + (STM32_FLASH_SIZE) * 1024UL - (EEPROM_PAGE_SIZE) * 2UL)
#undef E2END
#define E2END (EEPROM_PAGE_SIZE - 1) // 2KB
#endif
//
// Limit Switches

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

@ -35,11 +35,13 @@
#define DISABLE_JTAG
#define FLASH_EEPROM_EMULATION
#define EEPROM_PAGE_SIZE (0x800U) // 2KB
#define EEPROM_START_ADDRESS (0x8000000UL + (STM32_FLASH_SIZE) * 1024UL - (EEPROM_PAGE_SIZE) * 2UL)
#undef E2END
#define E2END (EEPROM_PAGE_SIZE - 1) // 2KB
#if EITHER(NO_EEPROM_SELECTED, FLASH_EEPROM_EMULATION)
#define FLASH_EEPROM_EMULATION
#define EEPROM_PAGE_SIZE (0x800U) // 2KB
#define EEPROM_START_ADDRESS (0x8000000UL + (STM32_FLASH_SIZE) * 1024UL - (EEPROM_PAGE_SIZE) * 2UL)
#undef E2END
#define E2END (EEPROM_PAGE_SIZE - 1) // 2KB
#endif
//
// Servos

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

@ -52,8 +52,10 @@
//#define BOGUS_TEMPERATURE_GRACE_PERIOD 2000
// Enable EEPROM Emulation for this board as it doesn't have EEPROM
#define FLASH_EEPROM_EMULATION
#define E2END 0xFFF // 4KB
#if EITHER(NO_EEPROM_SELECTED, FLASH_EEPROM_EMULATION)
#define FLASH_EEPROM_EMULATION
#define E2END 0xFFF // 4KB
#endif
//
// Limit Switches

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

@ -52,8 +52,10 @@
//#define BOGUS_TEMPERATURE_GRACE_PERIOD 2000
// Enable EEPROM Emulation for this board as it doesn't have EEPROM
#define FLASH_EEPROM_EMULATION
#define E2END 0xFFF // 4KB
#if EITHER(NO_EEPROM_SELECTED, FLASH_EEPROM_EMULATION)
#define FLASH_EEPROM_EMULATION
#define E2END 0xFFF // 4KB
#endif
//
// Limit Switches

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

@ -52,8 +52,10 @@
//#define BOGUS_TEMPERATURE_GRACE_PERIOD 2000
// Enable EEPROM Emulation for this board as it doesn't have EEPROM
#define FLASH_EEPROM_EMULATION
#define E2END 0xFFF // 4KB
#if EITHER(NO_EEPROM_SELECTED, FLASH_EEPROM_EMULATION)
#define FLASH_EEPROM_EMULATION
#define E2END 0xFFF // 4KB
#endif
//
// Limit Switches

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

@ -52,8 +52,10 @@
//#define BOGUS_TEMPERATURE_GRACE_PERIOD 2000
// Enable EEPROM Emulation for this board as it doesn't have EEPROM
#define FLASH_EEPROM_EMULATION
#define E2END 0xFFF // 4KB
#if EITHER(NO_EEPROM_SELECTED, FLASH_EEPROM_EMULATION)
#define FLASH_EEPROM_EMULATION
#define E2END 0xFFF // 4KB
#endif
//
// Limit Switches

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

@ -44,9 +44,11 @@
//#define I2C_EEPROM // AT24C64
//#define E2END 0x7FFFUL // 64KB
//#define FLASH_EEPROM_EMULATION
//#define E2END 0xFFFUL // 4KB
//#define E2END (EEPROM_START_ADDRESS + (EEPROM_PAGE_SIZE) * 2UL - 1UL)
//#define EEPROM_CHITCHAT
//#define DEBUG_EEPROM_READWRITE

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

@ -147,8 +147,10 @@
// Persistent Storage
// If no option is selected below the SD Card will be used
//
//#define SPI_EEPROM
#define FLASH_EEPROM_EMULATION
#if NO_EEPROM_SELECTED
//#define SPI_EEPROM
#define FLASH_EEPROM_EMULATION
#endif
#undef E2END
#if ENABLED(SPI_EEPROM)

8
Marlin/src/pins/stm32f1/pins_MALYAN_M200.h

@ -31,10 +31,10 @@
#define BOARD_INFO_NAME "Malyan M200"
// Enable EEPROM Emulation for this board
// This setting should probably be in configuration.h
// but it is literally the only board which uses it.
#define FLASH_EEPROM_EMULATION
// Assume Flash EEPROM
#if NO_EEPROM_SELECTED
#define FLASH_EEPROM_EMULATION
#endif
#define SDSS SS_PIN

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

@ -38,11 +38,13 @@
//
#define DISABLE_DEBUG
#define FLASH_EEPROM_EMULATION
// 2K in a AT24C16N
#define EEPROM_PAGE_SIZE (0x800U) // 2KB
#define EEPROM_START_ADDRESS (0x8000000UL + (STM32_FLASH_SIZE) * 1024UL - (EEPROM_PAGE_SIZE) * 2UL)
#define E2END (EEPROM_PAGE_SIZE - 1)
#if EITHER(NO_EEPROM_SELECTED, FLASH_EEPROM_EMULATION)
#define FLASH_EEPROM_EMULATION
// 2K in a AT24C16N
#define EEPROM_PAGE_SIZE (0x800U) // 2KB
#define EEPROM_START_ADDRESS (0x8000000UL + (STM32_FLASH_SIZE) * 1024UL - (EEPROM_PAGE_SIZE) * 2UL)
#define E2END (EEPROM_PAGE_SIZE - 1)
#endif
//
// Note: MKS Robin mini board is using SPI2 interface.

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

@ -41,8 +41,10 @@
//
// EEPROM
//
//#define FLASH_EEPROM_EMULATION
#define SDCARD_EEPROM_EMULATION
#if NO_EEPROM_SELECTED
//#define FLASH_EEPROM_EMULATION
#define SDCARD_EEPROM_EMULATION
#endif
//
// Limit Switches

6
Marlin/src/pins/stm32f4/pins_BTT_BTT002_V1_0.h

@ -30,8 +30,10 @@
#define BOARD_INFO_NAME "BIGTREE Btt002 1.0"
// Use one of these or SDCard-based Emulation will be used
//#define SRAM_EEPROM_EMULATION // Use BackSRAM-based EEPROM emulation
#define FLASH_EEPROM_EMULATION // Use Flash-based EEPROM emulation
#if NO_EEPROM_SELECTED
//#define SRAM_EEPROM_EMULATION // Use BackSRAM-based EEPROM emulation
#define FLASH_EEPROM_EMULATION // Use Flash-based EEPROM emulation
#endif
// Ignore temp readings during development.
//#define BOGUS_TEMPERATURE_GRACE_PERIOD 2000

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

@ -32,9 +32,11 @@
#define BOARD_INFO_NAME "BIGTREE GTR 1.0"
// Use one of these or SDCard-based Emulation will be used
//#define I2C_EEPROM
//#define SRAM_EEPROM_EMULATION // Use BackSRAM-based EEPROM emulation
//#define FLASH_EEPROM_EMULATION // Use Flash-based EEPROM emulation
#if NO_EEPROM_SELECTED
//#define I2C_EEPROM
//#define SRAM_EEPROM_EMULATION // Use BackSRAM-based EEPROM emulation
//#define FLASH_EEPROM_EMULATION // Use Flash-based EEPROM emulation
#endif
#define TP // Enable to define servo and probe pins
@ -389,3 +391,5 @@
//#define DOGLCD_MOSI PB15
#endif // HAS_SPI_LCD
#undef TP

6
Marlin/src/pins/stm32f4/pins_BTT_SKR_PRO_V1_1.h

@ -30,8 +30,10 @@
#define BOARD_INFO_NAME "BIGTREE SKR Pro 1.1" // redefined?
// Use one of these or SDCard-based Emulation will be used
//#define SRAM_EEPROM_EMULATION // Use BackSRAM-based EEPROM emulation
#define FLASH_EEPROM_EMULATION // Use Flash-based EEPROM emulation
#if NO_EEPROM_SELECTED
//#define SRAM_EEPROM_EMULATION // Use BackSRAM-based EEPROM emulation
#define FLASH_EEPROM_EMULATION // Use Flash-based EEPROM emulation
#endif
//
// Servos

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

@ -34,19 +34,21 @@
#define DEFAULT_MACHINE_NAME BOARD_INFO_NAME
#endif
// change the prio to 3 , 2 is for software serial
// Change the priority to 3. Priority 2 is for software serial.
//#define TEMP_TIMER_IRQ_PRIO 3
//
// EEPROM Emulation
//
#define FLASH_EEPROM_EMULATION
#if NO_EEPROM_SELECTED
#define FLASH_EEPROM_EMULATION
//#define SRAM_EEPROM_EMULATION
//#define I2C_EEPROM
#endif
#if ENABLED(FLASH_EEPROM_EMULATION)
#define FLASH_EEPROM_LEVELING
#endif
//#define SRAM_EEPROM_EMULATION
//#define I2C_EEPROM
#ifdef 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 E2END 0xFFF // 4KB
#endif

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

@ -28,7 +28,9 @@
#define BOARD_INFO_NAME "RemRam v1"
#define DEFAULT_MACHINE_NAME "RemRam"
#define SRAM_EEPROM_EMULATION // Emulate the EEPROM using Backup SRAM
#if NO_EEPROM_SELECTED
#define SRAM_EEPROM_EMULATION // Emulate the EEPROM using Backup SRAM
#endif
#if HOTENDS > 1 || E_STEPPERS > 1
#error "RemRam supports only one hotend / E-stepper."

Loading…
Cancel
Save