summaryrefslogtreecommitdiff
path: root/hw
diff options
context:
space:
mode:
authorhathach <[email protected]>2023-02-13 12:29:31 +0700
committerhathach <[email protected]>2023-02-13 12:29:31 +0700
commitfb5fd22c730c58c5049ffb70a785d39f2d3daaba (patch)
tree89394c954c0ddc1c639adc68a185dc3b603a4d3c /hw
parent49c621d51058289464abbcea5e7542b12b0a3bf8 (diff)
add uf2 linker for metro m7 1011
Diffstat (limited to 'hw')
-rw-r--r--hw/bsp/imxrt/boards/metro_m7_1011/board.mk5
-rw-r--r--hw/bsp/imxrt/family.c3
-rw-r--r--hw/bsp/imxrt/family.mk7
3 files changed, 9 insertions, 6 deletions
diff --git a/hw/bsp/imxrt/boards/metro_m7_1011/board.mk b/hw/bsp/imxrt/boards/metro_m7_1011/board.mk
index 7f1861ecc..89a459958 100644
--- a/hw/bsp/imxrt/boards/metro_m7_1011/board.mk
+++ b/hw/bsp/imxrt/boards/metro_m7_1011/board.mk
@@ -1,6 +1,9 @@
CFLAGS += -DCPU_MIMXRT1011DAE5A -DCFG_EXAMPLE_VIDEO_READONLY
MCU_VARIANT = MIMXRT1011
+# LD file with uf2
+LD_FILE = $(BOARD_PATH)/$(BOARD).ld
+
# For flash-jlink target
JLINK_DEVICE = MIMXRT1011DAE5A
@@ -8,7 +11,7 @@ JLINK_DEVICE = MIMXRT1011DAE5A
PYOCD_TARGET = mimxrt1010
# flash using pyocd
-flash: flash-pyocd
+flash: flash-uf2
flash-uf2: $(BUILD)/$(PROJECT).uf2
@echo copying $<
@$(CP) $< /media/$(USER)/METROM7BOOT
diff --git a/hw/bsp/imxrt/family.c b/hw/bsp/imxrt/family.c
index ecd18bad3..e28a6174a 100644
--- a/hw/bsp/imxrt/family.c
+++ b/hw/bsp/imxrt/family.c
@@ -57,8 +57,7 @@ void board_init(void)
{
// make sure the dcache is on.
#if defined(__DCACHE_PRESENT) && __DCACHE_PRESENT
- if (SCB_CCR_DC_Msk != (SCB_CCR_DC_Msk & SCB->CCR))
- SCB_EnableDCache();
+ if (SCB_CCR_DC_Msk != (SCB_CCR_DC_Msk & SCB->CCR)) SCB_EnableDCache();
#endif
// Init clock
diff --git a/hw/bsp/imxrt/family.mk b/hw/bsp/imxrt/family.mk
index e9eeb42f1..99bb0a0f7 100644
--- a/hw/bsp/imxrt/family.mk
+++ b/hw/bsp/imxrt/family.mk
@@ -28,7 +28,7 @@ CFLAGS += -Wno-error=unused-parameter -Wno-error=implicit-fallthrough -Wno-error
MCU_DIR = $(SDK_DIR)/devices/$(MCU_VARIANT)
# All source paths should be relative to the top level.
-LD_FILE = $(MCU_DIR)/gcc/$(MCU_VARIANT)xxxxx_flexspi_nor.ld
+LD_FILE ?= $(MCU_DIR)/gcc/$(MCU_VARIANT)xxxxx_flexspi_nor.ld
# TODO for net_lwip_webserver example, but may not needed !!
LDFLAGS += \
@@ -62,7 +62,8 @@ SRC_S += $(MCU_DIR)/gcc/startup_$(MCU_VARIANT).S
FREERTOS_PORT = ARM_CM7/r0p1
# UF2 generation, iMXRT need to strip to text only before conversion
+APPLICATION_ADDR = 0x6000C000
$(BUILD)/$(PROJECT).uf2: $(BUILD)/$(PROJECT).elf
@echo CREATE $@
- @$(OBJCOPY) -O ihex -R .flash_config -R .ivt $^ $(BUILD)/$(PROJECT)-textonly.hex
- $(PYTHON) $(TOP)/tools/uf2/utils/uf2conv.py -f $(UF2_FAMILY_ID) -c -o $@ $(BUILD)/$(PROJECT)-textonly.hex
+ @$(OBJCOPY) -O binary -R .flash_config -R .ivt $^ $(BUILD)/$(PROJECT)-textonly.bin
+ $(PYTHON) $(TOP)/tools/uf2/utils/uf2conv.py -f $(UF2_FAMILY_ID) -b $(APPLICATION_ADDR) -c -o $@ $(BUILD)/$(PROJECT)-textonly.bin