Skip to content

Commit a64e3eb

Browse files
committed
update board_test always output to uart regardless of LOGGER option
1 parent 52f0427 commit a64e3eb

File tree

6 files changed

+18
-20
lines changed

6 files changed

+18
-20
lines changed

docs/reference/getting_started.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -256,8 +256,8 @@ Open ``Project -> Add project Connection ...``, click ``OK``, choose ``tinyusb\\
256256
2. Open ``Project -> Add project Connection ...``, click ``OK``, choose ``tinyusb\\examples\\(.ipcf of example)``.
257257
For example ``C:\\tinyusb\\examples\\device\\cdc_msc\\iar_cdc_msc.ipcf``
258258

259-
Native CMake support (9.50.1+)
260-
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
259+
Native CMake support
260+
~~~~~~~~~~~~~~~~~~~~
261261

262262
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.
263263

examples/build_system/make/make.mk

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -123,27 +123,24 @@ endif
123123
ifeq (${MAX3421_HOST},1)
124124
SRC_C += src/portable/analog/max3421/hcd_max3421.c
125125
CFLAGS += -DCFG_TUH_MAX3421=1
126-
CMAKE_DEFSYM += -DMAX3421_HOST=1
127126
endif
128127

129128
# Log level is mapped to TUSB DEBUG option
130129
ifneq ($(LOG),)
131-
CMAKE_DEFSYM += -DLOG=$(LOG)
132130
CFLAGS += -DCFG_TUSB_DEBUG=$(LOG)
133131
endif
134132

135133
# Logger: default is uart, can be set to rtt or swo
136-
ifneq ($(LOGGER),)
137-
CMAKE_DEFSYM += -DLOGGER=$(LOGGER)
138-
endif
139-
140134
ifeq ($(LOGGER),rtt)
141-
CFLAGS += -DLOGGER_RTT -DSEGGER_RTT_MODE_DEFAULT=SEGGER_RTT_MODE_BLOCK_IF_FIFO_FULL
142-
RTT_SRC = lib/SEGGER_RTT
143-
INC += $(TOP)/$(RTT_SRC)/RTT
144-
SRC_C += $(RTT_SRC)/RTT/SEGGER_RTT.c
145-
else ifeq ($(LOGGER),swo)
135+
CFLAGS += -DLOGGER_RTT
136+
#CFLAGS += -DSEGGER_RTT_MODE_DEFAULT=SEGGER_RTT_MODE_BLOCK_IF_FIFO_FULL
137+
INC += $(TOP)/$(lib/SEGGER_RTT)/RTT
138+
SRC_C += $(lib/SEGGER_RTT)/RTT/SEGGER_RTT.c
139+
endif
140+
ifeq ($(LOGGER),swo)
146141
CFLAGS += -DLOGGER_SWO
142+
else
143+
CFLAGS += -DLOGGER_UART
147144
endif
148145

149146
# CPU specific flags

examples/device/board_test/src/main.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,9 @@ int main(void) {
5252
int ch = board_getchar();
5353
if (ch > 0) {
5454
board_putchar(ch);
55+
#ifndef LOGGER_UART
56+
board_uart_write(&ch, 1);
57+
#endif
5558
}
5659

5760
// Blink and print every interval ms
@@ -61,7 +64,10 @@ int main(void) {
6164
if (ch < 0) {
6265
// skip if echoing
6366
printf(HELLO_STR);
67+
68+
#ifndef LOGGER_UART
6469
board_uart_write(HELLO_STR, strlen(HELLO_STR));
70+
#endif
6571
}
6672

6773
board_led_write(led_state);

hw/bsp/board.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,6 @@ int sys_read(int fhdl, char *buf, size_t count) {
6060
int rd = (int) SEGGER_RTT_Read(0, buf, count);
6161
return (rd > 0) ? rd : -1;
6262
}
63-
6463
#endif
6564

6665
#elif defined(LOGGER_SWO)

hw/bsp/family_support.cmake

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -221,6 +221,8 @@ function(family_configure_common TARGET RTOS)
221221
target_include_directories(${TARGET} PUBLIC ${TOP}/lib/SEGGER_RTT/RTT)
222222
# target_compile_definitions(${TARGET} PUBLIC SEGGER_RTT_MODE_DEFAULT=SEGGER_RTT_MODE_BLOCK_IF_FIFO_FULL)
223223
endif ()
224+
else ()
225+
target_compile_definitions(${TARGET} PUBLIC LOGGER_UART)
224226
endif ()
225227

226228
if (CMAKE_C_COMPILER_ID STREQUAL "GNU" OR CMAKE_C_COMPILER_ID STREQUAL "Clang")

test/fuzz/make.mk

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -124,11 +124,5 @@ endif
124124

125125
# Log level is mapped to TUSB DEBUG option
126126
ifneq ($(LOG),)
127-
CMAKE_DEFSYM += -DLOG=$(LOG)
128127
CFLAGS += -DCFG_TUSB_DEBUG=$(LOG)
129128
endif
130-
131-
# Logger: default is uart, can be set to rtt or swo
132-
ifneq ($(LOGGER),)
133-
CMAKE_DEFSYM += -DLOGGER=$(LOGGER)
134-
endif

0 commit comments

Comments
 (0)