From bb0e688b8e950652c70d82b46b7093e14b33c350 Mon Sep 17 00:00:00 2001 From: hathach Date: Mon, 3 Jul 2023 16:35:22 +0700 Subject: [PATCH] add jlinkscript for detect rtt --- hw/bsp/ra/boards/ra4m1_ek/board.h | 2 +- hw/bsp/ra/boards/ra4m3_ek/board.h | 2 +- hw/bsp/ra/boards/ra6m1_ek/board.h | 2 +- hw/bsp/ra/boards/ra6m5_ek/board.h | 2 +- hw/bsp/ra/debug.jlinkscript | 4 ++++ hw/bsp/ra/family.c | 12 +++++++----- 6 files changed, 15 insertions(+), 9 deletions(-) create mode 100644 hw/bsp/ra/debug.jlinkscript diff --git a/hw/bsp/ra/boards/ra4m1_ek/board.h b/hw/bsp/ra/boards/ra4m1_ek/board.h index ba3698f3d..c132387bc 100644 --- a/hw/bsp/ra/boards/ra4m1_ek/board.h +++ b/hw/bsp/ra/boards/ra4m1_ek/board.h @@ -37,7 +37,7 @@ extern "C" { #define SW1 BSP_IO_PORT_01_PIN_05 #define BUTTON_STATE_ACTIVE 0 -const ioport_pin_cfg_t board_pin_cfg[] = { +static const ioport_pin_cfg_t board_pin_cfg[] = { {.pin = LED1, .pin_cfg = IOPORT_CFG_PORT_DIRECTION_OUTPUT}, {.pin = SW1, .pin_cfg = IOPORT_CFG_PORT_DIRECTION_INPUT}, // USB FS D+, D-, VBus diff --git a/hw/bsp/ra/boards/ra4m3_ek/board.h b/hw/bsp/ra/boards/ra4m3_ek/board.h index c2f150b33..4b4735c4f 100644 --- a/hw/bsp/ra/boards/ra4m3_ek/board.h +++ b/hw/bsp/ra/boards/ra4m3_ek/board.h @@ -37,7 +37,7 @@ extern "C" { #define SW1 (BSP_IO_PORT_00_PIN_05) #define BUTTON_STATE_ACTIVE 0 -const ioport_pin_cfg_t board_pin_cfg[] = { +static const ioport_pin_cfg_t board_pin_cfg[] = { {.pin = LED1, .pin_cfg = IOPORT_CFG_PORT_DIRECTION_OUTPUT}, {.pin = SW1, .pin_cfg = IOPORT_CFG_PORT_DIRECTION_INPUT}, // USB FS D+, D-, VBus diff --git a/hw/bsp/ra/boards/ra6m1_ek/board.h b/hw/bsp/ra/boards/ra6m1_ek/board.h index 0b7297fd4..2765a6a5f 100644 --- a/hw/bsp/ra/boards/ra6m1_ek/board.h +++ b/hw/bsp/ra/boards/ra6m1_ek/board.h @@ -37,7 +37,7 @@ extern "C" { #define SW1 BSP_IO_PORT_04_PIN_15 #define BUTTON_STATE_ACTIVE 0 -const ioport_pin_cfg_t board_pin_cfg[] = { +static const ioport_pin_cfg_t board_pin_cfg[] = { {.pin = LED1, .pin_cfg = IOPORT_CFG_PORT_DIRECTION_OUTPUT}, {.pin = SW1, .pin_cfg = IOPORT_CFG_PORT_DIRECTION_INPUT}, // USB FS D+, D-, VBus diff --git a/hw/bsp/ra/boards/ra6m5_ek/board.h b/hw/bsp/ra/boards/ra6m5_ek/board.h index 87434630f..c88e9a0a2 100644 --- a/hw/bsp/ra/boards/ra6m5_ek/board.h +++ b/hw/bsp/ra/boards/ra6m5_ek/board.h @@ -37,7 +37,7 @@ extern "C" { #define SW1 BSP_IO_PORT_00_PIN_05 #define BUTTON_STATE_ACTIVE 0 -const ioport_pin_cfg_t board_pin_cfg[] = { +static const ioport_pin_cfg_t board_pin_cfg[] = { { .pin = LED1, .pin_cfg = IOPORT_CFG_PORT_DIRECTION_OUTPUT | IOPORT_CFG_PORT_OUTPUT_LOW }, { .pin = SW1, .pin_cfg = IOPORT_CFG_PORT_DIRECTION_INPUT }, diff --git a/hw/bsp/ra/debug.jlinkscript b/hw/bsp/ra/debug.jlinkscript new file mode 100644 index 000000000..b34cfaa7f --- /dev/null +++ b/hw/bsp/ra/debug.jlinkscript @@ -0,0 +1,4 @@ +int SetupTarget(void) { + JLINK_ExecCommand("SetRTTSearchRanges 0x20000000 0x80000"); + return 0; +} diff --git a/hw/bsp/ra/family.c b/hw/bsp/ra/family.c index 8b5e911a1..08823dd52 100644 --- a/hw/bsp/ra/family.c +++ b/hw/bsp/ra/family.c @@ -90,12 +90,12 @@ void board_init(void) R_SYSTEM->TRCKCR = R_SYSTEM_TRCKCR_TRCKEN_Msk; #endif - board_led_write(false); + // Enable USB module + R_MSTP->MSTPCRB &= ~(1U << 11U); // FS - /* Enable USB_BASE */ - R_SYSTEM->PRCR = (uint16_t) BSP_PRV_PRCR_PRC1_UNLOCK; - R_MSTP->MSTPCRB &= ~(1U << 11U); - R_SYSTEM->PRCR = (uint16_t) BSP_PRV_PRCR_LOCK; +#ifdef R_USB_HS0_BASE + R_MSTP->MSTPCRB &= ~(1U << 12U); // HS +#endif #if CFG_TUSB_OS == OPT_OS_FREERTOS // If freeRTOS is used, IRQ priority is limit by max syscall ( smaller is higher ) @@ -108,6 +108,8 @@ void board_init(void) #if CFG_TUSB_OS == OPT_OS_NONE SysTick_Config(SystemCoreClock / 1000); #endif + + board_led_write(false); } void board_led_write(bool state) {