summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorhathach <[email protected]>2025-07-02 17:27:03 +0700
committerhathach <[email protected]>2025-07-02 17:27:03 +0700
commita64e3eb0aa661db14eb647e2f75059815741112f (patch)
treedf861940fe70ae28136ebe966b48bd1622195514
parent52f0427096a9e20b62dc3055a153a60e50317297 (diff)
update board_test always output to uart regardless of LOGGER option
-rw-r--r--docs/reference/getting_started.rst4
-rw-r--r--examples/build_system/make/make.mk19
-rw-r--r--examples/device/board_test/src/main.c6
-rw-r--r--hw/bsp/board.c1
-rw-r--r--hw/bsp/family_support.cmake2
-rw-r--r--test/fuzz/make.mk6
6 files changed, 18 insertions, 20 deletions
diff --git a/docs/reference/getting_started.rst b/docs/reference/getting_started.rst
index 5b009f21e..bb9ff1cb4 100644
--- a/docs/reference/getting_started.rst
+++ b/docs/reference/getting_started.rst
@@ -256,8 +256,8 @@ Open ``Project -> Add project Connection ...``, click ``OK``, choose ``tinyusb\\
2. Open ``Project -> Add project Connection ...``, click ``OK``, choose ``tinyusb\\examples\\(.ipcf of example)``.
For example ``C:\\tinyusb\\examples\\device\\cdc_msc\\iar_cdc_msc.ipcf``
-Native CMake support (9.50.1+)
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+Native CMake support
+~~~~~~~~~~~~~~~~~~~~
With 9.50.1 release, IAR added experimental native CMake support (strangely not mentioned in public release note). Now it's possible to import CMakeLists.txt then build and debug as a normal project.
diff --git a/examples/build_system/make/make.mk b/examples/build_system/make/make.mk
index dbc73903e..f70748d34 100644
--- a/examples/build_system/make/make.mk
+++ b/examples/build_system/make/make.mk
@@ -123,27 +123,24 @@ endif
ifeq (${MAX3421_HOST},1)
SRC_C += src/portable/analog/max3421/hcd_max3421.c
CFLAGS += -DCFG_TUH_MAX3421=1
- CMAKE_DEFSYM += -DMAX3421_HOST=1
endif
# Log level is mapped to TUSB DEBUG option
ifneq ($(LOG),)
- CMAKE_DEFSYM += -DLOG=$(LOG)
CFLAGS += -DCFG_TUSB_DEBUG=$(LOG)
endif
# Logger: default is uart, can be set to rtt or swo
-ifneq ($(LOGGER),)
- CMAKE_DEFSYM += -DLOGGER=$(LOGGER)
-endif
-
ifeq ($(LOGGER),rtt)
- CFLAGS += -DLOGGER_RTT -DSEGGER_RTT_MODE_DEFAULT=SEGGER_RTT_MODE_BLOCK_IF_FIFO_FULL
- RTT_SRC = lib/SEGGER_RTT
- INC += $(TOP)/$(RTT_SRC)/RTT
- SRC_C += $(RTT_SRC)/RTT/SEGGER_RTT.c
-else ifeq ($(LOGGER),swo)
+ CFLAGS += -DLOGGER_RTT
+ #CFLAGS += -DSEGGER_RTT_MODE_DEFAULT=SEGGER_RTT_MODE_BLOCK_IF_FIFO_FULL
+ INC += $(TOP)/$(lib/SEGGER_RTT)/RTT
+ SRC_C += $(lib/SEGGER_RTT)/RTT/SEGGER_RTT.c
+endif
+ifeq ($(LOGGER),swo)
CFLAGS += -DLOGGER_SWO
+else
+ CFLAGS += -DLOGGER_UART
endif
# CPU specific flags
diff --git a/examples/device/board_test/src/main.c b/examples/device/board_test/src/main.c
index 2c6ab6288..d91a8760e 100644
--- a/examples/device/board_test/src/main.c
+++ b/examples/device/board_test/src/main.c
@@ -52,6 +52,9 @@ int main(void) {
int ch = board_getchar();
if (ch > 0) {
board_putchar(ch);
+ #ifndef LOGGER_UART
+ board_uart_write(&ch, 1);
+ #endif
}
// Blink and print every interval ms
@@ -61,7 +64,10 @@ int main(void) {
if (ch < 0) {
// skip if echoing
printf(HELLO_STR);
+
+ #ifndef LOGGER_UART
board_uart_write(HELLO_STR, strlen(HELLO_STR));
+ #endif
}
board_led_write(led_state);
diff --git a/hw/bsp/board.c b/hw/bsp/board.c
index 8f2f93306..1ba5a1b9d 100644
--- a/hw/bsp/board.c
+++ b/hw/bsp/board.c
@@ -60,7 +60,6 @@ int sys_read(int fhdl, char *buf, size_t count) {
int rd = (int) SEGGER_RTT_Read(0, buf, count);
return (rd > 0) ? rd : -1;
}
-
#endif
#elif defined(LOGGER_SWO)
diff --git a/hw/bsp/family_support.cmake b/hw/bsp/family_support.cmake
index 0509fdc28..9ec80df91 100644
--- a/hw/bsp/family_support.cmake
+++ b/hw/bsp/family_support.cmake
@@ -221,6 +221,8 @@ function(family_configure_common TARGET RTOS)
target_include_directories(${TARGET} PUBLIC ${TOP}/lib/SEGGER_RTT/RTT)
# target_compile_definitions(${TARGET} PUBLIC SEGGER_RTT_MODE_DEFAULT=SEGGER_RTT_MODE_BLOCK_IF_FIFO_FULL)
endif ()
+ else ()
+ target_compile_definitions(${TARGET} PUBLIC LOGGER_UART)
endif ()
if (CMAKE_C_COMPILER_ID STREQUAL "GNU" OR CMAKE_C_COMPILER_ID STREQUAL "Clang")
diff --git a/test/fuzz/make.mk b/test/fuzz/make.mk
index b7b6d6a75..e9aa80bf1 100644
--- a/test/fuzz/make.mk
+++ b/test/fuzz/make.mk
@@ -124,11 +124,5 @@ endif
# Log level is mapped to TUSB DEBUG option
ifneq ($(LOG),)
- CMAKE_DEFSYM += -DLOG=$(LOG)
CFLAGS += -DCFG_TUSB_DEBUG=$(LOG)
endif
-
-# Logger: default is uart, can be set to rtt or swo
-ifneq ($(LOGGER),)
- CMAKE_DEFSYM += -DLOGGER=$(LOGGER)
-endif