Просмотр исходного кода

move tm4c132 into bsp family, add it into ci

hathach 4 лет назад
Родитель
Сommit
17ef1503c8

+ 1 - 0
.github/workflows/build_arm.yml

@@ -58,6 +58,7 @@ jobs:
         - 'stm32f7'
         - 'stm32h7'
         - 'stm32l4'
+        - 'tm4c123'
         - 'xmc4000'
     steps:
     - name: Setup Python

+ 52 - 0
hw/bsp/tm4c123/boards/ek-tm4c123gxl/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
+
+#define BOARD_UART            UART0
+#define BOARD_UART_PORT       GPIOA
+
+#define BOARD_BTN_PORT        GPIOF
+#define BOARD_BTN             4
+#define BOARD_BTN_Msk         (1u<<4)
+#define BUTTON_STATE_ACTIVE   0
+
+#define LED_PORT              GPIOF
+#define LED_PIN_RED           1
+#define LED_PIN_BLUE          2
+#define LED_PIN_GREEN         3
+#define LED_STATE_ON          1
+
+#ifdef __cplusplus
+ }
+#endif
+
+#endif

+ 11 - 0
hw/bsp/tm4c123/boards/ek-tm4c123gxl/board.mk

@@ -0,0 +1,11 @@
+CFLAGS += -DTM4C123GH6PM
+ 
+LD_FILE = $(BOARD_PATH)/tm4c123.ld
+
+# For flash-jlink target
+JLINK_DEVICE = TM4C123GH6PM
+
+# flash using openocd
+OPENOCD_OPTION = -f board/ti_ek-tm4c123gxl.cfg
+
+flash: flash-openocd

+ 0 - 0
hw/bsp/ek-tm4c123gxl/tm4c123.ld → hw/bsp/tm4c123/boards/ek-tm4c123gxl/tm4c123.ld


+ 3 - 16
hw/bsp/ek-tm4c123gxl/tm4c123gxl.c → hw/bsp/tm4c123/family.c

@@ -1,19 +1,6 @@
-#include <TM4C123.h>
-#include <board.h>
-
-#define BOARD_UART            UART0
-#define BOARD_UART_PORT       GPIOA
-
-#define BOARD_BTN_PORT        GPIOF
-#define BOARD_BTN             4
-#define BOARD_BTN_Msk         (1u<<4)
-#define BUTTON_STATE_ACTIVE   0
-
-#define LED_PORT              GPIOF
-#define LED_PIN_RED           1
-#define LED_PIN_BLUE          2
-#define LED_PIN_GREEN         3
-#define LED_STATE_ON          1
+#include "TM4C123.h"
+#include "bsp/board.h"
+#include "board.h"
 
 //--------------------------------------------------------------------+
 // Forward USB interrupt events to TinyUSB IRQ Handler

+ 3 - 8
hw/bsp/ek-tm4c123gxl/board.mk → hw/bsp/tm4c123/family.mk

@@ -1,5 +1,7 @@
 DEPS_SUBMODULES += hw/mcu/ti
 
+include $(TOP)/$(BOARD_PATH)/board.mk
+
 CFLAGS += \
   -flto \
   -mthumb \
@@ -22,7 +24,7 @@ LD_FILE = $(BOARD_PATH)/tm4c123.ld
 INC += \
 	$(TOP)/$(MCU_DIR)/CMSIS/5.7.0/CMSIS/Include \
 	$(TOP)/$(MCU_DIR)/Include/TM4C123 \
-	$(TOP)/hw/bsp
+	$(TOP)/$(BOARD_PATH)
 
 SRC_C += \
 	src/portable/mentor/musb/dcd_musb.c \
@@ -31,10 +33,3 @@ SRC_C += \
 
 # For freeRTOS port source
 FREERTOS_PORT = ARM_CM4F
-
-# For flash-jlink target
-JLINK_DEVICE = TM4C123GH6PM
-
-# flash using openocd
-OPENOCD_OPTION = -f board/ti_ek-tm4c123gxl.cfg
-flash: flash-openocd