summaryrefslogtreecommitdiff
path: root/hw
diff options
context:
space:
mode:
authorhathach <[email protected]>2025-11-28 12:55:56 +0700
committerhathach <[email protected]>2025-11-28 13:34:00 +0700
commit7d012b014eb27de9a5f34da543c707109c653045 (patch)
treecfa2d7369405b4fe794d7c572823db8e2a3ff522 /hw
parent1618c58dc4ef82f30c51c6318046d8dccb524425 (diff)
fix build with zephyr with latest nrfx v4
Diffstat (limited to 'hw')
-rw-r--r--hw/bsp/nrf/family.c9
-rw-r--r--hw/bsp/nrf/family.cmake4
2 files changed, 12 insertions, 1 deletions
diff --git a/hw/bsp/nrf/family.c b/hw/bsp/nrf/family.c
index 25062b18f..ee3ac61e2 100644
--- a/hw/bsp/nrf/family.c
+++ b/hw/bsp/nrf/family.c
@@ -100,7 +100,9 @@ static nrfx_uarte_t _uart_id = NRFX_UARTE_INSTANCE(120);
#define OUTPUTRDY_Msk POWER_USBREGSTATUS_OUTPUTRDY_Msk
#endif
+#if CFG_TUSB_OS != OPT_OS_ZEPHYR
static nrfx_uarte_t _uart_id = NRFX_UARTE_INSTANCE(0);
+#endif
void USBD_IRQHandler(void) {
tud_int_handler(0);
@@ -163,6 +165,7 @@ void board_init(void) {
irq_enable(DT_INST_IRQN(0));
#endif
+#if CFG_TUSB_OS != OPT_OS_ZEPHYR
// UART
nrfx_uarte_config_t uart_cfg = {
.txd_pin = UART_TX_PIN,
@@ -179,6 +182,7 @@ void board_init(void) {
};
nrfx_uarte_init(&_uart_id, &uart_cfg, NULL);
+#endif
//------------- USB -------------//
#if CFG_TUD_ENABLED
@@ -276,8 +280,13 @@ int board_uart_read(uint8_t* buf, int len) {
}
int board_uart_write(void const* buf, int len) {
+#if CFG_TUSB_OS == OPT_OS_ZEPHYR
+ (void) buf;
+ return len;
+#else
nrfx_err_t err = nrfx_uarte_tx(&_uart_id, (uint8_t const*) buf, (size_t) len ,0);
return (NRFX_SUCCESS == err) ? len : 0;
+#endif
}
#if CFG_TUSB_OS == OPT_OS_NONE
diff --git a/hw/bsp/nrf/family.cmake b/hw/bsp/nrf/family.cmake
index 4e999b636..3a6e7cc8b 100644
--- a/hw/bsp/nrf/family.cmake
+++ b/hw/bsp/nrf/family.cmake
@@ -127,7 +127,9 @@ function(family_configure_example TARGET RTOS)
${CMAKE_CURRENT_FUNCTION_LIST_DIR}/boards/${BOARD}
)
- if (NOT RTOS STREQUAL zephyr)
+ if (RTOS STREQUAL zephyr)
+ target_include_directories(${TARGET} PUBLIC ${ZEPHYR_HAL_NORDIC_MODULE_DIR}/nrfx/bsp/stable/mdk)
+ else ()
target_sources(${TARGET} PRIVATE ${STARTUP_FILE_${CMAKE_C_COMPILER_ID}})
if (CMAKE_C_COMPILER_ID STREQUAL "GNU")