diff --git a/.github/workflows/build_arm.yml b/.github/workflows/build_arm.yml index cf9246d52..e4d64826e 100644 --- a/.github/workflows/build_arm.yml +++ b/.github/workflows/build_arm.yml @@ -58,6 +58,7 @@ jobs: - 'stm32f7' - 'stm32h7' - 'stm32l4' + - 'tm4c123' - 'xmc4000' steps: - name: Setup Python diff --git a/hw/bsp/tm4c123/boards/ek-tm4c123gxl/board.h b/hw/bsp/tm4c123/boards/ek-tm4c123gxl/board.h new file mode 100644 index 000000000..5732056ae --- /dev/null +++ b/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 diff --git a/hw/bsp/tm4c123/boards/ek-tm4c123gxl/board.mk b/hw/bsp/tm4c123/boards/ek-tm4c123gxl/board.mk new file mode 100644 index 000000000..d60365d1d --- /dev/null +++ b/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 diff --git a/hw/bsp/ek-tm4c123gxl/tm4c123.ld b/hw/bsp/tm4c123/boards/ek-tm4c123gxl/tm4c123.ld similarity index 100% rename from hw/bsp/ek-tm4c123gxl/tm4c123.ld rename to hw/bsp/tm4c123/boards/ek-tm4c123gxl/tm4c123.ld diff --git a/hw/bsp/ek-tm4c123gxl/tm4c123gxl.c b/hw/bsp/tm4c123/family.c similarity index 91% rename from hw/bsp/ek-tm4c123gxl/tm4c123gxl.c rename to hw/bsp/tm4c123/family.c index 663fbf127..048832dc9 100644 --- a/hw/bsp/ek-tm4c123gxl/tm4c123gxl.c +++ b/hw/bsp/tm4c123/family.c @@ -1,19 +1,6 @@ -#include -#include - -#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 diff --git a/hw/bsp/ek-tm4c123gxl/board.mk b/hw/bsp/tm4c123/family.mk similarity index 81% rename from hw/bsp/ek-tm4c123gxl/board.mk rename to hw/bsp/tm4c123/family.mk index 9d0d67e1c..9665a2d7d 100644 --- a/hw/bsp/ek-tm4c123gxl/board.mk +++ b/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