mirror of
https://github.com/hathach/tinyusb.git
synced 2025-10-17 06:47:20 +08:00
update board_test always output to uart regardless of LOGGER option
This commit is contained in:
@@ -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)``.
|
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``
|
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.
|
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.
|
||||||
|
|
||||||
|
@@ -123,27 +123,24 @@ endif
|
|||||||
ifeq (${MAX3421_HOST},1)
|
ifeq (${MAX3421_HOST},1)
|
||||||
SRC_C += src/portable/analog/max3421/hcd_max3421.c
|
SRC_C += src/portable/analog/max3421/hcd_max3421.c
|
||||||
CFLAGS += -DCFG_TUH_MAX3421=1
|
CFLAGS += -DCFG_TUH_MAX3421=1
|
||||||
CMAKE_DEFSYM += -DMAX3421_HOST=1
|
|
||||||
endif
|
endif
|
||||||
|
|
||||||
# Log level is mapped to TUSB DEBUG option
|
# Log level is mapped to TUSB DEBUG option
|
||||||
ifneq ($(LOG),)
|
ifneq ($(LOG),)
|
||||||
CMAKE_DEFSYM += -DLOG=$(LOG)
|
|
||||||
CFLAGS += -DCFG_TUSB_DEBUG=$(LOG)
|
CFLAGS += -DCFG_TUSB_DEBUG=$(LOG)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
# Logger: default is uart, can be set to rtt or swo
|
# Logger: default is uart, can be set to rtt or swo
|
||||||
ifneq ($(LOGGER),)
|
|
||||||
CMAKE_DEFSYM += -DLOGGER=$(LOGGER)
|
|
||||||
endif
|
|
||||||
|
|
||||||
ifeq ($(LOGGER),rtt)
|
ifeq ($(LOGGER),rtt)
|
||||||
CFLAGS += -DLOGGER_RTT -DSEGGER_RTT_MODE_DEFAULT=SEGGER_RTT_MODE_BLOCK_IF_FIFO_FULL
|
CFLAGS += -DLOGGER_RTT
|
||||||
RTT_SRC = lib/SEGGER_RTT
|
#CFLAGS += -DSEGGER_RTT_MODE_DEFAULT=SEGGER_RTT_MODE_BLOCK_IF_FIFO_FULL
|
||||||
INC += $(TOP)/$(RTT_SRC)/RTT
|
INC += $(TOP)/$(lib/SEGGER_RTT)/RTT
|
||||||
SRC_C += $(RTT_SRC)/RTT/SEGGER_RTT.c
|
SRC_C += $(lib/SEGGER_RTT)/RTT/SEGGER_RTT.c
|
||||||
else ifeq ($(LOGGER),swo)
|
endif
|
||||||
|
ifeq ($(LOGGER),swo)
|
||||||
CFLAGS += -DLOGGER_SWO
|
CFLAGS += -DLOGGER_SWO
|
||||||
|
else
|
||||||
|
CFLAGS += -DLOGGER_UART
|
||||||
endif
|
endif
|
||||||
|
|
||||||
# CPU specific flags
|
# CPU specific flags
|
||||||
|
@@ -52,6 +52,9 @@ int main(void) {
|
|||||||
int ch = board_getchar();
|
int ch = board_getchar();
|
||||||
if (ch > 0) {
|
if (ch > 0) {
|
||||||
board_putchar(ch);
|
board_putchar(ch);
|
||||||
|
#ifndef LOGGER_UART
|
||||||
|
board_uart_write(&ch, 1);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
// Blink and print every interval ms
|
// Blink and print every interval ms
|
||||||
@@ -61,7 +64,10 @@ int main(void) {
|
|||||||
if (ch < 0) {
|
if (ch < 0) {
|
||||||
// skip if echoing
|
// skip if echoing
|
||||||
printf(HELLO_STR);
|
printf(HELLO_STR);
|
||||||
|
|
||||||
|
#ifndef LOGGER_UART
|
||||||
board_uart_write(HELLO_STR, strlen(HELLO_STR));
|
board_uart_write(HELLO_STR, strlen(HELLO_STR));
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
board_led_write(led_state);
|
board_led_write(led_state);
|
||||||
|
@@ -60,7 +60,6 @@ int sys_read(int fhdl, char *buf, size_t count) {
|
|||||||
int rd = (int) SEGGER_RTT_Read(0, buf, count);
|
int rd = (int) SEGGER_RTT_Read(0, buf, count);
|
||||||
return (rd > 0) ? rd : -1;
|
return (rd > 0) ? rd : -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#elif defined(LOGGER_SWO)
|
#elif defined(LOGGER_SWO)
|
||||||
|
@@ -221,6 +221,8 @@ function(family_configure_common TARGET RTOS)
|
|||||||
target_include_directories(${TARGET} PUBLIC ${TOP}/lib/SEGGER_RTT/RTT)
|
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)
|
# target_compile_definitions(${TARGET} PUBLIC SEGGER_RTT_MODE_DEFAULT=SEGGER_RTT_MODE_BLOCK_IF_FIFO_FULL)
|
||||||
endif ()
|
endif ()
|
||||||
|
else ()
|
||||||
|
target_compile_definitions(${TARGET} PUBLIC LOGGER_UART)
|
||||||
endif ()
|
endif ()
|
||||||
|
|
||||||
if (CMAKE_C_COMPILER_ID STREQUAL "GNU" OR CMAKE_C_COMPILER_ID STREQUAL "Clang")
|
if (CMAKE_C_COMPILER_ID STREQUAL "GNU" OR CMAKE_C_COMPILER_ID STREQUAL "Clang")
|
||||||
|
@@ -124,11 +124,5 @@ endif
|
|||||||
|
|
||||||
# Log level is mapped to TUSB DEBUG option
|
# Log level is mapped to TUSB DEBUG option
|
||||||
ifneq ($(LOG),)
|
ifneq ($(LOG),)
|
||||||
CMAKE_DEFSYM += -DLOG=$(LOG)
|
|
||||||
CFLAGS += -DCFG_TUSB_DEBUG=$(LOG)
|
CFLAGS += -DCFG_TUSB_DEBUG=$(LOG)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
# Logger: default is uart, can be set to rtt or swo
|
|
||||||
ifneq ($(LOGGER),)
|
|
||||||
CMAKE_DEFSYM += -DLOGGER=$(LOGGER)
|
|
||||||
endif
|
|
||||||
|
Reference in New Issue
Block a user