Skip to content

Commit b857a91

Browse files
robert-hhdpgeorge
authored andcommitted
mimxrt: Add support for VfsRom filesystem.
The default size for the ROM partition is 256k, and it is placed in flash between the text and writable vfs sections. Its size can be changed in `mpconfigboard.mk` by defining `MICROPY_HW_ROMFS_BYTES` to a different value, but it must not be smaller than a single sector. The MIMXRT1170_EVK and SEEED ARCH MIX ROMFS boards use a larger size of 512kB. ROMFS support is disabled for MIMXRT1050_EVKB due to issues with Hyperflash. The extents of the ROM partition are defined by the linker-level symbols `_micropy_hw_romfs_part0_start` and `_micropy_hw_romfs_part0_size`, following existing ports. Signed-off-by: Damien George <damien@micropython.org> Signed-off-by: robert-hh <robert@hammelrath.com>
1 parent d871c97 commit b857a91

13 files changed

Lines changed: 84 additions & 9 deletions

File tree

ports/mimxrt/Makefile

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -311,6 +311,11 @@ ifeq ($(USE_UF2_BOOTLOADER),1)
311311
CFLAGS += -DMICROPY_MACHINE_UF2_BOOTLOADER=1
312312
endif
313313

314+
# Set the default size of the VfsRom file system. Can be changed at board level
315+
ifeq ($(MICROPY_HW_ROMFS_BYTES),)
316+
MICROPY_HW_ROMFS_BYTES ?= 0x40000
317+
endif
318+
314319
# Add sources for respective board flash type
315320
# Add hal/flexspi_nor_flash.c or hal/flashspi_hyper_flash.c respectively
316321
SRC_HAL_C += hal/flexspi_$(subst qspi_,,$(FLEXSPI_FLASH_TYPE)).c
@@ -494,9 +499,10 @@ LDFLAGS += \
494499
# LDDEFINES are used for link time adaptation of linker scripts, utilizing
495500
# the C preprocessor. Therefore keep LDDEFINES separated from LDFLAGS!
496501

497-
LDDEFINES = \
502+
LDDEFINES += \
498503
-DMICROPY_HW_FLASH_BASE=$(MICROPY_HW_FLASH_BASE) \
499-
-DMICROPY_HW_FLASH_SIZE=$(MICROPY_HW_FLASH_SIZE)
504+
-DMICROPY_HW_FLASH_SIZE=$(MICROPY_HW_FLASH_SIZE) \
505+
-DMICROPY_HW_ROMFS_BYTES=$(MICROPY_HW_ROMFS_BYTES)
500506

501507
ifdef MICROPY_HW_FLASH_RESERVED
502508
LDDEFINES += -DMICROPY_HW_FLASH_RESERVED=$(MICROPY_HW_FLASH_RESERVED)

ports/mimxrt/boards/MIMXRT1011.ld

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,10 @@ interrupts_start = flash_start + 0x0000C000;
1818
interrupts_size = 0x00000400;
1919
text_start = flash_start + 0x0000C400;
2020
vfs_start = flash_start + 0x00100000;
21-
text_size = ((vfs_start) - (text_start));
2221
vfs_size = ((flash_end) - (vfs_start));
22+
_micropy_hw_romfs_part0_start = ((vfs_start) - MICROPY_HW_ROMFS_BYTES);
23+
_micropy_hw_romfs_part0_size = MICROPY_HW_ROMFS_BYTES;
24+
text_size = ((_micropy_hw_romfs_part0_start) - (text_start));
2325
itcm_start = 0x00000000;
2426
itcm_size = 0x00008000;
2527
dtcm_start = 0x20000000;

ports/mimxrt/boards/MIMXRT1015.ld

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,10 @@ interrupts_start = flash_start + 0x0000C000;
1818
interrupts_size = 0x00000400;
1919
text_start = flash_start + 0x0000C400;
2020
vfs_start = flash_start + 0x00100000;
21-
text_size = ((vfs_start) - (text_start));
2221
vfs_size = ((flash_end) - (vfs_start));
22+
_micropy_hw_romfs_part0_start = ((vfs_start) - MICROPY_HW_ROMFS_BYTES);
23+
_micropy_hw_romfs_part0_size = MICROPY_HW_ROMFS_BYTES;
24+
text_size = ((_micropy_hw_romfs_part0_start) - (text_start));
2325
itcm_start = 0x00000000;
2426
itcm_size = 0x00008000;
2527
dtcm_start = 0x20000000;

ports/mimxrt/boards/MIMXRT1021.ld

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,10 @@ interrupts_start = flash_start + 0x0000C000;
1818
interrupts_size = 0x00000400;
1919
text_start = flash_start + 0x0000C400;
2020
vfs_start = flash_start + 0x00100000;
21-
text_size = ((vfs_start) - (text_start));
2221
vfs_size = ((flash_end) - (vfs_start));
22+
_micropy_hw_romfs_part0_start = ((vfs_start) - MICROPY_HW_ROMFS_BYTES);
23+
_micropy_hw_romfs_part0_size = MICROPY_HW_ROMFS_BYTES;
24+
text_size = ((_micropy_hw_romfs_part0_start) - (text_start));
2325
itcm_start = 0x00000000;
2426
itcm_size = 0x00010000;
2527
dtcm_start = 0x20000000;

ports/mimxrt/boards/MIMXRT1050_EVK/mpconfigboard.mk

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ MICROPY_HW_SDRAM_SIZE = 0x2000000 # 32MB
1010
MICROPY_HW_FLASH_CLK = kFlexSpiSerialClk_133MHz
1111
MICROPY_HW_FLASH_QE_CMD = 0x01
1212
MICROPY_HW_FLASH_QE_ARG = 0x40
13+
MICROPY_HW_ROMFS_BYTES = 0 # Disabled for a board with Hyperflash
1314

1415
MICROPY_PY_LWIP = 1
1516
MICROPY_PY_SSL = 1

ports/mimxrt/boards/MIMXRT1052.ld

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,10 @@ interrupts_start = flash_start + 0x0000C000;
2020
interrupts_size = 0x00000400;
2121
text_start = flash_start + 0x0000C400;
2222
vfs_start = flash_start + 0x00200000;
23-
text_size = ((vfs_start) - (text_start));
2423
vfs_size = ((flash_end) - (vfs_start));
24+
_micropy_hw_romfs_part0_start = ((vfs_start) - MICROPY_HW_ROMFS_BYTES);
25+
_micropy_hw_romfs_part0_size = MICROPY_HW_ROMFS_BYTES;
26+
text_size = ((_micropy_hw_romfs_part0_start) - (text_start));
2527
itcm_start = 0x00000000;
2628
itcm_size = 0x00020000;
2729
dtcm_start = 0x20000000;

ports/mimxrt/boards/MIMXRT1062.ld

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,10 @@ interrupts_start = flash_start + 0x0000C000;
2020
interrupts_size = 0x00000400;
2121
text_start = flash_start + 0x0000C400;
2222
vfs_start = flash_start + 0x00100000;
23-
text_size = ((vfs_start) - (text_start));
2423
vfs_size = ((flash_end) - (vfs_start));
24+
_micropy_hw_romfs_part0_start = ((vfs_start) - MICROPY_HW_ROMFS_BYTES);
25+
_micropy_hw_romfs_part0_size = MICROPY_HW_ROMFS_BYTES;
26+
text_size = ((_micropy_hw_romfs_part0_start) - (text_start));
2527
itcm_start = 0x00000000;
2628
itcm_size = 0x00020000;
2729
dtcm_start = 0x20000000;

ports/mimxrt/boards/MIMXRT1064.ld

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,10 @@ interrupts_start = flash_start + 0x0000C000;
1414
interrupts_size = 0x00000400;
1515
text_start = flash_start + 0x0000C400;
1616
vfs_start = flash_start + 0x00100000;
17-
text_size = ((vfs_start) - (text_start));
1817
vfs_size = ((flash_end) - (vfs_start));
18+
_micropy_hw_romfs_part0_start = ((vfs_start) - MICROPY_HW_ROMFS_BYTES);
19+
_micropy_hw_romfs_part0_size = MICROPY_HW_ROMFS_BYTES;
20+
text_size = ((_micropy_hw_romfs_part0_start) - (text_start));
1921
itcm_start = 0x00000000;
2022
itcm_size = 0x00020000;
2123
dtcm_start = 0x20000000;

ports/mimxrt/boards/MIMXRT1170_EVK/mpconfigboard.mk

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ MICROPY_HW_FLASH_RESERVED ?= 0x100000 # 1MB CM4 Code address space
99
MICROPY_HW_FLASH_CLK = kFlexSpiSerialClk_133MHz
1010
MICROPY_HW_FLASH_QE_CMD = 0x31
1111
MICROPY_HW_FLASH_QE_ARG = 0x02
12+
MICROPY_HW_ROMFS_BYTES = 0x80000 # 512kB
1213

1314
MICROPY_HW_SDRAM_AVAIL = 1
1415
MICROPY_HW_SDRAM_SIZE = 0x4000000 # 64MB

ports/mimxrt/boards/MIMXRT1176.ld

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,10 @@ m_core1_image_start = vfs_start - 0x00040000;
3030
m_core1_image_size = 0x00040000;
3131
#endif
3232

33-
text_size = ((vfs_start) - (text_start));
3433
vfs_size = ((flash_end) - (vfs_start));
34+
_micropy_hw_romfs_part0_start = ((vfs_start) - MICROPY_HW_ROMFS_BYTES);
35+
_micropy_hw_romfs_part0_size = MICROPY_HW_ROMFS_BYTES;
36+
text_size = ((_micropy_hw_romfs_part0_start) - (text_start));
3537
itcm_start = 0x00000000;
3638
itcm_size = 0x00020000;
3739
dtcm_start = 0x20000000;

0 commit comments

Comments
 (0)