summaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
Diffstat (limited to 'examples')
-rw-r--r--examples/device/cdc_msc_freertos/src/FreeRTOSConfig.h71
-rw-r--r--examples/device/hid_composite_freertos/src/FreeRTOSConfig.h71
-rw-r--r--examples/make.mk6
-rw-r--r--examples/readme.md14
4 files changed, 20 insertions, 142 deletions
diff --git a/examples/device/cdc_msc_freertos/src/FreeRTOSConfig.h b/examples/device/cdc_msc_freertos/src/FreeRTOSConfig.h
index 0945baf1f..494452d43 100644
--- a/examples/device/cdc_msc_freertos/src/FreeRTOSConfig.h
+++ b/examples/device/cdc_msc_freertos/src/FreeRTOSConfig.h
@@ -42,78 +42,11 @@
* See http://www.freertos.org/a00110.html.
*----------------------------------------------------------*/
-// for OPT_MCU_
-#include "tusb_option.h"
-
-#if CFG_TUSB_MCU == OPT_MCU_LPC11UXX || CFG_TUSB_MCU == OPT_MCU_LPC13XX || \
- CFG_TUSB_MCU == OPT_MCU_LPC15XX || CFG_TUSB_MCU == OPT_MCU_LPC175X_6X || \
- CFG_TUSB_MCU == OPT_MCU_LPC177X_8X || CFG_TUSB_MCU == OPT_MCU_LPC18XX || \
- CFG_TUSB_MCU == OPT_MCU_LPC40XX || CFG_TUSB_MCU == OPT_MCU_LPC43XX
- #include "chip.h"
-
-#elif CFG_TUSB_MCU == OPT_MCU_LPC51UXX || CFG_TUSB_MCU == OPT_MCU_LPC54XXX || \
- CFG_TUSB_MCU == OPT_MCU_LPC55XX
- #include "fsl_device_registers.h"
-
-#elif CFG_TUSB_MCU == OPT_MCU_NRF5X
- #include "nrf.h"
-
-#elif CFG_TUSB_MCU == OPT_MCU_SAMD21 || CFG_TUSB_MCU == OPT_MCU_SAMD51
- #include "sam.h"
-
-#elif CFG_TUSB_MCU == OPT_MCU_SAMG
- #undef LITTLE_ENDIAN // hack to suppress "LITTLE_ENDIAN" redefined
- #include "sam.h"
-
-#elif CFG_TUSB_MCU == OPT_MCU_STM32F0
- #include "stm32f0xx.h"
-
-#elif CFG_TUSB_MCU == OPT_MCU_STM32F1
- #include "stm32f1xx.h"
-
-#elif CFG_TUSB_MCU == OPT_MCU_STM32F2
- #include "stm32f2xx.h"
-
-#elif CFG_TUSB_MCU == OPT_MCU_STM32F3
- #include "stm32f3xx.h"
-
-#elif CFG_TUSB_MCU == OPT_MCU_STM32F4
- #include "stm32f4xx.h"
-
-#elif CFG_TUSB_MCU == OPT_MCU_STM32F7
- #include "stm32f7xx.h"
-
-#elif CFG_TUSB_MCU == OPT_MCU_STM32H7
- #include "stm32h7xx.h"
-
-#elif CFG_TUSB_MCU == OPT_MCU_STM32L0
- #include "stm32l0xx.h"
-
-#elif CFG_TUSB_MCU == OPT_MCU_STM32L1
- #include "stm32l1xx.h"
-
-#elif CFG_TUSB_MCU == OPT_MCU_STM32L4
- #include "stm32l4xx.h"
-
-#elif CFG_TUSB_MCU == OPT_MCU_MIMXRT10XX
- #include "fsl_device_registers.h"
-
-#elif CFG_TUSB_MCU == OPT_MCU_NUC120
- #include "NUC100Series.h"
-
-#elif CFG_TUSB_MCU == OPT_MCU_NUC121 || CFG_TUSB_MCU == OPT_MCU_NUC126
- #include "NuMicro.h"
-
-#elif CFG_TUSB_MCU == OPT_MCU_NUC505
- #include "NUC505Series.h"
-
-#else
- #error "FreeRTOSConfig.h need to include low level mcu header for configuration"
-#endif
+// Include MCU header
+#include "bsp/board_mcu.h"
extern uint32_t SystemCoreClock;
-
/* Cortex M23/M33 port configuration. */
#define configENABLE_MPU 0
#define configENABLE_FPU 1
diff --git a/examples/device/hid_composite_freertos/src/FreeRTOSConfig.h b/examples/device/hid_composite_freertos/src/FreeRTOSConfig.h
index 0945baf1f..494452d43 100644
--- a/examples/device/hid_composite_freertos/src/FreeRTOSConfig.h
+++ b/examples/device/hid_composite_freertos/src/FreeRTOSConfig.h
@@ -42,78 +42,11 @@
* See http://www.freertos.org/a00110.html.
*----------------------------------------------------------*/
-// for OPT_MCU_
-#include "tusb_option.h"
-
-#if CFG_TUSB_MCU == OPT_MCU_LPC11UXX || CFG_TUSB_MCU == OPT_MCU_LPC13XX || \
- CFG_TUSB_MCU == OPT_MCU_LPC15XX || CFG_TUSB_MCU == OPT_MCU_LPC175X_6X || \
- CFG_TUSB_MCU == OPT_MCU_LPC177X_8X || CFG_TUSB_MCU == OPT_MCU_LPC18XX || \
- CFG_TUSB_MCU == OPT_MCU_LPC40XX || CFG_TUSB_MCU == OPT_MCU_LPC43XX
- #include "chip.h"
-
-#elif CFG_TUSB_MCU == OPT_MCU_LPC51UXX || CFG_TUSB_MCU == OPT_MCU_LPC54XXX || \
- CFG_TUSB_MCU == OPT_MCU_LPC55XX
- #include "fsl_device_registers.h"
-
-#elif CFG_TUSB_MCU == OPT_MCU_NRF5X
- #include "nrf.h"
-
-#elif CFG_TUSB_MCU == OPT_MCU_SAMD21 || CFG_TUSB_MCU == OPT_MCU_SAMD51
- #include "sam.h"
-
-#elif CFG_TUSB_MCU == OPT_MCU_SAMG
- #undef LITTLE_ENDIAN // hack to suppress "LITTLE_ENDIAN" redefined
- #include "sam.h"
-
-#elif CFG_TUSB_MCU == OPT_MCU_STM32F0
- #include "stm32f0xx.h"
-
-#elif CFG_TUSB_MCU == OPT_MCU_STM32F1
- #include "stm32f1xx.h"
-
-#elif CFG_TUSB_MCU == OPT_MCU_STM32F2
- #include "stm32f2xx.h"
-
-#elif CFG_TUSB_MCU == OPT_MCU_STM32F3
- #include "stm32f3xx.h"
-
-#elif CFG_TUSB_MCU == OPT_MCU_STM32F4
- #include "stm32f4xx.h"
-
-#elif CFG_TUSB_MCU == OPT_MCU_STM32F7
- #include "stm32f7xx.h"
-
-#elif CFG_TUSB_MCU == OPT_MCU_STM32H7
- #include "stm32h7xx.h"
-
-#elif CFG_TUSB_MCU == OPT_MCU_STM32L0
- #include "stm32l0xx.h"
-
-#elif CFG_TUSB_MCU == OPT_MCU_STM32L1
- #include "stm32l1xx.h"
-
-#elif CFG_TUSB_MCU == OPT_MCU_STM32L4
- #include "stm32l4xx.h"
-
-#elif CFG_TUSB_MCU == OPT_MCU_MIMXRT10XX
- #include "fsl_device_registers.h"
-
-#elif CFG_TUSB_MCU == OPT_MCU_NUC120
- #include "NUC100Series.h"
-
-#elif CFG_TUSB_MCU == OPT_MCU_NUC121 || CFG_TUSB_MCU == OPT_MCU_NUC126
- #include "NuMicro.h"
-
-#elif CFG_TUSB_MCU == OPT_MCU_NUC505
- #include "NUC505Series.h"
-
-#else
- #error "FreeRTOSConfig.h need to include low level mcu header for configuration"
-#endif
+// Include MCU header
+#include "bsp/board_mcu.h"
extern uint32_t SystemCoreClock;
-
/* Cortex M23/M33 port configuration. */
#define configENABLE_MPU 0
#define configENABLE_FPU 1
diff --git a/examples/make.mk b/examples/make.mk
index 78581f813..319ceece8 100644
--- a/examples/make.mk
+++ b/examples/make.mk
@@ -80,7 +80,7 @@ ifneq ($(LOG),)
CFLAGS += -DCFG_TUSB_DEBUG=$(LOG)
endif
-# Logger: default is UART, can be set to RTT
+# Logger: default is uart, can be set to rtt or swo
ifeq ($(LOGGER),rtt)
RTT_SRC = lib/SEGGER_RTT
@@ -88,4 +88,8 @@ ifeq ($(LOGGER),rtt)
INC += $(TOP)/$(RTT_SRC)/RTT
SRC_C += $(RTT_SRC)/RTT/SEGGER_RTT_printf.c
SRC_C += $(RTT_SRC)/RTT/SEGGER_RTT.c
+
+else ifeq ($(LOGGER),swo)
+ CFLAGS += -DLOGGER_SWO
+
endif
diff --git a/examples/readme.md b/examples/readme.md
index 092787221..8d3d2e415 100644
--- a/examples/readme.md
+++ b/examples/readme.md
@@ -44,14 +44,22 @@ $ 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](https://www.segger.com/products/debug-probes/j-link/technology/about-real-time-transfer/) for logging. To do that add option `LOGGER=rtt` to build command e.g
+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 debugger, it would be more efficient to use it for logging. There are 2 protocols:
+
+- `LOGGER=rtt`: use [Segger RTT protocol](https://www.segger.com/products/debug-probes/j-link/technology/about-real-time-transfer/)
+ - Cons: requires jlink as the debugger.
+ - Pros: work with most if not all MCUs
+ - Software viewer is JLink RTT Viewer/Client/Logger which is bundled with JLink driver package.
+- `LOGGER=swo`: Use dedicated SWO pin of ARM Cortex SWD debug header.
+ - Cons: only work with ARM Cortex MCUs minus M0
+ - Pros: even faster than RTT, and should be compatible with hardware and software debugger that support SWO.
+ - Software viewer is JLink SWO Viewer which is also bundled with JLink driver package.
```
$ make LOG=2 LOGGER=rtt BOARD=feather_nrf52840_express all
+$ make LOG=2 LOGGER=swo BOARD=feather_nrf52840_express all
```
-The log can be retrieved by JLink RTT Viewer/Client/Logger software which is bundled with their JLink driver.
-
## Flash
`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