summaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorhathach <[email protected]>2020-03-22 17:19:57 +0700
committerhathach <[email protected]>2020-03-22 17:19:57 +0700
commit4f871063fd33db2b55c6f78130c723a8854e0b11 (patch)
treeddc78bd68c16a0895e0a7b4f9d1aff6380a20484 /examples
parent1ab3a1035c997e66b2014e8edfb92e10202cd988 (diff)
parente47f9921570c75afd3288407601897c5b283f043 (diff)
Merge branch 'master' into cr1901-msp430f5529
Diffstat (limited to 'examples')
-rw-r--r--examples/device/board_test/src/main.c2
-rw-r--r--examples/device/cdc_dual_ports/Makefile12
-rw-r--r--examples/device/cdc_dual_ports/src/main.c100
-rw-r--r--examples/device/cdc_dual_ports/src/tusb_config.h92
-rw-r--r--examples/device/cdc_dual_ports/src/usb_descriptors.c165
-rw-r--r--examples/device/cdc_msc/ses/nrf5x/nrf5x.emProject1
-rw-r--r--examples/device/cdc_msc/src/main.c2
-rw-r--r--examples/device/cdc_msc/src/tusb_config.h3
-rw-r--r--examples/device/cdc_msc/src/usb_descriptors.c38
-rw-r--r--examples/device/cdc_msc_freertos/.skip.MCU_CXD560
-rw-r--r--examples/device/cdc_msc_freertos/.skip.MCU_VALENTYUSB_EPTRI0
-rw-r--r--examples/device/cdc_msc_freertos/Makefile27
-rw-r--r--examples/device/cdc_msc_freertos/ses/cdc_msc_hid_freertos.emProject (renamed from examples/device/cdc_msc_hid_freertos/ses/cdc_msc_hid_freertos.emProject)0
-rw-r--r--examples/device/cdc_msc_freertos/ses/lpc175x_6x/FreeRTOSConfig.h (renamed from examples/device/cdc_msc_hid_freertos/ses/lpc175x_6x/FreeRTOSConfig.h)0
-rw-r--r--examples/device/cdc_msc_freertos/ses/lpc175x_6x/LPC1700_Startup.s (renamed from examples/device/cdc_msc_hid_freertos/ses/lpc175x_6x/LPC1700_Startup.s)0
-rw-r--r--examples/device/cdc_msc_freertos/ses/lpc175x_6x/LPC1700_Target.js (renamed from examples/device/cdc_msc_hid_freertos/ses/lpc175x_6x/LPC1700_Target.js)0
-rw-r--r--examples/device/cdc_msc_freertos/ses/lpc175x_6x/LPC1769_MemoryMap.xml (renamed from examples/device/cdc_msc_hid_freertos/ses/lpc175x_6x/LPC1769_MemoryMap.xml)0
-rw-r--r--examples/device/cdc_msc_freertos/ses/lpc175x_6x/LPC176x5x_Registers.xml (renamed from examples/device/cdc_msc_hid_freertos/ses/lpc175x_6x/LPC176x5x_Registers.xml)0
-rw-r--r--examples/device/cdc_msc_freertos/ses/lpc175x_6x/LPC176x5x_Vectors.s (renamed from examples/device/cdc_msc_hid_freertos/ses/lpc175x_6x/LPC176x5x_Vectors.s)0
-rw-r--r--examples/device/cdc_msc_freertos/ses/lpc175x_6x/flash_placement.xml (renamed from examples/device/cdc_msc_hid_freertos/ses/lpc175x_6x/flash_placement.xml)0
-rw-r--r--examples/device/cdc_msc_freertos/ses/lpc175x_6x/lpc175x_6x.emProject (renamed from examples/device/cdc_msc_hid_freertos/ses/lpc175x_6x/lpc175x_6x.emProject)0
-rw-r--r--examples/device/cdc_msc_freertos/ses/lpc175x_6x/thumb_crt0.s (renamed from examples/device/cdc_msc_hid_freertos/ses/lpc175x_6x/thumb_crt0.s)0
-rw-r--r--examples/device/cdc_msc_freertos/ses/nrf5x/flash_placement.xml (renamed from examples/device/cdc_msc_hid_freertos/ses/nrf5x/flash_placement.xml)0
-rw-r--r--examples/device/cdc_msc_freertos/ses/nrf5x/nRF52840_xxAA_MemoryMap.xml (renamed from examples/device/cdc_msc_hid_freertos/ses/nrf5x/nRF52840_xxAA_MemoryMap.xml)0
-rw-r--r--examples/device/cdc_msc_freertos/ses/nrf5x/nRF_Target.js (renamed from examples/device/cdc_msc_hid_freertos/ses/nrf5x/nRF_Target.js)0
-rw-r--r--examples/device/cdc_msc_freertos/ses/nrf5x/nrf52840_Registers.xml (renamed from examples/device/cdc_msc_hid_freertos/ses/nrf5x/nrf52840_Registers.xml)0
-rw-r--r--examples/device/cdc_msc_freertos/ses/nrf5x/nrf5x.emProject (renamed from examples/device/cdc_msc_hid_freertos/ses/nrf5x/nrf5x.emProject)0
-rw-r--r--examples/device/cdc_msc_freertos/ses/nrf5x/thumb_crt0.s (renamed from examples/device/cdc_msc_hid_freertos/ses/nrf5x/thumb_crt0.s)0
-rw-r--r--examples/device/cdc_msc_freertos/ses/samd21/ATSAMD21G18A_MemoryMap.xml (renamed from examples/device/cdc_msc_hid_freertos/ses/samd21/ATSAMD21G18A_MemoryMap.xml)0
-rw-r--r--examples/device/cdc_msc_freertos/ses/samd21/ATSAMD21G18A_Registers.xml (renamed from examples/device/cdc_msc_hid_freertos/ses/samd21/ATSAMD21G18A_Registers.xml)0
-rw-r--r--examples/device/cdc_msc_freertos/ses/samd21/ATSAMD21G18A_Vectors.s (renamed from examples/device/cdc_msc_hid_freertos/ses/samd21/ATSAMD21G18A_Vectors.s)0
-rw-r--r--examples/device/cdc_msc_freertos/ses/samd21/SAMD21_Startup.s (renamed from examples/device/cdc_msc_hid_freertos/ses/samd21/SAMD21_Startup.s)0
-rw-r--r--examples/device/cdc_msc_freertos/ses/samd21/SAMD21_Target.js (renamed from examples/device/cdc_msc_hid_freertos/ses/samd21/SAMD21_Target.js)0
-rw-r--r--examples/device/cdc_msc_freertos/ses/samd21/flash_placement.xml (renamed from examples/device/cdc_msc_hid_freertos/ses/samd21/flash_placement.xml)0
-rw-r--r--examples/device/cdc_msc_freertos/ses/samd21/samd21.emProject (renamed from examples/device/cdc_msc_hid_freertos/ses/samd21/samd21.emProject)0
-rw-r--r--examples/device/cdc_msc_freertos/ses/samd21/thumb_crt0.s (renamed from examples/device/cdc_msc_hid_freertos/ses/samd21/thumb_crt0.s)0
-rw-r--r--examples/device/cdc_msc_freertos/ses/samd51/ATSAMD51J19A_MemoryMap.xml (renamed from examples/device/cdc_msc_hid_freertos/ses/samd51/ATSAMD51J19A_MemoryMap.xml)0
-rw-r--r--examples/device/cdc_msc_freertos/ses/samd51/ATSAMD51J19A_Registers.xml (renamed from examples/device/cdc_msc_hid_freertos/ses/samd51/ATSAMD51J19A_Registers.xml)0
-rw-r--r--examples/device/cdc_msc_freertos/ses/samd51/ATSAMD51J19A_Vectors.s (renamed from examples/device/cdc_msc_hid_freertos/ses/samd51/ATSAMD51J19A_Vectors.s)0
-rw-r--r--examples/device/cdc_msc_freertos/ses/samd51/SAMD51_Startup.s (renamed from examples/device/cdc_msc_hid_freertos/ses/samd51/SAMD51_Startup.s)0
-rw-r--r--examples/device/cdc_msc_freertos/ses/samd51/SAMD51_Target.js (renamed from examples/device/cdc_msc_hid_freertos/ses/samd51/SAMD51_Target.js)0
-rw-r--r--examples/device/cdc_msc_freertos/ses/samd51/flash_placement.xml (renamed from examples/device/cdc_msc_hid_freertos/ses/samd51/flash_placement.xml)0
-rw-r--r--examples/device/cdc_msc_freertos/ses/samd51/samd51.emProject (renamed from examples/device/cdc_msc_hid_freertos/ses/samd51/samd51.emProject)0
-rw-r--r--examples/device/cdc_msc_freertos/ses/samd51/thumb_crt0.s (renamed from examples/device/cdc_msc_hid_freertos/ses/samd51/thumb_crt0.s)0
-rw-r--r--examples/device/cdc_msc_freertos/src/FreeRTOSConfig.h233
-rw-r--r--examples/device/cdc_msc_freertos/src/freertos_hook.c (renamed from examples/device/cdc_msc_hid_freertos/src/freertos_hook.c)0
-rw-r--r--examples/device/cdc_msc_freertos/src/main.c (renamed from examples/device/cdc_msc_hid_freertos/src/main.c)119
-rw-r--r--examples/device/cdc_msc_freertos/src/msc_disk.c (renamed from examples/device/cdc_msc_hid_freertos/src/msc_disk.c)12
-rw-r--r--examples/device/cdc_msc_freertos/src/tusb_config.h (renamed from examples/device/cdc_msc_hid_freertos/src/tusb_config.h)4
-rw-r--r--examples/device/cdc_msc_freertos/src/usb_descriptors.c (renamed from examples/device/cdc_msc_hid_freertos/src/usb_descriptors.c)91
-rw-r--r--examples/device/cdc_msc_freertos/src/usb_descriptors.h (renamed from examples/device/cdc_msc_hid_freertos/src/usb_descriptors.h)0
-rw-r--r--examples/device/cdc_msc_hid_freertos/Makefile26
-rw-r--r--examples/device/dfu_rt/src/tusb_config.h2
-rw-r--r--examples/device/dfu_rt/src/usb_descriptors.c4
-rw-r--r--examples/device/hid_composite/src/tusb_config.h2
-rw-r--r--examples/device/hid_composite/src/usb_descriptors.c4
-rw-r--r--examples/device/hid_generic_inout/src/tusb_config.h2
-rw-r--r--examples/device/hid_generic_inout/src/usb_descriptors.c4
-rw-r--r--examples/device/midi_test/src/tusb_config.h2
-rw-r--r--examples/device/midi_test/src/usb_descriptors.c4
-rw-r--r--examples/device/msc_dual_lun/src/tusb_config.h2
-rw-r--r--examples/device/msc_dual_lun/src/usb_descriptors.c22
-rw-r--r--examples/device/net_lwip_webserver/.skip.MCU_LPC11UXX0
-rw-r--r--examples/device/net_lwip_webserver/.skip.MCU_LPC13XX0
-rw-r--r--examples/device/net_lwip_webserver/.skip.MCU_NUC1210
-rw-r--r--examples/device/net_lwip_webserver/.skip.MCU_STM32L00
-rw-r--r--examples/device/net_lwip_webserver/Makefile57
-rw-r--r--examples/device/net_lwip_webserver/src/arch/cc.h75
-rw-r--r--examples/device/net_lwip_webserver/src/lwipopts.h57
-rw-r--r--examples/device/net_lwip_webserver/src/main.c214
-rw-r--r--examples/device/net_lwip_webserver/src/tusb_config.h90
-rw-r--r--examples/device/net_lwip_webserver/src/usb_descriptors.c199
-rw-r--r--examples/device/net_lwip_webserver/src/usb_descriptors.h28
-rw-r--r--examples/device/usbtmc/src/tusb_config.h2
-rw-r--r--examples/device/usbtmc/src/usb_descriptors.c4
-rw-r--r--examples/device/webusb_serial/src/tusb_config.h2
-rw-r--r--examples/device/webusb_serial/src/usb_descriptors.c4
-rw-r--r--examples/host/cdc_msc_hid/ses/lpc175x_6x/lpc175x_6x.emProject54
-rw-r--r--examples/host/cdc_msc_hid/ses/lpc18xx/lpc18xx.emProject73
-rw-r--r--examples/host/cdc_msc_hid/ses/lpc40xx/lpc40xx.emProject53
-rw-r--r--examples/host/cdc_msc_hid/ses/lpc43xx/lpc43xx.emProject89
-rw-r--r--examples/host/cdc_msc_hid/src/tusb_config.h2
-rw-r--r--examples/make.mk9
-rw-r--r--examples/readme.md2
-rw-r--r--examples/rules.mk6
85 files changed, 1623 insertions, 372 deletions
diff --git a/examples/device/board_test/src/main.c b/examples/device/board_test/src/main.c
index 865821745..584ff799d 100644
--- a/examples/device/board_test/src/main.c
+++ b/examples/device/board_test/src/main.c
@@ -42,7 +42,7 @@ enum {
BLINK_UNPRESSED = 1000
};
-#define HELLO_STR "Hello from TinyUSB\n"
+#define HELLO_STR "Hello from TinyUSB\r\n"
int main(void)
{
diff --git a/examples/device/cdc_dual_ports/Makefile b/examples/device/cdc_dual_ports/Makefile
new file mode 100644
index 000000000..5a455078e
--- /dev/null
+++ b/examples/device/cdc_dual_ports/Makefile
@@ -0,0 +1,12 @@
+include ../../../tools/top.mk
+include ../../make.mk
+
+INC += \
+ src \
+ $(TOP)/hw \
+
+# Example source
+EXAMPLE_SOURCE += $(wildcard src/*.c)
+SRC_C += $(addprefix $(CURRENT_PATH)/, $(EXAMPLE_SOURCE))
+
+include ../../rules.mk
diff --git a/examples/device/cdc_dual_ports/src/main.c b/examples/device/cdc_dual_ports/src/main.c
new file mode 100644
index 000000000..d6e38df85
--- /dev/null
+++ b/examples/device/cdc_dual_ports/src/main.c
@@ -0,0 +1,100 @@
+/*
+ * The MIT License (MIT)
+ *
+ * Copyright (c) 2019 Ha Thach (tinyusb.org)
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ *
+ */
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#include <ctype.h>
+
+#include "bsp/board.h"
+#include "tusb.h"
+
+//------------- prototypes -------------//
+static void cdc_task(void);
+
+/*------------- MAIN -------------*/
+int main(void)
+{
+ board_init();
+
+ tusb_init();
+
+ while (1)
+ {
+ tud_task(); // tinyusb device task
+ cdc_task();
+ }
+
+ return 0;
+}
+
+// echo to either Serial0 or Serial1
+// with Serial0 as all lower case, Serial1 as all upper case
+static void echo_serial_port(uint8_t itf, uint8_t buf[], uint32_t count)
+{
+ for(uint32_t i=0; i<count; i++)
+ {
+ if (itf == 0)
+ {
+ // echo back 1st port as lower case
+ if (isupper(buf[i])) buf[i] += 'a' - 'A';
+ }
+ else
+ {
+ // echo back additional ports as upper case
+ if (islower(buf[i])) buf[i] -= 'a' - 'A';
+ }
+
+ tud_cdc_n_write_char(itf, buf[i]);
+
+ if ( buf[i] == '\r' ) tud_cdc_n_write_char(itf, '\n');
+ }
+ tud_cdc_n_write_flush(itf);
+}
+
+//--------------------------------------------------------------------+
+// USB CDC
+//--------------------------------------------------------------------+
+static void cdc_task(void)
+{
+ uint8_t itf;
+
+ for (itf = 0; itf < CFG_TUD_CDC; itf++)
+ {
+ if ( tud_cdc_n_connected(itf) )
+ {
+ if ( tud_cdc_n_available(itf) )
+ {
+ uint8_t buf[64];
+
+ uint32_t count = tud_cdc_n_read(itf, buf, sizeof(buf));
+
+ // echo back to both serial ports
+ echo_serial_port(0, buf, count);
+ echo_serial_port(1, buf, count);
+ }
+ }
+ }
+}
diff --git a/examples/device/cdc_dual_ports/src/tusb_config.h b/examples/device/cdc_dual_ports/src/tusb_config.h
new file mode 100644
index 000000000..9783bd4f6
--- /dev/null
+++ b/examples/device/cdc_dual_ports/src/tusb_config.h
@@ -0,0 +1,92 @@
+/*
+ * The MIT License (MIT)
+ *
+ * Copyright (c) 2019 Ha Thach (tinyusb.org)
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ *
+ */
+
+#ifndef _TUSB_CONFIG_H_
+#define _TUSB_CONFIG_H_
+
+#ifdef __cplusplus
+ extern "C" {
+#endif
+
+//--------------------------------------------------------------------
+// COMMON CONFIGURATION
+//--------------------------------------------------------------------
+
+// defined by compiler flags for flexibility
+#ifndef CFG_TUSB_MCU
+ #error CFG_TUSB_MCU must be defined
+#endif
+
+#if CFG_TUSB_MCU == OPT_MCU_LPC43XX || CFG_TUSB_MCU == OPT_MCU_LPC18XX || CFG_TUSB_MCU == OPT_MCU_MIMXRT10XX || CFG_TUSB_MCU == OPT_MCU_NUC505
+#define CFG_TUSB_RHPORT0_MODE (OPT_MODE_DEVICE | OPT_MODE_HIGH_SPEED)
+#else
+#define CFG_TUSB_RHPORT0_MODE OPT_MODE_DEVICE
+#endif
+
+#define CFG_TUSB_OS OPT_OS_NONE
+
+// CFG_TUSB_DEBUG is defined by compiler in DEBUG build
+// #define CFG_TUSB_DEBUG 0
+
+/* USB DMA on some MCUs can only access a specific SRAM region with restriction on alignment.
+ * Tinyusb use follows macros to declare transferring memory so that they can be put
+ * into those specific section.
+ * e.g
+ * - CFG_TUSB_MEM SECTION : __attribute__ (( section(".usb_ram") ))
+ * - CFG_TUSB_MEM_ALIGN : __attribute__ ((aligned(4)))
+ */
+#ifndef CFG_TUSB_MEM_SECTION
+#define CFG_TUSB_MEM_SECTION
+#endif
+
+#ifndef CFG_TUSB_MEM_ALIGN
+#define CFG_TUSB_MEM_ALIGN __attribute__ ((aligned(4)))
+#endif
+
+//--------------------------------------------------------------------
+// DEVICE CONFIGURATION
+//--------------------------------------------------------------------
+
+#ifndef CFG_TUD_ENDPOINT0_SIZE
+#define CFG_TUD_ENDPOINT0_SIZE 64
+#endif
+
+//------------- CLASS -------------//
+#define CFG_TUD_CDC 2
+#define CFG_TUD_MSC 0
+#define CFG_TUD_HID 0
+#define CFG_TUD_MIDI 0
+#define CFG_TUD_VENDOR 0
+
+// CDC FIFO size of TX and RX
+#define CFG_TUD_CDC_RX_BUFSIZE 64
+#define CFG_TUD_CDC_TX_BUFSIZE 64
+
+
+#ifdef __cplusplus
+ }
+#endif
+
+#endif /* _TUSB_CONFIG_H_ */
diff --git a/examples/device/cdc_dual_ports/src/usb_descriptors.c b/examples/device/cdc_dual_ports/src/usb_descriptors.c
new file mode 100644
index 000000000..1b1d171b1
--- /dev/null
+++ b/examples/device/cdc_dual_ports/src/usb_descriptors.c
@@ -0,0 +1,165 @@
+/*
+ * The MIT License (MIT)
+ *
+ * Copyright (c) 2019 Ha Thach (tinyusb.org)
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ *
+ */
+
+#include "tusb.h"
+
+/* A combination of interfaces must have a unique product id, since PC will save device driver after the first plug.
+ * Same VID/PID with different interface e.g MSC (first), then CDC (later) will possibly cause system error on PC.
+ *
+ * Auto ProductID layout's Bitmap:
+ * [MSB] MIDI | HID | MSC | CDC [LSB]
+ */
+#define _PID_MAP(itf, n) ( (CFG_TUD_##itf) << (n) )
+#define USB_PID (0x4000 | _PID_MAP(CDC, 0) | _PID_MAP(MSC, 1) | _PID_MAP(HID, 2) | \
+ _PID_MAP(MIDI, 3) | _PID_MAP(VENDOR, 4) )
+
+//--------------------------------------------------------------------+
+// Device Descriptors
+//--------------------------------------------------------------------+
+tusb_desc_device_t const desc_device =
+{
+ .bLength = sizeof(tusb_desc_device_t),
+ .bDescriptorType = TUSB_DESC_DEVICE,
+ .bcdUSB = 0x0200,
+
+ // Use Interface Association Descriptor (IAD) for CDC
+ // As required by USB Specs IAD's subclass must be common class (2) and protocol must be IAD (1)
+ .bDeviceClass = TUSB_CLASS_MISC,
+ .bDeviceSubClass = MISC_SUBCLASS_COMMON,
+ .bDeviceProtocol = MISC_PROTOCOL_IAD,
+ .bMaxPacketSize0 = CFG_TUD_ENDPOINT0_SIZE,
+
+ .idVendor = 0xCafe,
+ .idProduct = USB_PID,
+ .bcdDevice = 0x0100,
+
+ .iManufacturer = 0x01,
+ .iProduct = 0x02,
+ .iSerialNumber = 0x03,
+
+ .bNumConfigurations = 0x01
+};
+
+// Invoked when received GET DEVICE DESCRIPTOR
+// Application return pointer to descriptor
+uint8_t const * tud_descriptor_device_cb(void)
+{
+ return (uint8_t const *) &desc_device;
+}
+
+//--------------------------------------------------------------------+
+// Configuration Descriptor
+//--------------------------------------------------------------------+
+enum
+{
+ ITF_NUM_CDC1 = 0,
+ ITF_NUM_CDC_DATA1,
+ ITF_NUM_CDC2,
+ ITF_NUM_CDC_DATA2,
+ ITF_NUM_TOTAL
+};
+
+#define CONFIG_TOTAL_LEN (TUD_CONFIG_DESC_LEN + CFG_TUD_CDC * TUD_CDC_DESC_LEN)
+
+#if CFG_TUSB_MCU == OPT_MCU_LPC175X_6X || CFG_TUSB_MCU == OPT_MCU_LPC177X_8X || CFG_TUSB_MCU == OPT_MCU_LPC40XX
+ // LPC 17xx and 40xx endpoint type (bulk/interrupt/iso) are fixed by its number
+ // 0 control, 1 In, 2 Bulk, 3 Iso, 4 In etc ...
+ #define EPNUM_CDC 2
+#else
+ #define EPNUM_CDC 2
+#endif
+
+uint8_t const desc_configuration[] =
+{
+ // Interface count, string index, total length, attribute, power in mA
+ TUD_CONFIG_DESCRIPTOR(ITF_NUM_TOTAL, 0, CONFIG_TOTAL_LEN, TUSB_DESC_CONFIG_ATT_REMOTE_WAKEUP, 100),
+
+ // 1st CDC: Interface number, string index, EP notification address and size, EP data address (out, in) and size.
+ TUD_CDC_DESCRIPTOR(ITF_NUM_CDC1, 4, 0x81, 8, EPNUM_CDC, 0x80 | EPNUM_CDC, 64),
+
+ // 2nd CDC: Interface number, string index, EP notification address and size, EP data address (out, in) and size.
+ TUD_CDC_DESCRIPTOR(ITF_NUM_CDC2, 4, 0x83, 8, EPNUM_CDC + 2, 0x80 | (EPNUM_CDC + 2), 64),
+};
+
+// Invoked when received GET CONFIGURATION DESCRIPTOR
+// Application return pointer to descriptor
+// Descriptor contents must exist long enough for transfer to complete
+uint8_t const * tud_descriptor_configuration_cb(uint8_t index)
+{
+ (void) index; // for multiple configurations
+ return desc_configuration;
+}
+
+//--------------------------------------------------------------------+
+// String Descriptors
+//--------------------------------------------------------------------+
+
+// array of pointer to string descriptors
+char const* string_desc_arr [] =
+{
+ (const char[]) { 0x09, 0x04 }, // 0: is supported language is English (0x0409)
+ "TinyUSB", // 1: Manufacturer
+ "TinyUSB Device", // 2: Product
+ "123456", // 3: Serials, should use chip ID
+ "TinyUSB CDC", // 4: CDC Interface
+};
+
+static uint16_t _desc_str[32];
+
+// Invoked when received GET STRING DESCRIPTOR request
+// Application return pointer to descriptor, whose contents must exist long enough for transfer to complete
+uint16_t const* tud_descriptor_string_cb(uint8_t index, uint16_t langid)
+{
+ (void) langid;
+
+ uint8_t chr_count;
+
+ if ( index == 0)
+ {
+ memcpy(&_desc_str[1], string_desc_arr[0], 2);
+ chr_count = 1;
+ }else
+ {
+ // Convert ASCII string into UTF-16
+
+ if ( !(index < sizeof(string_desc_arr)/sizeof(string_desc_arr[0])) ) return NULL;
+
+ const char* str = string_desc_arr[index];
+
+ // Cap at max char
+ chr_count = strlen(str);
+ if ( chr_count > 31 ) chr_count = 31;
+
+ for(uint8_t i=0; i<chr_count; i++)
+ {
+ _desc_str[1+i] = str[i];
+ }
+ }
+
+ // first byte is length (including header), second byte is string type
+ _desc_str[0] = (TUSB_DESC_STRING << 8 ) | (2*chr_count + 2);
+
+ return _desc_str;
+}
diff --git a/examples/device/cdc_msc/ses/nrf5x/nrf5x.emProject b/examples/device/cdc_msc/ses/nrf5x/nrf5x.emProject
index 55c5a4ec4..fa5534635 100644
--- a/examples/device/cdc_msc/ses/nrf5x/nrf5x.emProject
+++ b/examples/device/cdc_msc/ses/nrf5x/nrf5x.emProject
@@ -60,6 +60,7 @@
<folder Name="src">
<file file_name="../../../../../hw/mcu/nordic/nrfx/drivers/src/nrfx_power.c" />
<file file_name="../../../../../hw/mcu/nordic/nrfx/drivers/src/nrfx_qspi.c" />
+ <file file_name="../../../../../hw/mcu/nordic/nrfx/drivers/src/nrfx_uarte.c" />
</folder>
</folder>
<folder Name="hal">
diff --git a/examples/device/cdc_msc/src/main.c b/examples/device/cdc_msc/src/main.c
index e1b9ab113..a407e2ddd 100644
--- a/examples/device/cdc_msc/src/main.c
+++ b/examples/device/cdc_msc/src/main.c
@@ -136,7 +136,7 @@ void tud_cdc_line_state_cb(uint8_t itf, bool dtr, bool rts)
if ( dtr && rts )
{
// print initial message when connected
- tud_cdc_write_str("\r\nTinyUSB CDC MSC HID device example\r\n");
+ tud_cdc_write_str("\r\nTinyUSB CDC MSC device example\r\n");
}
}
diff --git a/examples/device/cdc_msc/src/tusb_config.h b/examples/device/cdc_msc/src/tusb_config.h
index 4455f665e..733fd2d0a 100644
--- a/examples/device/cdc_msc/src/tusb_config.h
+++ b/examples/device/cdc_msc/src/tusb_config.h
@@ -39,7 +39,7 @@
#error CFG_TUSB_MCU must be defined
#endif
-#if CFG_TUSB_MCU == OPT_MCU_LPC43XX || CFG_TUSB_MCU == OPT_MCU_LPC18XX
+#if CFG_TUSB_MCU == OPT_MCU_LPC43XX || CFG_TUSB_MCU == OPT_MCU_LPC18XX || CFG_TUSB_MCU == OPT_MCU_MIMXRT10XX || CFG_TUSB_MCU == OPT_MCU_NUC505
#define CFG_TUSB_RHPORT0_MODE (OPT_MODE_DEVICE | OPT_MODE_HIGH_SPEED)
#else
#define CFG_TUSB_RHPORT0_MODE OPT_MODE_DEVICE
@@ -68,6 +68,7 @@
//--------------------------------------------------------------------
// DEVICE CONFIGURATION
//--------------------------------------------------------------------
+
#ifndef CFG_TUD_ENDPOINT0_SIZE
#define CFG_TUD_ENDPOINT0_SIZE 64
#endif
diff --git a/examples/device/cdc_msc/src/usb_descriptors.c b/examples/device/cdc_msc/src/usb_descriptors.c
index 11d07e9ba..127008227 100644
--- a/examples/device/cdc_msc/src/usb_descriptors.c
+++ b/examples/device/cdc_msc/src/usb_descriptors.c
@@ -86,12 +86,32 @@ enum
#if CFG_TUSB_MCU == OPT_MCU_LPC175X_6X || CFG_TUSB_MCU == OPT_MCU_LPC177X_8X || CFG_TUSB_MCU == OPT_MCU_LPC40XX
// LPC 17xx and 40xx endpoint type (bulk/interrupt/iso) are fixed by its number
- // 0 control, 1 In, 2 Bulk, 3 Iso, 4 In etc ...
- // Note: since CDC EP ( 1 & 2), HID (4) are spot-on, thus we only need to force
- // endpoint number for MSC to 5
- #define EPNUM_MSC 0x05
+ // 0 control, 1 In, 2 Bulk, 3 Iso, 4 In, 5 Bulk etc ...
+ #define EPNUM_CDC_NOTIF 0x81
+ #define EPNUM_CDC_OUT 0x02
+ #define EPNUM_CDC_IN 0x82
+
+ #define EPNUM_MSC_OUT 0x05
+ #define EPNUM_MSC_IN 0x85
+
+#elif CFG_TUSB_MCU == OPT_MCU_SAMG
+ // SAMG doesn't support a same endpoint number with different direction IN and OUT
+ // e.g EP1 OUT & EP1 IN cannot exist together
+ #define EPNUM_CDC_NOTIF 0x81
+ #define EPNUM_CDC_OUT 0x02
+ #define EPNUM_CDC_IN 0x83
+
+ #define EPNUM_MSC_OUT 0x04
+ #define EPNUM_MSC_IN 0x85
+
#else
- #define EPNUM_MSC 0x03
+ #define EPNUM_CDC_NOTIF 0x81
+ #define EPNUM_CDC_OUT 0x02
+ #define EPNUM_CDC_IN 0x82
+
+ #define EPNUM_MSC_OUT 0x03
+ #define EPNUM_MSC_IN 0x83
+
#endif
uint8_t const desc_configuration[] =
@@ -100,10 +120,10 @@ uint8_t const desc_configuration[] =
TUD_CONFIG_DESCRIPTOR(ITF_NUM_TOTAL, 0, CONFIG_TOTAL_LEN, TUSB_DESC_CONFIG_ATT_REMOTE_WAKEUP, 100),
// Interface number, string index, EP notification address and size, EP data address (out, in) and size.
- TUD_CDC_DESCRIPTOR(ITF_NUM_CDC, 4, 0x81, 8, 0x02, 0x82, 64),
+ TUD_CDC_DESCRIPTOR(ITF_NUM_CDC, 4, EPNUM_CDC_NOTIF, 8, EPNUM_CDC_OUT, EPNUM_CDC_IN, 64),
// Interface number, string index, EP Out & EP In address, EP size
- TUD_MSC_DESCRIPTOR(ITF_NUM_MSC, 5, EPNUM_MSC, 0x80 | EPNUM_MSC, (CFG_TUSB_RHPORT0_MODE & OPT_MODE_HIGH_SPEED) ? 512 : 64),
+ TUD_MSC_DESCRIPTOR(ITF_NUM_MSC, 5, EPNUM_MSC_OUT, EPNUM_MSC_IN, (CFG_TUSB_RHPORT0_MODE & OPT_MODE_HIGH_SPEED) ? 512 : 64),
};
@@ -135,8 +155,10 @@ static uint16_t _desc_str[32];
// Invoked when received GET STRING DESCRIPTOR request
// Application return pointer to descriptor, whose contents must exist long enough for transfer to complete
-uint16_t const* tud_descriptor_string_cb(uint8_t index)
+uint16_t const* tud_descriptor_string_cb(uint8_t index, uint16_t langid)
{
+ (void) langid;
+
uint8_t chr_count;
if ( index == 0)
diff --git a/examples/device/cdc_msc_freertos/.skip.MCU_CXD56 b/examples/device/cdc_msc_freertos/.skip.MCU_CXD56
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/examples/device/cdc_msc_freertos/.skip.MCU_CXD56
diff --git a/examples/device/cdc_msc_freertos/.skip.MCU_VALENTYUSB_EPTRI b/examples/device/cdc_msc_freertos/.skip.MCU_VALENTYUSB_EPTRI
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/examples/device/cdc_msc_freertos/.skip.MCU_VALENTYUSB_EPTRI
diff --git a/examples/device/cdc_msc_freertos/Makefile b/examples/device/cdc_msc_freertos/Makefile
new file mode 100644
index 000000000..3570daa41
--- /dev/null
+++ b/examples/device/cdc_msc_freertos/Makefile
@@ -0,0 +1,27 @@
+include ../../../tools/top.mk
+include ../../make.mk
+
+FREERTOS_SRC = lib/FreeRTOS/FreeRTOS/Source
+
+INC += \
+ src \
+ $(TOP)/hw \
+ $(TOP)/$(FREERTOS_SRC)/include \
+ $(TOP)/$(FREERTOS_SRC)/portable/GCC/$(FREERTOS_PORT)
+
+# Example source
+EXAMPLE_SOURCE += $(wildcard src/*.c)
+SRC_C += $(addprefix $(CURRENT_PATH)/, $(EXAMPLE_SOURCE))
+
+# FreeRTOS source, all files in port folder
+SRC_C += \
+ $(FREERTOS_SRC)/list.c \
+ $(FREERTOS_SRC)/queue.c \
+ $(FREERTOS_SRC)/tasks.c \
+ $(FREERTOS_SRC)/timers.c \
+ $(subst ../../../,,$(wildcard ../../../$(FREERTOS_SRC)/portable/GCC/$(FREERTOS_PORT)/*.c))
+
+# FreeRTOS (lto + Os) linker issue
+LDFLAGS += -Wl,--undefined=vTaskSwitchContext
+
+include ../../rules.mk
diff --git a/examples/device/cdc_msc_hid_freertos/ses/cdc_msc_hid_freertos.emProject b/examples/device/cdc_msc_freertos/ses/cdc_msc_hid_freertos.emProject
index acd8e98c2..acd8e98c2 100644
--- a/examples/device/cdc_msc_hid_freertos/ses/cdc_msc_hid_freertos.emProject
+++ b/examples/device/cdc_msc_freertos/ses/cdc_msc_hid_freertos.emProject
diff --git a/examples/device/cdc_msc_hid_freertos/ses/lpc175x_6x/FreeRTOSConfig.h b/examples/device/cdc_msc_freertos/ses/lpc175x_6x/FreeRTOSConfig.h
index 5d3ba479e..5d3ba479e 100644
--- a/examples/device/cdc_msc_hid_freertos/ses/lpc175x_6x/FreeRTOSConfig.h
+++ b/examples/device/cdc_msc_freertos/ses/lpc175x_6x/FreeRTOSConfig.h
diff --git a/examples/device/cdc_msc_hid_freertos/ses/lpc175x_6x/LPC1700_Startup.s b/examples/device/cdc_msc_freertos/ses/lpc175x_6x/LPC1700_Startup.s
index f039ad934..f039ad934 100644
--- a/examples/device/cdc_msc_hid_freertos/ses/lpc175x_6x/LPC1700_Startup.s
+++ b/examples/device/cdc_msc_freertos/ses/lpc175x_6x/LPC1700_Startup.s
diff --git a/examples/device/cdc_msc_hid_freertos/ses/lpc175x_6x/LPC1700_Target.js b/examples/device/cdc_msc_freertos/ses/lpc175x_6x/LPC1700_Target.js
index 7f945a3d2..7f945a3d2 100644
--- a/examples/device/cdc_msc_hid_freertos/ses/lpc175x_6x/LPC1700_Target.js
+++ b/examples/device/cdc_msc_freertos/ses/lpc175x_6x/LPC1700_Target.js
diff --git a/examples/device/cdc_msc_hid_freertos/ses/lpc175x_6x/LPC1769_MemoryMap.xml b/examples/device/cdc_msc_freertos/ses/lpc175x_6x/LPC1769_MemoryMap.xml
index d9c07aea3..d9c07aea3 100644
--- a/examples/device/cdc_msc_hid_freertos/ses/lpc175x_6x/LPC1769_MemoryMap.xml
+++ b/examples/device/cdc_msc_freertos/ses/lpc175x_6x/LPC1769_MemoryMap.xml
diff --git a/examples/device/cdc_msc_hid_freertos/ses/lpc175x_6x/LPC176x5x_Registers.xml b/examples/device/cdc_msc_freertos/ses/lpc175x_6x/LPC176x5x_Registers.xml
index fd38966b8..fd38966b8 100644
--- a/examples/device/cdc_msc_hid_freertos/ses/lpc175x_6x/LPC176x5x_Registers.xml
+++ b/examples/device/cdc_msc_freertos/ses/lpc175x_6x/LPC176x5x_Registers.xml
diff --git a/examples/device/cdc_msc_hid_freertos/ses/lpc175x_6x/LPC176x5x_Vectors.s b/examples/device/cdc_msc_freertos/ses/lpc175x_6x/LPC176x5x_Vectors.s
index c5fae1310..c5fae1310 100644
--- a/examples/device/cdc_msc_hid_freertos/ses/lpc175x_6x/LPC176x5x_Vectors.s
+++ b/examples/device/cdc_msc_freertos/ses/lpc175x_6x/LPC176x5x_Vectors.s
diff --git a/examples/device/cdc_msc_hid_freertos/ses/lpc175x_6x/flash_placement.xml b/examples/device/cdc_msc_freertos/ses/lpc175x_6x/flash_placement.xml
index 79bedc537..79bedc537 100644
--- a/examples/device/cdc_msc_hid_freertos/ses/lpc175x_6x/flash_placement.xml
+++ b/examples/device/cdc_msc_freertos/ses/lpc175x_6x/flash_placement.xml
diff --git a/examples/device/cdc_msc_hid_freertos/ses/lpc175x_6x/lpc175x_6x.emProject b/examples/device/cdc_msc_freertos/ses/lpc175x_6x/lpc175x_6x.emProject
index 4dc111f2e..4dc111f2e 100644
--- a/examples/device/cdc_msc_hid_freertos/ses/lpc175x_6x/lpc175x_6x.emProject
+++ b/examples/device/cdc_msc_freertos/ses/lpc175x_6x/lpc175x_6x.emProject
diff --git a/examples/device/cdc_msc_hid_freertos/ses/lpc175x_6x/thumb_crt0.s b/examples/device/cdc_msc_freertos/ses/lpc175x_6x/thumb_crt0.s
index 17f88e0ca..17f88e0ca 100644
--- a/examples/device/cdc_msc_hid_freertos/ses/lpc175x_6x/thumb_crt0.s
+++ b/examples/device/cdc_msc_freertos/ses/lpc175x_6x/thumb_crt0.s
diff --git a/examples/device/cdc_msc_hid_freertos/ses/nrf5x/flash_placement.xml b/examples/device/cdc_msc_freertos/ses/nrf5x/flash_placement.xml
index 951d23710..951d23710 100644
--- a/examples/device/cdc_msc_hid_freertos/ses/nrf5x/flash_placement.xml
+++ b/examples/device/cdc_msc_freertos/ses/nrf5x/flash_placement.xml
diff --git a/examples/device/cdc_msc_hid_freertos/ses/nrf5x/nRF52840_xxAA_MemoryMap.xml b/examples/device/cdc_msc_freertos/ses/nrf5x/nRF52840_xxAA_MemoryMap.xml
index cc4056c0d..cc4056c0d 100644
--- a/examples/device/cdc_msc_hid_freertos/ses/nrf5x/nRF52840_xxAA_MemoryMap.xml
+++ b/examples/device/cdc_msc_freertos/ses/nrf5x/nRF52840_xxAA_MemoryMap.xml
diff --git a/examples/device/cdc_msc_hid_freertos/ses/nrf5x/nRF_Target.js b/examples/device/cdc_msc_freertos/ses/nrf5x/nRF_Target.js
index 20560af43..20560af43 100644
--- a/examples/device/cdc_msc_hid_freertos/ses/nrf5x/nRF_Target.js
+++ b/examples/device/cdc_msc_freertos/ses/nrf5x/nRF_Target.js
diff --git a/examples/device/cdc_msc_hid_freertos/ses/nrf5x/nrf52840_Registers.xml b/examples/device/cdc_msc_freertos/ses/nrf5x/nrf52840_Registers.xml
index 39f861f95..39f861f95 100644
--- a/examples/device/cdc_msc_hid_freertos/ses/nrf5x/nrf52840_Registers.xml
+++ b/examples/device/cdc_msc_freertos/ses/nrf5x/nrf52840_Registers.xml
diff --git a/examples/device/cdc_msc_hid_freertos/ses/nrf5x/nrf5x.emProject b/examples/device/cdc_msc_freertos/ses/nrf5x/nrf5x.emProject
index f01b26d23..f01b26d23 100644
--- a/examples/device/cdc_msc_hid_freertos/ses/nrf5x/nrf5x.emProject
+++ b/examples/device/cdc_msc_freertos/ses/nrf5x/nrf5x.emProject
diff --git a/examples/device/cdc_msc_hid_freertos/ses/nrf5x/thumb_crt0.s b/examples/device/cdc_msc_freertos/ses/nrf5x/thumb_crt0.s
index 71820cb51..71820cb51 100644
--- a/examples/device/cdc_msc_hid_freertos/ses/nrf5x/thumb_crt0.s
+++ b/examples/device/cdc_msc_freertos/ses/nrf5x/thumb_crt0.s
diff --git a/examples/device/cdc_msc_hid_freertos/ses/samd21/ATSAMD21G18A_MemoryMap.xml b/examples/device/cdc_msc_freertos/ses/samd21/ATSAMD21G18A_MemoryMap.xml
index 2143d3055..2143d3055 100644
--- a/examples/device/cdc_msc_hid_freertos/ses/samd21/ATSAMD21G18A_MemoryMap.xml
+++ b/examples/device/cdc_msc_freertos/ses/samd21/ATSAMD21G18A_MemoryMap.xml
diff --git a/examples/device/cdc_msc_hid_freertos/ses/samd21/ATSAMD21G18A_Registers.xml b/examples/device/cdc_msc_freertos/ses/samd21/ATSAMD21G18A_Registers.xml
index 2e0fa0619..2e0fa0619 100644
--- a/examples/device/cdc_msc_hid_freertos/ses/samd21/ATSAMD21G18A_Registers.xml
+++ b/examples/device/cdc_msc_freertos/ses/samd21/ATSAMD21G18A_Registers.xml
diff --git a/examples/device/cdc_msc_hid_freertos/ses/samd21/ATSAMD21G18A_Vectors.s b/examples/device/cdc_msc_freertos/ses/samd21/ATSAMD21G18A_Vectors.s
index 5cecbd23b..5cecbd23b 100644
--- a/examples/device/cdc_msc_hid_freertos/ses/samd21/ATSAMD21G18A_Vectors.s
+++ b/examples/device/cdc_msc_freertos/ses/samd21/ATSAMD21G18A_Vectors.s
diff --git a/examples/device/cdc_msc_hid_freertos/ses/samd21/SAMD21_Startup.s b/examples/device/cdc_msc_freertos/ses/samd21/SAMD21_Startup.s
index c4b48d351..c4b48d351 100644
--- a/examples/device/cdc_msc_hid_freertos/ses/samd21/SAMD21_Startup.s
+++ b/examples/device/cdc_msc_freertos/ses/samd21/SAMD21_Startup.s
diff --git a/examples/device/cdc_msc_hid_freertos/ses/samd21/SAMD21_Target.js b/examples/device/cdc_msc_freertos/ses/samd21/SAMD21_Target.js
index 20560af43..20560af43 100644
--- a/examples/device/cdc_msc_hid_freertos/ses/samd21/SAMD21_Target.js
+++ b/examples/device/cdc_msc_freertos/ses/samd21/SAMD21_Target.js
diff --git a/examples/device/cdc_msc_hid_freertos/ses/samd21/flash_placement.xml b/examples/device/cdc_msc_freertos/ses/samd21/flash_placement.xml
index 79bedc537..79bedc537 100644
--- a/examples/device/cdc_msc_hid_freertos/ses/samd21/flash_placement.xml
+++ b/examples/device/cdc_msc_freertos/ses/samd21/flash_placement.xml
diff --git a/examples/device/cdc_msc_hid_freertos/ses/samd21/samd21.emProject b/examples/device/cdc_msc_freertos/ses/samd21/samd21.emProject
index 18291fbfd..18291fbfd 100644
--- a/examples/device/cdc_msc_hid_freertos/ses/samd21/samd21.emProject
+++ b/examples/device/cdc_msc_freertos/ses/samd21/samd21.emProject
diff --git a/examples/device/cdc_msc_hid_freertos/ses/samd21/thumb_crt0.s b/examples/device/cdc_msc_freertos/ses/samd21/thumb_crt0.s
index 17f88e0ca..17f88e0ca 100644
--- a/examples/device/cdc_msc_hid_freertos/ses/samd21/thumb_crt0.s
+++ b/examples/device/cdc_msc_freertos/ses/samd21/thumb_crt0.s
diff --git a/examples/device/cdc_msc_hid_freertos/ses/samd51/ATSAMD51J19A_MemoryMap.xml b/examples/device/cdc_msc_freertos/ses/samd51/ATSAMD51J19A_MemoryMap.xml
index 49d9a9cbd..49d9a9cbd 100644
--- a/examples/device/cdc_msc_hid_freertos/ses/samd51/ATSAMD51J19A_MemoryMap.xml
+++ b/examples/device/cdc_msc_freertos/ses/samd51/ATSAMD51J19A_MemoryMap.xml
diff --git a/examples/device/cdc_msc_hid_freertos/ses/samd51/ATSAMD51J19A_Registers.xml b/examples/device/cdc_msc_freertos/ses/samd51/ATSAMD51J19A_Registers.xml
index 83fe837fa..83fe837fa 100644
--- a/examples/device/cdc_msc_hid_freertos/ses/samd51/ATSAMD51J19A_Registers.xml
+++ b/examples/device/cdc_msc_freertos/ses/samd51/ATSAMD51J19A_Registers.xml
diff --git a/examples/device/cdc_msc_hid_freertos/ses/samd51/ATSAMD51J19A_Vectors.s b/examples/device/cdc_msc_freertos/ses/samd51/ATSAMD51J19A_Vectors.s
index 6369de863..6369de863 100644
--- a/examples/device/cdc_msc_hid_freertos/ses/samd51/ATSAMD51J19A_Vectors.s
+++ b/examples/device/cdc_msc_freertos/ses/samd51/ATSAMD51J19A_Vectors.s
diff --git a/examples/device/cdc_msc_hid_freertos/ses/samd51/SAMD51_Startup.s b/examples/device/cdc_msc_freertos/ses/samd51/SAMD51_Startup.s
index 03bf54def..03bf54def 100644
--- a/examples/device/cdc_msc_hid_freertos/ses/samd51/SAMD51_Startup.s
+++ b/examples/device/cdc_msc_freertos/ses/samd51/SAMD51_Startup.s
diff --git a/examples/device/cdc_msc_hid_freertos/ses/samd51/SAMD51_Target.js b/examples/device/cdc_msc_freertos/ses/samd51/SAMD51_Target.js
index 20560af43..20560af43 100644
--- a/examples/device/cdc_msc_hid_freertos/ses/samd51/SAMD51_Target.js
+++ b/examples/device/cdc_msc_freertos/ses/samd51/SAMD51_Target.js
diff --git a/examples/device/cdc_msc_hid_freertos/ses/samd51/flash_placement.xml b/examples/device/cdc_msc_freertos/ses/samd51/flash_placement.xml
index 79bedc537..79bedc537 100644
--- a/examples/device/cdc_msc_hid_freertos/ses/samd51/flash_placement.xml
+++ b/examples/device/cdc_msc_freertos/ses/samd51/flash_placement.xml
diff --git a/examples/device/cdc_msc_hid_freertos/ses/samd51/samd51.emProject b/examples/device/cdc_msc_freertos/ses/samd51/samd51.emProject
index c18aad2eb..c18aad2eb 100644
--- a/examples/device/cdc_msc_hid_freertos/ses/samd51/samd51.emProject
+++ b/examples/device/cdc_msc_freertos/ses/samd51/samd51.emProject
diff --git a/examples/device/cdc_msc_hid_freertos/ses/samd51/thumb_crt0.s b/examples/device/cdc_msc_freertos/ses/samd51/thumb_crt0.s
index 17f88e0ca..17f88e0ca 100644
--- a/examples/device/cdc_msc_hid_freertos/ses/samd51/thumb_crt0.s
+++ b/examples/device/cdc_msc_freertos/ses/samd51/thumb_crt0.s
diff --git a/examples/device/cdc_msc_freertos/src/FreeRTOSConfig.h b/examples/device/cdc_msc_freertos/src/FreeRTOSConfig.h
new file mode 100644
index 000000000..0945baf1f
--- /dev/null
+++ b/examples/device/cdc_msc_freertos/src/FreeRTOSConfig.h
@@ -0,0 +1,233 @@
+/*
+ * FreeRTOS Kernel V10.0.0
+ * Copyright (C) 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy of
+ * this software and associated documentation files (the "Software"), to deal in
+ * the Software without restriction, including without limitation the rights to
+ * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
+ * the Software, and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software. If you wish to use our Amazon
+ * FreeRTOS name, please do so in a fair use way that does not cause confusion.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
+ * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
+ * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
+ * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * http://www.FreeRTOS.org
+ * http://aws.amazon.com/freertos
+ *
+ * 1 tab == 4 spaces!
+ */
+
+
+#ifndef FREERTOS_CONFIG_H
+#define FREERTOS_CONFIG_H
+
+/*-----------------------------------------------------------
+ * Application specific definitions.
+ *
+ * These definitions should be adjusted for your particular hardware and
+ * application requirements.
+ *
+ * THESE PARAMETERS ARE DESCRIBED WITHIN THE 'CONFIGURATION' SECTION OF THE
+ * FreeRTOS API DOCUMENTATION AVAILABLE ON THE FreeRTOS.org WEB SITE.
+ *
+ * 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
+
+extern uint32_t SystemCoreClock;
+
+
+/* Cortex M23/M33 port configuration. */
+#define configENABLE_MPU 0
+#define configENABLE_FPU 1
+#define configENABLE_TRUSTZONE 0
+#define configMINIMAL_SECURE_STACK_SIZE ( 1024 )
+
+#define configUSE_PREEMPTION 1
+#define configUSE_PORT_OPTIMISED_TASK_SELECTION 0
+#define configCPU_CLOCK_HZ SystemCoreClock
+#define configTICK_RATE_HZ ( 1000 )
+#define configMAX_PRIORITIES ( 5 )
+#define configMINIMAL_STACK_SIZE ( 128 )
+#define configTOTAL_HEAP_SIZE ( 0*1024 ) // dynamic is not used
+#define configMAX_TASK_NAME_LEN 16
+#define configUSE_16_BIT_TICKS 0
+#define configIDLE_SHOULD_YIELD 1
+#define configUSE_MUTEXES 1
+#define configUSE_RECURSIVE_MUTEXES 1
+#define configUSE_COUNTING_SEMAPHORES 1
+#define configQUEUE_REGISTRY_SIZE 2
+#define configUSE_QUEUE_SETS 0
+#define configUSE_TIME_SLICING 0
+#define configUSE_NEWLIB_REENTRANT 0
+#define configENABLE_BACKWARD_COMPATIBILITY 1
+
+#define configSUPPORT_STATIC_ALLOCATION 1
+#define configSUPPORT_DYNAMIC_ALLOCATION 0
+
+/* Hook function related definitions. */
+#define configUSE_IDLE_HOOK 0
+#define configUSE_TICK_HOOK 0
+#define configUSE_MALLOC_FAILED_HOOK 0 // cause nested extern warning
+#define configCHECK_FOR_STACK_OVERFLOW 2
+
+/* Run time and task stats gathering related definitions. */
+#define configGENERATE_RUN_TIME_STATS 0
+#define configUSE_TRACE_FACILITY 1 // legacy trace
+#define configUSE_STATS_FORMATTING_FUNCTIONS 0
+
+/* Co-routine definitions. */
+#define configUSE_CO_ROUTINES 0
+#define configMAX_CO_ROUTINE_PRIORITIES 2
+
+/* Software timer related definitions. */
+#define configUSE_TIMERS 1
+#define configTIMER_TASK_PRIORITY (configMAX_PRIORITIES-2)
+#define configTIMER_QUEUE_LENGTH 32
+#define configTIMER_TASK_STACK_DEPTH configMINIMAL_STACK_SIZE
+
+/* Optional functions - most linkers will remove unused functions anyway. */
+#define INCLUDE_vTaskPrioritySet 0
+#define INCLUDE_uxTaskPriorityGet 0
+#define INCLUDE_vTaskDelete 0
+#define INCLUDE_vTaskSuspend 1 // required for queue, semaphore, mutex to be blocked indefinitely with portMAX_DELAY
+#define INCLUDE_xResumeFromISR 0
+#define INCLUDE_vTaskDelayUntil 1
+#define INCLUDE_vTaskDelay 1
+#define INCLUDE_xTaskGetSchedulerState 0
+#define INCLUDE_xTaskGetCurrentTaskHandle 0
+#define INCLUDE_uxTaskGetStackHighWaterMark 0
+#define INCLUDE_xTaskGetIdleTaskHandle 0
+#define INCLUDE_xTimerGetTimerDaemonTaskHandle 0
+#define INCLUDE_pcTaskGetTaskName 0
+#define INCLUDE_eTaskGetState 0
+#define INCLUDE_xEventGroupSetBitFromISR 0
+#define INCLUDE_xTimerPendFunctionCall 0
+
+/* Define to trap errors during development. */
+// Halt CPU (breakpoint) when hitting error, only apply for Cortex M3, M4, M7
+#if defined(__ARM_ARCH_7M__) || defined (__ARM_ARCH_7EM__)
+ #define configASSERT(_exp) \
+ do {\
+ if ( !(_exp) ) { \
+ volatile uint32_t* ARM_CM_DHCSR = ((volatile uint32_t*) 0xE000EDF0UL); /* Cortex M CoreDebug->DHCSR */ \
+ if ( (*ARM_CM_DHCSR) & 1UL ) { /* Only halt mcu if debugger is attached */ \
+ taskDISABLE_INTERRUPTS(); \
+ __asm("BKPT #0\n"); \
+ }\
+ }\
+ } while(0)
+#else
+ #define configASSERT( x )
+#endif
+
+/* FreeRTOS hooks to NVIC vectors */
+#define xPortPendSVHandler PendSV_Handler
+#define xPortSysTickHandler SysTick_Handler
+#define vPortSVCHandler SVC_Handler
+
+//--------------------------------------------------------------------+
+// Interrupt nesting behavior configuration.
+//--------------------------------------------------------------------+
+/* Cortex-M specific definitions. __NVIC_PRIO_BITS is defined in core_cmx.h */
+#ifdef __NVIC_PRIO_BITS
+ #define configPRIO_BITS __NVIC_PRIO_BITS
+#else
+ #error "This port requires __NVIC_PRIO_BITS to be defined"
+#endif
+
+/* The lowest interrupt priority that can be used in a call to a "set priority" function. */
+#define configLIBRARY_LOWEST_INTERRUPT_PRIORITY ((1<<configPRIO_BITS) - 1)
+
+/* The highest interrupt priority that can be used by any interrupt service
+routine that makes calls to interrupt safe FreeRTOS API functions. DO NOT CALL
+INTERRUPT SAFE FREERTOS API FUNCTIONS FROM ANY INTERRUPT THAT HAS A HIGHER
+PRIORITY THAN THIS! (higher priorities are lower numeric values. */
+#define configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY 2
+
+/* Interrupt priorities used by the kernel port layer itself. These are generic
+to all Cortex-M ports, and do not rely on any particular library functions. */
+#define configKERNEL_INTERRUPT_PRIORITY ( configLIBRARY_LOWEST_INTERRUPT_PRIORITY << (8 - configPRIO_BITS) )
+
+/* !!!! configMAX_SYSCALL_INTERRUPT_PRIORITY must not be set to zero !!!!
+See http://www.FreeRTOS.org/RTOS-Cortex-M3-M4.html. */
+#define configMAX_SYSCALL_INTERRUPT_PRIORITY ( configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY << (8 - configPRIO_BITS) )
+
+#endif /* __FREERTOS_CONFIG__H */
diff --git a/examples/device/cdc_msc_hid_freertos/src/freertos_hook.c b/examples/device/cdc_msc_freertos/src/freertos_hook.c
index 474e808a9..474e808a9 100644
--- a/examples/device/cdc_msc_hid_freertos/src/freertos_hook.c
+++ b/examples/device/cdc_msc_freertos/src/freertos_hook.c
diff --git a/examples/device/cdc_msc_hid_freertos/src/main.c b/examples/device/cdc_msc_freertos/src/main.c
index cb707675d..704d0803b 100644
--- a/examples/device/cdc_msc_hid_freertos/src/main.c
+++ b/examples/device/cdc_msc_freertos/src/main.c
@@ -36,8 +36,6 @@
#include "bsp/board.h"
#include "tusb.h"
-#include "usb_descriptors.h"
-
//--------------------------------------------------------------------+
// MACRO CONSTANT TYPEDEF PROTYPES
//--------------------------------------------------------------------+
@@ -53,12 +51,24 @@ enum {
BLINK_SUSPENDED = 2500,
};
+// static timer
+StaticTimer_t static_blink;
TimerHandle_t blink_tm;
+// static task for usbd
+#define USBD_STACK_SIZE 150
+StackType_t stack_usbd[USBD_STACK_SIZE];
+StaticTask_t static_task_usbd;
+
+// static task for cdc
+#define CDC_STACK_SZIE 128
+StackType_t stack_cdc[CDC_STACK_SZIE];
+StaticTask_t static_task_cdc;
+
+
void led_blinky_cb(TimerHandle_t xTimer);
void usb_device_task(void* param);
void cdc_task(void* params);
-void hid_task(void* params);
/*------------- MAIN -------------*/
int main(void)
@@ -66,21 +76,17 @@ int main(void)
board_init();
// soft timer for blinky
- blink_tm = xTimerCreate(NULL, pdMS_TO_TICKS(BLINK_NOT_MOUNTED), true, NULL, led_blinky_cb);
+ blink_tm = xTimerCreateStatic(NULL, pdMS_TO_TICKS(BLINK_NOT_MOUNTED), true, NULL, led_blinky_cb, &static_blink);
xTimerStart(blink_tm, 0);
tusb_init();
// Create a task for tinyusb device stack
- xTaskCreate( usb_device_task, "usbd", 150, NULL, configMAX_PRIORITIES-1, NULL);
+ (void) xTaskCreateStatic( usb_device_task, "usbd", USBD_STACK_SIZE, NULL, configMAX_PRIORITIES-1, stack_usbd, &static_task_usbd);
// Create task
#if CFG_TUD_CDC
- xTaskCreate( cdc_task, "cdc", 128, NULL, configMAX_PRIORITIES-2, NULL);
-#endif
-
-#if CFG_TUD_HID
- xTaskCreate( hid_task, "hid", 128, NULL, configMAX_PRIORITIES-2, NULL);
+ (void) xTaskCreateStatic( cdc_task, "cdc", CDC_STACK_SZIE, NULL, configMAX_PRIORITIES-2, stack_cdc, &static_task_cdc);
#endif
vTaskStartScheduler();
@@ -134,6 +140,7 @@ void tud_resume_cb(void)
xTimerChangePeriod(blink_tm, pdMS_TO_TICKS(BLINK_MOUNTED), 0);
}
+
//--------------------------------------------------------------------+
// USB CDC
//--------------------------------------------------------------------+
@@ -189,97 +196,7 @@ void tud_cdc_rx_cb(uint8_t itf)
(void) itf;
}
-#endif
-
-//--------------------------------------------------------------------+
-// USB HID
-//--------------------------------------------------------------------+
-#if CFG_TUD_HID
-
-void hid_task(void* params)
-{
- (void) params;
-
- while (1)
- {
- // Poll every 10ms
- vTaskDelay(pdMS_TO_TICKS(10));
-
- uint32_t const btn = board_button_read();
-
- // Remote wakeup
- if ( tud_suspended() && btn )
- {
- // Wake up host if we are in suspend mode
- // and REMOTE_WAKEUP feature is enabled by host
- tud_remote_wakeup();
- }
-
- /*------------- Mouse -------------*/
- if ( tud_hid_ready() )
- {
- if ( btn )
- {
- int8_t const delta = 5;
-
- // no button, right + down, no scroll pan
- tud_hid_mouse_report(REPORT_ID_MOUSE, 0x00, delta, delta, 0, 0);
-
- // delay a bit before attempt to send keyboard report
- vTaskDelay(pdMS_TO_TICKS(2));
- }
- }
-
- /*------------- Keyboard -------------*/
- if ( tud_hid_ready() )
- {
- // use to avoid send multiple consecutive zero report for keyboard
- static bool has_key = false;
-
- if ( btn )
- {
- uint8_t keycode[6] = { 0 };
- keycode[0] = HID_KEY_A;
-
- tud_hid_keyboard_report(REPORT_ID_KEYBOARD, 0, keycode);
-
- has_key = true;
- }else
- {
- // send empty key report if previously has key pressed
- if (has_key) tud_hid_keyboard_report(REPORT_ID_KEYBOARD, 0, NULL);
- has_key = false;
- }
- }
- }
-}
-
-// Invoked when received GET_REPORT control request
-// Application must fill buffer report's content and return its length.
-// Return zero will cause the stack to STALL request
-uint16_t tud_hid_get_report_cb(uint8_t report_id, hid_report_type_t report_type, uint8_t* buffer, uint16_t reqlen)
-{
- // TODO not Implemented
- (void) report_id;
- (void) report_type;
- (void) buffer;
- (void) reqlen;
-
- return 0;
-}
-
-// Invoked when received SET_REPORT control request or
-// received data on OUT endpoint ( Report ID = 0, Type = 0 )
-void tud_hid_set_report_cb(uint8_t report_id, hid_report_type_t report_type, uint8_t const* buffer, uint16_t bufsize)
-{
- // TODO not Implemented
- (void) report_id;
- (void) report_type;
- (void) buffer;
- (void) bufsize;
-}
-
-#endif
+#endif // CFG_TUD_CDC
//--------------------------------------------------------------------+
// BLINKING TASK
diff --git a/examples/device/cdc_msc_hid_freertos/src/msc_disk.c b/examples/device/cdc_msc_freertos/src/msc_disk.c
index b4986fbb7..5aa7befc9 100644
--- a/examples/device/cdc_msc_hid_freertos/src/msc_disk.c
+++ b/examples/device/cdc_msc_freertos/src/msc_disk.c
@@ -220,18 +220,6 @@ int32_t tud_msc_scsi_cb (uint8_t lun, uint8_t const scsi_cmd[16], void* buffer,
resplen = 0;
break;
- case SCSI_CMD_START_STOP_UNIT:
- // Host try to eject/safe remove/poweroff us. We could safely disconnect with disk storage, or go into lower power
- /* scsi_start_stop_unit_t const * start_stop = (scsi_start_stop_unit_t const *) scsi_cmd;
- // Start bit = 0 : low power mode, if load_eject = 1 : unmount disk storage as well
- // Start bit = 1 : Ready mode, if load_eject = 1 : mount disk storage
- start_stop->start;
- start_stop->load_eject;
- */
- resplen = 0;
- break;
-
-
default:
// Set Sense = Invalid Command Operation
tud_msc_set_sense(lun, SCSI_SENSE_ILLEGAL_REQUEST, 0x20, 0x00);
diff --git a/examples/device/cdc_msc_hid_freertos/src/tusb_config.h b/examples/device/cdc_msc_freertos/src/tusb_config.h
index f84874ab1..525019aaa 100644
--- a/examples/device/cdc_msc_hid_freertos/src/tusb_config.h
+++ b/examples/device/cdc_msc_freertos/src/tusb_config.h
@@ -39,7 +39,7 @@
#error CFG_TUSB_MCU must be defined
#endif
-#if CFG_TUSB_MCU == OPT_MCU_LPC43XX || CFG_TUSB_MCU == OPT_MCU_LPC18XX
+#if CFG_TUSB_MCU == OPT_MCU_LPC43XX || CFG_TUSB_MCU == OPT_MCU_LPC18XX || CFG_TUSB_MCU == OPT_MCU_MIMXRT10XX || CFG_TUSB_MCU == OPT_MCU_NUC505
#define CFG_TUSB_RHPORT0_MODE (OPT_MODE_DEVICE | OPT_MODE_HIGH_SPEED)
#else
#define CFG_TUSB_RHPORT0_MODE OPT_MODE_DEVICE
@@ -76,7 +76,7 @@
//------------- CLASS -------------//
#define CFG_TUD_CDC 1
#define CFG_TUD_MSC 1
-#define CFG_TUD_HID 1
+#define CFG_TUD_HID 0
#define CFG_TUD_MIDI 0
#define CFG_TUD_VENDOR 0
diff --git a/examples/device/cdc_msc_hid_freertos/src/usb_descriptors.c b/examples/device/cdc_msc_freertos/src/usb_descriptors.c
index d60c9a585..127008227 100644
--- a/examples/device/cdc_msc_hid_freertos/src/usb_descriptors.c
+++ b/examples/device/cdc_msc_freertos/src/usb_descriptors.c
@@ -24,7 +24,6 @@
*/
#include "tusb.h"
-#include "usb_descriptors.h"
/* A combination of interfaces must have a unique product id, since PC will save device driver after the first plug.
* Same VID/PID with different interface e.g MSC (first), then CDC (later) will possibly cause system error on PC.
@@ -45,17 +44,11 @@ tusb_desc_device_t const desc_device =
.bDescriptorType = TUSB_DESC_DEVICE,
.bcdUSB = 0x0200,
- #if CFG_TUD_CDC
// Use Interface Association Descriptor (IAD) for CDC
// As required by USB Specs IAD's subclass must be common class (2) and protocol must be IAD (1)
.bDeviceClass = TUSB_CLASS_MISC,
.bDeviceSubClass = MISC_SUBCLASS_COMMON,
.bDeviceProtocol = MISC_PROTOCOL_IAD,
- #else
- .bDeviceClass = 0x00,
- .bDeviceSubClass = 0x00,
- .bDeviceProtocol = 0x00,
- #endif
.bMaxPacketSize0 = CFG_TUD_ENDPOINT0_SIZE,
@@ -78,83 +71,62 @@ uint8_t const * tud_descriptor_device_cb(void)
}
//--------------------------------------------------------------------+
-// HID Report Descriptor
-//--------------------------------------------------------------------+
-#if CFG_TUD_HID
-
-uint8_t const desc_hid_report[] =
-{
- TUD_HID_REPORT_DESC_KEYBOARD( HID_REPORT_ID(REPORT_ID_KEYBOARD), ),
- TUD_HID_REPORT_DESC_MOUSE ( HID_REPORT_ID(REPORT_ID_MOUSE), )
-};
-
-// Invoked when received GET HID REPORT DESCRIPTOR
-// Application return pointer to descriptor
-// Descriptor contents must exist long enough for transfer to complete
-uint8_t const * tud_hid_descriptor_report_cb(void)
-{
- return desc_hid_report;
-}
-
-#endif
-
-//--------------------------------------------------------------------+
// Configuration Descriptor
//--------------------------------------------------------------------+
enum
{
-#if CFG_TUD_CDC
ITF_NUM_CDC = 0,
ITF_NUM_CDC_DATA,
-#endif
-
-#if CFG_TUD_MSC
ITF_NUM_MSC,
-#endif
-
-#if CFG_TUD_HID
- ITF_NUM_HID,
-#endif
-
ITF_NUM_TOTAL
};
-#define CONFIG_TOTAL_LEN (TUD_CONFIG_DESC_LEN + CFG_TUD_CDC*TUD_CDC_DESC_LEN + CFG_TUD_MSC*TUD_MSC_DESC_LEN + CFG_TUD_HID*TUD_HID_DESC_LEN)
+#define CONFIG_TOTAL_LEN (TUD_CONFIG_DESC_LEN + TUD_CDC_DESC_LEN + TUD_MSC_DESC_LEN)
#if CFG_TUSB_MCU == OPT_MCU_LPC175X_6X || CFG_TUSB_MCU == OPT_MCU_LPC177X_8X || CFG_TUSB_MCU == OPT_MCU_LPC40XX
// LPC 17xx and 40xx endpoint type (bulk/interrupt/iso) are fixed by its number
- // 0 control, 1 In, 2 Bulk, 3 Iso, 4 In etc ...
- // Note: since CDC EP ( 1 & 2), HID (4) are spot-on, thus we only need to force
- // endpoint number for MSC to 5
- #define EPNUM_MSC 0x05
+ // 0 control, 1 In, 2 Bulk, 3 Iso, 4 In, 5 Bulk etc ...
+ #define EPNUM_CDC_NOTIF 0x81
+ #define EPNUM_CDC_OUT 0x02
+ #define EPNUM_CDC_IN 0x82
+
+ #define EPNUM_MSC_OUT 0x05
+ #define EPNUM_MSC_IN 0x85
+
+#elif CFG_TUSB_MCU == OPT_MCU_SAMG
+ // SAMG doesn't support a same endpoint number with different direction IN and OUT
+ // e.g EP1 OUT & EP1 IN cannot exist together
+ #define EPNUM_CDC_NOTIF 0x81
+ #define EPNUM_CDC_OUT 0x02
+ #define EPNUM_CDC_IN 0x83
+
+ #define EPNUM_MSC_OUT 0x04
+ #define EPNUM_MSC_IN 0x85
+
#else
- #define EPNUM_MSC 0x03
+ #define EPNUM_CDC_NOTIF 0x81
+ #define EPNUM_CDC_OUT 0x02
+ #define EPNUM_CDC_IN 0x82
+
+ #define EPNUM_MSC_OUT 0x03
+ #define EPNUM_MSC_IN 0x83
+
#endif
uint8_t const desc_configuration[] =
{
- // interface count, string index, total length, attribute, power in mA
+ // Interface count, string index, total length, attribute, power in mA
TUD_CONFIG_DESCRIPTOR(ITF_NUM_TOTAL, 0, CONFIG_TOTAL_LEN, TUSB_DESC_CONFIG_ATT_REMOTE_WAKEUP, 100),
-#if CFG_TUD_CDC
// Interface number, string index, EP notification address and size, EP data address (out, in) and size.
- TUD_CDC_DESCRIPTOR(ITF_NUM_CDC, 4, 0x81, 8, 0x02, 0x82, 64),
-#endif
+ TUD_CDC_DESCRIPTOR(ITF_NUM_CDC, 4, EPNUM_CDC_NOTIF, 8, EPNUM_CDC_OUT, EPNUM_CDC_IN, 64),
-#if CFG_TUD_MSC
// Interface number, string index, EP Out & EP In address, EP size
- TUD_MSC_DESCRIPTOR(ITF_NUM_MSC, 5, EPNUM_MSC, 0x80 | EPNUM_MSC, 64), // highspeed 512
-#endif
-
-#if CFG_TUD_HID
- // Interface number, string index, protocol, report descriptor len, EP In address, size & polling interval
- TUD_HID_DESCRIPTOR(ITF_NUM_HID, 6, HID_PROTOCOL_NONE, sizeof(desc_hid_report), 0x84, 16, 10)
-#endif
+ TUD_MSC_DESCRIPTOR(ITF_NUM_MSC, 5, EPNUM_MSC_OUT, EPNUM_MSC_IN, (CFG_TUSB_RHPORT0_MODE & OPT_MODE_HIGH_SPEED) ? 512 : 64),
};
-
// Invoked when received GET CONFIGURATION DESCRIPTOR
// Application return pointer to descriptor
// Descriptor contents must exist long enough for transfer to complete
@@ -177,15 +149,16 @@ char const* string_desc_arr [] =
"123456", // 3: Serials, should use chip ID
"TinyUSB CDC", // 4: CDC Interface
"TinyUSB MSC", // 5: MSC Interface
- "TinyUSB HID" // 6: HID
};
static uint16_t _desc_str[32];
// Invoked when received GET STRING DESCRIPTOR request
// Application return pointer to descriptor, whose contents must exist long enough for transfer to complete
-uint16_t const* tud_descriptor_string_cb(uint8_t index)
+uint16_t const* tud_descriptor_string_cb(uint8_t index, uint16_t langid)
{
+ (void) langid;
+
uint8_t chr_count;
if ( index == 0)
diff --git a/examples/device/cdc_msc_hid_freertos/src/usb_descriptors.h b/examples/device/cdc_msc_freertos/src/usb_descriptors.h
index 6992d3349..6992d3349 100644
--- a/examples/device/cdc_msc_hid_freertos/src/usb_descriptors.h
+++ b/examples/device/cdc_msc_freertos/src/usb_descriptors.h
diff --git a/examples/device/cdc_msc_hid_freertos/Makefile b/examples/device/cdc_msc_hid_freertos/Makefile
deleted file mode 100644
index 7401f355a..000000000
--- a/examples/device/cdc_msc_hid_freertos/Makefile
+++ /dev/null
@@ -1,26 +0,0 @@
-include ../../../tools/top.mk
-include ../../make.mk
-
-INC += \
- src \
- $(TOP)/hw \
- $(TOP)/lib/FreeRTOS/Source/include \
- $(TOP)/lib/FreeRTOS/Source/portable/GCC/$(FREERTOS_PORT)
-
-# Example source
-EXAMPLE_SOURCE += $(wildcard src/*.c)
-SRC_C += $(addprefix $(CURRENT_PATH)/, $(EXAMPLE_SOURCE))
-
-# FreeRTOS source
-SRC_C += \
- lib/FreeRTOS/Source/list.c \
- lib/FreeRTOS/Source/queue.c \
- lib/FreeRTOS/Source/tasks.c \
- lib/FreeRTOS/Source/timers.c \
- lib/FreeRTOS/Source/portable/MemMang/heap_4.c \
- lib/FreeRTOS/Source/portable/GCC/$(FREERTOS_PORT)/port.c \
-
-# FreeRTOS (lto + Os) linker issue
-LDFLAGS += -Wl,--undefined=vTaskSwitchContext
-
-include ../../rules.mk
diff --git a/examples/device/dfu_rt/src/tusb_config.h b/examples/device/dfu_rt/src/tusb_config.h
index 7e79995d9..d1efcdab5 100644
--- a/examples/device/dfu_rt/src/tusb_config.h
+++ b/examples/device/dfu_rt/src/tusb_config.h
@@ -21,7 +21,7 @@
#error CFG_TUSB_MCU must be defined
#endif
-#if CFG_TUSB_MCU == OPT_MCU_LPC43XX || CFG_TUSB_MCU == OPT_MCU_LPC18XX
+#if CFG_TUSB_MCU == OPT_MCU_LPC43XX || CFG_TUSB_MCU == OPT_MCU_LPC18XX || CFG_TUSB_MCU == OPT_MCU_MIMXRT10XX || CFG_TUSB_MCU == OPT_MCU_NUC505
#define CFG_TUSB_RHPORT0_MODE (OPT_MODE_DEVICE | OPT_MODE_HIGH_SPEED)
#else
#define CFG_TUSB_RHPORT0_MODE OPT_MODE_DEVICE
diff --git a/examples/device/dfu_rt/src/usb_descriptors.c b/examples/device/dfu_rt/src/usb_descriptors.c
index 0c7081245..17b3fe87d 100644
--- a/examples/device/dfu_rt/src/usb_descriptors.c
+++ b/examples/device/dfu_rt/src/usb_descriptors.c
@@ -193,8 +193,10 @@ static uint16_t _desc_str[32];
// Invoked when received GET STRING DESCRIPTOR request
// Application return pointer to descriptor, whose contents must exist long enough for transfer to complete
-uint16_t const* tud_descriptor_string_cb(uint8_t index)
+uint16_t const* tud_descriptor_string_cb(uint8_t index, uint16_t langid)
{
+ (void) langid;
+
size_t chr_count;
if ( index == 0)
diff --git a/examples/device/hid_composite/src/tusb_config.h b/examples/device/hid_composite/src/tusb_config.h
index 8d29f10be..6d2fd0836 100644
--- a/examples/device/hid_composite/src/tusb_config.h
+++ b/examples/device/hid_composite/src/tusb_config.h
@@ -39,7 +39,7 @@
#error CFG_TUSB_MCU must be defined
#endif
-#if CFG_TUSB_MCU == OPT_MCU_LPC43XX || CFG_TUSB_MCU == OPT_MCU_LPC18XX
+#if CFG_TUSB_MCU == OPT_MCU_LPC43XX || CFG_TUSB_MCU == OPT_MCU_LPC18XX || CFG_TUSB_MCU == OPT_MCU_MIMXRT10XX || CFG_TUSB_MCU == OPT_MCU_NUC505
#define CFG_TUSB_RHPORT0_MODE (OPT_MODE_DEVICE | OPT_MODE_HIGH_SPEED)
#else
#define CFG_TUSB_RHPORT0_MODE OPT_MODE_DEVICE
diff --git a/examples/device/hid_composite/src/usb_descriptors.c b/examples/device/hid_composite/src/usb_descriptors.c
index 01f2cb59b..19689c90b 100644
--- a/examples/device/hid_composite/src/usb_descriptors.c
+++ b/examples/device/hid_composite/src/usb_descriptors.c
@@ -134,8 +134,10 @@ static uint16_t _desc_str[32];
// Invoked when received GET STRING DESCRIPTOR request
// Application return pointer to descriptor, whose contents must exist long enough for transfer to complete
-uint16_t const* tud_descriptor_string_cb(uint8_t index)
+uint16_t const* tud_descriptor_string_cb(uint8_t index, uint16_t langid)
{
+ (void) langid;
+
uint8_t chr_count;
if ( index == 0)
diff --git a/examples/device/hid_generic_inout/src/tusb_config.h b/examples/device/hid_generic_inout/src/tusb_config.h
index a7ce7acf8..2debafd2a 100644
--- a/examples/device/hid_generic_inout/src/tusb_config.h
+++ b/examples/device/hid_generic_inout/src/tusb_config.h
@@ -39,7 +39,7 @@
#error CFG_TUSB_MCU must be defined
#endif
-#if CFG_TUSB_MCU == OPT_MCU_LPC43XX || CFG_TUSB_MCU == OPT_MCU_LPC18XX
+#if CFG_TUSB_MCU == OPT_MCU_LPC43XX || CFG_TUSB_MCU == OPT_MCU_LPC18XX || CFG_TUSB_MCU == OPT_MCU_MIMXRT10XX || CFG_TUSB_MCU == OPT_MCU_NUC505
#define CFG_TUSB_RHPORT0_MODE (OPT_MODE_DEVICE | OPT_MODE_HIGH_SPEED)
#else
#define CFG_TUSB_RHPORT0_MODE OPT_MODE_DEVICE
diff --git a/examples/device/hid_generic_inout/src/usb_descriptors.c b/examples/device/hid_generic_inout/src/usb_descriptors.c
index 07989c5fd..87611a432 100644
--- a/examples/device/hid_generic_inout/src/usb_descriptors.c
+++ b/examples/device/hid_generic_inout/src/usb_descriptors.c
@@ -132,8 +132,10 @@ static uint16_t _desc_str[32];
// Invoked when received GET STRING DESCRIPTOR request
// Application return pointer to descriptor, whose contents must exist long enough for transfer to complete
-uint16_t const* tud_descriptor_string_cb(uint8_t index)
+uint16_t const* tud_descriptor_string_cb(uint8_t index, uint16_t langid)
{
+ (void) langid;
+
uint8_t chr_count;
if ( index == 0)
diff --git a/examples/device/midi_test/src/tusb_config.h b/examples/device/midi_test/src/tusb_config.h
index fcd6b97c2..56f326f31 100644
--- a/examples/device/midi_test/src/tusb_config.h
+++ b/examples/device/midi_test/src/tusb_config.h
@@ -39,7 +39,7 @@
#error CFG_TUSB_MCU must be defined
#endif
-#if CFG_TUSB_MCU == OPT_MCU_LPC43XX || CFG_TUSB_MCU == OPT_MCU_LPC18XX
+#if CFG_TUSB_MCU == OPT_MCU_LPC43XX || CFG_TUSB_MCU == OPT_MCU_LPC18XX || CFG_TUSB_MCU == OPT_MCU_MIMXRT10XX || CFG_TUSB_MCU == OPT_MCU_NUC505
#define CFG_TUSB_RHPORT0_MODE (OPT_MODE_DEVICE | OPT_MODE_HIGH_SPEED)
#else
#define CFG_TUSB_RHPORT0_MODE OPT_MODE_DEVICE
diff --git a/examples/device/midi_test/src/usb_descriptors.c b/examples/device/midi_test/src/usb_descriptors.c
index 2305c9f68..949404826 100644
--- a/examples/device/midi_test/src/usb_descriptors.c
+++ b/examples/device/midi_test/src/usb_descriptors.c
@@ -123,8 +123,10 @@ static uint16_t _desc_str[32];
// Invoked when received GET STRING DESCRIPTOR request
// Application return pointer to descriptor, whose contents must exist long enough for transfer to complete
-uint16_t const* tud_descriptor_string_cb(uint8_t index)
+uint16_t const* tud_descriptor_string_cb(uint8_t index, uint16_t langid)
{
+ (void) langid;
+
uint8_t chr_count;
if ( index == 0)
diff --git a/examples/device/msc_dual_lun/src/tusb_config.h b/examples/device/msc_dual_lun/src/tusb_config.h
index b45e9c4dc..82d07c60a 100644
--- a/examples/device/msc_dual_lun/src/tusb_config.h
+++ b/examples/device/msc_dual_lun/src/tusb_config.h
@@ -39,7 +39,7 @@
#error CFG_TUSB_MCU must be defined
#endif
-#if CFG_TUSB_MCU == OPT_MCU_LPC43XX || CFG_TUSB_MCU == OPT_MCU_LPC18XX
+#if CFG_TUSB_MCU == OPT_MCU_LPC43XX || CFG_TUSB_MCU == OPT_MCU_LPC18XX || CFG_TUSB_MCU == OPT_MCU_MIMXRT10XX || CFG_TUSB_MCU == OPT_MCU_NUC505
#define CFG_TUSB_RHPORT0_MODE (OPT_MODE_DEVICE | OPT_MODE_HIGH_SPEED)
#else
#define CFG_TUSB_RHPORT0_MODE OPT_MODE_DEVICE
diff --git a/examples/device/msc_dual_lun/src/usb_descriptors.c b/examples/device/msc_dual_lun/src/usb_descriptors.c
index e0a5904a4..3b2615fd4 100644
--- a/examples/device/msc_dual_lun/src/usb_descriptors.c
+++ b/examples/device/msc_dual_lun/src/usb_descriptors.c
@@ -80,10 +80,20 @@ enum
#if CFG_TUSB_MCU == OPT_MCU_LPC175X_6X || CFG_TUSB_MCU == OPT_MCU_LPC177X_8X || CFG_TUSB_MCU == OPT_MCU_LPC40XX
// LPC 17xx and 40xx endpoint type (bulk/interrupt/iso) are fixed by its number
- // 0 control, 1 In, 2 Bulk, 3 Iso, 4 In etc ...
- #define EPNUM_MSC 0x02
+ // 0 control, 1 In, 2 Bulk, 3 Iso, 4 In, 5 Bulk etc ...
+ #define EPNUM_MSC_OUT 0x02
+ #define EPNUM_MSC_IN 0x82
+
+#elif CFG_TUSB_MCU == OPT_MCU_SAMG
+ // SAMG doesn't support a same endpoint number with different direction IN and OUT
+ // e.g EP1 OUT & EP1 IN cannot exist together
+ #define EPNUM_MSC_OUT 0x01
+ #define EPNUM_MSC_IN 0x82
+
#else
- #define EPNUM_MSC 0x01
+ #define EPNUM_MSC_OUT 0x01
+ #define EPNUM_MSC_IN 0x81
+
#endif
uint8_t const desc_configuration[] =
@@ -92,7 +102,7 @@ uint8_t const desc_configuration[] =
TUD_CONFIG_DESCRIPTOR(ITF_NUM_TOTAL, 0, CONFIG_TOTAL_LEN, TUSB_DESC_CONFIG_ATT_REMOTE_WAKEUP, 100),
// Interface number, string index, EP Out & EP In address, EP size
- TUD_MSC_DESCRIPTOR(ITF_NUM_MSC, 0, EPNUM_MSC, 0x80 | EPNUM_MSC, (CFG_TUSB_RHPORT0_MODE & OPT_MODE_HIGH_SPEED) ? 512 : 64),
+ TUD_MSC_DESCRIPTOR(ITF_NUM_MSC, 0, EPNUM_MSC_OUT, EPNUM_MSC_IN, (CFG_TUSB_RHPORT0_MODE & OPT_MODE_HIGH_SPEED) ? 512 : 64),
};
// Invoked when received GET CONFIGURATION DESCRIPTOR
@@ -121,8 +131,10 @@ static uint16_t _desc_str[32];
// Invoked when received GET STRING DESCRIPTOR request
// Application return pointer to descriptor, whose contents must exist long enough for transfer to complete
-uint16_t const* tud_descriptor_string_cb(uint8_t index)
+uint16_t const* tud_descriptor_string_cb(uint8_t index, uint16_t langid)
{
+ (void) langid;
+
uint8_t chr_count;
if ( index == 0)
diff --git a/examples/device/net_lwip_webserver/.skip.MCU_LPC11UXX b/examples/device/net_lwip_webserver/.skip.MCU_LPC11UXX
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/examples/device/net_lwip_webserver/.skip.MCU_LPC11UXX
diff --git a/examples/device/net_lwip_webserver/.skip.MCU_LPC13XX b/examples/device/net_lwip_webserver/.skip.MCU_LPC13XX
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/examples/device/net_lwip_webserver/.skip.MCU_LPC13XX
diff --git a/examples/device/net_lwip_webserver/.skip.MCU_NUC121 b/examples/device/net_lwip_webserver/.skip.MCU_NUC121
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/examples/device/net_lwip_webserver/.skip.MCU_NUC121
diff --git a/examples/device/net_lwip_webserver/.skip.MCU_STM32L0 b/examples/device/net_lwip_webserver/.skip.MCU_STM32L0
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/examples/device/net_lwip_webserver/.skip.MCU_STM32L0
diff --git a/examples/device/net_lwip_webserver/Makefile b/examples/device/net_lwip_webserver/Makefile
new file mode 100644
index 000000000..a153c30be
--- /dev/null
+++ b/examples/device/net_lwip_webserver/Makefile
@@ -0,0 +1,57 @@
+include ../../../tools/top.mk
+include ../../make.mk
+
+CFLAGS += \
+ -DPBUF_POOL_SIZE=2 \
+ -DTCP_WND=2*TCP_MSS \
+ -DHTTPD_USE_CUSTOM_FSDATA=0
+
+INC += \
+ src \
+ $(TOP)/hw \
+ $(TOP)/lib/lwip/src/include \
+ $(TOP)/lib/lwip/src/include/ipv4 \
+ $(TOP)/lib/lwip/src/include/lwip/apps \
+ $(TOP)/lib/networking
+
+# Example source
+EXAMPLE_SOURCE += $(wildcard src/*.c)
+SRC_C += $(addprefix $(CURRENT_PATH)/, $(EXAMPLE_SOURCE))
+SRC_C += \
+ lib/lwip/src/core/altcp.c \
+ lib/lwip/src/core/altcp_alloc.c \
+ lib/lwip/src/core/altcp_tcp.c \
+ lib/lwip/src/core/def.c \
+ lib/lwip/src/core/dns.c \
+ lib/lwip/src/core/inet_chksum.c \
+ lib/lwip/src/core/init.c \
+ lib/lwip/src/core/ip.c \
+ lib/lwip/src/core/mem.c \
+ lib/lwip/src/core/memp.c \
+ lib/lwip/src/core/netif.c \
+ lib/lwip/src/core/pbuf.c \
+ lib/lwip/src/core/raw.c \
+ lib/lwip/src/core/stats.c \
+ lib/lwip/src/core/sys.c \
+ lib/lwip/src/core/tcp.c \
+ lib/lwip/src/core/tcp_in.c \
+ lib/lwip/src/core/tcp_out.c \
+ lib/lwip/src/core/timeouts.c \
+ lib/lwip/src/core/udp.c \
+ lib/lwip/src/core/ipv4/autoip.c \
+ lib/lwip/src/core/ipv4/dhcp.c \
+ lib/lwip/src/core/ipv4/etharp.c \
+ lib/lwip/src/core/ipv4/icmp.c \
+ lib/lwip/src/core/ipv4/igmp.c \
+ lib/lwip/src/core/ipv4/ip4.c \
+ lib/lwip/src/core/ipv4/ip4_addr.c \
+ lib/lwip/src/core/ipv4/ip4_frag.c \
+ lib/lwip/src/netif/ethernet.c \
+ lib/lwip/src/netif/slipif.c \
+ lib/lwip/src/apps/http/httpd.c \
+ lib/lwip/src/apps/http/fs.c \
+ lib/networking/dhserver.c \
+ lib/networking/dnserver.c \
+ lib/networking/rndis_reports.c
+
+include ../../rules.mk
diff --git a/examples/device/net_lwip_webserver/src/arch/cc.h b/examples/device/net_lwip_webserver/src/arch/cc.h
new file mode 100644
index 000000000..56a0cacf7
--- /dev/null
+++ b/examples/device/net_lwip_webserver/src/arch/cc.h
@@ -0,0 +1,75 @@
+/*
+ * Copyright (c) 2001-2003 Swedish Institute of Computer Science.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification,
+ * are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice,
+ * this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ * 3. The name of the author may not be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
+ * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
+ * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+ * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
+ * OF SUCH DAMAGE.
+ *
+ * This file is part of the lwIP TCP/IP stack.
+ *
+ * Author: Adam Dunkels <[email protected]>
+ *
+ */
+#ifndef __CC_H__
+#define __CC_H__
+
+//#include "cpu.h"
+
+typedef int sys_prot_t;
+
+
+
+/* define compiler specific symbols */
+#if defined (__ICCARM__)
+
+#define PACK_STRUCT_BEGIN
+#define PACK_STRUCT_STRUCT
+#define PACK_STRUCT_END
+#define PACK_STRUCT_FIELD(x) x
+#define PACK_STRUCT_USE_INCLUDES
+
+#elif defined (__CC_ARM)
+
+#define PACK_STRUCT_BEGIN __packed
+#define PACK_STRUCT_STRUCT
+#define PACK_STRUCT_END
+#define PACK_STRUCT_FIELD(x) x
+
+#elif defined (__GNUC__)
+
+#define PACK_STRUCT_BEGIN
+#define PACK_STRUCT_STRUCT __attribute__ ((__packed__))
+#define PACK_STRUCT_END
+#define PACK_STRUCT_FIELD(x) x
+
+#elif defined (__TASKING__)
+
+#define PACK_STRUCT_BEGIN
+#define PACK_STRUCT_STRUCT
+#define PACK_STRUCT_END
+#define PACK_STRUCT_FIELD(x) x
+
+#endif
+
+#define LWIP_PLATFORM_ASSERT(x) do { if(!(x)) while(1); } while(0)
+
+#endif /* __CC_H__ */
diff --git a/examples/device/net_lwip_webserver/src/lwipopts.h b/examples/device/net_lwip_webserver/src/lwipopts.h
new file mode 100644
index 000000000..23319592d
--- /dev/null
+++ b/examples/device/net_lwip_webserver/src/lwipopts.h
@@ -0,0 +1,57 @@
+/*
+ * Copyright (c) 2001-2003 Swedish Institute of Computer Science.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification,
+ * are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice,
+ * this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ * 3. The name of the author may not be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
+ * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
+ * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+ * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
+ * OF SUCH DAMAGE.
+ *
+ * This file is part of the lwIP TCP/IP stack.
+ *
+ * Author: Simon Goldschmidt
+ *
+ */
+#ifndef __LWIPOPTS_H__
+#define __LWIPOPTS_H__
+
+/* Prevent having to link sys_arch.c (we don't test the API layers in unit tests) */
+#define NO_SYS 1
+#define MEM_ALIGNMENT 4
+#define LWIP_RAW 1
+#define LWIP_NETCONN 0
+#define LWIP_SOCKET 0
+#define LWIP_DHCP 0
+#define LWIP_ICMP 1
+#define LWIP_UDP 1
+#define LWIP_TCP 1
+#define ETH_PAD_SIZE 0
+#define LWIP_IP_ACCEPT_UDP_PORT(p) ((p) == PP_NTOHS(67))
+
+#define TCP_MSS (1500 /*mtu*/ - 20 /*iphdr*/ - 20 /*tcphhr*/)
+#define TCP_SND_BUF (2 * TCP_MSS)
+
+#define ETHARP_SUPPORT_STATIC_ENTRIES 1
+
+#define LWIP_HTTPD_CGI 0
+#define LWIP_HTTPD_SSI 0
+#define LWIP_HTTPD_SSI_INCLUDE_TAG 0
+
+#endif /* __LWIPOPTS_H__ */
diff --git a/examples/device/net_lwip_webserver/src/main.c b/examples/device/net_lwip_webserver/src/main.c
new file mode 100644
index 000000000..c193aeb0f
--- /dev/null
+++ b/examples/device/net_lwip_webserver/src/main.c
@@ -0,0 +1,214 @@
+/*
+ * The MIT License (MIT)
+ *
+ * Copyright (c) 2020 Peter Lawrence
+ *
+ * influenced by lrndis https://github.com/fetisov/lrndis
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ *
+ */
+
+/*
+depending on the value of CFG_TUD_NET (tusb_config.h), this can be a CDC-ECM, RNDIS, or CDC-EEM USB virtual network adapter
+
+CDC-ECM should be valid on Linux and MacOS hosts
+RNDIS should be valid on Linux and Windows hosts
+CDC-EEM should be valid on Linux hosts
+
+You *must* customize tusb_config.h to set the CFG_TUD_NET definition to the type of these network adapters to emulate.
+
+The MCU appears to the host as IP address 192.168.7.1, and provides a DHCP server, DNS server, and web server.
+*/
+
+#include "bsp/board.h"
+#include "tusb.h"
+
+#include "dhserver.h"
+#include "dnserver.h"
+#include "lwip/init.h"
+#include "httpd.h"
+
+/* lwip context */
+static struct netif netif_data;
+
+/* shared between tud_network_recv_cb() and service_traffic() */
+static struct pbuf *received_frame;
+
+/* this is used by this code, ./class/net/net_driver.c, and usb_descriptors.c */
+/* ideally speaking, this should be generated from the hardware's unique ID (if available) */
+const uint8_t tud_network_mac_address[6] = {0x20,0x89,0x84,0x6A,0x96,0x00};
+
+/* network parameters of this MCU */
+static const ip_addr_t ipaddr = IPADDR4_INIT_BYTES(192, 168, 7, 1);
+static const ip_addr_t netmask = IPADDR4_INIT_BYTES(255, 255, 255, 0);
+static const ip_addr_t gateway = IPADDR4_INIT_BYTES(0, 0, 0, 0);
+
+/* database IP addresses that can be offered to the host; this must be in RAM to store assigned MAC addresses */
+static dhcp_entry_t entries[] =
+{
+ /* mac ip address subnet mask lease time */
+ { {0}, {192, 168, 7, 2}, {255, 255, 255, 0}, 24 * 60 * 60 },
+ { {0}, {192, 168, 7, 3}, {255, 255, 255, 0}, 24 * 60 * 60 },
+ { {0}, {192, 168, 7, 4}, {255, 255, 255, 0}, 24 * 60 * 60 }
+};
+
+/* DHCP configuration parameters, leveraging "entries" above */
+static const dhcp_config_t dhcp_config =
+{
+ {192, 168, 7, 1}, 67, /* server address (self), port */
+ {192, 168, 7, 1}, /* dns server (self) */
+ "usb", /* dns suffix */
+ TU_ARRAY_SIZE(entries), /* number of entries */
+ entries /* pointer to entries */
+};
+
+static err_t linkoutput_fn(struct netif *netif, struct pbuf *p)
+{
+ (void)netif;
+
+ for (;;)
+ {
+ /* if TinyUSB isn't ready, we must signal back to lwip that there is nothing we can do */
+ if (!tud_ready())
+ return ERR_USE;
+
+ /* if the network driver can accept another packet, we make it happen */
+ if (tud_network_can_xmit())
+ {
+ tud_network_xmit(p);
+ return ERR_OK;
+ }
+
+ /* transfer execution to TinyUSB in the hopes that it will finish transmitting the prior packet */
+ tud_task();
+ }
+}
+
+static err_t output_fn(struct netif *netif, struct pbuf *p, const ip_addr_t *addr)
+{
+ return etharp_output(netif, p, addr);
+}
+
+static err_t netif_init_cb(struct netif *netif)
+{
+ LWIP_ASSERT("netif != NULL", (netif != NULL));
+ netif->mtu = CFG_TUD_NET_MTU;
+ netif->flags = NETIF_FLAG_BROADCAST | NETIF_FLAG_ETHARP | NETIF_FLAG_LINK_UP | NETIF_FLAG_UP;
+ netif->state = NULL;
+ netif->name[0] = 'E';
+ netif->name[1] = 'X';
+ netif->linkoutput = linkoutput_fn;
+ netif->output = output_fn;
+ return ERR_OK;
+}
+
+static void init_lwip(void)
+{
+ struct netif *netif = &netif_data;
+
+ lwip_init();
+ netif->hwaddr_len = sizeof(tud_network_mac_address);
+ memcpy(netif->hwaddr, tud_network_mac_address, sizeof(tud_network_mac_address));
+
+ netif = netif_add(netif, &ipaddr, &netmask, &gateway, NULL, netif_init_cb, ip_input);
+ netif_set_default(netif);
+}
+
+/* handle any DNS requests from dns-server */
+bool dns_query_proc(const char *name, ip_addr_t *addr)
+{
+ if (0 == strcmp(name, "tiny.usb"))
+ {
+ *addr = ipaddr;
+ return true;
+ }
+ return false;
+}
+
+bool tud_network_recv_cb(struct pbuf *p)
+{
+ /* this shouldn't happen, but if we get another packet before
+ parsing the previous, we must signal our inability to accept it */
+ if (received_frame) return false;
+
+ /* store away the pointer for service_traffic() to later handle */
+ received_frame = p;
+ return true;
+}
+
+static void service_traffic(void)
+{
+ /* handle any packet received by tud_network_recv_cb() */
+ if (received_frame)
+ {
+ ethernet_input(received_frame, &netif_data);
+ pbuf_free(received_frame);
+ received_frame = NULL;
+ tud_network_recv_renew();
+ }
+}
+
+void tud_network_init_cb(void)
+{
+ /* if the network is re-initializing and we have a leftover packet, we must do a cleanup */
+ if (received_frame)
+ {
+ pbuf_free(received_frame);
+ received_frame = NULL;
+ }
+}
+
+int main(void)
+{
+ /* initialize TinyUSB */
+ board_init();
+ tusb_init();
+
+ /* initialize lwip, dhcp-server, dns-server, and http */
+ init_lwip();
+ while (!netif_is_up(&netif_data));
+ while (dhserv_init(&dhcp_config) != ERR_OK);
+ while (dnserv_init(&ipaddr, 53, dns_query_proc) != ERR_OK);
+ httpd_init();
+
+ while (1)
+ {
+ tud_task();
+ service_traffic();
+ }
+
+ return 0;
+}
+
+/* lwip has provision for using a mutex, when applicable */
+sys_prot_t sys_arch_protect(void)
+{
+ return 0;
+}
+void sys_arch_unprotect(sys_prot_t pval)
+{
+ (void)pval;
+}
+
+/* lwip needs a millisecond time source, and the TinyUSB board support code has one available */
+uint32_t sys_now(void)
+{
+ return board_millis();
+}
diff --git a/examples/device/net_lwip_webserver/src/tusb_config.h b/examples/device/net_lwip_webserver/src/tusb_config.h
new file mode 100644
index 000000000..0b40fefab
--- /dev/null
+++ b/examples/device/net_lwip_webserver/src/tusb_config.h
@@ -0,0 +1,90 @@
+/*
+ * The MIT License (MIT)
+ *
+ * Copyright (c) 2019 Ha Thach (tinyusb.org)
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ *
+ */
+
+#ifndef _TUSB_CONFIG_H_
+#define _TUSB_CONFIG_H_
+
+#ifdef __cplusplus
+ extern "C" {
+#endif
+
+//--------------------------------------------------------------------
+// COMMON CONFIGURATION
+//--------------------------------------------------------------------
+
+// defined by compiler flags for flexibility
+#ifndef CFG_TUSB_MCU
+ #error CFG_TUSB_MCU must be defined
+#endif
+
+#if CFG_TUSB_MCU == OPT_MCU_LPC43XX || CFG_TUSB_MCU == OPT_MCU_LPC18XX || CFG_TUSB_MCU == OPT_MCU_MIMXRT10XX || CFG_TUSB_MCU == OPT_MCU_NUC505
+#define CFG_TUSB_RHPORT0_MODE (OPT_MODE_DEVICE | OPT_MODE_HIGH_SPEED)
+#else
+#define CFG_TUSB_RHPORT0_MODE OPT_MODE_DEVICE
+#endif
+
+#define CFG_TUSB_OS OPT_OS_NONE
+
+// CFG_TUSB_DEBUG is defined by compiler in DEBUG build
+// #define CFG_TUSB_DEBUG 0
+
+/* USB DMA on some MCUs can only access a specific SRAM region with restriction on alignment.
+ * Tinyusb use follows macros to declare transferring memory so that they can be put
+ * into those specific section.
+ * e.g
+ * - CFG_TUSB_MEM SECTION : __attribute__ (( section(".usb_ram") ))
+ * - CFG_TUSB_MEM_ALIGN : __attribute__ ((aligned(4)))
+ */
+#ifndef CFG_TUSB_MEM_SECTION
+#define CFG_TUSB_MEM_SECTION
+#endif
+
+#ifndef CFG_TUSB_MEM_ALIGN
+#define CFG_TUSB_MEM_ALIGN __attribute__ ((aligned(4)))
+#endif
+
+//--------------------------------------------------------------------
+// DEVICE CONFIGURATION
+//--------------------------------------------------------------------
+
+#ifndef CFG_TUD_ENDPOINT0_SIZE
+#define CFG_TUD_ENDPOINT0_SIZE 64
+#endif
+
+//------------- CLASS -------------//
+#define CFG_TUD_CDC 0
+#define CFG_TUD_MSC 0
+#define CFG_TUD_HID 0
+#define CFG_TUD_MIDI 0
+#define CFG_TUD_VENDOR 0
+//#define CFG_TUD_NET OPT_NET_ECM
+#define CFG_TUD_NET OPT_NET_RNDIS
+//#define CFG_TUD_NET OPT_NET_EEM
+
+#ifdef __cplusplus
+ }
+#endif
+
+#endif /* _TUSB_CONFIG_H_ */
diff --git a/examples/device/net_lwip_webserver/src/usb_descriptors.c b/examples/device/net_lwip_webserver/src/usb_descriptors.c
new file mode 100644
index 000000000..26f8aeba6
--- /dev/null
+++ b/examples/device/net_lwip_webserver/src/usb_descriptors.c
@@ -0,0 +1,199 @@
+/*
+ * The MIT License (MIT)
+ *
+ * Copyright (c) 2019 Ha Thach (tinyusb.org)
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ *
+ */
+
+#include "tusb.h"
+#include "usb_descriptors.h"
+
+/* A combination of interfaces must have a unique product id, since PC will save device driver after the first plug.
+ * Same VID/PID with different interface e.g MSC (first), then CDC (later) will possibly cause system error on PC.
+ *
+ * Auto ProductID layout's Bitmap:
+ * [MSB] NET1:NET0 | VENDOR | MIDI | HID | MSC | CDC [LSB]
+ */
+#define _PID_MAP(itf, n) ( (CFG_TUD_##itf) << (n) )
+#define USB_PID (0x4000 | _PID_MAP(CDC, 0) | _PID_MAP(MSC, 1) | _PID_MAP(HID, 2) | \
+ _PID_MAP(MIDI, 3) | _PID_MAP(VENDOR, 4) | _PID_MAP(NET, 5) )
+
+//--------------------------------------------------------------------+
+// Device Descriptors
+//--------------------------------------------------------------------+
+tusb_desc_device_t const desc_device =
+{
+ .bLength = sizeof(tusb_desc_device_t),
+ .bDescriptorType = TUSB_DESC_DEVICE,
+ .bcdUSB = 0x0200,
+
+ .bDeviceClass = TUSB_CLASS_UNSPECIFIED,
+ .bDeviceSubClass = 0,
+ .bDeviceProtocol = 0,
+ .bMaxPacketSize0 = CFG_TUD_ENDPOINT0_SIZE,
+
+ .idVendor = 0xCafe,
+ .idProduct = USB_PID,
+ .bcdDevice = 0x0100,
+
+ .iManufacturer = 0x01,
+ .iProduct = 0x02,
+ .iSerialNumber = 0x03,
+
+ .bNumConfigurations = 0x01
+};
+
+// Invoked when received GET DEVICE DESCRIPTOR
+// Application return pointer to descriptor
+uint8_t const * tud_descriptor_device_cb(void)
+{
+ return (uint8_t const *) &desc_device;
+}
+
+//--------------------------------------------------------------------+
+// Configuration Descriptor
+//--------------------------------------------------------------------+
+enum
+{
+ ITF_NUM_CDC = 0,
+ ITF_NUM_CDC_DATA,
+ ITF_NUM_TOTAL
+};
+
+enum
+{
+ STR_LANGID = 0,
+ STR_MANUFACTURER,
+ STR_PRODUCT,
+ STR_ITFNAME,
+ STR_MAC,
+};
+
+#if CFG_TUD_NET == OPT_NET_ECM
+#define CONFIG_TOTAL_LEN (TUD_CONFIG_DESC_LEN + TUD_CDC_ECM_DESC_LEN)
+#elif CFG_TUD_NET == OPT_NET_RNDIS
+#define CONFIG_TOTAL_LEN (TUD_CONFIG_DESC_LEN + TUD_RNDIS_DESC_LEN)
+#elif CFG_TUD_NET == OPT_NET_EEM
+#define CONFIG_TOTAL_LEN (TUD_CONFIG_DESC_LEN + TUD_CDC_EEM_DESC_LEN)
+#endif
+
+#if CFG_TUSB_MCU == OPT_MCU_LPC175X_6X || CFG_TUSB_MCU == OPT_MCU_LPC177X_8X || CFG_TUSB_MCU == OPT_MCU_LPC40XX
+ // LPC 17xx and 40xx endpoint type (bulk/interrupt/iso) are fixed by its number
+ // 0 control, 1 In, 2 Bulk, 3 Iso, 4 In etc ...
+ #define EPNUM_CDC 2
+#else
+ #define EPNUM_CDC 2
+#endif
+
+uint8_t const desc_configuration[] =
+{
+ // Interface count, string index, total length, attribute, power in mA
+ TUD_CONFIG_DESCRIPTOR(ITF_NUM_TOTAL, 0, CONFIG_TOTAL_LEN, 0, 100),
+
+#if CFG_TUD_NET == OPT_NET_ECM
+ // Interface number, description string index, MAC address string index, EP notification address and size, EP data address (out, in), and size, max segment size.
+ TUD_CDC_ECM_DESCRIPTOR(ITF_NUM_CDC, STR_ITFNAME, STR_MAC, 0x81, 8, EPNUM_CDC, 0x80 | EPNUM_CDC, CFG_TUD_NET_ENDPOINT_SIZE, CFG_TUD_NET_MTU),
+#elif CFG_TUD_NET == OPT_NET_RNDIS
+ // Interface number, string index, EP notification address and size, EP data address (out, in) and size.
+ TUD_RNDIS_DESCRIPTOR(ITF_NUM_CDC, STR_ITFNAME, 0x81, 8, EPNUM_CDC, 0x80 | EPNUM_CDC, CFG_TUD_NET_ENDPOINT_SIZE),
+#elif CFG_TUD_NET == OPT_NET_EEM
+ // Interface number, description string index, EP data address (out, in) and size.
+ TUD_CDC_EEM_DESCRIPTOR(ITF_NUM_CDC, STR_ITFNAME, EPNUM_CDC, 0x80 | EPNUM_CDC, CFG_TUD_NET_ENDPOINT_SIZE),
+#endif
+};
+
+// Invoked when received GET CONFIGURATION DESCRIPTOR
+// Application return pointer to descriptor
+// Descriptor contents must exist long enough for transfer to complete
+uint8_t const * tud_descriptor_configuration_cb(uint8_t index)
+{
+ (void) index; // for multiple configurations
+ return desc_configuration;
+}
+
+//--------------------------------------------------------------------+
+// String Descriptors
+//--------------------------------------------------------------------+
+
+// array of pointer to string descriptors
+char const* string_desc_arr [] =
+{
+ [STR_LANGID] = (const char[]) { 0x09, 0x04 }, // supported language is English (0x0409)
+ [STR_MANUFACTURER] = "TinyUSB", // Manufacturer
+ [STR_PRODUCT] = "TinyUSB Device", // Product
+ [STR_ITFNAME] = // CDC-ECM Interface
+#if CFG_TUD_NET == OPT_NET_ECM
+ "TinyUSB CDC-ECM",
+#elif CFG_TUD_NET == OPT_NET_RNDIS
+ "TinyUSB RNDIS",
+#elif CFG_TUD_NET == OPT_NET_EEM
+ "TinyUSB CDC-EEM",
+#endif
+};
+
+static uint16_t _desc_str[32];
+
+// Invoked when received GET STRING DESCRIPTOR request
+// Application return pointer to descriptor, whose contents must exist long enough for transfer to complete
+uint16_t const* tud_descriptor_string_cb(uint8_t index, uint16_t langid)
+{
+ (void)langid;
+
+ unsigned chr_count = 0;
+
+ if (STR_LANGID == index)
+ {
+ memcpy(&_desc_str[1], string_desc_arr[0], 2);
+ chr_count = 1;
+ }
+ else if (STR_MAC == index)
+ {
+ // Convert MAC address into UTF-16
+
+ for (unsigned i=0; i<sizeof(tud_network_mac_address); i++)
+ {
+ _desc_str[1+chr_count++] = "0123456789ABCDEF"[(tud_network_mac_address[i] >> 4) & 0xf];
+ _desc_str[1+chr_count++] = "0123456789ABCDEF"[(tud_network_mac_address[i] >> 0) & 0xf];
+ }
+ }
+ else
+ {
+ // Convert ASCII string into UTF-16
+
+ if ( !(index < sizeof(string_desc_arr)/sizeof(string_desc_arr[0])) ) return NULL;
+
+ const char* str = string_desc_arr[index];
+
+ // Cap at max char
+ chr_count = strlen(str);
+ if ( chr_count > (TU_ARRAY_SIZE(_desc_str) - 1)) chr_count = TU_ARRAY_SIZE(_desc_str) - 1;
+
+ for (unsigned i=0; i<chr_count; i++)
+ {
+ _desc_str[1+i] = str[i];
+ }
+ }
+
+ // first byte is length (including header), second byte is string type
+ _desc_str[0] = (TUSB_DESC_STRING << 8 ) | (2*chr_count + 2);
+
+ return _desc_str;
+}
diff --git a/examples/device/net_lwip_webserver/src/usb_descriptors.h b/examples/device/net_lwip_webserver/src/usb_descriptors.h
new file mode 100644
index 000000000..280570831
--- /dev/null
+++ b/examples/device/net_lwip_webserver/src/usb_descriptors.h
@@ -0,0 +1,28 @@
+/*
+ * The MIT License (MIT)
+ *
+ * Copyright (c) 2019 Ha Thach (tinyusb.org)
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#ifndef USB_DESCRIPTORS_H_
+#define USB_DESCRIPTORS_H_
+
+#endif /* USB_DESCRIPTORS_H_ */
diff --git a/examples/device/usbtmc/src/tusb_config.h b/examples/device/usbtmc/src/tusb_config.h
index 124680ca2..b6a40355e 100644
--- a/examples/device/usbtmc/src/tusb_config.h
+++ b/examples/device/usbtmc/src/tusb_config.h
@@ -21,7 +21,7 @@
#error CFG_TUSB_MCU must be defined
#endif
-#if CFG_TUSB_MCU == OPT_MCU_LPC43XX || CFG_TUSB_MCU == OPT_MCU_LPC18XX
+#if CFG_TUSB_MCU == OPT_MCU_LPC43XX || CFG_TUSB_MCU == OPT_MCU_LPC18XX || CFG_TUSB_MCU == OPT_MCU_MIMXRT10XX || CFG_TUSB_MCU == OPT_MCU_NUC505
#define CFG_TUSB_RHPORT0_MODE (OPT_MODE_DEVICE | OPT_MODE_HIGH_SPEED)
#else
#define CFG_TUSB_RHPORT0_MODE OPT_MODE_DEVICE
diff --git a/examples/device/usbtmc/src/usb_descriptors.c b/examples/device/usbtmc/src/usb_descriptors.c
index 27e1bdaa9..92b1dce61 100644
--- a/examples/device/usbtmc/src/usb_descriptors.c
+++ b/examples/device/usbtmc/src/usb_descriptors.c
@@ -216,8 +216,10 @@ static uint16_t _desc_str[32];
// Invoked when received GET STRING DESCRIPTOR request
// Application return pointer to descriptor, whose contents must exist long enough for transfer to complete
-uint16_t const* tud_descriptor_string_cb(uint8_t index)
+uint16_t const* tud_descriptor_string_cb(uint8_t index, uint16_t langid)
{
+ (void) langid;
+
size_t chr_count;
if ( index == 0)
diff --git a/examples/device/webusb_serial/src/tusb_config.h b/examples/device/webusb_serial/src/tusb_config.h
index 8a73e8353..b3f449f93 100644
--- a/examples/device/webusb_serial/src/tusb_config.h
+++ b/examples/device/webusb_serial/src/tusb_config.h
@@ -39,7 +39,7 @@
#error CFG_TUSB_MCU must be defined
#endif
-#if CFG_TUSB_MCU == OPT_MCU_LPC43XX || CFG_TUSB_MCU == OPT_MCU_LPC18XX
+#if CFG_TUSB_MCU == OPT_MCU_LPC43XX || CFG_TUSB_MCU == OPT_MCU_LPC18XX || CFG_TUSB_MCU == OPT_MCU_MIMXRT10XX || CFG_TUSB_MCU == OPT_MCU_NUC505
#define CFG_TUSB_RHPORT0_MODE (OPT_MODE_DEVICE | OPT_MODE_HIGH_SPEED)
#else
#define CFG_TUSB_RHPORT0_MODE OPT_MODE_DEVICE
diff --git a/examples/device/webusb_serial/src/usb_descriptors.c b/examples/device/webusb_serial/src/usb_descriptors.c
index 740defe4e..2925a66c4 100644
--- a/examples/device/webusb_serial/src/usb_descriptors.c
+++ b/examples/device/webusb_serial/src/usb_descriptors.c
@@ -204,8 +204,10 @@ static uint16_t _desc_str[32];
// Invoked when received GET STRING DESCRIPTOR request
// Application return pointer to descriptor, whose contents must exist long enough for transfer to complete
-uint16_t const* tud_descriptor_string_cb(uint8_t index)
+uint16_t const* tud_descriptor_string_cb(uint8_t index, uint16_t langid)
{
+ (void) langid;
+
uint8_t chr_count;
if ( index == 0)
diff --git a/examples/host/cdc_msc_hid/ses/lpc175x_6x/lpc175x_6x.emProject b/examples/host/cdc_msc_hid/ses/lpc175x_6x/lpc175x_6x.emProject
index ecd2dc716..ba5a9cea7 100644
--- a/examples/host/cdc_msc_hid/ses/lpc175x_6x/lpc175x_6x.emProject
+++ b/examples/host/cdc_msc_hid/ses/lpc175x_6x/lpc175x_6x.emProject
@@ -29,7 +29,7 @@
linker_memory_map_file="LPC1769_MemoryMap.xml"
linker_section_placement_file="flash_placement.xml"
linker_section_placements_segments="FLASH RX 0x00000000 0x00080000;RAM RWX 0x10000000 0x00008000"
- macros="DeviceFamily=LPC1700;DeviceSubFamily=LPC176x;Target=LPC1769;Placement=Flash;rootDir=../../../../..;lpcDir=../../../../../hw/mcu/nxp/lpc_chip_175x_6x"
+ macros="DeviceFamily=LPC1700;DeviceSubFamily=LPC176x;Target=LPC1769;Placement=Flash;rootDir=../../../../..;lpcDir=../../../../../hw/mcu/nxp/lpcopen/lpc175x_6x/lpc_chip_175x_6x"
project_directory=""
project_type="Executable"
target_reset_script="Reset();"
@@ -46,40 +46,40 @@
<file file_name="../../../../../hw/bsp/ansi_escape.h" />
<file file_name="../../../../../hw/bsp/board.h" />
<folder Name="lpcxpresso1769">
- <file file_name="../../../../../hw/bsp/lpcxpresso1769/board_lpcxpresso1769.c" />
- <file file_name="../../../../../hw/bsp/lpcxpresso1769/board_lpcxpresso1769.h" />
+ <file file_name="../../../../../hw/bsp/lpcxpresso1769/lpcxpresso1769.c" />
</folder>
+ <file file_name="../../../../../hw/bsp/board.c" />
</folder>
<folder Name="mcu">
<folder Name="nxp">
<folder Name="lpc_chip_175x_6x">
<folder Name="inc">
- <file file_name="../../../../../hw/mcu/nxp/lpc_chip_175x_6x/inc/chip.h" />
- <file file_name="../../../../../hw/mcu/nxp/lpc_chip_175x_6x/inc/chip_lpc175x_6x.h" />
- <file file_name="../../../../../hw/mcu/nxp/lpc_chip_175x_6x/inc/chip_lpc177x_8x.h" />
- <file file_name="../../../../../hw/mcu/nxp/lpc_chip_175x_6x/inc/chip_lpc407x_8x.h" />
- <file file_name="../../../../../hw/mcu/nxp/lpc_chip_175x_6x/inc/clock_17xx_40xx.h" />
- <file file_name="../../../../../hw/mcu/nxp/lpc_chip_175x_6x/inc/cmsis.h" />
- <file file_name="../../../../../hw/mcu/nxp/lpc_chip_175x_6x/inc/cmsis_175x_6x.h" />
- <file file_name="../../../../../hw/mcu/nxp/lpc_chip_175x_6x/inc/core_cm3.h" />
- <file file_name="../../../../../hw/mcu/nxp/lpc_chip_175x_6x/inc/core_cmFunc.h" />
- <file file_name="../../../../../hw/mcu/nxp/lpc_chip_175x_6x/inc/core_cmInstr.h" />
- <file file_name="../../../../../hw/mcu/nxp/lpc_chip_175x_6x/inc/gpio_17xx_40xx.h" />
- <file file_name="../../../../../hw/mcu/nxp/lpc_chip_175x_6x/inc/gpioint_17xx_40xx.h" />
- <file file_name="../../../../../hw/mcu/nxp/lpc_chip_175x_6x/inc/iocon_17xx_40xx.h" />
- <file file_name="../../../../../hw/mcu/nxp/lpc_chip_175x_6x/inc/lpc_types.h" />
- <file file_name="../../../../../hw/mcu/nxp/lpc_chip_175x_6x/inc/sys_config.h" />
- <file file_name="../../../../../hw/mcu/nxp/lpc_chip_175x_6x/inc/sysctl_17xx_40xx.h" />
- <file file_name="../../../../../hw/mcu/nxp/lpc_chip_175x_6x/inc/uart_17xx_40xx.h" />
+ <file file_name="../../../../../hw/mcu/nxp/lpcopen/lpc175x_6x/lpc_chip_175x_6x/inc/chip.h" />
+ <file file_name="../../../../../hw/mcu/nxp/lpcopen/lpc175x_6x/lpc_chip_175x_6x/inc/chip_lpc175x_6x.h" />
+ <file file_name="../../../../../hw/mcu/nxp/lpcopen/lpc175x_6x/lpc_chip_175x_6x/inc/chip_lpc177x_8x.h" />
+ <file file_name="../../../../../hw/mcu/nxp/lpcopen/lpc175x_6x/lpc_chip_175x_6x/inc/chip_lpc407x_8x.h" />
+ <file file_name="../../../../../hw/mcu/nxp/lpcopen/lpc175x_6x/lpc_chip_175x_6x/inc/clock_17xx_40xx.h" />
+ <file file_name="../../../../../hw/mcu/nxp/lpcopen/lpc175x_6x/lpc_chip_175x_6x/inc/cmsis.h" />
+ <file file_name="../../../../../hw/mcu/nxp/lpcopen/lpc175x_6x/lpc_chip_175x_6x/inc/cmsis_175x_6x.h" />
+ <file file_name="../../../../../hw/mcu/nxp/lpcopen/lpc175x_6x/lpc_chip_175x_6x/inc/core_cm3.h" />
+ <file file_name="../../../../../hw/mcu/nxp/lpcopen/lpc175x_6x/lpc_chip_175x_6x/inc/core_cmFunc.h" />
+ <file file_name="../../../../../hw/mcu/nxp/lpcopen/lpc175x_6x/lpc_chip_175x_6x/inc/core_cmInstr.h" />
+ <file file_name="../../../../../hw/mcu/nxp/lpcopen/lpc175x_6x/lpc_chip_175x_6x/inc/gpio_17xx_40xx.h" />
+ <file file_name="../../../../../hw/mcu/nxp/lpcopen/lpc175x_6x/lpc_chip_175x_6x/inc/gpioint_17xx_40xx.h" />
+ <file file_name="../../../../../hw/mcu/nxp/lpcopen/lpc175x_6x/lpc_chip_175x_6x/inc/iocon_17xx_40xx.h" />
+ <file file_name="../../../../../hw/mcu/nxp/lpcopen/lpc175x_6x/lpc_chip_175x_6x/inc/lpc_types.h" />
+ <file file_name="../../../../../hw/mcu/nxp/lpcopen/lpc175x_6x/lpc_chip_175x_6x/inc/sys_config.h" />
+ <file file_name="../../../../../hw/mcu/nxp/lpcopen/lpc175x_6x/lpc_chip_175x_6x/inc/sysctl_17xx_40xx.h" />
+ <file file_name="../../../../../hw/mcu/nxp/lpcopen/lpc175x_6x/lpc_chip_175x_6x/inc/uart_17xx_40xx.h" />
</folder>
<folder Name="src">
- <file file_name="../../../../../hw/mcu/nxp/lpc_chip_175x_6x/src/chip_17xx_40xx.c" />
- <file file_name="../../../../../hw/mcu/nxp/lpc_chip_175x_6x/src/clock_17xx_40xx.c" />
- <file file_name="../../../../../hw/mcu/nxp/lpc_chip_175x_6x/src/gpio_17xx_40xx.c" />
- <file file_name="../../../../../hw/mcu/nxp/lpc_chip_175x_6x/src/iocon_17xx_40xx.c" />
- <file file_name="../../../../../hw/mcu/nxp/lpc_chip_175x_6x/src/sysctl_17xx_40xx.c" />
- <file file_name="../../../../../hw/mcu/nxp/lpc_chip_175x_6x/src/sysinit_17xx_40xx.c" />
- <file file_name="../../../../../hw/mcu/nxp/lpc_chip_175x_6x/src/uart_17xx_40xx.c" />
+ <file file_name="../../../../../hw/mcu/nxp/lpcopen/lpc175x_6x/lpc_chip_175x_6x/src/chip_17xx_40xx.c" />
+ <file file_name="../../../../../hw/mcu/nxp/lpcopen/lpc175x_6x/lpc_chip_175x_6x/src/clock_17xx_40xx.c" />
+ <file file_name="../../../../../hw/mcu/nxp/lpcopen/lpc175x_6x/lpc_chip_175x_6x/src/gpio_17xx_40xx.c" />
+ <file file_name="../../../../../hw/mcu/nxp/lpcopen/lpc175x_6x/lpc_chip_175x_6x/src/iocon_17xx_40xx.c" />
+ <file file_name="../../../../../hw/mcu/nxp/lpcopen/lpc175x_6x/lpc_chip_175x_6x/src/sysctl_17xx_40xx.c" />
+ <file file_name="../../../../../hw/mcu/nxp/lpcopen/lpc175x_6x/lpc_chip_175x_6x/src/sysinit_17xx_40xx.c" />
+ <file file_name="../../../../../hw/mcu/nxp/lpcopen/lpc175x_6x/lpc_chip_175x_6x/src/uart_17xx_40xx.c" />
</folder>
</folder>
</folder>
diff --git a/examples/host/cdc_msc_hid/ses/lpc18xx/lpc18xx.emProject b/examples/host/cdc_msc_hid/ses/lpc18xx/lpc18xx.emProject
index 8e9123dc7..2dd7de552 100644
--- a/examples/host/cdc_msc_hid/ses/lpc18xx/lpc18xx.emProject
+++ b/examples/host/cdc_msc_hid/ses/lpc18xx/lpc18xx.emProject
@@ -24,7 +24,7 @@
gcc_entry_point="Reset_Handler"
linker_memory_map_file="$(ProjectDir)/LPC1857_MemoryMap.xml"
linker_section_placement_file="$(ProjectDir)/flash_placement.xml"
- macros="DeviceFamily=LPC1800;DeviceSubFamily=LPC185x;Target=LPC1857;Placement=Flash;rootDir=../../../../..;lpcDir=../../../../../hw/mcu/nxp/lpc_chip_18xx"
+ macros="DeviceFamily=LPC1800;DeviceSubFamily=LPC185x;Target=LPC1857;Placement=Flash;rootDir=../../../../..;lpcDir=../../../../../hw/mcu/nxp/lpcopen/lpc18xx/lpc_chip_18xx"
package_dependencies="LPC1800"
project_directory=""
project_type="Executable"
@@ -51,52 +51,51 @@
<file file_name="../../../../../hw/bsp/ansi_escape.h" />
<file file_name="../../../../../hw/bsp/board.h" />
<folder Name="mcb1800">
- <file file_name="../../../../../hw/bsp/mcb1800/board_mcb1800.c" />
- <file file_name="../../../../../hw/bsp/mcb1800/board_mcb1800.h" />
+ <file file_name="../../../../../hw/bsp/mcb1800/mcb1800.c" />
</folder>
</folder>
<folder Name="mcu">
<folder Name="nxp">
<folder Name="lpc_chip_18xx">
<folder Name="inc">
- <file file_name="../../../../../hw/mcu/nxp/lpc_chip_18xx/inc/arm_common_tables.h" />
- <file file_name="../../../../../hw/mcu/nxp/lpc_chip_18xx/inc/arm_math.h" />
- <file file_name="../../../../../hw/mcu/nxp/lpc_chip_18xx/inc/cguccu_18xx_43xx.h" />
- <file file_name="../../../../../hw/mcu/nxp/lpc_chip_18xx/inc/chip.h" />
- <file file_name="../../../../../hw/mcu/nxp/lpc_chip_18xx/inc/chip_clocks.h" />
- <file file_name="../../../../../hw/mcu/nxp/lpc_chip_18xx/inc/chip_lpc18xx.h" />
- <file file_name="../../../../../hw/mcu/nxp/lpc_chip_18xx/inc/chip_lpc43xx.h" />
- <file file_name="../../../../../hw/mcu/nxp/lpc_chip_18xx/inc/clock_18xx_43xx.h" />
- <file file_name="../../../../../hw/mcu/nxp/lpc_chip_18xx/inc/cmsis.h" />
- <file file_name="../../../../../hw/mcu/nxp/lpc_chip_18xx/inc/cmsis_18xx.h" />
- <file file_name="../../../../../hw/mcu/nxp/lpc_chip_18xx/inc/cmsis_43xx.h" />
- <file file_name="../../../../../hw/mcu/nxp/lpc_chip_18xx/inc/cmsis_43xx_m0app.h" />
- <file file_name="../../../../../hw/mcu/nxp/lpc_chip_18xx/inc/cmsis_43xx_m0sub.h" />
- <file file_name="../../../../../hw/mcu/nxp/lpc_chip_18xx/inc/core_cm0.h" />
- <file file_name="../../../../../hw/mcu/nxp/lpc_chip_18xx/inc/core_cm0plus.h" />
- <file file_name="../../../../../hw/mcu/nxp/lpc_chip_18xx/inc/core_cm3.h" />
- <file file_name="../../../../../hw/mcu/nxp/lpc_chip_18xx/inc/core_cm4.h" />
- <file file_name="../../../../../hw/mcu/nxp/lpc_chip_18xx/inc/core_cm4_simd.h" />
- <file file_name="../../../../../hw/mcu/nxp/lpc_chip_18xx/inc/core_cmFunc.h" />
- <file file_name="../../../../../hw/mcu/nxp/lpc_chip_18xx/inc/core_cmInstr.h" />
- <file file_name="../../../../../hw/mcu/nxp/lpc_chip_18xx/inc/core_sc000.h" />
- <file file_name="../../../../../hw/mcu/nxp/lpc_chip_18xx/inc/core_sc300.h" />
- <file file_name="../../../../../hw/mcu/nxp/lpc_chip_18xx/inc/creg_18xx_43xx.h" />
- <file file_name="../../../../../hw/mcu/nxp/lpc_chip_18xx/inc/gpio_18xx_43xx.h" />
- <file file_name="../../../../../hw/mcu/nxp/lpc_chip_18xx/inc/lpc_types.h" />
- <file file_name="../../../../../hw/mcu/nxp/lpc_chip_18xx/inc/uart_18xx_43xx.h" />
- <file file_name="../../../../../hw/mcu/nxp/lpc_chip_18xx/inc/usbhs_18xx_43xx.h" />
+ <file file_name="../../../../../hw/mcu/nxp/lpcopen/lpc18xx/lpc_chip_18xx/inc/arm_common_tables.h" />
+ <file file_name="../../../../../hw/mcu/nxp/lpcopen/lpc18xx/lpc_chip_18xx/inc/arm_math.h" />
+ <file file_name="../../../../../hw/mcu/nxp/lpcopen/lpc18xx/lpc_chip_18xx/inc/cguccu_18xx_43xx.h" />
+ <file file_name="../../../../../hw/mcu/nxp/lpcopen/lpc18xx/lpc_chip_18xx/inc/chip.h" />
+ <file file_name="../../../../../hw/mcu/nxp/lpcopen/lpc18xx/lpc_chip_18xx/inc/chip_clocks.h" />
+ <file file_name="../../../../../hw/mcu/nxp/lpcopen/lpc18xx/lpc_chip_18xx/inc/chip_lpc18xx.h" />
+ <file file_name="../../../../../hw/mcu/nxp/lpcopen/lpc18xx/lpc_chip_18xx/inc/chip_lpc43xx.h" />
+ <file file_name="../../../../../hw/mcu/nxp/lpcopen/lpc18xx/lpc_chip_18xx/inc/clock_18xx_43xx.h" />
+ <file file_name="../../../../../hw/mcu/nxp/lpcopen/lpc18xx/lpc_chip_18xx/inc/cmsis.h" />
+ <file file_name="../../../../../hw/mcu/nxp/lpcopen/lpc18xx/lpc_chip_18xx/inc/cmsis_18xx.h" />
+ <file file_name="../../../../../hw/mcu/nxp/lpcopen/lpc18xx/lpc_chip_18xx/inc/cmsis_43xx.h" />
+ <file file_name="../../../../../hw/mcu/nxp/lpcopen/lpc18xx/lpc_chip_18xx/inc/cmsis_43xx_m0app.h" />
+ <file file_name="../../../../../hw/mcu/nxp/lpcopen/lpc18xx/lpc_chip_18xx/inc/cmsis_43xx_m0sub.h" />
+ <file file_name="../../../../../hw/mcu/nxp/lpcopen/lpc18xx/lpc_chip_18xx/inc/core_cm0.h" />
+ <file file_name="../../../../../hw/mcu/nxp/lpcopen/lpc18xx/lpc_chip_18xx/inc/core_cm0plus.h" />
+ <file file_name="../../../../../hw/mcu/nxp/lpcopen/lpc18xx/lpc_chip_18xx/inc/core_cm3.h" />
+ <file file_name="../../../../../hw/mcu/nxp/lpcopen/lpc18xx/lpc_chip_18xx/inc/core_cm4.h" />
+ <file file_name="../../../../../hw/mcu/nxp/lpcopen/lpc18xx/lpc_chip_18xx/inc/core_cm4_simd.h" />
+ <file file_name="../../../../../hw/mcu/nxp/lpcopen/lpc18xx/lpc_chip_18xx/inc/core_cmFunc.h" />
+ <file file_name="../../../../../hw/mcu/nxp/lpcopen/lpc18xx/lpc_chip_18xx/inc/core_cmInstr.h" />
+ <file file_name="../../../../../hw/mcu/nxp/lpcopen/lpc18xx/lpc_chip_18xx/inc/core_sc000.h" />
+ <file file_name="../../../../../hw/mcu/nxp/lpcopen/lpc18xx/lpc_chip_18xx/inc/core_sc300.h" />
+ <file file_name="../../../../../hw/mcu/nxp/lpcopen/lpc18xx/lpc_chip_18xx/inc/creg_18xx_43xx.h" />
+ <file file_name="../../../../../hw/mcu/nxp/lpcopen/lpc18xx/lpc_chip_18xx/inc/gpio_18xx_43xx.h" />
+ <file file_name="../../../../../hw/mcu/nxp/lpcopen/lpc18xx/lpc_chip_18xx/inc/lpc_types.h" />
+ <file file_name="../../../../../hw/mcu/nxp/lpcopen/lpc18xx/lpc_chip_18xx/inc/uart_18xx_43xx.h" />
+ <file file_name="../../../../../hw/mcu/nxp/lpcopen/lpc18xx/lpc_chip_18xx/inc/usbhs_18xx_43xx.h" />
<folder Name="config_18xx">
- <file file_name="../../../../../hw/mcu/nxp/lpc_chip_18xx/inc/config_18xx/cmsis_18xx.h" />
- <file file_name="../../../../../hw/mcu/nxp/lpc_chip_18xx/inc/config_18xx/sys_config.h" />
+ <file file_name="../../../../../hw/mcu/nxp/lpcopen/lpc18xx/lpc_chip_18xx/inc/config_18xx/cmsis_18xx.h" />
+ <file file_name="../../../../../hw/mcu/nxp/lpcopen/lpc18xx/lpc_chip_18xx/inc/config_18xx/sys_config.h" />
</folder>
</folder>
<folder Name="src">
- <file file_name="../../../../../hw/mcu/nxp/lpc_chip_18xx/src/chip_18xx_43xx.c" />
- <file file_name="../../../../../hw/mcu/nxp/lpc_chip_18xx/src/clock_18xx_43xx.c" />
- <file file_name="../../../../../hw/mcu/nxp/lpc_chip_18xx/src/gpio_18xx_43xx.c" />
- <file file_name="../../../../../hw/mcu/nxp/lpc_chip_18xx/src/sysinit_18xx_43xx.c" />
- <file file_name="../../../../../hw/mcu/nxp/lpc_chip_18xx/src/uart_18xx_43xx.c" />
+ <file file_name="../../../../../hw/mcu/nxp/lpcopen/lpc18xx/lpc_chip_18xx/src/chip_18xx_43xx.c" />
+ <file file_name="../../../../../hw/mcu/nxp/lpcopen/lpc18xx/lpc_chip_18xx/src/clock_18xx_43xx.c" />
+ <file file_name="../../../../../hw/mcu/nxp/lpcopen/lpc18xx/lpc_chip_18xx/src/gpio_18xx_43xx.c" />
+ <file file_name="../../../../../hw/mcu/nxp/lpcopen/lpc18xx/lpc_chip_18xx/src/sysinit_18xx_43xx.c" />
+ <file file_name="../../../../../hw/mcu/nxp/lpcopen/lpc18xx/lpc_chip_18xx/src/uart_18xx_43xx.c" />
</folder>
</folder>
</folder>
diff --git a/examples/host/cdc_msc_hid/ses/lpc40xx/lpc40xx.emProject b/examples/host/cdc_msc_hid/ses/lpc40xx/lpc40xx.emProject
index 63cf74840..bfb7922a3 100644
--- a/examples/host/cdc_msc_hid/ses/lpc40xx/lpc40xx.emProject
+++ b/examples/host/cdc_msc_hid/ses/lpc40xx/lpc40xx.emProject
@@ -26,7 +26,7 @@
gcc_entry_point="Reset_Handler"
linker_memory_map_file="$(ProjectDir)/LPC4088FBD208_MemoryMap.xml"
linker_section_placement_file="$(ProjectDir)/flash_placement.xml"
- macros="DeviceFamily=LPC4000;DeviceSubFamily=LPC408x;Target=LPC4088FBD208;Placement=Flash;rootDir=../../../../..;lpcDir=../../../../../hw/mcu/nxp/lpc_chip_40xx"
+ macros="DeviceFamily=LPC4000;DeviceSubFamily=LPC408x;Target=LPC4088FBD208;Placement=Flash;rootDir=../../../../..;lpcDir=../../../../../hw/mcu/nxp/lpcopen/lpc40xx/lpc_chip_40xx"
package_dependencies="LPC4000"
project_directory=""
project_type="Executable"
@@ -53,40 +53,39 @@
<file file_name="../../../../../hw/bsp/ansi_escape.h" />
<file file_name="../../../../../hw/bsp/board.h" />
<folder Name="ea4088qs">
- <file file_name="../../../../../hw/bsp/ea4088qs/board_ea4088qs.c" />
- <file file_name="../../../../../hw/bsp/ea4088qs/board_ea4088qs.h" />
+ <file file_name="../../../../../hw/bsp/ea4088qs/ea4088qs.c" />
</folder>
</folder>
<folder Name="mcu">
<folder Name="nxp">
<folder Name="lpc_chip_40xx">
<folder Name="inc">
- <file file_name="../../../../../hw/mcu/nxp/lpc_chip_40xx/inc/chip.h" />
- <file file_name="../../../../../hw/mcu/nxp/lpc_chip_40xx/inc/chip_lpc175x_6x.h" />
- <file file_name="../../../../../hw/mcu/nxp/lpc_chip_40xx/inc/chip_lpc177x_8x.h" />
- <file file_name="../../../../../hw/mcu/nxp/lpc_chip_40xx/inc/chip_lpc407x_8x.h" />
- <file file_name="../../../../../hw/mcu/nxp/lpc_chip_40xx/inc/clock_17xx_40xx.h" />
- <file file_name="../../../../../hw/mcu/nxp/lpc_chip_40xx/inc/cmsis.h" />
- <file file_name="../../../../../hw/mcu/nxp/lpc_chip_40xx/inc/cmsis_40xx.h" />
- <file file_name="../../../../../hw/mcu/nxp/lpc_chip_40xx/inc/core_cm4.h" />
- <file file_name="../../../../../hw/mcu/nxp/lpc_chip_40xx/inc/core_cm4_simd.h" />
- <file file_name="../../../../../hw/mcu/nxp/lpc_chip_40xx/inc/core_cmFunc.h" />
- <file file_name="../../../../../hw/mcu/nxp/lpc_chip_40xx/inc/core_cmInstr.h" />
- <file file_name="../../../../../hw/mcu/nxp/lpc_chip_40xx/inc/gpio_17xx_40xx.h" />
- <file file_name="../../../../../hw/mcu/nxp/lpc_chip_40xx/inc/sys_config.h" />
- <file file_name="../../../../../hw/mcu/nxp/lpc_chip_40xx/inc/sysctl_17xx_40xx.h" />
- <file file_name="../../../../../hw/mcu/nxp/lpc_chip_40xx/inc/uart_17xx_40xx.h" />
- <file file_name="../../../../../hw/mcu/nxp/lpc_chip_40xx/inc/usb_17xx_40xx.h" />
- <file file_name="../../../../../hw/mcu/nxp/lpc_chip_40xx/inc/iocon_17xx_40xx.h" />
+ <file file_name="../../../../../hw/mcu/nxp/lpcopen/lpc40xx/lpc_chip_40xx/inc/chip.h" />
+ <file file_name="../../../../../hw/mcu/nxp/lpcopen/lpc40xx/lpc_chip_40xx/inc/chip_lpc175x_6x.h" />
+ <file file_name="../../../../../hw/mcu/nxp/lpcopen/lpc40xx/lpc_chip_40xx/inc/chip_lpc177x_8x.h" />
+ <file file_name="../../../../../hw/mcu/nxp/lpcopen/lpc40xx/lpc_chip_40xx/inc/chip_lpc407x_8x.h" />
+ <file file_name="../../../../../hw/mcu/nxp/lpcopen/lpc40xx/lpc_chip_40xx/inc/clock_17xx_40xx.h" />
+ <file file_name="../../../../../hw/mcu/nxp/lpcopen/lpc40xx/lpc_chip_40xx/inc/cmsis.h" />
+ <file file_name="../../../../../hw/mcu/nxp/lpcopen/lpc40xx/lpc_chip_40xx/inc/cmsis_40xx.h" />
+ <file file_name="../../../../../hw/mcu/nxp/lpcopen/lpc40xx/lpc_chip_40xx/inc/core_cm4.h" />
+ <file file_name="../../../../../hw/mcu/nxp/lpcopen/lpc40xx/lpc_chip_40xx/inc/core_cm4_simd.h" />
+ <file file_name="../../../../../hw/mcu/nxp/lpcopen/lpc40xx/lpc_chip_40xx/inc/core_cmFunc.h" />
+ <file file_name="../../../../../hw/mcu/nxp/lpcopen/lpc40xx/lpc_chip_40xx/inc/core_cmInstr.h" />
+ <file file_name="../../../../../hw/mcu/nxp/lpcopen/lpc40xx/lpc_chip_40xx/inc/gpio_17xx_40xx.h" />
+ <file file_name="../../../../../hw/mcu/nxp/lpcopen/lpc40xx/lpc_chip_40xx/inc/sys_config.h" />
+ <file file_name="../../../../../hw/mcu/nxp/lpcopen/lpc40xx/lpc_chip_40xx/inc/sysctl_17xx_40xx.h" />
+ <file file_name="../../../../../hw/mcu/nxp/lpcopen/lpc40xx/lpc_chip_40xx/inc/uart_17xx_40xx.h" />
+ <file file_name="../../../../../hw/mcu/nxp/lpcopen/lpc40xx/lpc_chip_40xx/inc/usb_17xx_40xx.h" />
+ <file file_name="../../../../../hw/mcu/nxp/lpcopen/lpc40xx/lpc_chip_40xx/inc/iocon_17xx_40xx.h" />
</folder>
<folder Name="src">
- <file file_name="../../../../../hw/mcu/nxp/lpc_chip_40xx/src/chip_17xx_40xx.c" />
- <file file_name="../../../../../hw/mcu/nxp/lpc_chip_40xx/src/clock_17xx_40xx.c" />
- <file file_name="../../../../../hw/mcu/nxp/lpc_chip_40xx/src/gpio_17xx_40xx.c" />
- <file file_name="../../../../../hw/mcu/nxp/lpc_chip_40xx/src/iocon_17xx_40xx.c" />
- <file file_name="../../../../../hw/mcu/nxp/lpc_chip_40xx/src/sysctl_17xx_40xx.c" />
- <file file_name="../../../../../hw/mcu/nxp/lpc_chip_40xx/src/sysinit_17xx_40xx.c" />
- <file file_name="../../../../../hw/mcu/nxp/lpc_chip_40xx/src/uart_17xx_40xx.c" />
+ <file file_name="../../../../../hw/mcu/nxp/lpcopen/lpc40xx/lpc_chip_40xx/src/chip_17xx_40xx.c" />
+ <file file_name="../../../../../hw/mcu/nxp/lpcopen/lpc40xx/lpc_chip_40xx/src/clock_17xx_40xx.c" />
+ <file file_name="../../../../../hw/mcu/nxp/lpcopen/lpc40xx/lpc_chip_40xx/src/gpio_17xx_40xx.c" />
+ <file file_name="../../../../../hw/mcu/nxp/lpcopen/lpc40xx/lpc_chip_40xx/src/iocon_17xx_40xx.c" />
+ <file file_name="../../../../../hw/mcu/nxp/lpcopen/lpc40xx/lpc_chip_40xx/src/sysctl_17xx_40xx.c" />
+ <file file_name="../../../../../hw/mcu/nxp/lpcopen/lpc40xx/lpc_chip_40xx/src/sysinit_17xx_40xx.c" />
+ <file file_name="../../../../../hw/mcu/nxp/lpcopen/lpc40xx/lpc_chip_40xx/src/uart_17xx_40xx.c" />
</folder>
</folder>
</folder>
diff --git a/examples/host/cdc_msc_hid/ses/lpc43xx/lpc43xx.emProject b/examples/host/cdc_msc_hid/ses/lpc43xx/lpc43xx.emProject
index 425f42a58..3b93c623c 100644
--- a/examples/host/cdc_msc_hid/ses/lpc43xx/lpc43xx.emProject
+++ b/examples/host/cdc_msc_hid/ses/lpc43xx/lpc43xx.emProject
@@ -29,7 +29,7 @@
linker_memory_map_file="LPC4357 Cortex-M4_MemoryMap.xml"
linker_section_placement_file="flash_placement.xml"
linker_section_placements_segments="FLASH RX 0x1a000000 0x00080000;RAM RWX 0x10000000 0x00008000"
- macros="DeviceFamily=LPC4300;DeviceSubFamily=LPC435x;Target=LPC4357 Cortex-M4;Placement=Flash;rootDir=../../../../..;lpcDir=../../../../../hw/mcu/nxp/lpc_chip_43xx"
+ macros="DeviceFamily=LPC4300;DeviceSubFamily=LPC435x;Target=LPC4357 Cortex-M4;Placement=Flash;rootDir=../../../../..;lpcDir=../../../../../hw/mcu/nxp/lpcopen/lpc43xx/lpc_chip_43xx"
project_directory=""
project_type="Executable"
target_reset_script="Reset();"
@@ -46,8 +46,7 @@
<file file_name="../../../../../hw/bsp/ansi_escape.h" />
<file file_name="../../../../../hw/bsp/board.h" />
<folder Name="ea4357">
- <file file_name="../../../../../hw/bsp/ea4357/board_ea4357.c" />
- <file file_name="../../../../../hw/bsp/ea4357/board_ea4357.h" />
+ <file file_name="../../../../../hw/bsp/ea4357/ea4357.c" />
<file file_name="../../../../../hw/bsp/ea4357/pca9532.c" />
<file file_name="../../../../../hw/bsp/ea4357/pca9532.h" />
</folder>
@@ -56,52 +55,52 @@
<folder Name="nxp">
<folder Name="lpc_chip_43xx">
<folder Name="inc">
- <file file_name="../../../../../hw/mcu/nxp/lpc_chip_43xx/inc/arm_common_tables.h" />
- <file file_name="../../../../../hw/mcu/nxp/lpc_chip_43xx/inc/arm_math.h" />
- <file file_name="../../../../../hw/mcu/nxp/lpc_chip_43xx/inc/cguccu_18xx_43xx.h" />
- <file file_name="../../../../../hw/mcu/nxp/lpc_chip_43xx/inc/chip.h" />
- <file file_name="../../../../../hw/mcu/nxp/lpc_chip_43xx/inc/chip_clocks.h" />
- <file file_name="../../../../../hw/mcu/nxp/lpc_chip_43xx/inc/chip_lpc18xx.h" />
- <file file_name="../../../../../hw/mcu/nxp/lpc_chip_43xx/inc/chip_lpc43xx.h" />
- <file file_name="../../../../../hw/mcu/nxp/lpc_chip_43xx/inc/clock_18xx_43xx.h" />
- <file file_name="../../../../../hw/mcu/nxp/lpc_chip_43xx/inc/cmsis.h" />
- <file file_name="../../../../../hw/mcu/nxp/lpc_chip_43xx/inc/cmsis_18xx.h" />
- <file file_name="../../../../../hw/mcu/nxp/lpc_chip_43xx/inc/cmsis_43xx.h" />
- <file file_name="../../../../../hw/mcu/nxp/lpc_chip_43xx/inc/cmsis_43xx_m0app.h" />
- <file file_name="../../../../../hw/mcu/nxp/lpc_chip_43xx/inc/cmsis_43xx_m0sub.h" />
- <file file_name="../../../../../hw/mcu/nxp/lpc_chip_43xx/inc/core_cm0.h" />
- <file file_name="../../../../../hw/mcu/nxp/lpc_chip_43xx/inc/core_cm0plus.h" />
- <file file_name="../../../../../hw/mcu/nxp/lpc_chip_43xx/inc/core_cm3.h" />
- <file file_name="../../../../../hw/mcu/nxp/lpc_chip_43xx/inc/core_cm4.h" />
- <file file_name="../../../../../hw/mcu/nxp/lpc_chip_43xx/inc/core_cm4_simd.h" />
- <file file_name="../../../../../hw/mcu/nxp/lpc_chip_43xx/inc/core_cmFunc.h" />
- <file file_name="../../../../../hw/mcu/nxp/lpc_chip_43xx/inc/core_cmInstr.h" />
- <file file_name="../../../../../hw/mcu/nxp/lpc_chip_43xx/inc/core_sc000.h" />
- <file file_name="../../../../../hw/mcu/nxp/lpc_chip_43xx/inc/core_sc300.h" />
- <file file_name="../../../../../hw/mcu/nxp/lpc_chip_43xx/inc/creg_18xx_43xx.h" />
- <file file_name="../../../../../hw/mcu/nxp/lpc_chip_43xx/inc/fpu_init.h" />
- <file file_name="../../../../../hw/mcu/nxp/lpc_chip_43xx/inc/gpio_18xx_43xx.h" />
- <file file_name="../../../../../hw/mcu/nxp/lpc_chip_43xx/inc/i2c_18xx_43xx.h" />
- <file file_name="../../../../../hw/mcu/nxp/lpc_chip_43xx/inc/i2c_common_18xx_43xx.h" />
- <file file_name="../../../../../hw/mcu/nxp/lpc_chip_43xx/inc/i2cm_18xx_43xx.h" />
- <file file_name="../../../../../hw/mcu/nxp/lpc_chip_43xx/inc/lpc_types.h" />
- <file file_name="../../../../../hw/mcu/nxp/lpc_chip_43xx/inc/packing.h" />
- <file file_name="../../../../../hw/mcu/nxp/lpc_chip_43xx/inc/uart_18xx_43xx.h" />
- <file file_name="../../../../../hw/mcu/nxp/lpc_chip_43xx/inc/usbhs_18xx_43xx.h" />
+ <file file_name="../../../../../hw/mcu/nxp/lpcopen/lpc43xx/lpc_chip_43xx/inc/arm_common_tables.h" />
+ <file file_name="../../../../../hw/mcu/nxp/lpcopen/lpc43xx/lpc_chip_43xx/inc/arm_math.h" />
+ <file file_name="../../../../../hw/mcu/nxp/lpcopen/lpc43xx/lpc_chip_43xx/inc/cguccu_18xx_43xx.h" />
+ <file file_name="../../../../../hw/mcu/nxp/lpcopen/lpc43xx/lpc_chip_43xx/inc/chip.h" />
+ <file file_name="../../../../../hw/mcu/nxp/lpcopen/lpc43xx/lpc_chip_43xx/inc/chip_clocks.h" />
+ <file file_name="../../../../../hw/mcu/nxp/lpcopen/lpc43xx/lpc_chip_43xx/inc/chip_lpc18xx.h" />
+ <file file_name="../../../../../hw/mcu/nxp/lpcopen/lpc43xx/lpc_chip_43xx/inc/chip_lpc43xx.h" />
+ <file file_name="../../../../../hw/mcu/nxp/lpcopen/lpc43xx/lpc_chip_43xx/inc/clock_18xx_43xx.h" />
+ <file file_name="../../../../../hw/mcu/nxp/lpcopen/lpc43xx/lpc_chip_43xx/inc/cmsis.h" />
+ <file file_name="../../../../../hw/mcu/nxp/lpcopen/lpc43xx/lpc_chip_43xx/inc/cmsis_18xx.h" />
+ <file file_name="../../../../../hw/mcu/nxp/lpcopen/lpc43xx/lpc_chip_43xx/inc/cmsis_43xx.h" />
+ <file file_name="../../../../../hw/mcu/nxp/lpcopen/lpc43xx/lpc_chip_43xx/inc/cmsis_43xx_m0app.h" />
+ <file file_name="../../../../../hw/mcu/nxp/lpcopen/lpc43xx/lpc_chip_43xx/inc/cmsis_43xx_m0sub.h" />
+ <file file_name="../../../../../hw/mcu/nxp/lpcopen/lpc43xx/lpc_chip_43xx/inc/core_cm0.h" />
+ <file file_name="../../../../../hw/mcu/nxp/lpcopen/lpc43xx/lpc_chip_43xx/inc/core_cm0plus.h" />
+ <file file_name="../../../../../hw/mcu/nxp/lpcopen/lpc43xx/lpc_chip_43xx/inc/core_cm3.h" />
+ <file file_name="../../../../../hw/mcu/nxp/lpcopen/lpc43xx/lpc_chip_43xx/inc/core_cm4.h" />
+ <file file_name="../../../../../hw/mcu/nxp/lpcopen/lpc43xx/lpc_chip_43xx/inc/core_cm4_simd.h" />
+ <file file_name="../../../../../hw/mcu/nxp/lpcopen/lpc43xx/lpc_chip_43xx/inc/core_cmFunc.h" />
+ <file file_name="../../../../../hw/mcu/nxp/lpcopen/lpc43xx/lpc_chip_43xx/inc/core_cmInstr.h" />
+ <file file_name="../../../../../hw/mcu/nxp/lpcopen/lpc43xx/lpc_chip_43xx/inc/core_sc000.h" />
+ <file file_name="../../../../../hw/mcu/nxp/lpcopen/lpc43xx/lpc_chip_43xx/inc/core_sc300.h" />
+ <file file_name="../../../../../hw/mcu/nxp/lpcopen/lpc43xx/lpc_chip_43xx/inc/creg_18xx_43xx.h" />
+ <file file_name="../../../../../hw/mcu/nxp/lpcopen/lpc43xx/lpc_chip_43xx/inc/fpu_init.h" />
+ <file file_name="../../../../../hw/mcu/nxp/lpcopen/lpc43xx/lpc_chip_43xx/inc/gpio_18xx_43xx.h" />
+ <file file_name="../../../../../hw/mcu/nxp/lpcopen/lpc43xx/lpc_chip_43xx/inc/i2c_18xx_43xx.h" />
+ <file file_name="../../../../../hw/mcu/nxp/lpcopen/lpc43xx/lpc_chip_43xx/inc/i2c_common_18xx_43xx.h" />
+ <file file_name="../../../../../hw/mcu/nxp/lpcopen/lpc43xx/lpc_chip_43xx/inc/i2cm_18xx_43xx.h" />
+ <file file_name="../../../../../hw/mcu/nxp/lpcopen/lpc43xx/lpc_chip_43xx/inc/lpc_types.h" />
+ <file file_name="../../../../../hw/mcu/nxp/lpcopen/lpc43xx/lpc_chip_43xx/inc/packing.h" />
+ <file file_name="../../../../../hw/mcu/nxp/lpcopen/lpc43xx/lpc_chip_43xx/inc/uart_18xx_43xx.h" />
+ <file file_name="../../../../../hw/mcu/nxp/lpcopen/lpc43xx/lpc_chip_43xx/inc/usbhs_18xx_43xx.h" />
<folder Name="config_43xx">
- <file file_name="../../../../../hw/mcu/nxp/lpc_chip_43xx/inc/config_43xx/cmsis_43xx.h" />
- <file file_name="../../../../../hw/mcu/nxp/lpc_chip_43xx/inc/config_43xx/sys_config.h" />
+ <file file_name="../../../../../hw/mcu/nxp/lpcopen/lpc43xx/lpc_chip_43xx/inc/config_43xx/cmsis_43xx.h" />
+ <file file_name="../../../../../hw/mcu/nxp/lpcopen/lpc43xx/lpc_chip_43xx/inc/config_43xx/sys_config.h" />
</folder>
</folder>
<folder Name="src">
- <file file_name="../../../../../hw/mcu/nxp/lpc_chip_43xx/src/chip_18xx_43xx.c" />
- <file file_name="../../../../../hw/mcu/nxp/lpc_chip_43xx/src/clock_18xx_43xx.c" />
- <file file_name="../../../../../hw/mcu/nxp/lpc_chip_43xx/src/fpu_init.c" />
- <file file_name="../../../../../hw/mcu/nxp/lpc_chip_43xx/src/gpio_18xx_43xx.c" />
- <file file_name="../../../../../hw/mcu/nxp/lpc_chip_43xx/src/i2c_18xx_43xx.c" />
- <file file_name="../../../../../hw/mcu/nxp/lpc_chip_43xx/src/i2cm_18xx_43xx.c" />
- <file file_name="../../../../../hw/mcu/nxp/lpc_chip_43xx/src/sysinit_18xx_43xx.c" />
- <file file_name="../../../../../hw/mcu/nxp/lpc_chip_43xx/src/uart_18xx_43xx.c" />
+ <file file_name="../../../../../hw/mcu/nxp/lpcopen/lpc43xx/lpc_chip_43xx/src/chip_18xx_43xx.c" />
+ <file file_name="../../../../../hw/mcu/nxp/lpcopen/lpc43xx/lpc_chip_43xx/src/clock_18xx_43xx.c" />
+ <file file_name="../../../../../hw/mcu/nxp/lpcopen/lpc43xx/lpc_chip_43xx/src/fpu_init.c" />
+ <file file_name="../../../../../hw/mcu/nxp/lpcopen/lpc43xx/lpc_chip_43xx/src/gpio_18xx_43xx.c" />
+ <file file_name="../../../../../hw/mcu/nxp/lpcopen/lpc43xx/lpc_chip_43xx/src/i2c_18xx_43xx.c" />
+ <file file_name="../../../../../hw/mcu/nxp/lpcopen/lpc43xx/lpc_chip_43xx/src/i2cm_18xx_43xx.c" />
+ <file file_name="../../../../../hw/mcu/nxp/lpcopen/lpc43xx/lpc_chip_43xx/src/sysinit_18xx_43xx.c" />
+ <file file_name="../../../../../hw/mcu/nxp/lpcopen/lpc43xx/lpc_chip_43xx/src/uart_18xx_43xx.c" />
</folder>
</folder>
</folder>
diff --git a/examples/host/cdc_msc_hid/src/tusb_config.h b/examples/host/cdc_msc_hid/src/tusb_config.h
index 7a18c692b..7c1818109 100644
--- a/examples/host/cdc_msc_hid/src/tusb_config.h
+++ b/examples/host/cdc_msc_hid/src/tusb_config.h
@@ -40,7 +40,7 @@
#error CFG_TUSB_MCU must be defined
#endif
-#if CFG_TUSB_MCU == OPT_MCU_LPC43XX || CFG_TUSB_MCU == OPT_MCU_LPC18XX
+#if CFG_TUSB_MCU == OPT_MCU_LPC43XX || CFG_TUSB_MCU == OPT_MCU_LPC18XX || CFG_TUSB_MCU == OPT_MCU_MIMXRT10XX
#define CFG_TUSB_RHPORT0_MODE (OPT_MODE_HOST | OPT_MODE_HIGH_SPEED)
#else
#define CFG_TUSB_RHPORT0_MODE OPT_MODE_HOST
diff --git a/examples/make.mk b/examples/make.mk
index fc9745131..4c8b703c2 100644
--- a/examples/make.mk
+++ b/examples/make.mk
@@ -5,6 +5,8 @@
# Compiler
ifeq ($(BOARD), msp_exp430f5529lp)
CROSS_COMPILE = msp430-elf-
+else ifeq ($(BOARD), fomu)
+ CROSS_COMPILE = riscv-none-embed-
else
CROSS_COMPILE = arm-none-eabi-
endif
@@ -74,6 +76,7 @@ CFLAGS += \
-Wno-deprecated-declarations \
-Wnested-externs \
-Wunreachable-code \
+ -Wno-error=lto-type-mismatch \
-ffunction-sections \
-fdata-sections
@@ -84,11 +87,7 @@ CFLAGS += \
ifeq ($(DEBUG), 1)
CFLAGS += -Og -ggdb
else
- ifneq ($(BOARD),spresense)
- CFLAGS += -flto -Os
- else
- CFLAGS += -Os
- endif
+ CFLAGS += -Os
endif
# TUSB Logging option
diff --git a/examples/readme.md b/examples/readme.md
index dc4c563dd..897931b0e 100644
--- a/examples/readme.md
+++ b/examples/readme.md
@@ -12,7 +12,7 @@ $ cd tinyusb
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
+$ git submodule update --init --recursive
```
It will takes a bit of time due to the number of supported MCUs, luckily we only need to do this once.
diff --git a/examples/rules.mk b/examples/rules.mk
index c18536476..04cdef2d2 100644
--- a/examples/rules.mk
+++ b/examples/rules.mk
@@ -22,6 +22,7 @@ SRC_C += \
src/class/midi/midi_device.c \
src/class/usbtmc/usbtmc_device.c \
src/class/vendor/vendor_device.c \
+ src/class/net/net_device.c \
src/portable/$(VENDOR)/$(CHIP_FAMILY)/dcd_$(CHIP_FAMILY).c
# TinyUSB stack include
@@ -125,8 +126,13 @@ endif
# Flash using jlink
flash-jlink: $(BUILD)/$(BOARD)-firmware.hex
@echo halt > $(BUILD)/$(BOARD).jlink
+ @echo r > $(BUILD)/$(BOARD).jlink
@echo loadfile $^ >> $(BUILD)/$(BOARD).jlink
@echo r >> $(BUILD)/$(BOARD).jlink
@echo go >> $(BUILD)/$(BOARD).jlink
@echo exit >> $(BUILD)/$(BOARD).jlink
$(JLINKEXE) -device $(JLINK_DEVICE) -if $(JLINK_IF) -JTAGConf -1,-1 -speed auto -CommandFile $(BUILD)/$(BOARD).jlink
+
+# flash STM32 MCU using stlink with STM32 Cube Programmer CLI
+flash-stlink: $(BUILD)/$(BOARD)-firmware.elf
+ STM32_Programmer_CLI --connect port=swd --write $< --go