tinyusb/hw/bsp/imxrt/family.mk

78 lines
2.4 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
CPU_CORE ?= cortex-m7
2023-11-16 15:38:55 +07:00
MCU_VARIANT_WITH_CORE = ${MCU_VARIANT}${MCU_CORE}
MCU_DIR = $(SDK_DIR)/devices/$(MCU_VARIANT)
2023-11-16 15:38:55 +07:00
2019-11-23 01:09:39 +07:00
CFLAGS += \
-D__ARMVFP__=0 \
-D__ARMFPV5__=0 \
2019-11-23 01:09:39 +07:00
-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
LDFLAGS_GCC += -specs=nosys.specs -specs=nano.specs
2019-11-23 01:09:39 +07:00
# All source paths should be relative to the top level.
2023-11-16 15:38:55 +07:00
LD_FILE ?= $(MCU_DIR)/gcc/$(MCU_VARIANT)xxxxx${MCU_CORE}_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 \
2023-11-16 15:38:55 +07:00
${BOARD_PATH}/board/clock_config.c \
${BOARD_PATH}/board/pin_mux.c \
$(MCU_DIR)/system_$(MCU_VARIANT_WITH_CORE).c \
2019-11-23 01:09:39 +07:00
$(MCU_DIR)/xip/fsl_flexspi_nor_boot.c \
$(MCU_DIR)/drivers/fsl_clock.c \
2021-04-28 19:30:23 +07:00
$(SDK_DIR)/drivers/common/fsl_common.c \
2023-11-16 15:38:55 +07:00
$(SDK_DIR)/drivers/common/fsl_common_arm.c \
2021-04-28 19:30:23 +07:00
$(SDK_DIR)/drivers/igpio/fsl_gpio.c \
$(SDK_DIR)/drivers/lpuart/fsl_lpuart.c
2019-11-23 01:09:39 +07:00
2023-11-16 15:38:55 +07:00
# Optional drivers: only available for some mcus: rt1160, rt1170
ifneq (,$(wildcard ${TOP}/${MCU_DIR}/drivers/fsl_dcdc.c))
SRC_C += \
${MCU_DIR}/drivers/fsl_dcdc.c \
${MCU_DIR}/drivers/fsl_pmu.c \
${MCU_DIR}/drivers/fsl_anatop_ai.c
endif
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
2023-11-16 15:38:55 +07:00
SRC_S += $(MCU_DIR)/gcc/startup_$(MCU_VARIANT_WITH_CORE).S
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