Refine EEPROM types / flags (#17772)

This commit is contained in:
Scott Lahteine 2020-04-29 14:46:33 -05:00 committed by GitHub
parent 2d758663db
commit 5e6faa999d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
58 changed files with 365 additions and 256 deletions

View File

@ -27,6 +27,7 @@
#include "../shared/eeprom_api.h" #include "../shared/eeprom_api.h"
size_t PersistentStore::capacity() { return E2END + 1; }
bool PersistentStore::access_start() { return true; } bool PersistentStore::access_start() { return true; }
bool PersistentStore::access_finish() { return true; } bool PersistentStore::access_finish() { return true; }
@ -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 return false; // always assume success for AVR's
} }
size_t PersistentStore::capacity() { return E2END + 1; }
#endif // EEPROM_SETTINGS || SD_FIRMWARE_UPDATE #endif // EEPROM_SETTINGS || SD_FIRMWARE_UPDATE
#endif // __AVR__ #endif // __AVR__

View File

@ -30,6 +30,7 @@
#define CPU_32_BIT #define CPU_32_BIT
#include "../shared/Marduino.h" #include "../shared/Marduino.h"
#include "../shared/eeprom_if.h"
#include "../shared/math_32bit.h" #include "../shared/math_32bit.h"
#include "../shared/HAL_SPI.h" #include "../shared/HAL_SPI.h"
#include "fastio.h" #include "fastio.h"
@ -130,14 +131,6 @@ void sei(); // Enable interrupts
void HAL_clear_reset_source(); // clear reset reason void HAL_clear_reset_source(); // clear reset reason
uint8_t HAL_get_reset_source(); // get 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 // ADC
// //

View File

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

View File

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

View File

@ -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

View File

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

View File

@ -109,12 +109,6 @@ int freeMemory();
void analogWrite(pin_t pin, int value); 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 // ADC
#define HAL_ANALOG_SELECT(pin) #define HAL_ANALOG_SELECT(pin)

View File

@ -23,7 +23,7 @@
#include "../../inc/MarlinConfig.h" #include "../../inc/MarlinConfig.h"
#if USE_WIRED_EEPROM #if ENABLED(EEPROM_SETTINGS)
#include "../shared/eeprom_api.h" #include "../shared/eeprom_api.h"
#include <EEPROM.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; } size_t PersistentStore::capacity() { return EEPROM_SIZE; }
#endif // USE_WIRED_EEPROM #endif // EEPROM_SETTINGS
#endif // ARDUINO_ARCH_ESP32 #endif // ARDUINO_ARCH_ESP32

View File

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

View File

@ -75,20 +75,6 @@ uint16_t analogRead(pin_t adc_pin) {
return Gpio::get(DIGITAL_PIN_TO_ANALOG_PIN(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 *dtostrf(double __val, signed char __width, unsigned char __prec, char *__s) {
char format_string[20]; char format_string[20];
snprintf(format_string, 20, "%%%d.%df", __width, __prec); snprintf(format_string, 20, "%%%d.%df", __width, __prec);

View File

@ -106,12 +106,6 @@ bool digitalRead(pin_t);
void analogWrite(pin_t, int); void analogWrite(pin_t, int);
uint16_t analogRead(pin_t); 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 random(int32_t, int32_t); int32_t random(int32_t, int32_t);
void randomSeed(uint32_t); void randomSeed(uint32_t);

View File

@ -58,6 +58,8 @@ static uint8_t ram_eeprom[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; }
bool PersistentStore::access_start() { bool PersistentStore::access_start() {
uint32_t first_nblank_loc, first_nblank_val; uint32_t first_nblank_loc, first_nblank_val;
IAP_STATUS_CODE status; 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 return false; // return true for any error
} }
size_t PersistentStore::capacity() { return EEPROM_SIZE; }
#endif // FLASH_EEPROM_EMULATION #endif // FLASH_EEPROM_EMULATION
#endif // TARGET_LPC1768 #endif // TARGET_LPC1768

View File

@ -38,6 +38,8 @@ 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
bool PersistentStore::access_start() { bool PersistentStore::access_start() {
const char eeprom_erase_value = 0xFF; const char eeprom_erase_value = 0xFF;
MSC_Aquire_Lock(); 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 return bytes_read != size; // return true for any error
} }
size_t PersistentStore::capacity() { return 4096; } // 4KiB of Emulated EEPROM
#endif // SDCARD_EEPROM_EMULATION #endif // SDCARD_EEPROM_EMULATION
#endif // TARGET_LPC1768 #endif // TARGET_LPC1768

View File

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

View File

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

View File

@ -113,12 +113,6 @@ typedef int8_t pin_t;
void HAL_clear_reset_source(); // clear reset reason void HAL_clear_reset_source(); // clear reset reason
uint8_t HAL_get_reset_source(); // get 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 // ADC
// //

View File

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

View File

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

View File

@ -191,16 +191,6 @@ static inline int freeMemory() {
#pragma GCC diagnostic pop #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 // ADC
// //

View File

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

View File

@ -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

View File

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

View File

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

View File

@ -248,19 +248,6 @@ static int freeMemory() {
#pragma GCC diagnostic pop #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 // ADC
// //

View File

@ -23,8 +23,11 @@
#if USE_WIRED_EEPROM #if USE_WIRED_EEPROM
#include "../shared/eeprom_if.h"
#include "../shared/eeprom_api.h" #include "../shared/eeprom_api.h"
size_t PersistentStore::capacity() { return E2END + 1; }
bool PersistentStore::access_start() { bool PersistentStore::access_start() {
#if ENABLED(SPI_EEPROM) #if ENABLED(SPI_EEPROM)
#if SPI_CHAN_EEPROM1 == 1 #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; return false;
} }
size_t PersistentStore::capacity() { return E2END + 1; }
#endif // USE_WIRED_EEPROM #endif // USE_WIRED_EEPROM
#endif // __STM32F1__ #endif // __STM32F1__

View File

@ -24,4 +24,6 @@
// 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 USE_FALLBACK_EEPROM #if USE_FALLBACK_EEPROM
#define SDCARD_EEPROM_EMULATION #define SDCARD_EEPROM_EMULATION
#elif EITHER(I2C_EEPROM, SPI_EEPROM)
#define USE_SHARED_EEPROM 1
#endif #endif

View File

@ -51,6 +51,8 @@
#error "SERIAL_PORT cannot be 0. (Port 0 does not exist.) Please update your configuration." #error "SERIAL_PORT cannot be 0. (Port 0 does not exist.) Please update your configuration."
#elif SERIAL_PORT == -1 #elif SERIAL_PORT == -1
#define MYSERIAL0 SerialUSB #define MYSERIAL0 SerialUSB
#elif SERIAL_PORT == 0
#define MYSERIAL0 Serial1
#elif SERIAL_PORT == 1 #elif SERIAL_PORT == 1
#define MYSERIAL0 SerialUART1 #define MYSERIAL0 SerialUART1
#elif SERIAL_PORT == 2 #elif SERIAL_PORT == 2
@ -74,6 +76,8 @@
#error "SERIAL_PORT_2 must be different than SERIAL_PORT. Please update your configuration." #error "SERIAL_PORT_2 must be different than SERIAL_PORT. Please update your configuration."
#elif SERIAL_PORT_2 == -1 #elif SERIAL_PORT_2 == -1
#define MYSERIAL1 SerialUSB #define MYSERIAL1 SerialUSB
#elif SERIAL_PORT_2 == 0
#define MYSERIAL1 Serial1
#elif SERIAL_PORT_2 == 1 #elif SERIAL_PORT_2 == 1
#define MYSERIAL1 SerialUART1 #define MYSERIAL1 SerialUART1
#elif SERIAL_PORT_2 == 2 #elif SERIAL_PORT_2 == 2
@ -103,6 +107,8 @@
#error "DGUS_SERIAL_PORT must be different than SERIAL_PORT_2. Please update your configuration." #error "DGUS_SERIAL_PORT must be different than SERIAL_PORT_2. Please update your configuration."
#elif DGUS_SERIAL_PORT == -1 #elif DGUS_SERIAL_PORT == -1
#define DGUS_SERIAL SerialUSB #define DGUS_SERIAL SerialUSB
#elif DGUS_SERIAL_PORT == 0
#define DGUS_SERIAL Serial1
#elif DGUS_SERIAL_PORT == 1 #elif DGUS_SERIAL_PORT == 1
#define DGUS_SERIAL SerialUART1 #define DGUS_SERIAL SerialUART1
#elif DGUS_SERIAL_PORT == 2 #elif DGUS_SERIAL_PORT == 2
@ -206,19 +212,6 @@ static inline int freeMemory() {
#pragma GCC diagnostic pop #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 // ADC
// //

View File

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

View File

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

View File

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

View File

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

View File

@ -29,6 +29,7 @@
#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; }
bool PersistentStore::access_start() { return true; } bool PersistentStore::access_start() { return true; }
bool PersistentStore::access_finish() { return true; } bool PersistentStore::access_finish() { return true; }
@ -63,7 +64,5 @@ bool PersistentStore::read_data(int &pos, uint8_t* value, size_t size, uint16_t
return false; return false;
} }
size_t PersistentStore::capacity() { return E2END + 1; }
#endif // USE_WIRED_EEPROM #endif // USE_WIRED_EEPROM
#endif // __MK64FX512__ || __MK66FX1M0__ #endif // __MK64FX512__ || __MK66FX1M0__

View File

@ -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);

View File

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

View File

@ -21,15 +21,16 @@
*/ */
/** /**
* Description: functions for SPI connected external EEPROM. * Platform-independent Arduino functions for SPI EEPROM.
* Not platform dependent. * Enable USE_SHARED_EEPROM if not supplied by the framework.
*/ */
#include "../../inc/MarlinConfig.h" #include "../../inc/MarlinConfig.h"
#if ENABLED(SPI_EEPROM) #if BOTH(USE_SHARED_EEPROM, SPI_EEPROM)
#include "../HAL.h" #include "../HAL.h"
#include "eeprom_if.h"
#define CMD_WREN 6 // WREN #define CMD_WREN 6 // WREN
#define CMD_READ 2 // WRITE #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 delay(EEPROM_WRITE_DELAY); // wait for page write to complete
} }
#endif // SPI_EEPROM #endif // USE_SHARED_EEPROM && I2C_EEPROM

View File

@ -337,3 +337,8 @@
#else #else
#define SD_CONNECTION_IS(...) 0 #define SD_CONNECTION_IS(...) 0
#endif #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

View File

@ -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 * 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) #if ENABLED(EEPROM_SETTINGS)
#error "Please select only one of SDCARD, FLASH, or SRAM_EEPROM_EMULATION." #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 #endif
/** /**

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -34,19 +34,21 @@
#define DEFAULT_MACHINE_NAME BOARD_INFO_NAME #define DEFAULT_MACHINE_NAME BOARD_INFO_NAME
#endif #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 //#define TEMP_TIMER_IRQ_PRIO 3
// //
// EEPROM Emulation // 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) #if ENABLED(FLASH_EEPROM_EMULATION)
#define FLASH_EEPROM_LEVELING #define FLASH_EEPROM_LEVELING
#endif #elif ENABLED(I2C_EEPROM)
//#define SRAM_EEPROM_EMULATION
//#define I2C_EEPROM
#ifdef I2C_EEPROM
#undef E2END // Defined in Arduino Core STM32 to be used with EEPROM emulation. This board uses a real EEPROM. #undef E2END // Defined in Arduino Core STM32 to be used with EEPROM emulation. This board uses a real EEPROM.
#define E2END 0xFFF // 4KB #define E2END 0xFFF // 4KB
#endif #endif

View File

@ -28,7 +28,9 @@
#define BOARD_INFO_NAME "RemRam v1" #define BOARD_INFO_NAME "RemRam v1"
#define DEFAULT_MACHINE_NAME "RemRam" #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 #if HOTENDS > 1 || E_STEPPERS > 1
#error "RemRam supports only one hotend / E-stepper." #error "RemRam supports only one hotend / E-stepper."