mirror of
https://github.com/hathach/tinyusb.git
synced 2025-02-07 05:54:11 +08:00
more nuvoton support
- add LED for nutiny nuc 121, 125s, 126v - flash target to use nuvoton's openocd fork
This commit is contained in:
parent
6781d58449
commit
4de9439fb1
@ -51,5 +51,8 @@ FREERTOS_PORT = ARM_CM0
|
|||||||
JLINK_DEVICE = NUC121SC2AE
|
JLINK_DEVICE = NUC121SC2AE
|
||||||
JLINK_IF = swd
|
JLINK_IF = swd
|
||||||
|
|
||||||
# flash using jlink
|
|
||||||
flash: flash-jlink
|
# Flash using Nuvoton's openocd fork at https://github.com/OpenNuvoton/OpenOCD-Nuvoton
|
||||||
|
# Please compile and install it from github source
|
||||||
|
flash: $(BUILD)/$(BOARD)-firmware.elf
|
||||||
|
openocd -f interface/nulink.cfg -f target/numicroM0.cfg -c "program $< verify reset exit"
|
||||||
|
@ -29,6 +29,11 @@
|
|||||||
#include "clk.h"
|
#include "clk.h"
|
||||||
#include "sys.h"
|
#include "sys.h"
|
||||||
|
|
||||||
|
#define LED_PORT PB
|
||||||
|
#define LED_PIN 4
|
||||||
|
#define LED_PIN_IO PB4
|
||||||
|
#define LED_STATE_ON 0
|
||||||
|
|
||||||
void board_init(void)
|
void board_init(void)
|
||||||
{
|
{
|
||||||
/* Unlock protected registers */
|
/* Unlock protected registers */
|
||||||
@ -60,6 +65,9 @@ void board_init(void)
|
|||||||
// 1ms tick timer
|
// 1ms tick timer
|
||||||
SysTick_Config(48000000 / 1000);
|
SysTick_Config(48000000 / 1000);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
// LED
|
||||||
|
GPIO_SetMode(LED_PORT, 1 << LED_PIN, GPIO_MODE_OUTPUT);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if CFG_TUSB_OS == OPT_OS_NONE
|
#if CFG_TUSB_OS == OPT_OS_NONE
|
||||||
@ -81,7 +89,7 @@ uint32_t board_millis(void)
|
|||||||
|
|
||||||
void board_led_write(bool state)
|
void board_led_write(bool state)
|
||||||
{
|
{
|
||||||
(void)(state);
|
LED_PIN_IO = (state ? LED_STATE_ON : (1-LED_STATE_ON));
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t board_button_read(void)
|
uint32_t board_button_read(void)
|
||||||
|
@ -13,7 +13,8 @@ LD_FILE = hw/bsp/nutiny_nuc125s/nuc125_flash.ld
|
|||||||
|
|
||||||
SRC_C += \
|
SRC_C += \
|
||||||
hw/mcu/nuvoton/nuc121_125/Device/Nuvoton/NUC121/Source/system_NUC121.c \
|
hw/mcu/nuvoton/nuc121_125/Device/Nuvoton/NUC121/Source/system_NUC121.c \
|
||||||
hw/mcu/nuvoton/nuc121_125/StdDriver/src/clk.c
|
hw/mcu/nuvoton/nuc121_125/StdDriver/src/clk.c \
|
||||||
|
hw/mcu/nuvoton/nuc121_125/StdDriver/src/gpio.c
|
||||||
|
|
||||||
SRC_S += \
|
SRC_S += \
|
||||||
hw/mcu/nuvoton/nuc121_125/Device/Nuvoton/NUC121/Source/GCC/startup_NUC121.S
|
hw/mcu/nuvoton/nuc121_125/Device/Nuvoton/NUC121/Source/GCC/startup_NUC121.S
|
||||||
@ -34,5 +35,7 @@ FREERTOS_PORT = ARM_CM0
|
|||||||
JLINK_DEVICE = NUC125SC2AE
|
JLINK_DEVICE = NUC125SC2AE
|
||||||
JLINK_IF = swd
|
JLINK_IF = swd
|
||||||
|
|
||||||
# flash using jlink
|
# Flash using Nuvoton's openocd fork at https://github.com/OpenNuvoton/OpenOCD-Nuvoton
|
||||||
flash: flash-jlink
|
# Please compile and install it from github source
|
||||||
|
flash: $(BUILD)/$(BOARD)-firmware.elf
|
||||||
|
openocd -f interface/nulink.cfg -f target/numicroM0.cfg -c "program $< verify reset exit"
|
||||||
|
@ -29,6 +29,11 @@
|
|||||||
#include "clk.h"
|
#include "clk.h"
|
||||||
#include "sys.h"
|
#include "sys.h"
|
||||||
|
|
||||||
|
#define LED_PORT PB
|
||||||
|
#define LED_PIN 4
|
||||||
|
#define LED_PIN_IO PB4
|
||||||
|
#define LED_STATE_ON 0
|
||||||
|
|
||||||
void board_init(void)
|
void board_init(void)
|
||||||
{
|
{
|
||||||
/* Unlock protected registers */
|
/* Unlock protected registers */
|
||||||
@ -60,6 +65,9 @@ void board_init(void)
|
|||||||
// 1ms tick timer
|
// 1ms tick timer
|
||||||
SysTick_Config(48000000 / 1000);
|
SysTick_Config(48000000 / 1000);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
// LED
|
||||||
|
GPIO_SetMode(LED_PORT, 1 << LED_PIN, GPIO_MODE_OUTPUT);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if CFG_TUSB_OS == OPT_OS_NONE
|
#if CFG_TUSB_OS == OPT_OS_NONE
|
||||||
@ -81,7 +89,7 @@ uint32_t board_millis(void)
|
|||||||
|
|
||||||
void board_led_write(bool state)
|
void board_led_write(bool state)
|
||||||
{
|
{
|
||||||
(void)(state);
|
LED_PIN_IO = (state ? LED_STATE_ON : (1-LED_STATE_ON));
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t board_button_read(void)
|
uint32_t board_button_read(void)
|
||||||
|
@ -55,5 +55,7 @@ FREERTOS_PORT = ARM_CM0
|
|||||||
JLINK_DEVICE = NUC126VG4AE
|
JLINK_DEVICE = NUC126VG4AE
|
||||||
JLINK_IF = swd
|
JLINK_IF = swd
|
||||||
|
|
||||||
# flash using jlink
|
# Flash using Nuvoton's openocd fork at https://github.com/OpenNuvoton/OpenOCD-Nuvoton
|
||||||
flash: flash-jlink
|
# Please compile and install it from github source
|
||||||
|
flash: $(BUILD)/$(BOARD)-firmware.elf
|
||||||
|
openocd -f interface/nulink.cfg -f target/numicroM0.cfg -c "program $< verify reset exit"
|
||||||
|
@ -29,6 +29,11 @@
|
|||||||
#include "clk.h"
|
#include "clk.h"
|
||||||
#include "sys.h"
|
#include "sys.h"
|
||||||
|
|
||||||
|
#define LED_PORT PC
|
||||||
|
#define LED_PIN 9
|
||||||
|
#define LED_PIN_IO PC9
|
||||||
|
#define LED_STATE_ON 0
|
||||||
|
|
||||||
#define CRYSTAL_LESS /* system will be 48MHz when defined, otherwise, system is 72MHz */
|
#define CRYSTAL_LESS /* system will be 48MHz when defined, otherwise, system is 72MHz */
|
||||||
#define HIRC48_AUTO_TRIM SYS_IRCTCTL1_REFCKSEL_Msk | (1UL << SYS_IRCTCTL1_LOOPSEL_Pos) | (2UL << SYS_IRCTCTL1_FREQSEL_Pos)
|
#define HIRC48_AUTO_TRIM SYS_IRCTCTL1_REFCKSEL_Msk | (1UL << SYS_IRCTCTL1_LOOPSEL_Pos) | (2UL << SYS_IRCTCTL1_FREQSEL_Pos)
|
||||||
#define TRIM_INIT (SYS_BASE+0x118)
|
#define TRIM_INIT (SYS_BASE+0x118)
|
||||||
@ -91,6 +96,9 @@ void board_init(void)
|
|||||||
// 1ms tick timer
|
// 1ms tick timer
|
||||||
SysTick_Config(48000000 / 1000);
|
SysTick_Config(48000000 / 1000);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
// LED
|
||||||
|
GPIO_SetMode(LED_PORT, 1 << LED_PIN, GPIO_MODE_OUTPUT);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if CFG_TUSB_OS == OPT_OS_NONE
|
#if CFG_TUSB_OS == OPT_OS_NONE
|
||||||
@ -112,7 +120,7 @@ uint32_t board_millis(void)
|
|||||||
|
|
||||||
void board_led_write(bool state)
|
void board_led_write(bool state)
|
||||||
{
|
{
|
||||||
(void)(state);
|
LED_PIN_IO = (state ? LED_STATE_ON : (1-LED_STATE_ON));
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t board_button_read(void)
|
uint32_t board_button_read(void)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user