Skip to content

Commit 42a6364

Browse files
dhylandsdpgeorge
authored andcommitted
stmhal: Add support for building frozen files.
This allows FROZEN_DIR=some-directory to be specified on the make command line, which will then add all of the files contained within the indicated frozen directory as frozen files in the image. There is no change in flash/ram usage if not using the feature. This is especially useful on smaller MCUs (like the 401) which only has 64K flash file system.
1 parent 6c8b3a7 commit 42a6364

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

stmhal/Makefile

+13
Original file line numberDiff line numberDiff line change
@@ -264,6 +264,19 @@ $(BUILD)/$(HAL_DIR)/src/stm32$(MCU_SERIES)xx_hal_sd.o: COPT += -Os
264264

265265
all: $(BUILD)/firmware.dfu $(BUILD)/firmware.hex
266266

267+
ifneq ($(FROZEN_DIR),)
268+
CFLAGS += -DMICROPY_MODULE_FROZEN
269+
OBJ += $(BUILD)/frozen-files.o
270+
MAKE_FROZEN = ../tools/make-frozen.py
271+
272+
$(BUILD)/frozen-files.o: $(BUILD)/frozen-files.c
273+
$(call compile_c)
274+
275+
$(BUILD)/frozen-files.c: $(shell find $(FROZEN_DIR) -type f)
276+
@$(ECHO) "Creating $@"
277+
$(Q)$(PYTHON) $(MAKE_FROZEN) $(FROZEN_DIR) > $@
278+
endif
279+
267280
.PHONY: deploy
268281

269282
deploy: $(BUILD)/firmware.dfu

0 commit comments

Comments
 (0)