summaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
Diffstat (limited to 'examples')
-rw-r--r--examples/make.mk12
-rw-r--r--examples/readme.md27
2 files changed, 36 insertions, 3 deletions
diff --git a/examples/make.mk b/examples/make.mk
index f2a8b979e..78581f813 100644
--- a/examples/make.mk
+++ b/examples/make.mk
@@ -75,7 +75,17 @@ else
CFLAGS += -Os
endif
-# TUSB Logging option
+# Log level is mapped to TUSB DEBUG option
ifneq ($(LOG),)
CFLAGS += -DCFG_TUSB_DEBUG=$(LOG)
endif
+
+# Logger: default is UART, can be set to RTT
+ifeq ($(LOGGER),rtt)
+ RTT_SRC = lib/SEGGER_RTT
+
+ CFLAGS += -DLOGGER_RTT
+ INC += $(TOP)/$(RTT_SRC)/RTT
+ SRC_C += $(RTT_SRC)/RTT/SEGGER_RTT_printf.c
+ SRC_C += $(RTT_SRC)/RTT/SEGGER_RTT.c
+endif
diff --git a/examples/readme.md b/examples/readme.md
index b661d169f..45746cc75 100644
--- a/examples/readme.md
+++ b/examples/readme.md
@@ -32,12 +32,36 @@ Then compile with `make BOARD=[your_board] all`, for example
$ make BOARD=feather_nrf52840_express all
```
+### Debug Log
+
+### Log Level
+
+Should you have an issue running example and/or submitting an bug report. You could enable TinyUSB built-in debug logging with optional `LOG=`. LOG=1 will only print out error message, LOG=2 print more information with on-going events. LOG=3 or higher is not used yet.
+
+```
+$ make LOG=2 BOARD=feather_nrf52840_express all
+```
+
+### Logger
+
+By default log message is printed via on-board UART which is slow and take lots of CPU time comparing to USB speed. If your board support on-board/external JLink debugger, it would be more efficient to use it with RTT protocol for logging. To do that add option `LOGGER=rtt` to build command e.g
+
+```
+$ make LOG=2 LOGGER=rtt BOARD=feather_nrf52840_express all
+```
+
## Flash
-`flash` target will use the on-board debugger (jlink/cmsisdap/stlink/dfu) to flash the binary. We should install those debugger/programmer software in advance. Furthermore, since external jlink can be used with most of the board, there is also `flash-jlink` target for your convenience.
+`flash` target will use the default on-board debugger (jlink/cmsisdap/stlink/dfu) to flash the binary, please install those support software in advance. Some board use bootloader/DFU via serial which is required to pass to make command
```
$ make BOARD=feather_nrf52840_express flash
+$ make SERIAL=/dev/ttyACM0 BOARD=feather_nrf52840_express flash
+```
+
+Since jlink can be used with most of the boards, there is also `flash-jlink` target for your convenience.
+
+```
$ make BOARD=feather_nrf52840_express flash-jlink
```
@@ -46,4 +70,3 @@ Some board use uf2 bootloader for drag & drop in to mass storage device, uf2 can
```
$ make BOARD=feather_nrf52840_express all uf2
```
-