summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorhathach <[email protected]>2021-04-28 15:58:43 +0700
committerhathach <[email protected]>2021-04-28 16:13:43 +0700
commit3da76ae4495cc16a4eed5882122efad696e2270c (patch)
tree0ffb07b78abd7d4fca4b32e599df9807a1b2bf7e
parent33f713f5ef36f0db3e5d331f29fed6b182cc37a9 (diff)
making new family lpc54
-rw-r--r--hw/bsp/lpc54/boards/lpcxpresso54114/board.mk11
-rw-r--r--hw/bsp/lpc54/family.c (renamed from hw/bsp/lpcxpresso54114/lpcxpresso54114.c)36
-rw-r--r--hw/bsp/lpc54/family.mk (renamed from hw/bsp/lpcxpresso54114/board.mk)14
-rw-r--r--hw/bsp/lpc55/family.c26
4 files changed, 45 insertions, 42 deletions
diff --git a/hw/bsp/lpc54/boards/lpcxpresso54114/board.mk b/hw/bsp/lpc54/boards/lpcxpresso54114/board.mk
new file mode 100644
index 000000000..33e1a6dc0
--- /dev/null
+++ b/hw/bsp/lpc54/boards/lpcxpresso54114/board.mk
@@ -0,0 +1,11 @@
+MCU_VARIANT = LPC55S69
+MCU_CORE = LPC55S69_cm33_core0
+
+CFLAGS += -DCPU_LPC54114J256BD64_cm4
+LD_FILE = $(MCU_DIR)/gcc/LPC54114J256_cm4_flash.ld
+
+JLINK_DEVICE = LPC54114J256_M4
+PYOCD_TARGET = LPC54114
+
+# flash using pyocd
+flash: flash-pyocd
diff --git a/hw/bsp/lpcxpresso54114/lpcxpresso54114.c b/hw/bsp/lpc54/family.c
index 3bccc4bd7..ead69cef2 100644
--- a/hw/bsp/lpcxpresso54114/lpcxpresso54114.c
+++ b/hw/bsp/lpc54/family.c
@@ -31,14 +31,6 @@
#include "fsl_iocon.h"
//--------------------------------------------------------------------+
-// Forward USB interrupt events to TinyUSB IRQ Handler
-//--------------------------------------------------------------------+
-void USB0_IRQHandler(void)
-{
- tud_int_handler(0);
-}
-
-//--------------------------------------------------------------------+
// MACRO TYPEDEF CONSTANT ENUM
//--------------------------------------------------------------------+
#define LED_PORT 0
@@ -50,16 +42,24 @@ void USB0_IRQHandler(void)
#define BUTTON_PIN 24
// IOCON pin mux
-#define IOCON_PIO_DIGITAL_EN 0x80u /*!<@brief Enables digital function */
+#define IOCON_PIO_DIGITAL_EN 0x80u // Enables digital function
#define IOCON_PIO_FUNC0 0x00u
-#define IOCON_PIO_FUNC1 0x01u /*!<@brief Selects pin function 1 */
-#define IOCON_PIO_FUNC7 0x07u /*!<@brief Selects pin function 7 */
-#define IOCON_PIO_INPFILT_OFF 0x0100u /*!<@brief Input filter disabled */
-#define IOCON_PIO_INV_DI 0x00u /*!<@brief Input function is not inverted */
-#define IOCON_PIO_MODE_INACT 0x00u /*!<@brief No addition pin function */
+#define IOCON_PIO_FUNC1 0x01u // Selects pin function 1
+#define IOCON_PIO_FUNC7 0x07u // Selects pin function 7
+#define IOCON_PIO_INPFILT_OFF 0x0100u // Input filter disabled
+#define IOCON_PIO_INV_DI 0x00u // Input function is not inverted
+#define IOCON_PIO_MODE_INACT 0x00u // No addition pin function
#define IOCON_PIO_MODE_PULLUP 0x10u
-#define IOCON_PIO_OPENDRAIN_DI 0x00u /*!<@brief Open drain is disabled */
-#define IOCON_PIO_SLEW_STANDARD 0x00u /*!<@brief Standard mode, output slew rate control is enabled */
+#define IOCON_PIO_OPENDRAIN_DI 0x00u // Open drain is disabled
+#define IOCON_PIO_SLEW_STANDARD 0x00u // Standard mode, output slew rate control is enabled
+
+//--------------------------------------------------------------------+
+// Forward USB interrupt events to TinyUSB IRQ Handler
+//--------------------------------------------------------------------+
+void USB0_IRQHandler(void)
+{
+ tud_int_handler(0);
+}
/****************************************************************
name: BOARD_BootClockFROHF96M
@@ -104,10 +104,10 @@ void board_init(void)
// Init 96 MHz clock
BootClockFROHF96M();
-#if CFG_TUSB_OS == OPT_OS_NONE
// 1ms tick timer
SysTick_Config(SystemCoreClock / 1000);
-#elif CFG_TUSB_OS == OPT_OS_FREERTOS
+
+#if CFG_TUSB_OS == OPT_OS_FREERTOS
// If freeRTOS is used, IRQ priority is limit by max syscall ( smaller is higher )
NVIC_SetPriority(USB0_IRQn, configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY );
#endif
diff --git a/hw/bsp/lpcxpresso54114/board.mk b/hw/bsp/lpc54/family.mk
index b6bc07615..969d1ae2a 100644
--- a/hw/bsp/lpcxpresso54114/board.mk
+++ b/hw/bsp/lpc54/family.mk
@@ -1,5 +1,7 @@
DEPS_SUBMODULES += hw/mcu/nxp
+include $(TOP)/$(BOARD_PATH)/board.mk
+
CFLAGS += \
-flto \
-mthumb \
@@ -7,7 +9,6 @@ CFLAGS += \
-mcpu=cortex-m4 \
-mfloat-abi=hard \
-mfpu=fpv4-sp-d16 \
- -DCPU_LPC54114J256BD64_cm4 \
-DCFG_TUSB_MCU=OPT_MCU_LPC54XXX \
-DCFG_TUSB_MEM_SECTION='__attribute__((section(".data")))' \
-DCFG_TUSB_MEM_ALIGN='__attribute__((aligned(64)))'
@@ -17,9 +18,6 @@ CFLAGS += -Wno-error=unused-parameter
MCU_DIR = hw/mcu/nxp/sdk/devices/LPC54114
-# All source paths should be relative to the top level.
-LD_FILE = $(MCU_DIR)/gcc/LPC54114J256_cm4_flash.ld
-
SRC_C += \
src/portable/nxp/lpc_ip3511/dcd_lpc_ip3511.c \
$(MCU_DIR)/system_LPC54114_cm4.c \
@@ -29,6 +27,7 @@ SRC_C += \
$(MCU_DIR)/drivers/fsl_reset.c
INC += \
+ $(TOP)/$(BOARD_PATH) \
$(TOP)/$(MCU_DIR)/../../CMSIS/Include \
$(TOP)/$(MCU_DIR) \
$(TOP)/$(MCU_DIR)/drivers
@@ -39,10 +38,3 @@ LIBS += $(TOP)/$(MCU_DIR)/gcc/libpower_cm4_hardabi.a
# For freeRTOS port source
FREERTOS_PORT = ARM_CM4F
-
-# For flash-jlink target
-JLINK_DEVICE = LPC54114J256_M4
-
-# flash using pyocd
-flash: $(BUILD)/$(PROJECT).hex
- pyocd flash -t LPC54114 $<
diff --git a/hw/bsp/lpc55/family.c b/hw/bsp/lpc55/family.c
index 890c2f5c5..4fc1f6222 100644
--- a/hw/bsp/lpc55/family.c
+++ b/hw/bsp/lpc55/family.c
@@ -39,20 +39,20 @@
//--------------------------------------------------------------------+
// IOCON pin mux
-#define IOCON_PIO_DIGITAL_EN 0x0100u /*!<@brief Enables digital function */
-#define IOCON_PIO_FUNC0 0x00u /*!<@brief Selects pin function 0 */
-#define IOCON_PIO_FUNC1 0x01u /*!<@brief Selects pin function 1 */
-#define IOCON_PIO_FUNC4 0x04u /*!<@brief Selects pin function 4 */
-#define IOCON_PIO_FUNC7 0x07u /*!<@brief Selects pin function 7 */
-#define IOCON_PIO_INV_DI 0x00u /*!<@brief Input function is not inverted */
-#define IOCON_PIO_MODE_INACT 0x00u /*!<@brief No addition pin function */
-#define IOCON_PIO_OPENDRAIN_DI 0x00u /*!<@brief Open drain is disabled */
-#define IOCON_PIO_SLEW_STANDARD 0x00u /*!<@brief Standard mode, output slew rate control is enabled */
+#define IOCON_PIO_DIGITAL_EN 0x0100u // Enables digital function
+#define IOCON_PIO_FUNC0 0x00u // Selects pin function 0
+#define IOCON_PIO_FUNC1 0x01u // Selects pin function 1
+#define IOCON_PIO_FUNC4 0x04u // Selects pin function 4
+#define IOCON_PIO_FUNC7 0x07u // Selects pin function 7
+#define IOCON_PIO_INV_DI 0x00u // Input function is not inverted
+#define IOCON_PIO_MODE_INACT 0x00u // No addition pin function
+#define IOCON_PIO_OPENDRAIN_DI 0x00u // Open drain is disabled
+#define IOCON_PIO_SLEW_STANDARD 0x00u // Standard mode, output slew rate control is enabled
-#define IOCON_PIO_DIG_FUNC0_EN (IOCON_PIO_DIGITAL_EN | IOCON_PIO_FUNC0) /*!<@brief Digital pin function 0 enabled */
-#define IOCON_PIO_DIG_FUNC1_EN (IOCON_PIO_DIGITAL_EN | IOCON_PIO_FUNC1) /*!<@brief Digital pin function 1 enabled */
-#define IOCON_PIO_DIG_FUNC4_EN (IOCON_PIO_DIGITAL_EN | IOCON_PIO_FUNC4) /*!<@brief Digital pin function 2 enabled */
-#define IOCON_PIO_DIG_FUNC7_EN (IOCON_PIO_DIGITAL_EN | IOCON_PIO_FUNC7) /*!<@brief Digital pin function 2 enabled */
+#define IOCON_PIO_DIG_FUNC0_EN (IOCON_PIO_DIGITAL_EN | IOCON_PIO_FUNC0) // Digital pin function 0 enabled
+#define IOCON_PIO_DIG_FUNC1_EN (IOCON_PIO_DIGITAL_EN | IOCON_PIO_FUNC1) // Digital pin function 1 enabled
+#define IOCON_PIO_DIG_FUNC4_EN (IOCON_PIO_DIGITAL_EN | IOCON_PIO_FUNC4) // Digital pin function 2 enabled
+#define IOCON_PIO_DIG_FUNC7_EN (IOCON_PIO_DIGITAL_EN | IOCON_PIO_FUNC7) // Digital pin function 2 enabled
//--------------------------------------------------------------------+
// Forward USB interrupt events to TinyUSB IRQ Handler