From 80be1aa13dcdd0b86c01212b6266a099669c98b2 Mon Sep 17 00:00:00 2001 From: hathach Date: Sun, 19 Mar 2023 17:19:33 +0700 Subject: [PATCH] bsp lpc11 --- .github/workflows/build_arm.yml | 2 +- hw/bsp/lpc11/boards/lpcxpresso11u37/board.mk | 24 ++++++++++ .../boards}/lpcxpresso11u37/lpc11u37.ld | 0 .../boards}/lpcxpresso11u37/lpcxpresso11u37.c | 2 +- hw/bsp/lpc11/boards/lpcxpresso11u68/board.mk | 18 ++++++++ .../boards}/lpcxpresso11u68/lpc11u68.ld | 0 .../boards}/lpcxpresso11u68/lpcxpresso11u68.c | 2 +- hw/bsp/lpc11/family.mk | 43 +++++++++++++++++ hw/bsp/lpcxpresso11u37/board.mk | 46 ------------------- hw/bsp/lpcxpresso11u68/board.mk | 42 ----------------- 10 files changed, 88 insertions(+), 91 deletions(-) create mode 100644 hw/bsp/lpc11/boards/lpcxpresso11u37/board.mk rename hw/bsp/{ => lpc11/boards}/lpcxpresso11u37/lpc11u37.ld (100%) rename hw/bsp/{ => lpc11/boards}/lpcxpresso11u37/lpcxpresso11u37.c (99%) create mode 100644 hw/bsp/lpc11/boards/lpcxpresso11u68/board.mk rename hw/bsp/{ => lpc11/boards}/lpcxpresso11u68/lpc11u68.ld (100%) rename hw/bsp/{ => lpc11/boards}/lpcxpresso11u68/lpcxpresso11u68.c (99%) create mode 100644 hw/bsp/lpc11/family.mk delete mode 100644 hw/bsp/lpcxpresso11u37/board.mk delete mode 100644 hw/bsp/lpcxpresso11u68/board.mk diff --git a/.github/workflows/build_arm.yml b/.github/workflows/build_arm.yml index ee3d9f533..1a0e556e9 100644 --- a/.github/workflows/build_arm.yml +++ b/.github/workflows/build_arm.yml @@ -35,7 +35,7 @@ jobs: - 'broadcom_32bit' - 'imxrt' - 'kinetis_k32 kinetis_kl' - - 'lpc15 lpc18' + - 'lpc11 lpc15 lpc18' - 'lpc54 lpc55' - 'mm32 msp432e4' - 'nrf' diff --git a/hw/bsp/lpc11/boards/lpcxpresso11u37/board.mk b/hw/bsp/lpc11/boards/lpcxpresso11u37/board.mk new file mode 100644 index 000000000..fdc17374b --- /dev/null +++ b/hw/bsp/lpc11/boards/lpcxpresso11u37/board.mk @@ -0,0 +1,24 @@ +MCU = 11uxx +MCU_DRV = 11xx + +CFLAGS += \ + -DCORE_M0 \ + -DCFG_EXAMPLE_MSC_READONLY \ + -DCFG_EXAMPLE_VIDEO_READONLY \ + -DCFG_TUSB_MEM_SECTION='__attribute__((section(".data.$$RAM2")))' + +# mcu driver cause following warnings +CFLAGS += \ + -Wno-error=strict-prototypes \ + -Wno-error=unused-parameter \ + -Wno-error=redundant-decls + +# All source paths should be relative to the top level. +LD_FILE = $(BOARD_PATH)/lpc11u37.ld + +# For flash-jlink target +JLINK_DEVICE = LPC11U37/401 +PYOCD_TARGET = lpc11u37 + +# flash using pyocd +flash: flash-pyocd diff --git a/hw/bsp/lpcxpresso11u37/lpc11u37.ld b/hw/bsp/lpc11/boards/lpcxpresso11u37/lpc11u37.ld similarity index 100% rename from hw/bsp/lpcxpresso11u37/lpc11u37.ld rename to hw/bsp/lpc11/boards/lpcxpresso11u37/lpc11u37.ld diff --git a/hw/bsp/lpcxpresso11u37/lpcxpresso11u37.c b/hw/bsp/lpc11/boards/lpcxpresso11u37/lpcxpresso11u37.c similarity index 99% rename from hw/bsp/lpcxpresso11u37/lpcxpresso11u37.c rename to hw/bsp/lpc11/boards/lpcxpresso11u37/lpcxpresso11u37.c index 79cd685c3..02dc2cbf9 100644 --- a/hw/bsp/lpcxpresso11u37/lpcxpresso11u37.c +++ b/hw/bsp/lpc11/boards/lpcxpresso11u37/lpcxpresso11u37.c @@ -25,7 +25,7 @@ */ #include "chip.h" -#include "../board.h" +#include "bsp/board.h" //--------------------------------------------------------------------+ // Forward USB interrupt events to TinyUSB IRQ Handler diff --git a/hw/bsp/lpc11/boards/lpcxpresso11u68/board.mk b/hw/bsp/lpc11/boards/lpcxpresso11u68/board.mk new file mode 100644 index 000000000..fbe97b853 --- /dev/null +++ b/hw/bsp/lpc11/boards/lpcxpresso11u68/board.mk @@ -0,0 +1,18 @@ +MCU = 11u6x +MCU_DRV = 11u6x + +CFLAGS += \ + -DCORE_M0PLUS \ + -D__VTOR_PRESENT=0 \ + -DCFG_TUSB_MEM_SECTION='__attribute__((section(".data.$$RAM3")))' \ + -DCFG_TUSB_MEM_ALIGN='__attribute__((aligned(64)))' + +# All source paths should be relative to the top level. +LD_FILE = $(BOARD_PATH)/lpc11u68.ld + +# For flash-jlink target +JLINK_DEVICE = LPC11U68 +PYOCD_TARGET = lpc11u68 + +# flash using pyocd +flash: flash-pyocd diff --git a/hw/bsp/lpcxpresso11u68/lpc11u68.ld b/hw/bsp/lpc11/boards/lpcxpresso11u68/lpc11u68.ld similarity index 100% rename from hw/bsp/lpcxpresso11u68/lpc11u68.ld rename to hw/bsp/lpc11/boards/lpcxpresso11u68/lpc11u68.ld diff --git a/hw/bsp/lpcxpresso11u68/lpcxpresso11u68.c b/hw/bsp/lpc11/boards/lpcxpresso11u68/lpcxpresso11u68.c similarity index 99% rename from hw/bsp/lpcxpresso11u68/lpcxpresso11u68.c rename to hw/bsp/lpc11/boards/lpcxpresso11u68/lpcxpresso11u68.c index a04e43867..44d091511 100644 --- a/hw/bsp/lpcxpresso11u68/lpcxpresso11u68.c +++ b/hw/bsp/lpc11/boards/lpcxpresso11u68/lpcxpresso11u68.c @@ -25,7 +25,7 @@ */ #include "chip.h" -#include "../board.h" +#include "bsp/board.h" //--------------------------------------------------------------------+ // Forward USB interrupt events to TinyUSB IRQ Handler diff --git a/hw/bsp/lpc11/family.mk b/hw/bsp/lpc11/family.mk new file mode 100644 index 000000000..eb427c09d --- /dev/null +++ b/hw/bsp/lpc11/family.mk @@ -0,0 +1,43 @@ +DEPS_SUBMODULES += hw/mcu/nxp/lpcopen + +MCU_DIR = hw/mcu/nxp/lpcopen/lpc$(MCU)/lpc_chip_$(MCU) +include $(TOP)/$(BOARD_PATH)/board.mk + +CFLAGS += \ + -flto \ + -mthumb \ + -mabi=aapcs \ + -mcpu=cortex-m0plus \ + -nostdlib \ + -D__USE_LPCOPEN \ + -DCFG_TUSB_MCU=OPT_MCU_LPC11UXX \ + -DCFG_TUSB_MEM_ALIGN='__attribute__((aligned(64)))' + +SRC_C += \ + src/portable/nxp/lpc_ip3511/dcd_lpc_ip3511.c \ + $(MCU_DIR)/../gcc/cr_startup_lpc$(MCU_DRV).c \ + $(MCU_DIR)/src/chip_$(MCU_DRV).c \ + $(MCU_DIR)/src/clock_$(MCU_DRV).c \ + $(MCU_DIR)/src/iocon_$(MCU_DRV).c \ + $(MCU_DIR)/src/sysinit_$(MCU_DRV).c + +ifeq ($(MCU),11u6x) +SRC_C += \ + $(MCU_DIR)/src/gpio_$(MCU_DRV).c \ + $(MCU_DIR)/src/syscon_$(MCU_DRV).c \ + +else + +SRC_C += \ + $(MCU_DIR)/src/gpio_$(MCU_DRV)_1.c \ + $(MCU_DIR)/src/sysctl_$(MCU_DRV).c +endif + +INC += \ + $(TOP)/$(MCU_DIR)/inc + +# For freeRTOS port source +FREERTOS_PORTABLE_SRC = $(FREERTOS_PORTABLE_PATH)/ARM_CM0 + +# For flash-jlink target +JLINK_DEVICE = LPC11U68 diff --git a/hw/bsp/lpcxpresso11u37/board.mk b/hw/bsp/lpcxpresso11u37/board.mk deleted file mode 100644 index 61e5eda7e..000000000 --- a/hw/bsp/lpcxpresso11u37/board.mk +++ /dev/null @@ -1,46 +0,0 @@ -DEPS_SUBMODULES += hw/mcu/nxp/lpcopen - -CFLAGS += \ - -flto \ - -mthumb \ - -mabi=aapcs \ - -mcpu=cortex-m0 \ - -nostdlib \ - -DCORE_M0 \ - -D__USE_LPCOPEN \ - -DCFG_EXAMPLE_MSC_READONLY \ - -DCFG_EXAMPLE_VIDEO_READONLY \ - -DCFG_TUSB_MCU=OPT_MCU_LPC11UXX \ - -DCFG_TUSB_MEM_SECTION='__attribute__((section(".data.$$RAM2")))' \ - -DCFG_TUSB_MEM_ALIGN='__attribute__((aligned(64)))' - -# mcu driver cause following warnings -CFLAGS += -Wno-error=strict-prototypes -Wno-error=unused-parameter -Wno-error=redundant-decls - -MCU_DIR = hw/mcu/nxp/lpcopen/lpc11uxx/lpc_chip_11uxx - -# All source paths should be relative to the top level. -LD_FILE = hw/bsp/$(BOARD)/lpc11u37.ld - -SRC_C += \ - src/portable/nxp/lpc_ip3511/dcd_lpc_ip3511.c \ - $(MCU_DIR)/../gcc/cr_startup_lpc11xx.c \ - $(MCU_DIR)/src/chip_11xx.c \ - $(MCU_DIR)/src/clock_11xx.c \ - $(MCU_DIR)/src/gpio_11xx_1.c \ - $(MCU_DIR)/src/iocon_11xx.c \ - $(MCU_DIR)/src/sysctl_11xx.c \ - $(MCU_DIR)/src/sysinit_11xx.c - -INC += \ - $(TOP)/$(MCU_DIR)/inc - -# For freeRTOS port source -FREERTOS_PORTABLE_SRC = $(FREERTOS_PORTABLE_PATH)/ARM_CM0 - -# For flash-jlink target -JLINK_DEVICE = LPC11U37/401 - -# flash using pyocd -flash: $(BUILD)/$(PROJECT).hex - pyocd flash -t lpc11u37 $< diff --git a/hw/bsp/lpcxpresso11u68/board.mk b/hw/bsp/lpcxpresso11u68/board.mk deleted file mode 100644 index cd6ad3617..000000000 --- a/hw/bsp/lpcxpresso11u68/board.mk +++ /dev/null @@ -1,42 +0,0 @@ -DEPS_SUBMODULES += hw/mcu/nxp/lpcopen - -CFLAGS += \ - -flto \ - -mthumb \ - -mabi=aapcs \ - -mcpu=cortex-m0plus \ - -nostdlib \ - -DCORE_M0PLUS \ - -D__VTOR_PRESENT=0 \ - -D__USE_LPCOPEN \ - -DCFG_TUSB_MCU=OPT_MCU_LPC11UXX \ - -DCFG_TUSB_MEM_SECTION='__attribute__((section(".data.$$RAM3")))' \ - -DCFG_TUSB_MEM_ALIGN='__attribute__((aligned(64)))' - -MCU_DIR = hw/mcu/nxp/lpcopen/lpc11u6x/lpc_chip_11u6x - -# All source paths should be relative to the top level. -LD_FILE = hw/bsp/$(BOARD)/lpc11u68.ld - -SRC_C += \ - src/portable/nxp/lpc_ip3511/dcd_lpc_ip3511.c \ - $(MCU_DIR)/../gcc/cr_startup_lpc11u6x.c \ - $(MCU_DIR)/src/chip_11u6x.c \ - $(MCU_DIR)/src/clock_11u6x.c \ - $(MCU_DIR)/src/gpio_11u6x.c \ - $(MCU_DIR)/src/iocon_11u6x.c \ - $(MCU_DIR)/src/syscon_11u6x.c \ - $(MCU_DIR)/src/sysinit_11u6x.c - -INC += \ - $(TOP)/$(MCU_DIR)/inc - -# For freeRTOS port source -FREERTOS_PORTABLE_SRC = $(FREERTOS_PORTABLE_PATH)/ARM_CM0 - -# For flash-jlink target -JLINK_DEVICE = LPC11U68 - -# flash using pyocd -flash: $(BUILD)/$(PROJECT).hex - pyocd flash -t lpc11u68 $<