Refine EEPROM types / flags (#17772)
This commit is contained in:
parent
2d758663db
commit
5e6faa999d
@ -27,6 +27,7 @@
|
||||
|
||||
#include "../shared/eeprom_api.h"
|
||||
|
||||
size_t PersistentStore::capacity() { return E2END + 1; }
|
||||
bool PersistentStore::access_start() { 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
|
||||
}
|
||||
|
||||
size_t PersistentStore::capacity() { return E2END + 1; }
|
||||
|
||||
#endif // EEPROM_SETTINGS || SD_FIRMWARE_UPDATE
|
||||
#endif // __AVR__
|
||||
|
@ -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
|
||||
//
|
||||
|
@ -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();
|
||||
|
||||
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
|
||||
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
|
@ -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
Normal file
69
Marlin/src/HAL/DUE/eeprom_wired.cpp
Normal 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
|
@ -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
|
||||
|
@ -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)
|
||||
|
||||
|
@ -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
|
||||
|
@ -20,8 +20,3 @@
|
||||
*
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#undef USE_WIRED_EEPROM
|
||||
#if ENABLED(EEPROM_SETTINGS) && DISABLED(FLASH_EEPROM_EMULATION)
|
||||
#define USE_WIRED_EEPROM 1
|
||||
#endif
|
||||
|
@ -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);
|
||||
|
@ -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);
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -21,8 +21,6 @@
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#undef I2C_EEPROM // Arduino framework provides code for I2C
|
||||
|
||||
#if USE_FALLBACK_EEPROM
|
||||
#define FLASH_EEPROM_EMULATION
|
||||
#endif
|
||||
|
@ -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
|
||||
//
|
||||
|
@ -18,17 +18,16 @@
|
||||
* 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; }
|
||||
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;
|
||||
}
|
||||
|
||||
#endif // EEPROM_SETTINGS && !(QSPI_EEPROM || FLASH_EEPROM_EMULATION)
|
||||
#endif // USE_WIRED_EEPROM
|
||||
#endif // __SAMD51__
|
@ -23,4 +23,6 @@
|
||||
|
||||
#if USE_FALLBACK_EEPROM
|
||||
#define FLASH_EEPROM_EMULATION
|
||||
#elif EITHER(I2C_EEPROM, SPI_EEPROM)
|
||||
#define USE_SHARED_EEPROM 1
|
||||
#endif
|
||||
|
@ -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
|
||||
//
|
||||
|
@ -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
Normal file
64
Marlin/src/HAL/STM32/eeprom_sram.cpp
Normal 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
|
@ -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,8 +38,6 @@ 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;
|
||||
@ -47,9 +48,6 @@ bool PersistentStore::write_data(int &pos, const uint8_t *value, size_t size, ui
|
||||
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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
//
|
||||
|
@ -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__
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
//
|
||||
|
@ -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);
|
||||
|
@ -22,12 +22,14 @@
|
||||
*/
|
||||
#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"
|
||||
|
||||
size_t PersistentStore::capacity() { return E2END + 1; }
|
||||
bool PersistentStore::access_start() { 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;
|
||||
}
|
||||
|
||||
size_t PersistentStore::capacity() { return E2END + 1; }
|
||||
|
||||
#endif // EEPROM_SETTINGS
|
||||
#endif // STM32GENERIC && (STM32F4 || STM32F7)
|
||||
|
@ -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)
|
||||
|
||||
/**
|
||||
|
@ -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
|
@ -29,6 +29,7 @@
|
||||
#include "../shared/eeprom_api.h"
|
||||
#include <avr/eeprom.h>
|
||||
|
||||
size_t PersistentStore::capacity() { return E2END + 1; }
|
||||
bool PersistentStore::access_start() { 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;
|
||||
}
|
||||
|
||||
size_t PersistentStore::capacity() { return E2END + 1; }
|
||||
|
||||
#endif // USE_WIRED_EEPROM
|
||||
#endif // __MK64FX512__ || __MK66FX1M0__
|
||||
|
30
Marlin/src/HAL/shared/eeprom_if.h
Normal file
30
Marlin/src/HAL/shared/eeprom_if.h
Normal 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);
|
@ -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
|
@ -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
|
@ -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
|
||||
|
@ -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
|
||||
|
||||
/**
|
||||
|
@ -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;
|
||||
|
@ -31,7 +31,9 @@
|
||||
//
|
||||
// EEPROM Emulation
|
||||
//
|
||||
#if NO_EEPROM_SELECTED
|
||||
#define FLASH_EEPROM_EMULATION
|
||||
#endif
|
||||
|
||||
//
|
||||
// SD CARD SPI
|
||||
|
@ -33,11 +33,13 @@
|
||||
// Ignore temp readings during development.
|
||||
//#define BOGUS_TEMPERATURE_GRACE_PERIOD 2000
|
||||
|
||||
#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
|
||||
|
@ -31,11 +31,13 @@
|
||||
// Ignore temp readings during development.
|
||||
//#define BOGUS_TEMPERATURE_GRACE_PERIOD 2000
|
||||
|
||||
#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
|
||||
|
@ -33,10 +33,12 @@
|
||||
// Ignore temp readings during development.
|
||||
//#define BOGUS_TEMPERATURE_GRACE_PERIOD 2000
|
||||
|
||||
#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
|
||||
|
@ -38,11 +38,13 @@
|
||||
//
|
||||
// Flash EEPROM Emulation
|
||||
//
|
||||
#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
|
||||
|
@ -35,11 +35,13 @@
|
||||
|
||||
#define DISABLE_JTAG
|
||||
|
||||
#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
|
||||
|
@ -52,8 +52,10 @@
|
||||
//#define BOGUS_TEMPERATURE_GRACE_PERIOD 2000
|
||||
|
||||
// Enable EEPROM Emulation for this board as it doesn't have EEPROM
|
||||
#if EITHER(NO_EEPROM_SELECTED, FLASH_EEPROM_EMULATION)
|
||||
#define FLASH_EEPROM_EMULATION
|
||||
#define E2END 0xFFF // 4KB
|
||||
#endif
|
||||
|
||||
//
|
||||
// Limit Switches
|
||||
|
@ -52,8 +52,10 @@
|
||||
//#define BOGUS_TEMPERATURE_GRACE_PERIOD 2000
|
||||
|
||||
// Enable EEPROM Emulation for this board as it doesn't have EEPROM
|
||||
#if EITHER(NO_EEPROM_SELECTED, FLASH_EEPROM_EMULATION)
|
||||
#define FLASH_EEPROM_EMULATION
|
||||
#define E2END 0xFFF // 4KB
|
||||
#endif
|
||||
|
||||
//
|
||||
// Limit Switches
|
||||
|
@ -52,8 +52,10 @@
|
||||
//#define BOGUS_TEMPERATURE_GRACE_PERIOD 2000
|
||||
|
||||
// Enable EEPROM Emulation for this board as it doesn't have EEPROM
|
||||
#if EITHER(NO_EEPROM_SELECTED, FLASH_EEPROM_EMULATION)
|
||||
#define FLASH_EEPROM_EMULATION
|
||||
#define E2END 0xFFF // 4KB
|
||||
#endif
|
||||
|
||||
//
|
||||
// Limit Switches
|
||||
|
@ -52,8 +52,10 @@
|
||||
//#define BOGUS_TEMPERATURE_GRACE_PERIOD 2000
|
||||
|
||||
// Enable EEPROM Emulation for this board as it doesn't have EEPROM
|
||||
#if EITHER(NO_EEPROM_SELECTED, FLASH_EEPROM_EMULATION)
|
||||
#define FLASH_EEPROM_EMULATION
|
||||
#define E2END 0xFFF // 4KB
|
||||
#endif
|
||||
|
||||
//
|
||||
// Limit Switches
|
||||
|
@ -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
|
||||
|
||||
|
@ -147,8 +147,10 @@
|
||||
// Persistent Storage
|
||||
// If no option is selected below the SD Card will be used
|
||||
//
|
||||
#if NO_EEPROM_SELECTED
|
||||
//#define SPI_EEPROM
|
||||
#define FLASH_EEPROM_EMULATION
|
||||
#endif
|
||||
|
||||
#undef E2END
|
||||
#if ENABLED(SPI_EEPROM)
|
||||
|
@ -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.
|
||||
// Assume Flash EEPROM
|
||||
#if NO_EEPROM_SELECTED
|
||||
#define FLASH_EEPROM_EMULATION
|
||||
#endif
|
||||
|
||||
#define SDSS SS_PIN
|
||||
|
||||
|
@ -38,11 +38,13 @@
|
||||
//
|
||||
#define DISABLE_DEBUG
|
||||
|
||||
#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.
|
||||
|
@ -41,8 +41,10 @@
|
||||
//
|
||||
// EEPROM
|
||||
//
|
||||
#if NO_EEPROM_SELECTED
|
||||
//#define FLASH_EEPROM_EMULATION
|
||||
#define SDCARD_EEPROM_EMULATION
|
||||
#endif
|
||||
|
||||
//
|
||||
// Limit Switches
|
||||
|
@ -30,8 +30,10 @@
|
||||
#define BOARD_INFO_NAME "BIGTREE Btt002 1.0"
|
||||
|
||||
// Use one of these or SDCard-based Emulation will be used
|
||||
#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
|
||||
|
@ -32,9 +32,11 @@
|
||||
#define BOARD_INFO_NAME "BIGTREE GTR 1.0"
|
||||
|
||||
// Use one of these or SDCard-based Emulation will be used
|
||||
#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
|
||||
|
@ -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
|
||||
#if NO_EEPROM_SELECTED
|
||||
//#define SRAM_EEPROM_EMULATION // Use BackSRAM-based EEPROM emulation
|
||||
#define FLASH_EEPROM_EMULATION // Use Flash-based EEPROM emulation
|
||||
#endif
|
||||
|
||||
//
|
||||
// Servos
|
||||
|
@ -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
|
||||
//
|
||||
#if NO_EEPROM_SELECTED
|
||||
#define FLASH_EEPROM_EMULATION
|
||||
#if ENABLED(FLASH_EEPROM_EMULATION)
|
||||
#define FLASH_EEPROM_LEVELING
|
||||
#endif
|
||||
//#define SRAM_EEPROM_EMULATION
|
||||
//#define I2C_EEPROM
|
||||
#ifdef I2C_EEPROM
|
||||
#endif
|
||||
|
||||
#if ENABLED(FLASH_EEPROM_EMULATION)
|
||||
#define FLASH_EEPROM_LEVELING
|
||||
#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
|
||||
|
@ -28,7 +28,9 @@
|
||||
#define BOARD_INFO_NAME "RemRam v1"
|
||||
#define DEFAULT_MACHINE_NAME "RemRam"
|
||||
|
||||
#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…
Reference in New Issue
Block a user