summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorhathach <[email protected]>2021-03-03 16:03:21 +0700
committerhathach <[email protected]>2021-03-03 16:03:21 +0700
commit0dc1a3d3afbde34274e6883aadcac06dba4a2579 (patch)
tree2789ae2885f342cabca1a97820a3dccb18d1e8b6
parent7b162ec93f57426a26b351512f2f05156b8fa8b1 (diff)
add lpc18 family
-rw-r--r--hw/bsp/lpc18/boards/mcb1800/board.h52
-rw-r--r--hw/bsp/lpc18/boards/mcb1800/board.mk4
-rw-r--r--hw/bsp/lpc18/boards/mcb1800/lpc1857.ld (renamed from hw/bsp/mcb1800/lpc1857.ld)0
-rw-r--r--hw/bsp/lpc18/family.c (renamed from hw/bsp/mcb1800/mcb1800.c)16
-rw-r--r--hw/bsp/lpc18/family.mk (renamed from hw/bsp/mcb1800/board.mk)11
5 files changed, 63 insertions, 20 deletions
diff --git a/hw/bsp/lpc18/boards/mcb1800/board.h b/hw/bsp/lpc18/boards/mcb1800/board.h
new file mode 100644
index 000000000..d690b69d9
--- /dev/null
+++ b/hw/bsp/lpc18/boards/mcb1800/board.h
@@ -0,0 +1,52 @@
+/*
+ * 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
+
+// PD_10
+#define LED_PORT 6
+#define LED_PIN 24
+
+// P4_0
+#define BUTTON_PORT 2
+#define BUTTON_PIN 0
+
+#define UART_DEV LPC_USART3
+#define UART_PORT 0x02
+#define UART_PIN_TX 3
+#define UART_PIN_RX 4
+
+
+#ifdef __cplusplus
+ }
+#endif
+
+#endif
diff --git a/hw/bsp/lpc18/boards/mcb1800/board.mk b/hw/bsp/lpc18/boards/mcb1800/board.mk
new file mode 100644
index 000000000..d601c5773
--- /dev/null
+++ b/hw/bsp/lpc18/boards/mcb1800/board.mk
@@ -0,0 +1,4 @@
+LD_FILE = $(BOARD_PATH)/lpc1857.ld
+
+# For flash-jlink target
+JLINK_DEVICE = LPC1857
diff --git a/hw/bsp/mcb1800/lpc1857.ld b/hw/bsp/lpc18/boards/mcb1800/lpc1857.ld
index 983b41eb0..983b41eb0 100644
--- a/hw/bsp/mcb1800/lpc1857.ld
+++ b/hw/bsp/lpc18/boards/mcb1800/lpc1857.ld
diff --git a/hw/bsp/mcb1800/mcb1800.c b/hw/bsp/lpc18/family.c
index 5256501ed..441e98028 100644
--- a/hw/bsp/mcb1800/mcb1800.c
+++ b/hw/bsp/lpc18/family.c
@@ -25,7 +25,8 @@
*/
#include "chip.h"
-#include "../board.h"
+#include "bsp/board.h"
+#include "board.h"
//--------------------------------------------------------------------+
// USB Interrupt Handler
@@ -56,19 +57,6 @@ void USB1_IRQHandler(void)
// MACRO TYPEDEF CONSTANT ENUM DECLARATION
//--------------------------------------------------------------------+
-// PD_10
-#define LED_PORT 6
-#define LED_PIN 24
-
-// P4_0
-#define BUTTON_PORT 2
-#define BUTTON_PIN 0
-
-#define UART_DEV LPC_USART3
-#define UART_PORT 0x02
-#define UART_PIN_TX 3
-#define UART_PIN_RX 4
-
/* System configuration variables used by chip driver */
const uint32_t OscRateIn = 12000000;
diff --git a/hw/bsp/mcb1800/board.mk b/hw/bsp/lpc18/family.mk
index f8fd25800..9d10d4c7e 100644
--- a/hw/bsp/mcb1800/board.mk
+++ b/hw/bsp/lpc18/family.mk
@@ -1,3 +1,7 @@
+FAMILY_SUBMODULES = hw/mcu/nxp
+
+include $(TOP)/$(BOARD_PATH)/board.mk
+
CFLAGS += \
-flto \
-mthumb \
@@ -13,9 +17,6 @@ CFLAGS += -Wno-error=unused-parameter -Wno-error=strict-prototypes
MCU_DIR = hw/mcu/nxp/lpcopen/lpc18xx/lpc_chip_18xx
-# All source paths should be relative to the top level.
-LD_FILE = hw/bsp/$(BOARD)/lpc1857.ld
-
SRC_C += \
$(MCU_DIR)/../gcc/cr_startup_lpc18xx.c \
$(MCU_DIR)/src/chip_18xx_43xx.c \
@@ -25,6 +26,7 @@ SRC_C += \
$(MCU_DIR)/src/uart_18xx_43xx.c
INC += \
+ $(TOP)/$(BOARD_PATH) \
$(TOP)/$(MCU_DIR)/inc \
$(TOP)/$(MCU_DIR)/inc/config_18xx
@@ -35,8 +37,5 @@ CHIP_FAMILY = transdimension
# For freeRTOS port source
FREERTOS_PORT = ARM_CM3
-# For flash-jlink target
-JLINK_DEVICE = LPC1857
-
# flash using jlink
flash: flash-jlink