mirror of
https://github.com/zsa/qmk_firmware.git
synced 2026-05-03 05:37:40 +00:00
* Add additional fixes to EEPROM driver selection (#7274) - uprintf -> dprintf - Fix atsam "vendor" eeprom. - Bump Kinetis K20x to 64 bytes, too. - Rollback Kinetis to 32 bytes as partitioning can only be done once. Add warning about changing the value. - Change RAM-backed "fake" EEPROM implementations to match eeconfig's current usage. - Add 24LC128 by request. * format code according to conventions [skip ci] Co-authored-by: Nick Brassel <nick@tzarc.org> Co-authored-by: QMK Bot <hello@qmk.fm> Co-authored-by: Florian Didron <fdidron@users.noreply.github.com>
This commit is contained in:
committed by
Florian Didron
parent
30ed4bdb38
commit
ebd4b1dc1e
@@ -16,9 +16,12 @@
|
||||
|
||||
#include "eeprom.h"
|
||||
|
||||
#define EEPROM_SIZE 32
|
||||
#ifndef EEPROM_SIZE
|
||||
# include "eeconfig.h"
|
||||
# define EEPROM_SIZE (((EECONFIG_SIZE + 3) / 4) * 4) // based off eeconfig's current usage, aligned to 4-byte sizes, to deal with LTO
|
||||
#endif
|
||||
|
||||
static uint8_t buffer[EEPROM_SIZE];
|
||||
__attribute__((aligned(4))) static uint8_t buffer[EEPROM_SIZE];
|
||||
|
||||
uint8_t eeprom_read_byte(const uint8_t *addr) {
|
||||
uintptr_t offset = (uintptr_t)addr;
|
||||
|
||||
@@ -50,7 +50,16 @@
|
||||
// (aligned to 2 or 4 byte boundaries) has twice the endurance
|
||||
// compared to writing 8 bit bytes.
|
||||
//
|
||||
# define EEPROM_SIZE 32
|
||||
# ifndef EEPROM_SIZE
|
||||
# define EEPROM_SIZE 32
|
||||
# endif
|
||||
|
||||
/*
|
||||
^^^ Here be dragons:
|
||||
NXP AppNote AN4282 section 3.1 states that partitioning must only be done once.
|
||||
Once EEPROM partitioning is done, the size is locked to this initial configuration.
|
||||
Attempts to modify the EEPROM_SIZE setting may brick your board.
|
||||
*/
|
||||
|
||||
// Writing unaligned 16 or 32 bit data is handled automatically when
|
||||
// this is defined, but at a cost of extra code size. Without this,
|
||||
@@ -517,8 +526,11 @@ void eeprom_write_block(const void *buf, void *addr, uint32_t len) {
|
||||
#else
|
||||
// No EEPROM supported, so emulate it
|
||||
|
||||
# define EEPROM_SIZE 64
|
||||
static uint8_t buffer[EEPROM_SIZE];
|
||||
# ifndef EEPROM_SIZE
|
||||
# include "eeconfig.h"
|
||||
# define EEPROM_SIZE (((EECONFIG_SIZE + 3) / 4) * 4) // based off eeconfig's current usage, aligned to 4-byte sizes, to deal with LTO
|
||||
# endif
|
||||
__attribute__((aligned(4))) static uint8_t buffer[EEPROM_SIZE];
|
||||
|
||||
uint8_t eeprom_read_byte(const uint8_t *addr) {
|
||||
uint32_t offset = (uint32_t)addr;
|
||||
|
||||
Reference in New Issue
Block a user