tinyusb/hw/bsp/imxrt/family.mk

70 lines
2.1 KiB
Makefile
Raw Normal View History

UF2_FAMILY_ID = 0x4fb2d5bd
2021-04-28 19:30:23 +07:00
SDK_DIR = hw/mcu/nxp/mcux-sdk
DEPS_SUBMODULES += $(SDK_DIR) lib/CMSIS_5
2020-11-29 20:41:30 +07:00
include $(TOP)/$(BOARD_PATH)/board.mk
2019-11-23 01:09:39 +07:00
CFLAGS += \
-mthumb \
-mabi=aapcs \
-mcpu=cortex-m7 \
-mfloat-abi=hard \
-mfpu=fpv5-d16 \
-D__ARMVFP__=0 -D__ARMFPV5__=0\
-DXIP_EXTERNAL_FLASH=1 \
-DXIP_BOOT_HEADER_ENABLE=1 \
-DCFG_TUSB_MCU=OPT_MCU_MIMXRT1XXX
2019-11-23 01:09:39 +07:00
ifdef BOARD_TUD_RHPORT
CFLAGS += -DBOARD_TUD_RHPORT=$(BOARD_TUD_RHPORT)
endif
ifdef BOARD_TUH_RHPORT
CFLAGS += -DBOARD_TUH_RHPORT=$(BOARD_TUH_RHPORT)
endif
2019-11-23 01:09:39 +07:00
# mcu driver cause following warnings
CFLAGS += -Wno-error=unused-parameter -Wno-error=implicit-fallthrough -Wno-error=redundant-decls
2019-11-23 01:09:39 +07:00
2021-04-28 19:30:23 +07:00
MCU_DIR = $(SDK_DIR)/devices/$(MCU_VARIANT)
2019-11-23 01:09:39 +07:00
# All source paths should be relative to the top level.
2023-02-13 12:29:31 +07:00
LD_FILE ?= $(MCU_DIR)/gcc/$(MCU_VARIANT)xxxxx_flexspi_nor.ld
2020-11-29 20:41:30 +07:00
# TODO for net_lwip_webserver example, but may not needed !!
2020-11-29 20:41:30 +07:00
LDFLAGS += \
-Wl,--defsym,__stack_size__=0x800 \
2019-11-23 01:09:39 +07:00
SRC_C += \
2021-12-01 23:19:17 +07:00
src/portable/chipidea/ci_hs/dcd_ci_hs.c \
src/portable/chipidea/ci_hs/hcd_ci_hs.c \
src/portable/ehci/ehci.c \
2020-11-29 20:41:30 +07:00
$(MCU_DIR)/system_$(MCU_VARIANT).c \
2019-11-23 01:09:39 +07:00
$(MCU_DIR)/xip/fsl_flexspi_nor_boot.c \
$(MCU_DIR)/project_template/clock_config.c \
$(MCU_DIR)/drivers/fsl_clock.c \
2021-04-28 19:30:23 +07:00
$(SDK_DIR)/drivers/common/fsl_common.c \
$(SDK_DIR)/drivers/igpio/fsl_gpio.c \
$(SDK_DIR)/drivers/lpuart/fsl_lpuart.c
2019-11-23 01:09:39 +07:00
INC += \
2020-11-29 20:41:30 +07:00
$(TOP)/$(BOARD_PATH) \
$(TOP)/lib/CMSIS_5/CMSIS/Core/Include \
2019-11-23 01:09:39 +07:00
$(TOP)/$(MCU_DIR) \
$(TOP)/$(MCU_DIR)/project_template \
2021-04-28 19:30:23 +07:00
$(TOP)/$(MCU_DIR)/drivers \
$(TOP)/$(SDK_DIR)/drivers/common \
$(TOP)/$(SDK_DIR)/drivers/igpio \
$(TOP)/$(SDK_DIR)/drivers/lpuart
2019-11-23 01:09:39 +07:00
2020-11-29 20:41:30 +07:00
SRC_S += $(MCU_DIR)/gcc/startup_$(MCU_VARIANT).S
2019-11-23 01:09:39 +07:00
# For freeRTOS port source
FREERTOS_PORTABLE_SRC = $(FREERTOS_PORTABLE_PATH)/ARM_CM7/r0p1
2019-11-23 01:09:39 +07:00
# UF2 generation, iMXRT need to strip to text only before conversion
2023-02-13 12:29:31 +07:00
APPLICATION_ADDR = 0x6000C000
$(BUILD)/$(PROJECT).uf2: $(BUILD)/$(PROJECT).elf
@echo CREATE $@
2023-02-13 12:29:31 +07:00
@$(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