Ver Fonte

added lpcxpresso 55s28

hathach há 5 anos atrás
pai
commit
e9059b5d84

+ 2 - 1
hw/bsp/lpc55/boards/double_m33_express/board.mk

@@ -1,4 +1,5 @@
-MCU_VARIANT = LPC55S69_cm33_core0
+MCU_VARIANT = LPC55S69
+MCU_CORE = LPC55S69_cm33_core0
 
 CFLAGS += -DCPU_LPC55S69JBD100_cm33_core0
 LD_FILE = $(BOARD_PATH)/LPC55S69_cm33_core0_uf2.ld

+ 53 - 0
hw/bsp/lpc55/boards/lpcxpresso55s28/board.h

@@ -0,0 +1,53 @@
+/*
+ * The MIT License (MIT)
+ *
+ * Copyright (c) 2021, Ha Thach (tinyusb.org)
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ *
+ * This file is part of the TinyUSB stack.
+ */
+
+#ifndef BOARD_H_
+#define BOARD_H_
+
+#ifdef __cplusplus
+ extern "C" {
+#endif
+
+// LED
+#define LED_PORT              1
+#define LED_PIN               6
+#define LED_STATE_ON          0
+
+// WAKE button
+#define BUTTON_PORT           1
+#define BUTTON_PIN            18
+#define BUTTON_STATE_ACTIVE   0
+
+// UART
+//#define UART_DEV              USART0
+//#define UART_RX_PINMUX        0U, 29U, IOCON_PIO_DIG_FUNC1_EN
+//#define UART_TX_PINMUX        0U, 30U, IOCON_PIO_DIG_FUNC1_EN
+
+#ifdef __cplusplus
+ }
+#endif
+
+#endif

+ 10 - 0
hw/bsp/lpc55/boards/lpcxpresso55s28/board.mk

@@ -0,0 +1,10 @@
+MCU_VARIANT = LPC55S28
+MCU_CORE = LPC55S28
+
+CFLAGS += -DCPU_LPC55S28JBD100
+
+JLINK_DEVICE = LPC55S28
+PYOCD_TARGET = LPC55S28
+
+# flash using pyocd
+flash: flash-pyocd

+ 2 - 1
hw/bsp/lpc55/boards/lpcxpresso55s69/board.mk

@@ -1,4 +1,5 @@
-MCU_VARIANT = LPC55S69_cm33_core0
+MCU_VARIANT = LPC55S69
+MCU_CORE = LPC55S69_cm33_core0
 
 CFLAGS += -DCPU_LPC55S69JBD100_cm33_core0
 

+ 16 - 5
hw/bsp/lpc55/family.mk

@@ -2,6 +2,9 @@ UF2_FAMILY_ID = 0x2abc77ec
 
 include $(TOP)/$(BOARD_PATH)/board.mk
 
+# TODO change Default to Highspeed PORT1
+PORT ?= 0
+
 CFLAGS += \
   -flto \
   -mthumb \
@@ -11,18 +14,26 @@ CFLAGS += \
   -mfpu=fpv5-sp-d16 \
   -DCFG_TUSB_MCU=OPT_MCU_LPC55XX \
   -DCFG_TUSB_MEM_SECTION='__attribute__((section(".data")))' \
-  -DCFG_TUSB_MEM_ALIGN='__attribute__((aligned(64)))'
+  -DCFG_TUSB_MEM_ALIGN='__attribute__((aligned(64)))' \
+  -DBOARD_DEVICE_RHPORT_NUM=$(PORT)
+
+ifeq ($(PORT), 1)
+  CFLAGS += -DBOARD_DEVICE_RHPORT_SPEED=OPT_MODE_HIGH_SPEED
+  $(info "PORT1 High Speed")
+else
+  $(info "PORT0 Full Speed")
+endif
 
 # mcu driver cause following warnings
 CFLAGS += -Wno-error=unused-parameter -Wno-error=float-equal
 
-MCU_DIR = hw/mcu/nxp/sdk/devices/LPC55S69
+MCU_DIR = hw/mcu/nxp/sdk/devices/$(MCU_VARIANT)
 
 # All source paths should be relative to the top level.
-LD_FILE ?= $(MCU_DIR)/gcc/$(MCU_VARIANT)_flash.ld
+LD_FILE ?= $(MCU_DIR)/gcc/$(MCU_CORE)_flash.ld
 
 SRC_C += \
-	$(MCU_DIR)/system_$(MCU_VARIANT).c \
+	$(MCU_DIR)/system_$(MCU_CORE).c \
 	$(MCU_DIR)/drivers/fsl_clock.c \
 	$(MCU_DIR)/drivers/fsl_gpio.c \
 	$(MCU_DIR)/drivers/fsl_power.c \
@@ -38,7 +49,7 @@ INC += \
 	$(TOP)/$(MCU_DIR) \
 	$(TOP)/$(MCU_DIR)/drivers
 
-SRC_S += $(MCU_DIR)/gcc/startup_$(MCU_VARIANT).S
+SRC_S += $(MCU_DIR)/gcc/startup_$(MCU_CORE).S
 
 LIBS += $(TOP)/$(MCU_DIR)/gcc/libpower_hardabi.a