aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdrian <elagil@users.noreply.github.com>2020-10-22 12:05:01 +0200
committerGitHub <noreply@github.com>2020-10-22 21:05:01 +1100
commit120c42255baecb664ae813d58aa3010760f97795 (patch)
treebfa044740e946d05ee1d1017c7a7b65a93830d99
parentf9853433c140700ce6bfbfba7517e1e0620789d4 (diff)
downloadqmk_firmware-120c42255baecb664ae813d58aa3010760f97795.tar.gz
qmk_firmware-120c42255baecb664ae813d58aa3010760f97795.zip
Added EEPROM emulation for STM32F042x6 series processors (#10685)
* Added STM32F042x6 support for EEPROM emulation * Default to lower stack size on STM32F042 * Moved stack setting * Re-moved stack definition * Removed unnecessary check
-rw-r--r--common_features.mk11
-rw-r--r--tmk_core/common/chibios/eeprom_stm32.h6
-rw-r--r--tmk_core/common/chibios/flash_stm32.c3
3 files changed, 19 insertions, 1 deletions
diff --git a/common_features.mk b/common_features.mk
index ed6908f4b..e0ae1d74c 100644
--- a/common_features.mk
+++ b/common_features.mk
@@ -114,6 +114,17 @@ else
114 SRC += $(PLATFORM_COMMON_DIR)/flash_stm32.c 114 SRC += $(PLATFORM_COMMON_DIR)/flash_stm32.c
115 OPT_DEFS += -DEEPROM_EMU_STM32F072xB 115 OPT_DEFS += -DEEPROM_EMU_STM32F072xB
116 OPT_DEFS += -DSTM32_EEPROM_ENABLE 116 OPT_DEFS += -DSTM32_EEPROM_ENABLE
117 else ifeq ($(MCU_SERIES)_$(MCU_LDSCRIPT), STM32F0xx_STM32F042x6)
118
119 # Stack sizes: Since this chip has limited RAM capacity, the stack area needs to be reduced.
120 # This ensures that the EEPROM page buffer fits into RAM
121 USE_PROCESS_STACKSIZE = 0x600
122 USE_EXCEPTIONS_STACKSIZE = 0x300
123
124 SRC += $(PLATFORM_COMMON_DIR)/eeprom_stm32.c
125 SRC += $(PLATFORM_COMMON_DIR)/flash_stm32.c
126 OPT_DEFS += -DEEPROM_EMU_STM32F042x6
127 OPT_DEFS += -DSTM32_EEPROM_ENABLE
117 else ifneq ($(filter $(MCU_SERIES),STM32L0xx STM32L1xx),) 128 else ifneq ($(filter $(MCU_SERIES),STM32L0xx STM32L1xx),)
118 OPT_DEFS += -DEEPROM_DRIVER 129 OPT_DEFS += -DEEPROM_DRIVER
119 COMMON_VPATH += $(DRIVER_PATH)/eeprom 130 COMMON_VPATH += $(DRIVER_PATH)/eeprom
diff --git a/tmk_core/common/chibios/eeprom_stm32.h b/tmk_core/common/chibios/eeprom_stm32.h
index e68914595..ea0ce0640 100644
--- a/tmk_core/common/chibios/eeprom_stm32.h
+++ b/tmk_core/common/chibios/eeprom_stm32.h
@@ -36,12 +36,14 @@
36# define MCU_STM32F103RB 36# define MCU_STM32F103RB
37#elif defined(EEPROM_EMU_STM32F072xB) 37#elif defined(EEPROM_EMU_STM32F072xB)
38# define MCU_STM32F072CB 38# define MCU_STM32F072CB
39#elif defined(EEPROM_EMU_STM32F042x6)
40# define MCU_STM32F042K6
39#else 41#else
40# error "not implemented." 42# error "not implemented."
41#endif 43#endif
42 44
43#ifndef EEPROM_PAGE_SIZE 45#ifndef EEPROM_PAGE_SIZE
44# if defined(MCU_STM32F103RB) 46# if defined(MCU_STM32F103RB) || defined(MCU_STM32F042K6)
45# define FEE_PAGE_SIZE (uint16_t)0x400 // Page size = 1KByte 47# define FEE_PAGE_SIZE (uint16_t)0x400 // Page size = 1KByte
46# define FEE_DENSITY_PAGES 2 // How many pages are used 48# define FEE_DENSITY_PAGES 2 // How many pages are used
47# elif defined(MCU_STM32F103ZE) || defined(MCU_STM32F103RE) || defined(MCU_STM32F103RD) || defined(MCU_STM32F303CC) || defined(MCU_STM32F072CB) 49# elif defined(MCU_STM32F103ZE) || defined(MCU_STM32F103RE) || defined(MCU_STM32F103RD) || defined(MCU_STM32F303CC) || defined(MCU_STM32F072CB)
@@ -55,6 +57,8 @@
55#ifndef EEPROM_START_ADDRESS 57#ifndef EEPROM_START_ADDRESS
56# if defined(MCU_STM32F103RB) || defined(MCU_STM32F072CB) 58# if defined(MCU_STM32F103RB) || defined(MCU_STM32F072CB)
57# define FEE_MCU_FLASH_SIZE 128 // Size in Kb 59# define FEE_MCU_FLASH_SIZE 128 // Size in Kb
60# elif defined(MCU_STM32F042K6)
61# define FEE_MCU_FLASH_SIZE 32 // Size in Kb
58# elif defined(MCU_STM32F103ZE) || defined(MCU_STM32F103RE) 62# elif defined(MCU_STM32F103ZE) || defined(MCU_STM32F103RE)
59# define FEE_MCU_FLASH_SIZE 512 // Size in Kb 63# define FEE_MCU_FLASH_SIZE 512 // Size in Kb
60# elif defined(MCU_STM32F103RD) 64# elif defined(MCU_STM32F103RD)
diff --git a/tmk_core/common/chibios/flash_stm32.c b/tmk_core/common/chibios/flash_stm32.c
index e166fc5e6..e8b3dc4bc 100644
--- a/tmk_core/common/chibios/flash_stm32.c
+++ b/tmk_core/common/chibios/flash_stm32.c
@@ -25,6 +25,9 @@
25#elif defined(EEPROM_EMU_STM32F072xB) 25#elif defined(EEPROM_EMU_STM32F072xB)
26# define STM32F072xB 26# define STM32F072xB
27# include "stm32f0xx.h" 27# include "stm32f0xx.h"
28#elif defined(EEPROM_EMU_STM32F042x6)
29# define STM32F042x6
30# include "stm32f0xx.h"
28#else 31#else
29# error "not implemented." 32# error "not implemented."
30#endif 33#endif