diff options
| author | hathach <[email protected]> | 2023-07-31 19:09:40 +0700 |
|---|---|---|
| committer | hathach <[email protected]> | 2023-07-31 19:09:40 +0700 |
| commit | 3f788a4e5a7758ce51cbcadef4ac21e427cc3c56 (patch) | |
| tree | e804bef2676cc9cd9e6506c9b83aebae36403a83 /hw | |
| parent | cb47231518d8a33bb9c5ab710c819049274d443b (diff) | |
enable USBMC for uno r4, add board_init_after_tusb() API
add BOARD_UPPERCASE for board detection
Diffstat (limited to 'hw')
| -rw-r--r-- | hw/bsp/board.h | 3 | ||||
| -rw-r--r-- | hw/bsp/family_support.cmake | 5 | ||||
| -rw-r--r-- | hw/bsp/ra/boards/uno_r4/board.mk | 2 | ||||
| -rw-r--r-- | hw/bsp/ra/family.c | 7 |
4 files changed, 16 insertions, 1 deletions
diff --git a/hw/bsp/board.h b/hw/bsp/board.h index 036556731..d782013bb 100644 --- a/hw/bsp/board.h +++ b/hw/bsp/board.h @@ -54,6 +54,9 @@ // Initialize on-board peripherals : led, button, uart and USB void board_init(void); +// Init board after tinyusb is initialized +void board_init_after_tusb(void) TU_ATTR_WEAK; + // Turn LED on or off void board_led_write(bool state); diff --git a/hw/bsp/family_support.cmake b/hw/bsp/family_support.cmake index d8298c8ad..db1ce988e 100644 --- a/hw/bsp/family_support.cmake +++ b/hw/bsp/family_support.cmake @@ -181,6 +181,11 @@ endfunction() function(family_configure_common TARGET RTOS) family_add_rtos(${TARGET} ${RTOS}) + string(TOUPPER ${BOARD} BOARD_UPPER) + target_compile_definitions(${TARGET} PUBLIC + BOARD_${BOARD_UPPER} + ) + # run size after build add_custom_command(TARGET ${TARGET} POST_BUILD COMMAND ${CMAKE_SIZE} $<TARGET_FILE:${TARGET}> diff --git a/hw/bsp/ra/boards/uno_r4/board.mk b/hw/bsp/ra/boards/uno_r4/board.mk index cbe6c782c..b7075eec0 100644 --- a/hw/bsp/ra/boards/uno_r4/board.mk +++ b/hw/bsp/ra/boards/uno_r4/board.mk @@ -1,7 +1,7 @@ CPU_CORE = cortex-m4 MCU_VARIANT = ra4m1 -LD_FILE = $(BOARD_PATH)/${BOARD}.ld +LD_FILE = ${BOARD_PATH}/${BOARD}.ld # For flash-jlink target JLINK_DEVICE = R7FA4M1AB diff --git a/hw/bsp/ra/family.c b/hw/bsp/ra/family.c index 096f0d0ff..e6213061d 100644 --- a/hw/bsp/ra/family.c +++ b/hw/bsp/ra/family.c @@ -124,6 +124,13 @@ void board_init(void) { board_led_write(false); } +void board_init_after_tusb(void) { + // For board that use USB LDO regulator +#if defined(BOARD_UNO_R4) + R_USB_FS0->USBMC |= R_USB_FS0_USBMC_VDCEN_Msk; +#endif +} + void board_led_write(bool state) { R_IOPORT_PinWrite(&port_ctrl, LED1, state ? LED_STATE_ON : !LED_STATE_ON); } |
