add flash-openocd target. correct ek-tm4c123 button state
This commit is contained in:
parent
23e6e0ef33
commit
91646d039c
|
@ -12,3 +12,10 @@ ATTRS{idVendor}=="cafe", MODE="0666", GROUP="dialout"
|
||||||
|
|
||||||
# Rule to blacklist TinyUSB example from being manipulated by ModemManager.
|
# Rule to blacklist TinyUSB example from being manipulated by ModemManager.
|
||||||
SUBSYSTEMS=="usb", ATTRS{idVendor}=="cafe", ENV{ID_MM_DEVICE_IGNORE}="1"
|
SUBSYSTEMS=="usb", ATTRS{idVendor}=="cafe", ENV{ID_MM_DEVICE_IGNORE}="1"
|
||||||
|
|
||||||
|
# Xplained Pro SamG55 Device
|
||||||
|
SUBSYSTEMS=="usb", ATTRS{idVendor}=="03eb", ATTRS{idProduct}=="2111", MODE="0666", GROUP="users", ENV{ID_MM_DEVICE_IGNORE}="1"
|
||||||
|
SUBSYSTEMS=="tty", ATTRS{idVendor}=="03eb", ATTRS{idProduct}=="2111", MODE="0666", GROUP="users", ENV{ID_MM_DEVICE_IGNORE}="1"
|
||||||
|
|
||||||
|
# TI Stellaris/Tiva-C Launchpad ICDI
|
||||||
|
SUBSYSTEM=="usb", ATTRS{idVendor}=="1cbe", ATTRS{idProduct}=="00fd", MODE="0666"
|
||||||
|
|
|
@ -158,13 +158,14 @@ endif
|
||||||
# Flash Targets
|
# Flash Targets
|
||||||
# ---------------------------------------
|
# ---------------------------------------
|
||||||
|
|
||||||
# Flash binary using Jlink
|
# Jlink binary
|
||||||
ifeq ($(OS),Windows_NT)
|
ifeq ($(OS),Windows_NT)
|
||||||
JLINKEXE = JLink.exe
|
JLINKEXE = JLink.exe
|
||||||
else
|
else
|
||||||
JLINKEXE = JLinkExe
|
JLINKEXE = JLinkExe
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
# Jlink Interface
|
||||||
JLINK_IF ?= swd
|
JLINK_IF ?= swd
|
||||||
|
|
||||||
# Flash using jlink
|
# Flash using jlink
|
||||||
|
@ -177,18 +178,22 @@ flash-jlink: $(BUILD)/$(PROJECT).hex
|
||||||
@echo exit >> $(BUILD)/$(BOARD).jlink
|
@echo exit >> $(BUILD)/$(BOARD).jlink
|
||||||
$(JLINKEXE) -device $(JLINK_DEVICE) -if $(JLINK_IF) -JTAGConf -1,-1 -speed auto -CommandFile $(BUILD)/$(BOARD).jlink
|
$(JLINKEXE) -device $(JLINK_DEVICE) -if $(JLINK_IF) -JTAGConf -1,-1 -speed auto -CommandFile $(BUILD)/$(BOARD).jlink
|
||||||
|
|
||||||
# flash STM32 MCU using stlink with STM32 Cube Programmer CLI
|
# Flash STM32 MCU using stlink with STM32 Cube Programmer CLI
|
||||||
flash-stlink: $(BUILD)/$(PROJECT).elf
|
flash-stlink: $(BUILD)/$(PROJECT).elf
|
||||||
STM32_Programmer_CLI --connect port=swd --write $< --go
|
STM32_Programmer_CLI --connect port=swd --write $< --go
|
||||||
|
|
||||||
# flash with pyocd
|
# Flash using pyocd
|
||||||
PYOCD_OPTION ?=
|
PYOCD_OPTION ?=
|
||||||
flash-pyocd: $(BUILD)/$(PROJECT).hex
|
flash-pyocd: $(BUILD)/$(PROJECT).hex
|
||||||
pyocd flash -t $(PYOCD_TARGET) $(PYOCD_OPTION) $<
|
pyocd flash -t $(PYOCD_TARGET) $(PYOCD_OPTION) $<
|
||||||
pyocd reset -t $(PYOCD_TARGET)
|
pyocd reset -t $(PYOCD_TARGET)
|
||||||
|
|
||||||
# flash with Black Magic Probe
|
# Flash using openocd
|
||||||
|
OPENOCD_OPTION ?=
|
||||||
|
flash-openocd: $(BUILD)/$(PROJECT).elf
|
||||||
|
openocd $(OPENOCD_OPTION) -c "program $< verify reset exit"
|
||||||
|
|
||||||
|
# flash with Black Magic Probe
|
||||||
# This symlink is created by https://github.com/blacksphere/blackmagic/blob/master/driver/99-blackmagic.rules
|
# This symlink is created by https://github.com/blacksphere/blackmagic/blob/master/driver/99-blackmagic.rules
|
||||||
BMP ?= /dev/ttyBmpGdb
|
BMP ?= /dev/ttyBmpGdb
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
|
|
||||||
DEPS_SUBMODULES += hw/mcu/ti
|
DEPS_SUBMODULES += hw/mcu/ti
|
||||||
|
|
||||||
CFLAGS += \
|
CFLAGS += \
|
||||||
|
@ -12,39 +11,29 @@ CFLAGS += \
|
||||||
-uvectors \
|
-uvectors \
|
||||||
-DTM4C123GH6PM
|
-DTM4C123GH6PM
|
||||||
|
|
||||||
# lpc_types.h cause following errors
|
# mcu driver cause following warnings
|
||||||
CFLAGS += -Wno-error=strict-prototypes
|
CFLAGS += -Wno-error=strict-prototypes -Wno-error=cast-qual
|
||||||
|
|
||||||
MCU_DIR=hw/mcu/ti/tm4c123xx/
|
MCU_DIR=hw/mcu/ti/tm4c123xx/
|
||||||
|
|
||||||
CMSIS=$(TOP)/hw/mcu/ti/tm4c123xx/CMSIS/5.7.0/CMSIS/Include
|
|
||||||
|
|
||||||
TI_HDR=$(TOP)/hw/mcu/ti/tm4c123xx/Include/TM4C123/
|
|
||||||
|
|
||||||
# All source paths should be relative to the top level.
|
# All source paths should be relative to the top level.
|
||||||
|
LD_FILE = $(BOARD_PATH)/tm4c123.ld
|
||||||
LD_FILE = hw/bsp/$(BOARD)/tm4c123.ld
|
|
||||||
|
|
||||||
INC += \
|
INC += \
|
||||||
$(CMSIS) \
|
$(TOP)/$(MCU_DIR)/CMSIS/5.7.0/CMSIS/Include \
|
||||||
$(TI_HDR) \
|
$(TOP)/$(MCU_DIR)/Include/TM4C123 \
|
||||||
$(TOP)/hw/bsp
|
$(TOP)/hw/bsp
|
||||||
|
|
||||||
|
|
||||||
SRC_C += \
|
SRC_C += \
|
||||||
$(MCU_DIR)/Source/system_TM4C123.c \
|
$(MCU_DIR)/Source/system_TM4C123.c \
|
||||||
$(MCU_DIR)/Source/GCC/tm4c123_startup.c
|
$(MCU_DIR)/Source/GCC/tm4c123_startup.c
|
||||||
|
|
||||||
# For TinyUSB port source
|
|
||||||
VENDOR = ti
|
|
||||||
CHIP_FAMILY = tm4c123xx
|
|
||||||
|
|
||||||
# For freeRTOS port source
|
# For freeRTOS port source
|
||||||
FREERTOS_PORT = ARM_CM4F
|
FREERTOS_PORT = ARM_CM4F
|
||||||
|
|
||||||
# For flash-jlink target
|
# For flash-jlink target
|
||||||
JLINK_DEVICE = LPC1769
|
JLINK_DEVICE = TM4C123GH6PM
|
||||||
|
|
||||||
# flash using jlink
|
# flash using openocd
|
||||||
flash: $(BUILD)/$(PROJECT).elf
|
OPENOCD_OPTION = -f board/ti_ek-tm4c123gxl.cfg
|
||||||
openocd -f board/ti_ek-tm4c123gxl.cfg -c "program $< verify reset exit"
|
flash: flash-openocd
|
||||||
|
|
|
@ -3,9 +3,12 @@
|
||||||
|
|
||||||
#define BOARD_UART UART0
|
#define BOARD_UART UART0
|
||||||
#define BOARD_UART_PORT GPIOA
|
#define BOARD_UART_PORT GPIOA
|
||||||
|
|
||||||
#define BOARD_BTN_PORT GPIOF
|
#define BOARD_BTN_PORT GPIOF
|
||||||
#define BOARD_BTN 4
|
#define BOARD_BTN 4
|
||||||
#define BOARD_BTN_Msk (1u<<4)
|
#define BOARD_BTN_Msk (1u<<4)
|
||||||
|
#define BUTTON_STATE_ACTIVE 0
|
||||||
|
|
||||||
#define LED_PORT GPIOF
|
#define LED_PORT GPIOF
|
||||||
#define LED_PIN_RED 1
|
#define LED_PIN_RED 1
|
||||||
#define LED_PIN_BLUE 2
|
#define LED_PIN_BLUE 2
|
||||||
|
@ -125,7 +128,8 @@ void board_led_write(bool state)
|
||||||
|
|
||||||
uint32_t board_button_read(void)
|
uint32_t board_button_read(void)
|
||||||
{
|
{
|
||||||
return ReadGPIOPin(BOARD_BTN_PORT, BOARD_BTN_Msk);
|
uint32_t gpio_value = ReadGPIOPin(BOARD_BTN_PORT, BOARD_BTN_Msk);
|
||||||
|
return BUTTON_STATE_ACTIVE ? gpio_value : !gpio_value;
|
||||||
}
|
}
|
||||||
|
|
||||||
int board_uart_write(void const* buf, int len)
|
int board_uart_write(void const* buf, int len)
|
||||||
|
|
Loading…
Reference in New Issue