summaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorhathach <[email protected]>2019-09-09 00:53:05 +0700
committerGitHub <[email protected]>2019-09-09 00:53:05 +0700
commit4fe34c8f9b61ad85ce3bcd54466b03666c4578b8 (patch)
treec9d3008e9e728ca0f6589cb6f6c77083f0e78976 /examples
parent6b7fe012f6c9e740160c183077f5780b58024268 (diff)
parentf8081536310e5ac7a1e8c8ba9295890429a2cb6f (diff)
Merge pull request #120 from hathach/develop
Ported STM32F412 Discovery board, close #102
Diffstat (limited to 'examples')
-rw-r--r--examples/device/cdc_msc_hid/src/msc_disk.c3
-rw-r--r--examples/device/cdc_msc_hid/src/tusb_config.h9
-rw-r--r--examples/device/cdc_msc_hid_freertos/src/msc_disk.c3
-rw-r--r--examples/device/msc_dual_lun/src/msc_disk_dual.c3
-rw-r--r--examples/readme.md37
-rw-r--r--examples/rules.mk2
6 files changed, 48 insertions, 9 deletions
diff --git a/examples/device/cdc_msc_hid/src/msc_disk.c b/examples/device/cdc_msc_hid/src/msc_disk.c
index 406baf719..bc61f5d67 100644
--- a/examples/device/cdc_msc_hid/src/msc_disk.c
+++ b/examples/device/cdc_msc_hid/src/msc_disk.c
@@ -30,7 +30,8 @@
// Some MCU doesn't have enough 8KB SRAM to store the whole disk
// We will use Flash as read-only disk
-#if CFG_TUSB_MCU == OPT_MCU_LPC13XX
+// - LPC1347, LPC11uxx
+#if (CFG_TUSB_MCU == OPT_MCU_LPC13XX) || (CFG_TUSB_MCU == OPT_MCU_LPC11UXX)
#define DISK_READONLY
#endif
diff --git a/examples/device/cdc_msc_hid/src/tusb_config.h b/examples/device/cdc_msc_hid/src/tusb_config.h
index 544216da9..6eb6c10f1 100644
--- a/examples/device/cdc_msc_hid/src/tusb_config.h
+++ b/examples/device/cdc_msc_hid/src/tusb_config.h
@@ -75,12 +75,13 @@
#define CFG_TUD_CDC 1
#define CFG_TUD_MSC 1
-#if CFG_TUSB_MCU == OPT_MCU_STM32F4
-// STM32F4 does not have enough endpoints (4, including hardcoded control
+// Some STM32 MCUs does not have enough endpoints (4, including control
// endpoint) to enable CDC, MSC, and HID simultaneously, so disable HID as a compromise.
-#define CFG_TUD_HID 0
+#if CFG_TUSB_MCU == OPT_MCU_STM32F4
+ #include "stm32f4xx.h"
+ #define CFG_TUD_HID ((USB_OTG_FS_MAX_IN_ENDPOINTS > 4) ? 1 : 0)
#else
-#define CFG_TUD_HID 1
+ #define CFG_TUD_HID 1
#endif
#define CFG_TUD_MIDI 0
diff --git a/examples/device/cdc_msc_hid_freertos/src/msc_disk.c b/examples/device/cdc_msc_hid_freertos/src/msc_disk.c
index 6962e09e1..184602cdd 100644
--- a/examples/device/cdc_msc_hid_freertos/src/msc_disk.c
+++ b/examples/device/cdc_msc_hid_freertos/src/msc_disk.c
@@ -30,7 +30,8 @@
// Some MCU doesn't have enough 8KB SRAM to store the whole disk
// We will use Flash as read-only disk
-#if CFG_TUSB_MCU == OPT_MCU_LPC13XX
+// - LPC1347, LPC11uxx
+#if (CFG_TUSB_MCU == OPT_MCU_LPC13XX) || (CFG_TUSB_MCU == OPT_MCU_LPC11UXX)
#define DISK_READONLY
#endif
diff --git a/examples/device/msc_dual_lun/src/msc_disk_dual.c b/examples/device/msc_dual_lun/src/msc_disk_dual.c
index d44d18285..4baf13fc5 100644
--- a/examples/device/msc_dual_lun/src/msc_disk_dual.c
+++ b/examples/device/msc_dual_lun/src/msc_disk_dual.c
@@ -30,7 +30,8 @@
// Some MCU doesn't have enough 8KB SRAM to store the whole disk
// We will use Flash as read-only disk
-#if CFG_TUSB_MCU == OPT_MCU_LPC13XX
+// - LPC1347, LPC11uxx
+#if (CFG_TUSB_MCU == OPT_MCU_LPC13XX) || (CFG_TUSB_MCU == OPT_MCU_LPC11UXX)
#define DISK_READONLY
#endif
diff --git a/examples/readme.md b/examples/readme.md
index 228029e99..f48e897d6 100644
--- a/examples/readme.md
+++ b/examples/readme.md
@@ -1,3 +1,38 @@
# Examples
-Build and Run example instructions \ No newline at end of file
+## Clone this repo
+
+```
+$ git clone https://github.com/hathach/tinyusb tinyusb
+$ cd tinyusb
+```
+
+## Fetch submodule MCUs drivers
+
+TinyUSB examples includes external repos aka submodules to provide low-level MCU peripheral's driver to compile with. Therefore we will firstly fetch those mcu driver repo by running this command in the top folder repo
+
+```
+$ git submodule update --init --rescursive
+```
+
+It will takes a bit of time due to the number of supported MCUs, luckily we only need to do this once.
+
+## Build
+
+[Here is the list of supported Boards](docs/boards.md) that should work out of the box with provided examples.
+
+To build example, go to its folder project then type `make BOARD=[our_board] all` e.g
+
+```
+$ cd examples/device/cdc_msc_hid
+$ make BOARD=feather_nrf52840_express all
+```
+
+## Flash
+
+TODO: write more on flashing
+
+```
+$ make BOARD=feather_nrf52840_express flash
+```
+
diff --git a/examples/rules.mk b/examples/rules.mk
index 18410d2d9..478a5907a 100644
--- a/examples/rules.mk
+++ b/examples/rules.mk
@@ -43,7 +43,7 @@ endif
# Set all as default goal
.DEFAULT_GOAL := all
-all: $(BUILD)/$(BOARD)-firmware.bin size
+all: $(BUILD)/$(BOARD)-firmware.bin $(BUILD)/$(BOARD)-firmware.hex size
uf2: $(BUILD)/$(BOARD)-firmware.uf2