hathach пре 5 година
родитељ
комит
3da76ae449
4 измењених фајлова са 46 додато и 43 уклоњено
  1. 11 0
      hw/bsp/lpc54/boards/lpcxpresso54114/board.mk
  2. 18 18
      hw/bsp/lpc54/family.c
  3. 3 11
      hw/bsp/lpc54/family.mk
  4. 14 14
      hw/bsp/lpc55/family.c

+ 11 - 0
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

+ 18 - 18
hw/bsp/lpcxpresso54114/lpcxpresso54114.c → hw/bsp/lpc54/family.c

@@ -30,14 +30,6 @@
 #include "fsl_power.h"
 #include "fsl_iocon.h"
 
-//--------------------------------------------------------------------+
-// Forward USB interrupt events to TinyUSB IRQ Handler
-//--------------------------------------------------------------------+
-void USB0_IRQHandler(void)
-{
-  tud_int_handler(0);
-}
-
 //--------------------------------------------------------------------+
 // MACRO TYPEDEF CONSTANT ENUM
 //--------------------------------------------------------------------+
@@ -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

+ 3 - 11
hw/bsp/lpcxpresso54114/board.mk → 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 $<

+ 14 - 14
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_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_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) // 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