summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
-rw-r--r--stmhal/Makefile11
-rw-r--r--stmhal/boards/ESPRUINO_PICO/mpconfigboard.mk2
-rw-r--r--stmhal/boards/ESPRUINO_PICO/stm32f4xx_hal_conf.h6
-rw-r--r--stmhal/boards/NUCLEO_F401RE/mpconfigboard.mk2
-rw-r--r--stmhal/boards/common.ld10
-rw-r--r--stmhal/boards/stm32f401xd.ld31
-rw-r--r--stmhal/boards/stm32f401xe.ld (renamed from stmhal/boards/stm32f401.ld)7
7 files changed, 55 insertions, 14 deletions
diff --git a/stmhal/Makefile b/stmhal/Makefile
index 477cb2631d..7be0f28fe1 100644
--- a/stmhal/Makefile
+++ b/stmhal/Makefile
@@ -261,12 +261,15 @@ OBJ += $(addprefix $(BUILD)/, $(SRC_USBDEV:.c=.o))
OBJ += $(addprefix $(BUILD)/, $(SRC_MOD:.c=.o))
OBJ += $(BUILD)/pins_$(BOARD).o
-# We put ff.o and stm32f4xx_hal_sd.o into the first 16K section with the ISRs.
+# We put several files into the first 16K section with the ISRs.
# If we compile these using -O0 then it won't fit. So if you really want these
-# to be compiled with -O0, then edit stm32f405.ld (in the .isr_vector section)
-# and comment out the following 2 lines.
+# to be compiled with -O0, then edit boards/common.ld (in the .isr_vector section)
+# and comment out the following lines.
$(BUILD)/$(FATFS_DIR)/ff.o: COPT += -Os
-$(BUILD)/$(HAL_DIR)/src/stm32$(MCU_SERIES)xx_hal_sd.o: COPT += -Os
+$(filter $(PY_BUILD)/../extmod/vfs_fat_%.o, $(PY_O)): COPT += -Os
+$(PY_BUILD)/formatfloat.o: COPT += -Os
+$(PY_BUILD)/parsenum.o: COPT += -Os
+$(PY_BUILD)/mpprint.o: COPT += -Os
all: $(BUILD)/firmware.dfu $(BUILD)/firmware.hex
diff --git a/stmhal/boards/ESPRUINO_PICO/mpconfigboard.mk b/stmhal/boards/ESPRUINO_PICO/mpconfigboard.mk
index 428b271ab3..4c44022c32 100644
--- a/stmhal/boards/ESPRUINO_PICO/mpconfigboard.mk
+++ b/stmhal/boards/ESPRUINO_PICO/mpconfigboard.mk
@@ -1,4 +1,4 @@
MCU_SERIES = f4
CMSIS_MCU = STM32F401xE
AF_FILE = boards/stm32f401_af.csv
-LD_FILE = boards/stm32f401.ld
+LD_FILE = boards/stm32f401xd.ld
diff --git a/stmhal/boards/ESPRUINO_PICO/stm32f4xx_hal_conf.h b/stmhal/boards/ESPRUINO_PICO/stm32f4xx_hal_conf.h
index fcbb6637a9..c68c00d198 100644
--- a/stmhal/boards/ESPRUINO_PICO/stm32f4xx_hal_conf.h
+++ b/stmhal/boards/ESPRUINO_PICO/stm32f4xx_hal_conf.h
@@ -54,10 +54,10 @@
*/
#define HAL_MODULE_ENABLED
#define HAL_ADC_MODULE_ENABLED
-#define HAL_CAN_MODULE_ENABLED
+/* #define HAL_CAN_MODULE_ENABLED */
/* #define HAL_CRC_MODULE_ENABLED */
/* #define HAL_CRYP_MODULE_ENABLED */
-#define HAL_DAC_MODULE_ENABLED
+/* #define HAL_DAC_MODULE_ENABLED */
/* #define HAL_DCMI_MODULE_ENABLED */
#define HAL_DMA_MODULE_ENABLED
/* #define HAL_DMA2D_MODULE_ENABLED */
@@ -79,7 +79,7 @@
#define HAL_RNG_MODULE_ENABLED
#define HAL_RTC_MODULE_ENABLED
/* #define HAL_SAI_MODULE_ENABLED */
-#define HAL_SD_MODULE_ENABLED
+/* #define HAL_SD_MODULE_ENABLED */
#define HAL_SPI_MODULE_ENABLED
#define HAL_TIM_MODULE_ENABLED
#define HAL_UART_MODULE_ENABLED
diff --git a/stmhal/boards/NUCLEO_F401RE/mpconfigboard.mk b/stmhal/boards/NUCLEO_F401RE/mpconfigboard.mk
index 428b271ab3..eb391bed73 100644
--- a/stmhal/boards/NUCLEO_F401RE/mpconfigboard.mk
+++ b/stmhal/boards/NUCLEO_F401RE/mpconfigboard.mk
@@ -1,4 +1,4 @@
MCU_SERIES = f4
CMSIS_MCU = STM32F401xE
AF_FILE = boards/stm32f401_af.csv
-LD_FILE = boards/stm32f401.ld
+LD_FILE = boards/stm32f401xe.ld
diff --git a/stmhal/boards/common.ld b/stmhal/boards/common.ld
index 9716c596e2..fcae1b4c6e 100644
--- a/stmhal/boards/common.ld
+++ b/stmhal/boards/common.ld
@@ -14,8 +14,16 @@ SECTIONS
out. */
. = ALIGN(4);
+
+ /* NOTE: If you update the list of files contained in .isr_vector,
+ then be sure to also update smhal/Makefile where it forcibly
+ builds each of these files with -Os */
+
*/ff.o(.text*)
- */stm32f4xx_hal_sd.o(.text*)
+ */vfs_fat_*.o(.text*)
+ */py/formatfloat.o(.text*)
+ */py/parsenum.o(.text*)
+ */py/mpprint.o(.text*)
. = ALIGN(4);
} >FLASH_ISR
diff --git a/stmhal/boards/stm32f401xd.ld b/stmhal/boards/stm32f401xd.ld
new file mode 100644
index 0000000000..53aa83d53b
--- /dev/null
+++ b/stmhal/boards/stm32f401xd.ld
@@ -0,0 +1,31 @@
+/*
+ GNU linker script for STM32F401xD
+*/
+
+/* Specify the memory areas */
+MEMORY
+{
+ FLASH (rx) : ORIGIN = 0x08000000, LENGTH = 0x060000 /* entire flash, 384 KiB */
+ FLASH_ISR (rx) : ORIGIN = 0x08000000, LENGTH = 0x004000 /* sector 0, 16 KiB */
+ FLASH_FS (rx) : ORIGIN = 0x08004000, LENGTH = 0x01C000 /* sectors 1,2,3 are 16K, 4 is 64K */
+ FLASH_TEXT (rx) : ORIGIN = 0x08020000, LENGTH = 0x040000 /* sectors 5,6 2*128KiB = 256 KiB */
+ RAM (xrw) : ORIGIN = 0x20000000, LENGTH = 0x018000 /* 96 KiB */
+}
+
+/* produce a link error if there is not this amount of RAM for these sections */
+_minimum_stack_size = 2K;
+_minimum_heap_size = 16K;
+
+/* Define tho top end of the stack. The stack is full descending so begins just
+ above last byte of RAM. Note that EABI requires the stack to be 8-byte
+ aligned for a call. */
+_estack = ORIGIN(RAM) + LENGTH(RAM);
+
+/* define common sections and symbols */
+INCLUDE common.ld
+
+/* RAM extents for the garbage collector */
+_ram_start = ORIGIN(RAM);
+_ram_end = ORIGIN(RAM) + LENGTH(RAM);
+_heap_start = _ebss; /* heap starts just after statically allocated memory */
+_heap_end = 0x20014000; /* tunable */
diff --git a/stmhal/boards/stm32f401.ld b/stmhal/boards/stm32f401xe.ld
index 2d81841ff4..a91eee0798 100644
--- a/stmhal/boards/stm32f401.ld
+++ b/stmhal/boards/stm32f401xe.ld
@@ -1,15 +1,14 @@
/*
- GNU linker script for STM32F401
+ GNU linker script for STM32F401xE
*/
/* Specify the memory areas */
-/* TODO verify these regions */
MEMORY
{
FLASH (rx) : ORIGIN = 0x08000000, LENGTH = 0x080000 /* entire flash, 512 KiB */
FLASH_ISR (rx) : ORIGIN = 0x08000000, LENGTH = 0x004000 /* sector 0, 16 KiB */
- /* sectors 1,2,3 are 16K, 4 is 64K (for filesystem) */
- FLASH_TEXT (rx) : ORIGIN = 0x08020000, LENGTH = 0x080000 /* sectors 5,6,7 3*128KiB = 384 KiB */
+ FLASH_FS (rx) : ORIGIN = 0x08004000, LENGTH = 0x01C000 /* sectors 1,2,3 are 16K, 4 is 64K */
+ FLASH_TEXT (rx) : ORIGIN = 0x08020000, LENGTH = 0x060000 /* sectors 5,6,7 3*128KiB = 384 KiB */
RAM (xrw) : ORIGIN = 0x20000000, LENGTH = 0x018000 /* 96 KiB */
}