diff --git a/demos/device/device_freertos/.cproject b/demos/device/device_freertos/.cproject
index b34d852a5..368f3f740 100644
--- a/demos/device/device_freertos/.cproject
+++ b/demos/device/device_freertos/.cproject
@@ -241,6 +241,7 @@
+
@@ -576,8 +577,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<TargetConfig>
-<Properties property_0="" property_2="LPC18x7_43x7_2x512_BootA.cfx" property_3="NXP" property_4="LPC4357" property_count="5" version="60100"/>
-<infoList vendor="NXP"><info chip="LPC4357" flash_driver="LPC18x7_43x7_2x512_BootA.cfx" match_id="0x0" name="LPC4357" resetscript="LPC18LPC43InternalFLASHBootResetscript.scp" stub="crt_emu_lpc18_43_nxp"><chip><name>LPC4357</name>
+<Properties property_0="" property_2="LPC18x7_43x7_2x512_BootA.cfx" property_3="NXP" property_4="LPC4357" property_count="5" version="70002"/>
+<infoList vendor="NXP"><info chip="LPC4357" flash_driver="LPC18x7_43x7_2x512_BootA.cfx" match_id="0x0" name="LPC4357" stub="crt_emu_lpc18_43_nxp"><chip><name>LPC4357</name>
<family>LPC43xx</family>
<vendor>NXP (formerly Philips)</vendor>
<reset board="None" core="Real" sys="Real"/>
@@ -596,61 +597,61 @@
<prog_flash blocksz="0x10000" location="0x1a010000" maxprgbuff="0x400" progwithcode="TRUE" size="0x70000"/>
<prog_flash blocksz="0x2000" location="0x1b000000" maxprgbuff="0x400" progwithcode="TRUE" size="0x10000"/>
<prog_flash blocksz="0x10000" location="0x1b010000" maxprgbuff="0x400" progwithcode="TRUE" size="0x70000"/>
-<peripheralInstance derived_from="V7M_MPU" id="MPU" location="0xe000ed90"/>
-<peripheralInstance derived_from="V7M_NVIC" id="NVIC" location="0xe000e000"/>
-<peripheralInstance derived_from="V7M_DCR" id="DCR" location="0xe000edf0"/>
-<peripheralInstance derived_from="V7M_ITM" id="ITM" location="0xe0000000"/>
-<peripheralInstance derived_from="SCT" id="SCT" location="0x40000000"/>
-<peripheralInstance derived_from="GPDMA" id="GPDMA" location="0x40002000"/>
-<peripheralInstance derived_from="SPIFI" id="SPIFI" location="0x40003000"/>
-<peripheralInstance derived_from="SDMMC" id="SDMMC" location="0x40004000"/>
-<peripheralInstance derived_from="EMC" id="EMC" location="0x40005000"/>
-<peripheralInstance derived_from="USB0" id="USB0" location="0x40006000"/>
-<peripheralInstance derived_from="USB1" id="USB1" location="0x40007000"/>
-<peripheralInstance derived_from="LCD" id="LCD" location="0x40008000"/>
-<peripheralInstance derived_from="EEPROM" id="EEPROM" location="0x4000e000"/>
-<peripheralInstance derived_from="ETHERNET" id="ETHERNET" location="0x40010000"/>
-<peripheralInstance derived_from="ATIMER" id="ATIMER" location="0x40040000"/>
-<peripheralInstance derived_from="REGFILE" id="REGFILE" location="0x40041000"/>
-<peripheralInstance derived_from="PMC" id="PMC" location="0x40042000"/>
-<peripheralInstance derived_from="CREG" id="CREG" location="0x40043000"/>
-<peripheralInstance derived_from="EVENTROUTER" id="EVENTROUTER" location="0x40044000"/>
-<peripheralInstance derived_from="RTC" id="RTC" location="0x40046000"/>
-<peripheralInstance derived_from="CGU" id="CGU" location="0x40050000"/>
-<peripheralInstance derived_from="CCU1" id="CCU1" location="0x40051000"/>
-<peripheralInstance derived_from="CCU2" id="CCU2" location="0x40052000"/>
-<peripheralInstance derived_from="RGU" id="RGU" location="0x40053000"/>
-<peripheralInstance derived_from="WWDT" id="WWDT" location="0x40080000"/>
-<peripheralInstance derived_from="USART0" id="USART0" location="0x40081000"/>
-<peripheralInstance derived_from="USART2" id="USART2" location="0x400c1000"/>
-<peripheralInstance derived_from="USART3" id="USART3" location="0x400c2000"/>
-<peripheralInstance derived_from="UART1" id="UART1" location="0x40082000"/>
-<peripheralInstance derived_from="SSP0" id="SSP0" location="0x40083000"/>
-<peripheralInstance derived_from="SSP1" id="SSP1" location="0x400c5000"/>
-<peripheralInstance derived_from="TIMER0" id="TIMER0" location="0x40084000"/>
-<peripheralInstance derived_from="TIMER1" id="TIMER1" location="0x40085000"/>
-<peripheralInstance derived_from="TIMER2" id="TIMER2" location="0x400c3000"/>
-<peripheralInstance derived_from="TIMER3" id="TIMER3" location="0x400c4000"/>
-<peripheralInstance derived_from="SCU" id="SCU" location="0x40086000"/>
-<peripheralInstance derived_from="GPIO-PIN-INT" id="GPIO-PIN-INT" location="0x40087000"/>
-<peripheralInstance derived_from="GPIO-GROUP-INT0" id="GPIO-GROUP-INT0" location="0x40088000"/>
-<peripheralInstance derived_from="GPIO-GROUP-INT1" id="GPIO-GROUP-INT1" location="0x40089000"/>
-<peripheralInstance derived_from="MCPWM" id="MCPWM" location="0x400a0000"/>
-<peripheralInstance derived_from="I2C0" id="I2C0" location="0x400a1000"/>
-<peripheralInstance derived_from="I2C1" id="I2C1" location="0x400e0000"/>
-<peripheralInstance derived_from="I2S0" id="I2S0" location="0x400a2000"/>
-<peripheralInstance derived_from="I2S1" id="I2S1" location="0x400a3000"/>
-<peripheralInstance derived_from="C-CAN1" id="C-CAN1" location="0x400a4000"/>
-<peripheralInstance derived_from="RITIMER" id="RITIMER" location="0x400c0000"/>
-<peripheralInstance derived_from="QEI" id="QEI" location="0x400c6000"/>
-<peripheralInstance derived_from="GIMA" id="GIMA" location="0x400c7000"/>
-<peripheralInstance derived_from="DAC" id="DAC" location="0x400e1000"/>
-<peripheralInstance derived_from="C-CAN0" id="C-CAN0" location="0x400e2000"/>
-<peripheralInstance derived_from="ADC0" id="ADC0" location="0x400e3000"/>
-<peripheralInstance derived_from="ADC1" id="ADC1" location="0x400e4000"/>
-<peripheralInstance derived_from="GPIO-PORT" id="GPIO-PORT" location="0x400f4000"/>
-<peripheralInstance derived_from="SPI" id="SPI" location="0x40100000"/>
-<peripheralInstance derived_from="SGPIO" id="SGPIO" location="0x40101000"/>
+<peripheralInstance derived_from="V7M_MPU" determined="infoFile" id="MPU" location="0xe000ed90"/>
+<peripheralInstance derived_from="V7M_NVIC" determined="infoFile" id="NVIC" location="0xe000e000"/>
+<peripheralInstance derived_from="V7M_DCR" determined="infoFile" id="DCR" location="0xe000edf0"/>
+<peripheralInstance derived_from="V7M_ITM" determined="infoFile" id="ITM" location="0xe0000000"/>
+<peripheralInstance derived_from="SCT" determined="infoFile" id="SCT" location="0x40000000"/>
+<peripheralInstance derived_from="GPDMA" determined="infoFile" id="GPDMA" location="0x40002000"/>
+<peripheralInstance derived_from="SPIFI" determined="infoFile" id="SPIFI" location="0x40003000"/>
+<peripheralInstance derived_from="SDMMC" determined="infoFile" id="SDMMC" location="0x40004000"/>
+<peripheralInstance derived_from="EMC" determined="infoFile" id="EMC" location="0x40005000"/>
+<peripheralInstance derived_from="USB0" determined="infoFile" id="USB0" location="0x40006000"/>
+<peripheralInstance derived_from="USB1" determined="infoFile" id="USB1" location="0x40007000"/>
+<peripheralInstance derived_from="LCD" determined="infoFile" id="LCD" location="0x40008000"/>
+<peripheralInstance derived_from="EEPROM" determined="infoFile" id="EEPROM" location="0x4000e000"/>
+<peripheralInstance derived_from="ETHERNET" determined="infoFile" id="ETHERNET" location="0x40010000"/>
+<peripheralInstance derived_from="ATIMER" determined="infoFile" id="ATIMER" location="0x40040000"/>
+<peripheralInstance derived_from="REGFILE" determined="infoFile" id="REGFILE" location="0x40041000"/>
+<peripheralInstance derived_from="PMC" determined="infoFile" id="PMC" location="0x40042000"/>
+<peripheralInstance derived_from="CREG" determined="infoFile" id="CREG" location="0x40043000"/>
+<peripheralInstance derived_from="EVENTROUTER" determined="infoFile" id="EVENTROUTER" location="0x40044000"/>
+<peripheralInstance derived_from="RTC" determined="infoFile" id="RTC" location="0x40046000"/>
+<peripheralInstance derived_from="CGU" determined="infoFile" id="CGU" location="0x40050000"/>
+<peripheralInstance derived_from="CCU1" determined="infoFile" id="CCU1" location="0x40051000"/>
+<peripheralInstance derived_from="CCU2" determined="infoFile" id="CCU2" location="0x40052000"/>
+<peripheralInstance derived_from="RGU" determined="infoFile" id="RGU" location="0x40053000"/>
+<peripheralInstance derived_from="WWDT" determined="infoFile" id="WWDT" location="0x40080000"/>
+<peripheralInstance derived_from="USART0" determined="infoFile" id="USART0" location="0x40081000"/>
+<peripheralInstance derived_from="USART2" determined="infoFile" id="USART2" location="0x400c1000"/>
+<peripheralInstance derived_from="USART3" determined="infoFile" id="USART3" location="0x400c2000"/>
+<peripheralInstance derived_from="UART1" determined="infoFile" id="UART1" location="0x40082000"/>
+<peripheralInstance derived_from="SSP0" determined="infoFile" id="SSP0" location="0x40083000"/>
+<peripheralInstance derived_from="SSP1" determined="infoFile" id="SSP1" location="0x400c5000"/>
+<peripheralInstance derived_from="TIMER0" determined="infoFile" id="TIMER0" location="0x40084000"/>
+<peripheralInstance derived_from="TIMER1" determined="infoFile" id="TIMER1" location="0x40085000"/>
+<peripheralInstance derived_from="TIMER2" determined="infoFile" id="TIMER2" location="0x400c3000"/>
+<peripheralInstance derived_from="TIMER3" determined="infoFile" id="TIMER3" location="0x400c4000"/>
+<peripheralInstance derived_from="SCU" determined="infoFile" id="SCU" location="0x40086000"/>
+<peripheralInstance derived_from="GPIO-PIN-INT" determined="infoFile" id="GPIO-PIN-INT" location="0x40087000"/>
+<peripheralInstance derived_from="GPIO-GROUP-INT0" determined="infoFile" id="GPIO-GROUP-INT0" location="0x40088000"/>
+<peripheralInstance derived_from="GPIO-GROUP-INT1" determined="infoFile" id="GPIO-GROUP-INT1" location="0x40089000"/>
+<peripheralInstance derived_from="MCPWM" determined="infoFile" id="MCPWM" location="0x400a0000"/>
+<peripheralInstance derived_from="I2C0" determined="infoFile" id="I2C0" location="0x400a1000"/>
+<peripheralInstance derived_from="I2C1" determined="infoFile" id="I2C1" location="0x400e0000"/>
+<peripheralInstance derived_from="I2S0" determined="infoFile" id="I2S0" location="0x400a2000"/>
+<peripheralInstance derived_from="I2S1" determined="infoFile" id="I2S1" location="0x400a3000"/>
+<peripheralInstance derived_from="C-CAN1" determined="infoFile" id="C-CAN1" location="0x400a4000"/>
+<peripheralInstance derived_from="RITIMER" determined="infoFile" id="RITIMER" location="0x400c0000"/>
+<peripheralInstance derived_from="QEI" determined="infoFile" id="QEI" location="0x400c6000"/>
+<peripheralInstance derived_from="GIMA" determined="infoFile" id="GIMA" location="0x400c7000"/>
+<peripheralInstance derived_from="DAC" determined="infoFile" id="DAC" location="0x400e1000"/>
+<peripheralInstance derived_from="C-CAN0" determined="infoFile" id="C-CAN0" location="0x400e2000"/>
+<peripheralInstance derived_from="ADC0" determined="infoFile" id="ADC0" location="0x400e3000"/>
+<peripheralInstance derived_from="ADC1" determined="infoFile" id="ADC1" location="0x400e4000"/>
+<peripheralInstance derived_from="GPIO-PORT" determined="infoFile" id="GPIO-PORT" location="0x400f4000"/>
+<peripheralInstance derived_from="SPI" determined="infoFile" id="SPI" location="0x40100000"/>
+<peripheralInstance derived_from="SGPIO" determined="infoFile" id="SGPIO" location="0x40101000"/>
</chip>
<processor><name gcc_name="cortex-m4">Cortex-M4</name>
<family>Cortex-M</family>
diff --git a/demos/device/device_freertos/device_freertos.uvopt b/demos/device/device_freertos/device_freertos.uvopt
index 5311cba48..00d1f0f97 100644
--- a/demos/device/device_freertos/device_freertos.uvopt
+++ b/demos/device/device_freertos/device_freertos.uvopt
@@ -73,7 +73,7 @@
1
0
- 1
+ 0
8
@@ -679,7 +679,7 @@
1
0
- 0
+ 1
8
@@ -935,10 +935,10 @@
1
0
0
- 24
+ 15
0
- 88
- 94
+ 68
+ 86
0
..\src\main.c
main.c
@@ -1375,10 +1375,10 @@
1
0
0
- 80
+ 0
0
- 221
- 237
+ 1
+ 1
0
..\..\..\tinyusb\device\usbd.c
usbd.c
@@ -1994,7 +1994,7 @@
0
0
138
- 146
+ 156
0
..\..\..\mcu\lpc43xx\keil\startup_LPC43xx.s
startup_LPC43xx.s
@@ -2063,10 +2063,10 @@
1
0
0
- 63
+ 51
0
- 1875
- 1882
+ 1653
+ 1673
0
..\..\..\vendor\freertos\freertos\Source\tasks.c
tasks.c
@@ -2143,10 +2143,10 @@
1
0
0
- 6
+ 0
0
- 59
- 62
+ 1
+ 1
0
..\..\..\vendor\freertos\freertoslpc\FreeRTOSCommonHooks.c
FreeRTOSCommonHooks.c
diff --git a/demos/device/device_os_none/.cproject b/demos/device/device_os_none/.cproject
index 0e699d8b7..706115a79 100644
--- a/demos/device/device_os_none/.cproject
+++ b/demos/device/device_os_none/.cproject
@@ -28,7 +28,7 @@
-
+
-
+
@@ -61,7 +61,7 @@
-
+
@@ -118,7 +118,7 @@
-
+
-
+
@@ -152,7 +152,7 @@
-
+
@@ -209,7 +209,7 @@
-
+
-
+
@@ -245,7 +245,7 @@
-
+
@@ -305,7 +305,7 @@
-
+
-
+
@@ -338,7 +338,7 @@
-
+
@@ -395,7 +395,7 @@
-
+
-
+
@@ -431,7 +431,7 @@
-
+
@@ -489,7 +489,7 @@
-
+
-
+
@@ -523,7 +523,7 @@
-
+
@@ -559,49 +559,86 @@
<?xml version="1.0" encoding="UTF-8"?>
<TargetConfig>
-<Properties property_0="" property_2="LPC11_12_13_64K_8K.cfx" property_3="NXP" property_4="LPC1347" property_count="5" version="60100"/>
-<infoList vendor="NXP"><info chip="LPC1347" flash_driver="LPC11_12_13_64K_8K.cfx" match_id="0x08020543" name="LPC1347" stub="crt_emu_lpc11_13_nxp"><chip><name>LPC1347</name>
-<family>LPC13xx (12bit ADC)</family>
+<Properties property_0="" property_2="LPC18x7_43x7_2x512_BootA.cfx" property_3="NXP" property_4="LPC4357" property_count="5" version="60100"/>
+<infoList vendor="NXP"><info chip="LPC4357" flash_driver="LPC18x7_43x7_2x512_BootA.cfx" match_id="0x0" name="LPC4357" resetscript="LPC18LPC43InternalFLASHBootResetscript.scp" stub="crt_emu_lpc18_43_nxp"><chip><name>LPC4357</name>
+<family>LPC43xx</family>
<vendor>NXP (formerly Philips)</vendor>
<reset board="None" core="Real" sys="Real"/>
-<clock changeable="TRUE" freq="12MHz" is_accurate="TRUE"/>
+<clock changeable="TRUE" freq="20MHz" is_accurate="TRUE"/>
<memory can_program="true" id="Flash" is_ro="true" type="Flash"/>
<memory id="RAM" type="RAM"/>
<memory id="Periph" is_volatile="true" type="Peripheral"/>
-<memoryInstance derived_from="Flash" id="MFlash64" location="0x0" size="0x10000"/>
-<memoryInstance derived_from="RAM" id="RamLoc8" location="0x10000000" size="0x2000"/>
-<memoryInstance derived_from="RAM" id="RamUsb2" location="0x20004000" size="0x800"/>
-<memoryInstance derived_from="RAM" id="RamPeriph2" location="0x20000000" size="0x800"/>
-<prog_flash blocksz="0x1000" location="0x0" maxprgbuff="0x1000" progwithcode="TRUE" size="0x10000"/>
+<memoryInstance derived_from="Flash" id="MFlashA512" location="0x1a000000" size="0x80000"/>
+<memoryInstance derived_from="Flash" id="MFlashB512" location="0x1b000000" size="0x80000"/>
+<memoryInstance derived_from="RAM" id="RamLoc32" location="0x10000000" size="0x8000"/>
+<memoryInstance derived_from="RAM" id="RamLoc40" location="0x10080000" size="0xa000"/>
+<memoryInstance derived_from="RAM" id="RamAHB32" location="0x20000000" size="0x8000"/>
+<memoryInstance derived_from="RAM" id="RamAHB16" location="0x20008000" size="0x4000"/>
+<memoryInstance derived_from="RAM" id="RamAHB_ETB16" location="0x2000c000" size="0x4000"/>
+<prog_flash blocksz="0x2000" location="0x1a000000" maxprgbuff="0x400" progwithcode="TRUE" size="0x10000"/>
+<prog_flash blocksz="0x10000" location="0x1a010000" maxprgbuff="0x400" progwithcode="TRUE" size="0x70000"/>
+<prog_flash blocksz="0x2000" location="0x1b000000" maxprgbuff="0x400" progwithcode="TRUE" size="0x10000"/>
+<prog_flash blocksz="0x10000" location="0x1b010000" maxprgbuff="0x400" progwithcode="TRUE" size="0x70000"/>
<peripheralInstance derived_from="V7M_MPU" id="MPU" location="0xe000ed90"/>
<peripheralInstance derived_from="V7M_NVIC" id="NVIC" location="0xe000e000"/>
<peripheralInstance derived_from="V7M_DCR" id="DCR" location="0xe000edf0"/>
<peripheralInstance derived_from="V7M_ITM" id="ITM" location="0xe0000000"/>
-<peripheralInstance derived_from="I2C" id="I2C" location="0x40000000"/>
-<peripheralInstance derived_from="WWDT" id="WWDT" location="0x40004000"/>
-<peripheralInstance derived_from="CT16B0" id="CT16B0" location="0x4000c000"/>
-<peripheralInstance derived_from="CT16B1" id="CT16B1" location="0x40010000"/>
-<peripheralInstance derived_from="CT32B0" id="CT32B0" location="0x40014000"/>
-<peripheralInstance derived_from="CT32B1" id="CT32B1" location="0x40018000"/>
-<peripheralInstance derived_from="USART" id="USART" location="0x40008000"/>
-<peripheralInstance derived_from="ADC" id="ADC" location="0x4001c000"/>
-<peripheralInstance derived_from="PMU" id="PMU" location="0x40038000"/>
-<peripheralInstance derived_from="FLASHCTRL" id="FLASHCTRL" location="0x4003c000"/>
-<peripheralInstance derived_from="SSP0" id="SSP0" location="0x40040000"/>
-<peripheralInstance derived_from="IOCON" id="IOCON" location="0x40044000"/>
-<peripheralInstance derived_from="SYSCON" id="SYSCON" location="0x40048000"/>
-<peripheralInstance derived_from="GPIO-PIN-INT" id="GPIO-PIN-INT" location="0x4004c000"/>
-<peripheralInstance derived_from="SSP1" id="SSP1" location="0x40058000"/>
-<peripheralInstance derived_from="GPIO-GROUP-INT0" id="GPIO-GROUP-INT0" location="0x4005c000"/>
-<peripheralInstance derived_from="GPIO-GROUP-INT1" id="GPIO-GROUP-INT1" location="0x40060000"/>
-<peripheralInstance derived_from="RITIMER" id="RITIMER" location="0x40064000"/>
-<peripheralInstance derived_from="USB" id="USB" location="0x40080000"/>
-<peripheralInstance derived_from="GPIO-PORT" id="GPIO-PORT" location="0x50000000"/>
+<peripheralInstance derived_from="SCT" id="SCT" location="0x40000000"/>
+<peripheralInstance derived_from="GPDMA" id="GPDMA" location="0x40002000"/>
+<peripheralInstance derived_from="SPIFI" id="SPIFI" location="0x40003000"/>
+<peripheralInstance derived_from="SDMMC" id="SDMMC" location="0x40004000"/>
+<peripheralInstance derived_from="EMC" id="EMC" location="0x40005000"/>
+<peripheralInstance derived_from="USB0" id="USB0" location="0x40006000"/>
+<peripheralInstance derived_from="USB1" id="USB1" location="0x40007000"/>
+<peripheralInstance derived_from="LCD" id="LCD" location="0x40008000"/>
+<peripheralInstance derived_from="EEPROM" id="EEPROM" location="0x4000e000"/>
+<peripheralInstance derived_from="ETHERNET" id="ETHERNET" location="0x40010000"/>
+<peripheralInstance derived_from="ATIMER" id="ATIMER" location="0x40040000"/>
+<peripheralInstance derived_from="REGFILE" id="REGFILE" location="0x40041000"/>
+<peripheralInstance derived_from="PMC" id="PMC" location="0x40042000"/>
+<peripheralInstance derived_from="CREG" id="CREG" location="0x40043000"/>
+<peripheralInstance derived_from="EVENTROUTER" id="EVENTROUTER" location="0x40044000"/>
+<peripheralInstance derived_from="RTC" id="RTC" location="0x40046000"/>
+<peripheralInstance derived_from="CGU" id="CGU" location="0x40050000"/>
+<peripheralInstance derived_from="CCU1" id="CCU1" location="0x40051000"/>
+<peripheralInstance derived_from="CCU2" id="CCU2" location="0x40052000"/>
+<peripheralInstance derived_from="RGU" id="RGU" location="0x40053000"/>
+<peripheralInstance derived_from="WWDT" id="WWDT" location="0x40080000"/>
+<peripheralInstance derived_from="USART0" id="USART0" location="0x40081000"/>
+<peripheralInstance derived_from="USART2" id="USART2" location="0x400c1000"/>
+<peripheralInstance derived_from="USART3" id="USART3" location="0x400c2000"/>
+<peripheralInstance derived_from="UART1" id="UART1" location="0x40082000"/>
+<peripheralInstance derived_from="SSP0" id="SSP0" location="0x40083000"/>
+<peripheralInstance derived_from="SSP1" id="SSP1" location="0x400c5000"/>
+<peripheralInstance derived_from="TIMER0" id="TIMER0" location="0x40084000"/>
+<peripheralInstance derived_from="TIMER1" id="TIMER1" location="0x40085000"/>
+<peripheralInstance derived_from="TIMER2" id="TIMER2" location="0x400c3000"/>
+<peripheralInstance derived_from="TIMER3" id="TIMER3" location="0x400c4000"/>
+<peripheralInstance derived_from="SCU" id="SCU" location="0x40086000"/>
+<peripheralInstance derived_from="GPIO-PIN-INT" id="GPIO-PIN-INT" location="0x40087000"/>
+<peripheralInstance derived_from="GPIO-GROUP-INT0" id="GPIO-GROUP-INT0" location="0x40088000"/>
+<peripheralInstance derived_from="GPIO-GROUP-INT1" id="GPIO-GROUP-INT1" location="0x40089000"/>
+<peripheralInstance derived_from="MCPWM" id="MCPWM" location="0x400a0000"/>
+<peripheralInstance derived_from="I2C0" id="I2C0" location="0x400a1000"/>
+<peripheralInstance derived_from="I2C1" id="I2C1" location="0x400e0000"/>
+<peripheralInstance derived_from="I2S0" id="I2S0" location="0x400a2000"/>
+<peripheralInstance derived_from="I2S1" id="I2S1" location="0x400a3000"/>
+<peripheralInstance derived_from="C-CAN1" id="C-CAN1" location="0x400a4000"/>
+<peripheralInstance derived_from="RITIMER" id="RITIMER" location="0x400c0000"/>
+<peripheralInstance derived_from="QEI" id="QEI" location="0x400c6000"/>
+<peripheralInstance derived_from="GIMA" id="GIMA" location="0x400c7000"/>
+<peripheralInstance derived_from="DAC" id="DAC" location="0x400e1000"/>
+<peripheralInstance derived_from="C-CAN0" id="C-CAN0" location="0x400e2000"/>
+<peripheralInstance derived_from="ADC0" id="ADC0" location="0x400e3000"/>
+<peripheralInstance derived_from="ADC1" id="ADC1" location="0x400e4000"/>
+<peripheralInstance derived_from="GPIO-PORT" id="GPIO-PORT" location="0x400f4000"/>
+<peripheralInstance derived_from="SPI" id="SPI" location="0x40100000"/>
+<peripheralInstance derived_from="SGPIO" id="SGPIO" location="0x40101000"/>
</chip>
-<processor><name gcc_name="cortex-m3">Cortex-M3</name>
+<processor><name gcc_name="cortex-m4">Cortex-M4</name>
<family>Cortex-M</family>
</processor>
-<link href="nxp_lpc13Uxx_peripheral.xme" show="embed" type="simple"/>
+<link href="nxp_lpc43xx_peripheral.xme" show="embed" type="simple"/>
</info>
</infoList>
</TargetConfig>
diff --git a/demos/device/src/cdc_device_app.c b/demos/device/src/cdc_device_app.c
index accd61547..f7ef8e58c 100644
--- a/demos/device/src/cdc_device_app.c
+++ b/demos/device/src/cdc_device_app.c
@@ -95,7 +95,7 @@ void tusbd_cdc_xfer_cb(uint8_t coreid, tusb_event_t event, cdc_pipeid_t pipe_id,
break;
case TUSB_EVENT_XFER_ERROR:
- xferred_bytes = 0; // ignore
+ tusbd_cdc_receive(0, serial_rx_buffer, CDCD_APP_BUFFER_SIZE, true); // ignore, queue transfer again
break;
case TUSB_EVENT_XFER_STALLED:
diff --git a/tinyusb/class/cdc_device.c b/tinyusb/class/cdc_device.c
index 2c90bfc4b..5cee0f898 100644
--- a/tinyusb/class/cdc_device.c
+++ b/tinyusb/class/cdc_device.c
@@ -204,7 +204,6 @@ tusb_error_t cdcd_control_request_subtask(uint8_t coreid, tusb_control_request_t
case CDC_REQUEST_SET_CONTROL_LINE_STATE: // TODO extract DTE present
break;
-
default: return TUSB_ERROR_DCD_CONTROL_REQUEST_NOT_SUPPORT;
}
diff --git a/tinyusb/class/msc_device.c b/tinyusb/class/msc_device.c
index 091faabb6..742fc8524 100644
--- a/tinyusb/class/msc_device.c
+++ b/tinyusb/class/msc_device.c
@@ -158,7 +158,7 @@ tusb_error_t mscd_xfer_cb(endpoint_handle_t edpt_hdl, tusb_event_t event, uint32
//------------- new CBW received -------------//
if ( !is_waiting_read10_write10 )
{
- if ( endpointhandle_is_equal(p_msc->edpt_in, edpt_hdl) ) return TUSB_ERROR_NONE; // bulk in interrupt for dcd to clean up
+// if ( endpointhandle_is_equal(p_msc->edpt_in, edpt_hdl) ) return TUSB_ERROR_NONE; // bulk in interrupt for dcd to clean up
ASSERT( endpointhandle_is_equal(p_msc->edpt_out, edpt_hdl) &&
xferred_bytes == sizeof(msc_cmd_block_wrapper_t) &&
diff --git a/tinyusb/device/dcd_lpc43xx.c b/tinyusb/device/dcd_lpc43xx.c
index ea020a4ef..60d8e2fc7 100644
--- a/tinyusb/device/dcd_lpc43xx.c
+++ b/tinyusb/device/dcd_lpc43xx.c
@@ -151,7 +151,7 @@ typedef struct ATTR_ALIGNED(64) {
/// thus there are 16 bytes padding free that we can make use of.
//--------------------------------------------------------------------+
uint8_t class_code; // Class code that endpoint belongs to
- uint8_t list_qtd_idx[DCD_QTD_PER_QHD_MAX];
+ volatile uint8_t list_qtd_idx[DCD_QTD_PER_QHD_MAX];
uint8_t reserved[15-DCD_QTD_PER_QHD_MAX];
} dcd_qhd_t;
@@ -167,6 +167,9 @@ typedef struct {
}dcd_data_t;
+extern ATTR_WEAK dcd_data_t dcd_data0;
+extern ATTR_WEAK dcd_data_t dcd_data1;
+
#if (TUSB_CFG_CONTROLLER_0_MODE & TUSB_MODE_DEVICE)
TUSB_CFG_ATTR_USBRAM ATTR_ALIGNED(2048) STATIC_VAR dcd_data_t dcd_data0;
#endif
@@ -176,20 +179,7 @@ TUSB_CFG_ATTR_USBRAM ATTR_ALIGNED(2048) STATIC_VAR dcd_data_t dcd_data1;
#endif
static LPC_USB0_Type * const LPC_USB[2] = { LPC_USB0, ((LPC_USB0_Type*) LPC_USB1_BASE) };
-static dcd_data_t* const dcd_data_ptr[2] =
-{
- #if (TUSB_CFG_CONTROLLER_0_MODE & TUSB_MODE_DEVICE)
- &dcd_data0,
- #else
- NULL,
- #endif
-
- #if (TUSB_CFG_CONTROLLER_1_MODE & TUSB_MODE_DEVICE)
- &dcd_data1
- #else
- NULL
- #endif
-};
+static dcd_data_t* const dcd_data_ptr[2] = { &dcd_data0, &dcd_data1 };
//--------------------------------------------------------------------+
// CONTROLLER API
@@ -364,6 +354,7 @@ tusb_error_t dcd_pipe_control_xfer(uint8_t coreid, tusb_direction_t dir, uint8_t
uint8_t const ep_status = 1 - ep_data;
while(lpc_usb->ENDPTSETUPSTAT & BIT_(0)) {} // wait until ENDPTSETUPSTAT before priming data/status in response
+// while(p_dcd->qhd[0].qtd_overlay.active || p_dcd->qhd[1].qtd_overlay.active) {}; // wait until previous device request is completed
ASSERT_FALSE(p_dcd->qhd[0].qtd_overlay.active || p_dcd->qhd[1].qtd_overlay.active, TUSB_ERROR_FAILED);
//------------- Data Phase -------------//
@@ -454,10 +445,10 @@ endpoint_handle_t dcd_pipe_open(uint8_t coreid, tusb_descriptor_endpoint_t const
bool dcd_pipe_is_busy(endpoint_handle_t edpt_hdl)
{
- dcd_qhd_t* p_qhd = &dcd_data_ptr[edpt_hdl.coreid]->qhd[edpt_hdl.index];
+ dcd_qhd_t const * p_qhd = &dcd_data_ptr[edpt_hdl.coreid]->qhd[edpt_hdl.index];
- // LPC_USB0->ENDPTSTAT & endpoint_phy2pos(edpt_hdl.index)
- return !p_qhd->qtd_overlay.halted && p_qhd->qtd_overlay.active;
+ return p_qhd->list_qtd_idx[0] != 0; // qtd list is not empty
+// return !p_qhd->qtd_overlay.halted && p_qhd->qtd_overlay.active;
}
// add only, controller virtually cannot know
diff --git a/tinyusb/device/usbd.c b/tinyusb/device/usbd.c
index 258a8ef9f..6200113b6 100644
--- a/tinyusb/device/usbd.c
+++ b/tinyusb/device/usbd.c
@@ -112,7 +112,7 @@ bool tusbd_is_configured(uint8_t coreid)
//--------------------------------------------------------------------+
//------------- OSAL Task -------------//
-enum { USBD_TASK_QUEUE_DEPTH = 8 };
+enum { USBD_TASK_QUEUE_DEPTH = 16 };
typedef enum {
USBD_EVENTID_SETUP_RECEIVED = 1,
@@ -200,24 +200,23 @@ static tusb_error_t usbd_body_subtask(void)
tusb_error_t error;
error = TUSB_ERROR_NONE;
+ memclr_(&event, sizeof(usbd_task_event_t));
osal_queue_receive(usbd_queue_hdl, &event, OSAL_TIMEOUT_WAIT_FOREVER, &error);
SUBTASK_ASSERT_STATUS(error);
if ( USBD_EVENTID_SETUP_RECEIVED == event.event_id )
{
OSAL_SUBTASK_INVOKED_AND_WAIT( usbd_control_request_subtask(event.coreid, &event.setup_received), error );
- }else
+ }else if (USBD_EVENTID_XFER_DONE == event.event_id)
{
uint8_t class_index;
class_index = std_class_code_to_index( event.xfer_done.edpt_hdl.class_code );
- if (usbd_class_drivers[class_index].xfer_cb)
- {
- usbd_class_drivers[class_index].xfer_cb( event.xfer_done.edpt_hdl, (tusb_event_t) event.sub_event_id, event.xfer_done.xferred_byte);
- }else
- {
- hal_debugger_breakpoint(); // something wrong, no one claims the isr's source
- }
+ SUBTASK_ASSERT(usbd_class_drivers[class_index].xfer_cb != NULL);
+ usbd_class_drivers[class_index].xfer_cb( event.xfer_done.edpt_hdl, (tusb_event_t) event.sub_event_id, event.xfer_done.xferred_byte);
+ }else
+ {
+ SUBTASK_ASSERT(false);
}
OSAL_SUBTASK_END
@@ -400,6 +399,7 @@ void usbd_dcd_bus_event_isr(uint8_t coreid, usbd_bus_event_type_t bus_event)
case USBD_BUS_EVENT_RESET :
case USBD_BUS_EVENT_UNPLUGGED :
memclr_(&usbd_devices[coreid], sizeof(usbd_device_info_t));
+ osal_queue_flush(usbd_queue_hdl);
osal_semaphore_reset(usbd_control_xfer_sem_hdl);
for (uint8_t class_code = TUSB_CLASS_AUDIO; class_code < USBD_CLASS_DRIVER_COUNT; class_code++)
{
@@ -424,7 +424,7 @@ void usbd_setup_received_isr(uint8_t coreid, tusb_control_request_t * p_request)
};
task_event.setup_received = (*p_request);
- osal_queue_send(usbd_queue_hdl, &task_event);
+ ASSERT( TUSB_ERROR_NONE == osal_queue_send(usbd_queue_hdl, &task_event), VOID_RETURN);
}
void usbd_xfer_isr(endpoint_handle_t edpt_hdl, tusb_event_t event, uint32_t xferred_bytes)
@@ -444,7 +444,7 @@ void usbd_xfer_isr(endpoint_handle_t edpt_hdl, tusb_event_t event, uint32_t xfer
task_event.xfer_done.xferred_byte = xferred_bytes;
task_event.xfer_done.edpt_hdl = edpt_hdl;
- osal_queue_send(usbd_queue_hdl, &task_event);
+ ASSERT( TUSB_ERROR_NONE == osal_queue_send(usbd_queue_hdl, &task_event), VOID_RETURN);
}
}
diff --git a/tinyusb/host/usbh.c b/tinyusb/host/usbh.c
index 542f6d5bf..b36fa7cd1 100644
--- a/tinyusb/host/usbh.c
+++ b/tinyusb/host/usbh.c
@@ -108,7 +108,7 @@ enum { USBH_CLASS_DRIVER_COUNT = sizeof(usbh_class_drivers) / sizeof(host_class_
TUSB_CFG_ATTR_USBRAM usbh_device_info_t usbh_devices[TUSB_CFG_HOST_DEVICE_MAX+1]; // including zero-address
//------------- Enumeration Task Data -------------/
-enum { ENUM_QUEUE_DEPTH = 8 };
+enum { ENUM_QUEUE_DEPTH = 16 };
OSAL_TASK_DEF(usbh_enumeration_task, 200, TUSB_CFG_OS_TASK_PRIO);
OSAL_QUEUE_DEF(enum_queue_def, ENUM_QUEUE_DEPTH, uint32_t);
diff --git a/tinyusb/osal/osal_freeRTOS.h b/tinyusb/osal/osal_freeRTOS.h
index 4d35c3c0f..934b9bbad 100644
--- a/tinyusb/osal/osal_freeRTOS.h
+++ b/tinyusb/osal/osal_freeRTOS.h
@@ -103,28 +103,26 @@ static inline void osal_task_delay(uint32_t msec)
typedef xSemaphoreHandle osal_semaphore_handle_t;
// create FreeRTOS binary semaphore with zero as init value TODO: omit semaphore take from vSemaphoreCreateBinary API, should double checks this
-#define osal_semaphore_create(x) \
- xQueueGenericCreate( ( unsigned portBASE_TYPE ) 1, semSEMAPHORE_QUEUE_ITEM_LENGTH, queueQUEUE_TYPE_BINARY_SEMAPHORE )
+#define osal_semaphore_create(x) xSemaphoreCreateBinary()
// TODO add timeout (with instant return from ISR option) for semaphore post & queue send
static inline tusb_error_t osal_semaphore_post(osal_semaphore_handle_t const sem_hdl) ATTR_ALWAYS_INLINE;
static inline tusb_error_t osal_semaphore_post(osal_semaphore_handle_t const sem_hdl)
{
- portBASE_TYPE task_waken;
- return (xSemaphoreGiveFromISR(sem_hdl, &task_waken) == pdTRUE) ? TUSB_ERROR_NONE : TUSB_ERROR_OSAL_SEMAPHORE_FAILED;
+ return (xSemaphoreGive(sem_hdl) == pdTRUE) ? TUSB_ERROR_NONE : TUSB_ERROR_OSAL_SEMAPHORE_FAILED;
}
static inline void osal_semaphore_wait(osal_semaphore_handle_t const sem_hdl, uint32_t msec, tusb_error_t *p_error) ATTR_ALWAYS_INLINE;
static inline void osal_semaphore_wait(osal_semaphore_handle_t const sem_hdl, uint32_t msec, tusb_error_t *p_error)
{
- (*p_error) = ( xSemaphoreTake(sem_hdl, osal_tick_from_msec(msec)) == pdPASS ) ? TUSB_ERROR_NONE : TUSB_ERROR_OSAL_TIMEOUT;
+ uint32_t const ticks = (msec == OSAL_TIMEOUT_WAIT_FOREVER) ? portMAX_DELAY : osal_tick_from_msec(msec);
+ (*p_error) = ( xSemaphoreTake(sem_hdl, ticks) == pdPASS ) ? TUSB_ERROR_NONE : TUSB_ERROR_OSAL_TIMEOUT;
}
static inline void osal_semaphore_reset(osal_semaphore_handle_t const sem_hdl) ATTR_ALWAYS_INLINE;
static inline void osal_semaphore_reset(osal_semaphore_handle_t const sem_hdl)
{
- portBASE_TYPE task_waken;
- xSemaphoreTakeFromISR(sem_hdl, &task_waken);
+ (void) xSemaphoreTake(sem_hdl, 0);
}
//--------------------------------------------------------------------+
@@ -144,7 +142,8 @@ static inline tusb_error_t osal_mutex_release(osal_mutex_handle_t const mutex_h
static inline void osal_mutex_wait(osal_mutex_handle_t const mutex_hdl, uint32_t msec, tusb_error_t *p_error) ATTR_ALWAYS_INLINE;
static inline void osal_mutex_wait(osal_mutex_handle_t const mutex_hdl, uint32_t msec, tusb_error_t *p_error)
{
- (*p_error) = ( xSemaphoreTake(mutex_hdl, osal_tick_from_msec(msec)) == pdPASS ) ? TUSB_ERROR_NONE : TUSB_ERROR_OSAL_TIMEOUT;
+ uint32_t const ticks = (msec == OSAL_TIMEOUT_WAIT_FOREVER) ? portMAX_DELAY : osal_tick_from_msec(msec);
+ (*p_error) = ( xSemaphoreTake(mutex_hdl, ticks) == pdPASS ) ? TUSB_ERROR_NONE : TUSB_ERROR_OSAL_TIMEOUT;
}
static inline void osal_mutex_reset(osal_mutex_handle_t const mutex_hdl) ATTR_ALWAYS_INLINE;
@@ -176,14 +175,14 @@ typedef xQueueHandle osal_queue_handle_t;
static inline void osal_queue_receive (osal_queue_handle_t const queue_hdl, void *p_data, uint32_t msec, tusb_error_t *p_error) ATTR_ALWAYS_INLINE;
static inline void osal_queue_receive (osal_queue_handle_t const queue_hdl, void *p_data, uint32_t msec, tusb_error_t *p_error)
{
- (*p_error) = ( xQueueReceive(queue_hdl, p_data, osal_tick_from_msec(msec)) == pdPASS ) ? TUSB_ERROR_NONE : TUSB_ERROR_OSAL_TIMEOUT;
+ uint32_t const ticks = (msec == OSAL_TIMEOUT_WAIT_FOREVER) ? portMAX_DELAY : osal_tick_from_msec(msec);
+ (*p_error) = ( xQueueReceive(queue_hdl, p_data, ticks) == pdPASS ) ? TUSB_ERROR_NONE : TUSB_ERROR_OSAL_TIMEOUT;
}
-static inline tusb_error_t osal_queue_send(osal_queue_handle_t const queue_hdl, void const * data) ATTR_ALWAYS_INLINE;
+static inline tusb_error_t osal_queue_send(osal_queue_handle_t const queue_hdl, void const * data) ATTR_WARN_UNUSED_RESULT ATTR_ALWAYS_INLINE;
static inline tusb_error_t osal_queue_send(osal_queue_handle_t const queue_hdl, void const * data)
{
- portBASE_TYPE taskWaken;
- return ( xQueueSendFromISR(queue_hdl, data, &taskWaken) == pdTRUE ) ? TUSB_ERROR_NONE : TUSB_ERROR_OSAL_QUEUE_FAILED;
+ return ( xQueueSend(queue_hdl, data, 0) == pdTRUE ) ? TUSB_ERROR_NONE : TUSB_ERROR_OSAL_QUEUE_FAILED;
}
static inline void osal_queue_flush(osal_queue_handle_t const queue_hdl) ATTR_ALWAYS_INLINE;