add LOGGER option to use rtt
update example readme for debug log. Update bug template to ask for LOG as well.
This commit is contained in:
@@ -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
|
||||
|
@@ -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
|
||||
```
|
||||
|
||||
|
Reference in New Issue
Block a user