Compare commits

...

443 Commits

Author SHA1 Message Date
Ha Thach
963971c6aa
Merge pull request #3157 from hathach/update-buildsystem
Update buildsystem
2025-07-02 18:15:37 +07:00
hathach
a52e5ce99a
build iar with circleci large resource 2025-07-02 17:43:38 +07:00
hathach
a64e3eb0aa
update board_test always output to uart regardless of LOGGER option 2025-07-02 17:27:03 +07:00
hathach
52f0427096
remove make wrapper for rp2040/espressif 2025-07-02 16:34:17 +07:00
hathach
014d6b2f26
remove cmake arm-clang and make iar to reduce concurrent jobs 2025-07-02 15:55:42 +07:00
hathach
a8b5e2bfc0
update example 2025-07-02 15:38:14 +07:00
hathach
0388700ad7
update esp build, replace TUSB_MCU_VENDOR_ESPRESSIF by ESP_PLATFORM 2025-07-02 15:32:12 +07:00
hathach
4579b4f825
add doc for building examples with cmake build system
change ci matrix build:
- github build make/cmake one per family on push only
- circicle do full cmake build for all toolchain (missing rx-gcc)
2025-07-02 14:41:16 +07:00
hathach
a42184b6fe
remove legacy DEPS_SUBMODULES in make 2025-07-02 11:03:50 +07:00
Ha Thach
0d6cb38163
Merge pull request #2967 from HiFiPhile/async_io
MSC Device: Add asynchronous IO support
2025-07-01 22:43:58 +07:00
hathach
c96cc4369f
defer proc_async_io_done() 2025-07-01 22:17:38 +07:00
hathach
216a35e59a
update example 2025-07-01 21:48:28 +07:00
hathach
d22cbe4cb5
refactor async io, add in_isr argument to tud_msc_async_io_done()
use cbw.command[0] for pending IO command
2025-07-01 20:13:21 +07:00
hathach
77e142ed76
Merge branch 'master' into fork/HiFiPhile/async_io 2025-06-30 21:09:40 +07:00
Ha Thach
cd96277bdc
Merge pull request #2488 from IngHK/cdch_upgrade
CHCh Upgrade: Improved FTDI and CP210x support, add PL2303 support, bugfixes
2025-06-27 21:47:13 +07:00
hathach
d86362414e
clean up 2025-06-27 21:17:30 +07:00
hathach
0194b8434f
use enum buf for process_set_config for ch34x and pl2303 2025-06-27 17:27:09 +07:00
hathach
f4d049e61b
update acm and pl2303 to match the rest of drivers 2025-06-27 17:09:11 +07:00
Zixun LI
cc12306e4b
Merge pull request #3153 from Milek7/implicit-fb
audio_device: Fix data IN endpoints with implicit feedback
2025-06-27 11:40:25 +02:00
hathach
8b5d703f74
major refactor to generalize cdch serial driver
- add common 2 stage set line coding for driver without direct set_line_coding support e.g ftdi, cp210x, ch34x
- add common cdch_process_line_state_on_enum() to handle cfg line state on enum e.g CFG_TUH_CDC_LINE_CONTROL/CODING_ON_ENUM
- refactor cdch_internal_control_complete and user_complete_cb to be managed by tuh_cdc_ API instead of serial driver
2025-06-27 15:57:18 +07:00
milek7
2843eb4052 audio_device: Fix data IN endpoints with implicit feedback 2025-06-26 22:38:43 +02:00
HiFiPhile
d789a87a7d Merge branch 'master' into async_io
Signed-off-by: HiFiPhile <admin@hifiphile.com>
2025-06-22 17:19:08 +02:00
hathach
470e12febc
refactor, add cdch_internal_control_complete() 2025-06-20 17:25:58 +07:00
hathach
900d0d974b
refactor change signature of serial driver's process_set_config
adding serial driver's request_complete()
2025-06-20 17:04:40 +07:00
hathach
adf6cbfe03
cdch clean up and refactor, add explicit sync() API 2025-06-20 12:52:34 +07:00
hathach
5c974cee23
usbh make TU_API_SYNC() public, to implement sync() API, change return of sync API from uint8_t to tusb_xfer_result_t 2025-06-20 12:51:29 +07:00
hathach
221b5288e4
union ftdi/pl2303/acm data to save memory. 2025-06-19 18:14:24 +07:00
hathach
ce9140a150
rename tuh_cdc_get_local_line_coding to tuh_cdc_get_line_coding_local
add tuh_cdc_get_control_line_state_local()
implement tuh_cdc_get/set_dtr/rts() as inline
2025-06-19 17:57:21 +07:00
hathach
fa3ec44533
revert CFG_TUH_CDC_DTR/RTS_CONTROL_ON_ENUM 2025-06-19 17:22:26 +07:00
hathach
ec1a26251d
clean up pl2303 type data 2025-06-19 17:05:21 +07:00
hathach
2adb305ea7
house keeping 2025-06-19 15:30:02 +07:00
hathach
9503883ba7
usbh: add new API tuh_descriptor_get_device_local()
cdc host: remove the local desc_dev and the get_device descriptor call for ftdi and pl2303
2025-06-18 23:44:03 +07:00
hathach
506edc6267
add get_itf_by_xfer() to better determine cdc interface from xfer complete callback 2025-06-18 18:55:31 +07:00
hathach
d4abf43f22
add common cdch_process_set_config() to safely complete set_config() when it failed.
driver_process_set_config() also pass drv index with user_data
2025-06-17 22:16:13 +07:00
hathach
4a44dd5c47
Merge branch 'master' into fork/IngHK/cdch_upgrade
# Conflicts:
#	README.rst
#	docs/reference/index.rst
#	src/class/cdc/cdc_device.c
#	src/class/cdc/cdc_host.c
2025-06-16 11:08:01 +07:00
Ha Thach
e95973d346
Merge pull request #3137 from HiFiPhile/uac_simplify
uac2: remove support fifo
2025-06-12 22:18:17 +07:00
Ha Thach
99b4ebeb10
Merge pull request #3140 from james-advatek/stm32n657nucleo
Add STM32N657 Nucleo Board support
2025-06-12 21:50:23 +07:00
hathach
7d66a3e775
merge n6 and h7rs (same config) 2025-06-12 21:20:49 +07:00
hathach
2e231a7517
doc update 2025-06-12 15:57:56 +07:00
hathach
76b7468c74
ci skip clang/iar build for stm32n6
add stm32-tcpp0203 driver as dependency for h7rs and n6
2025-06-12 15:32:36 +07:00
hathach
edec37c1a3
fix cmake build 2025-06-12 14:07:51 +07:00
hathach
386f33807a
Merge branch 'master' into fork/james-advatek/stm32n657nucleo 2025-06-12 11:02:54 +07:00
Ha Thach
170de855a3
Merge pull request #2960 from HiFiPhile/h7rs
Add NUCLEO-H7S3L8 BSP
2025-06-11 21:05:33 +07:00
hathach
732a07ba5d
fix linker issue with clang 2025-06-11 19:59:24 +07:00
hathach
14124c1735
add h7rs to ci matrix 2025-06-11 19:35:20 +07:00
hathach
d3d505e8f7
Merge branch 'master' into fork/HiFiPhile/h7rs 2025-06-11 16:23:54 +07:00
Ha Thach
8e25220369
Merge pull request #3145 from hathach/refactor-maxim-bsp
Refactor maxim bsp
2025-06-11 16:20:35 +07:00
hathach
41e615d7c2
add make build for maxim 2025-06-11 12:08:16 +07:00
hathach
1be7b8f781
remove max32666fthr from hil pool 2025-06-11 09:39:42 +07:00
hathach
b56265f381
merge all maxim (32650, 32666, 32690, 78002) family into common bsp/maxim. Only support cmake build system
rename hw/mcu/analog/max32 to hw/mcu/analog/msdk
2025-06-10 22:28:03 +07:00
HiFiPhile
b203d9eaf7
Merge pull request #3143 from Precidata/fix-epsize
Fix TUH_EPSIZE_BULK_MPS macro
2025-06-09 18:15:33 +02:00
Cédric Berger
d533650105 Fix TUH_EPSIZE_BULK_MPS macro
TUH_EPSIZE_BULK_MPS should be set based on TUH_OPT_HIGH_SPEED, not TUD_OPT_HIGH_SPEED
2025-06-09 16:56:02 +02:00
HiFiPhile
d61077cbad
Merge pull request #3135 from andrewleech/ncm-link-state-control
Add USB NCM link state control support
2025-06-09 14:25:25 +02:00
HiFiPhile
1ccb10e3f1 Fix ECM compile
Signed-off-by: HiFiPhile <admin@hifiphile.com>
2025-06-08 13:53:23 +02:00
James Sandison
b956d10487 fix: allow FreeRTOS examples to compile 2025-06-04 13:52:35 +10:00
James Sandison
5c4b2c75d2 docs: update dwc2_info.md 2025-06-04 13:21:34 +10:00
James Sandison
efc8c08a66 chore: delete accidentally commited submodules 2025-06-04 11:42:21 +10:00
James Sandison
3cf7234d67 chore: whitespace fix 2025-06-04 11:37:45 +10:00
James Sandison
001c7e3863 doc: remove reference to stm32n657_dk board 2025-06-04 11:27:55 +10:00
James Sandison
d62a521e7c chore: add newline to EOF 2025-06-04 11:27:34 +10:00
James Sandison
56c9521abd chore: squash previous commits from other branches 2025-06-04 11:21:27 +10:00
HiFiPhile
dc0038f614 uac2: remove support fifo
Signed-off-by: HiFiPhile <admin@hifiphile.com>
2025-05-29 13:56:46 +02:00
HiFiPhile
3d2b870fcb Fix wrong SysTick clock on NUCLEO-C071RB
Signed-off-by: HiFiPhile <admin@hifiphile.com>
2025-05-29 13:36:34 +02:00
Andrew Leech
b6ce41188e examples/device/net_lwip_webserver: Simplify example code.
Now that tud_network_recv_renew has protections against recursion it's
safe and simpler to handle the lwip frame entirely in the same callback.
2025-05-29 09:36:38 +10:00
Andrew Leech
9021efcacb Add link state control support for ECM mode
Extends the link state control feature to CDC-ECM mode.
RNDIS mode prints state changes but doesn't send notifications
to the host yet (would require RNDIS_INDICATE_STATUS_MSG).

For ECM:
- Tracks link state and sends proper CDC notifications
- Handles notification endpoint busy conditions
- Only sends connection notification when link is actually up

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-05-29 09:36:38 +10:00
Andrew Leech
5de4a23abe Add USB NCM link state control support
This adds the ability to dynamically control the network link state
for NCM devices. The host OS will see the network interface as
connected/disconnected based on the link state.

New API:
- tud_network_link_state(rhport, is_up): Set link up/down state

Example updates:
- Added button control to toggle link state
- Fixed LWIP integration to properly handle link state changes
- Added printf to show correct protocol (NCM vs RNDIS/ECM)

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-05-29 09:36:38 +10:00
Ha Thach
2a364ca272
Merge pull request #3136 from hathach/update-max32
add OPT_MCU_MAX32665
2025-05-28 16:59:52 +07:00
hathach
132c55aca0
add OPT_MCU_MAX32665 2025-05-28 08:38:26 +07:00
Ha Thach
8f077f9295
Merge pull request #3111 from hathach/ci_vbus 2025-05-23 21:50:00 +07:00
HiFiPhile
1a13bd8eba Add comment about CFG_TUD_CI_HS_VBUS_CHARGE
Signed-off-by: HiFiPhile <admin@hifiphile.com>
2025-05-23 13:27:27 +02:00
Ha Thach
d3a9fee5cb
Merge pull request #3130 from hathach/max3421-use-spinlock
add usbh_spin_lock/unlock() use spinlock to replace atomic flag for hcd max3421
2025-05-21 17:01:06 +07:00
hathach
a484b2e372
update bug template to include commit SHA 2025-05-21 15:59:55 +07:00
hathach
e41a63c60d
add usbh_spin_lock/unlock() use spinlock instead of atomic flag for hcd max3421 2025-05-21 15:27:18 +07:00
Ha Thach
3a042b37da
Merge pull request #3127 from hathach/fix/dcd_race_condition
add osal spinlock API, Fix/dcd dwc2 race condition
2025-05-21 15:15:43 +07:00
hathach
58dfc126ac
remove unused dwc2_critical.h 2025-05-21 14:36:53 +07:00
hathach
5551a3e430
add usbd_spin_lock/unlock for driver usage 2025-05-21 11:41:06 +07:00
hathach
c1d23a0a92
osal_spin skipping lock/unlock when executed in isr 2025-05-21 11:19:07 +07:00
hathach
a4875fefea
rename osal_critcal to osal_spinlock
add spinlock implementation for most rtos
2025-05-20 17:01:31 +07:00
hathach
bb1d348eb3
implement osal critical for none/freertos/pico-sdk 2025-05-19 22:51:40 +07:00
hathach
bffe5d97cc
limit hil-hfp iar build to 4 parallel jobs 2025-05-19 20:22:29 +07:00
hathach
9aea7751f2
dwc2 only enter critical in isr with multiple core CPUs 2025-05-19 20:04:20 +07:00
hathach
72ee742761
add osal_critical API() for use with dwc2 2025-05-19 20:04:19 +07:00
Tomas Rezucha
c8baba10f9
fix(dcd): Fixed race condition on device disconnect
TinyUSB does not provide any locking means to protect the DCD variables.
This can lead to race conditions when the user is trying to submit
a transfer while the device is being disconnected. This can cause
the device to be in an inconsistent state, leading to a crash or
undefined behavior.

This commit adds a spin-lock to protect the DCD variables during
device disconnect.

Closes https://github.com/espressif/esp-idf/issues/9691
Also reported in https://github.com/espressif/esp-usb/pull/131
2025-05-19 20:04:16 +07:00
Ha Thach
5428b87948
Merge pull request #3103 from wavenumber-eng/mcxa156__sdk216
Added initial support for FRDM-MCXA156 and fixed up  a crash with FRDM-MCXN947
2025-05-16 22:32:04 +07:00
Ha Thach
3024bff12f
Merge pull request #3123 from hathach/follow-up-pr3118
follow up to pr3118, interface also end with IAD. Add more checks
2025-05-16 21:10:02 +07:00
hathach
67389f37f2
follow up to pr3118, interface also end with IAD. Add more checks 2025-05-16 16:39:53 +07:00
HiFiPhile
531fb69531
Merge pull request #3118 from ZakDanger/vendor_device_fix
vendor device open fix for descriptor parsing
2025-05-16 10:25:28 +02:00
HiFiPhile
6346fbec16 Merge branch 'master' into h7rs 2025-05-15 21:40:36 +02:00
Ha Thach
9548d51c7e
Merge pull request #3121 from hathach/bump-gcc14
Bump gcc14
2025-05-15 21:46:55 +07:00
hathach
38e5a67461
bump up pio-usb and codeql version 2025-05-15 10:27:00 +07:00
hathach
0ebc91ec97
update stm32wb linker to match new startup 2025-05-14 15:41:57 +07:00
hathach
fe4446090e
fix dual example for rp2350 conflict printf and cdc_printf 2025-05-13 16:27:26 +07:00
hathach
ed087b9ed8
pump up pico-pio-usb and cmsis_device_wb 2025-05-13 16:13:50 +07:00
hathach
baf67539fc
fix warnings, minor clean up 2025-05-13 12:16:22 +07:00
hathach
228b2dec1c
bump ci to gcc 14 2025-05-12 15:40:58 +07:00
HiFiPhile
a2117d5d0f simplify vendord_open parsing loop
Signed-off-by: HiFiPhile <admin@hifiphile.com>
2025-05-09 16:43:19 +02:00
ZakDanger
6b30a61bdb revert 'end fix' 2025-05-09 20:44:11 +10:00
ZakDanger
ae8c00f5d7 revert 'end fix' 2025-05-09 20:42:19 +10:00
ZakDanger
f5944d35b0 vendor device open fix for descriptor parsing 2025-05-09 18:17:07 +10:00
Ha Thach
542e5b4550
Merge pull request #3114 from hathach/fix-sigma-mouse-multiple-attach
Fix sigma mouse multiple attach
2025-05-06 21:40:23 +07:00
hathach
a05fc50461
clean up ci 2025-05-06 18:41:12 +07:00
hathach
fb2214dea6
move hil into build workflow 2025-05-06 16:30:34 +07:00
hathach
809af3e74c
chore(usbh): change removing_hubs to array instead of bitmask 2025-05-06 15:58:07 +07:00
hathach
bc37ed6e3e
usbh: force removed device in the same bus info, before setting address.
usbh: move code around
hub: queue status endpoint for detach/remove event
2025-05-06 15:23:23 +07:00
HiFiPhile
6a92b8efa4 dcd/ci_hs: add vbus charge option.
Signed-off-by: HiFiPhile <admin@hifiphile.com>
2025-05-04 15:10:17 +02:00
hathach
d221d55b08
fix pre-commmit 2025-04-29 21:41:34 +07:00
Ha Thach
1a783b3573
Merge pull request #3104 from hathach/usbh-attach-debounce
Usbh attach debounce
2025-04-29 21:36:18 +07:00
hathach
2abd3c54c4
define hcd_devtree_info_t forr backward compatible 2025-04-29 20:49:47 +07:00
hathach
e7d4b5c9e7
add enum for set addr recovery 2025-04-29 20:16:50 +07:00
hathach
fc43eeddf2
attach debouncing fixed issue with port1 highspeed on imxrt 2025-04-29 10:11:20 +07:00
Eli Hughes
538684ac62 - spelling fixes to pass ci
- added mca156 the list in boards.rst.
-  Fixup to family.cmake for mcxa156 to pass ci
2025-04-28 07:58:09 -04:00
ehughes
08ebf1b0f2
Merge branch 'hathach:master' into mcxa156__sdk216 2025-04-28 07:09:42 -04:00
hathach
42d4f7c81e
remove the old attach duplicated logic, debouncing skip should take care of it. 2025-04-28 15:10:03 +07:00
hathach
2c1414b4c1
usbh: add roothub debounncing flag to ignore attach/remove event on the roothub that is currently doing debouncing delay 2025-04-28 14:59:32 +07:00
Ha Thach
a22e45b816
Merge pull request #3100 from wavenumber-eng/get_deps_fix
Fixed broken deps on a fresh clone
2025-04-28 10:36:29 +07:00
Eli Hughes
f392b4c91d Added initial support for FRDM-MCXA156 and fixed up a crash with MCXN947
I will be porting tinyuf2 to MCXA156 and N947 and need this work in place.

This is the 1st step before bringing in support for other MCX devices.

We had previous patched https://github.com/hathach/mcux-sdk.git'  for MCX support as it was not pulically available

I updated get_deps to point to the mcux-sdk version 2.16.10 from NXP. I repointed the entry in the get_deps script to use NXP MCU repo.  The existing current code couldn't build as the MCUXpresso SDK was old.

- For now, I put a copy of fsl_spc.c in the drivers folder for the mcx family.  None of the ports could build with the version in the mcux github sdk.  The sdk on github has version 2.4.0.   The SDK package that can be downloaded with the SDK generator uses 2.4.2.  All of the clock_config routines use versions of the datastructure from 2.4.2.  For now, keeping an updated copy in hw/bsp/mcx/drivers so we can build against the latest mcuxpresso sdk and enable MCXA156.  I'll file an issue on the nxp github.

- Cleaned up the MCX family.c a little bit.  the MCXA/N these chips don't have SCT so I removed the neopixel code.

- fixed a clock init issue w/ N947 that was causing it to crash when initializing the uart.

- I tested the cmake and make scripts on the A153,A156 and N947 using the CDC/MSC sample.  All worked OK.

- Patched get_deps so it will do a fetch/check on a new folder.  Some of the deps were failing on a fresh clone of tinyusb

- Fixed  lpc51,54 and lpc55 make/cmake files to build with mcuxpresso sdk 2.16.10  The folder structure for flexcomm/uart changed a little bit

- lpc55s59 libpower_hardabi.a no longer is included in mcuxpressosdk, (fsl_power.c is replacement). remove of libpower_hardabi.a from the linker config.  LPC55 still works as expected.

- Using tinyuf2 get deps
2025-04-27 09:42:42 -04:00
Eli Hughes
0937a2b2d3 using get-deps from tinyuf2 2025-04-27 09:38:18 -04:00
Ha Thach
b5d4d0f623
Merge pull request #3096 from hathach/usbh-improve-hub
Usbh improve hub
2025-04-24 23:02:18 +07:00
hathach
b5b7a4be60
hub check status before get 1st device descriptor 2025-04-24 22:21:38 +07:00
hathach
093720f60b
fix build 2025-04-24 18:08:00 +07:00
hathach
0f784e8a07
refactor hub driver and move port reset on connection change to usbh.
hub: add hub_port_get_status_local(), ignore resp in hub_port_get_status(pot != 0)
usbh properly deboucning with hub/rootport accordingly to usb specs, also add 10ms of reset recovery
2025-04-24 17:59:45 +07:00
Ha Thach
1afe8a0039
Merge pull request #3095 from fenugrec/ex_cmake_CM0
examples cmake: fix gcc flag -mcpu=cortex=m0
2025-04-24 10:46:14 +07:00
hathach
89f8d0cffb
add tuh_address_set() API
minor rename and move code around
2025-04-24 10:41:00 +07:00
fenugrec
736b1d50bc examples cmake: fix gcc flag -mcpu=cortex-m0 2025-04-23 16:04:42 -04:00
Ha Thach
8b3c558881
Merge pull request #3093 from hathach/refactor-usbh-bus-info
refactor(usbh) improve the usage of bus info
2025-04-23 20:08:38 +07:00
hathach
9a1f690ec4
move usbh ctrl_xfer into usbh_data 2025-04-23 16:50:58 +07:00
hathach
a2da575793
rename and expose tuh_bus_info_get() to application 2025-04-23 16:03:40 +07:00
hathach
741cb3cf02
rename hcd_devtree_info_t to tuh_bus_info_t, hcd_devtree_get_info to hcd_bus_info_get
streamline bus info to usbh_devies, also replace dev0 (renamed to dev0_bus)
2025-04-23 12:35:32 +07:00
Ha Thach
b632686f54
Merge pull request #3080 from HiFiPhile/enum_racing
host: fix enumerate racing
2025-04-23 10:41:14 +07:00
HiFiPhile
b6170c965f Compile fix.
Signed-off-by: HiFiPhile <admin@hifiphile.com>
2025-04-22 21:14:04 +02:00
HiFiPhile
9645baa42e include h7rs in host examples.
Signed-off-by: HiFiPhile <admin@hifiphile.com>
2025-04-22 20:19:34 +02:00
hathach
8f9ef7dfbe
reduce ENUM_DEBOUNCING_DELAY_MS to 200ms
replace dev0.enumerating by enumerating_daddr for better clean up on unplugging while enumerating
move controller_id & enumerating_daddr into _usbh_data struct
2025-04-22 22:09:06 +07:00
hathach
940fe43e68
move removing dev0 to process_removing_device() 2025-04-22 17:33:37 +07:00
HiFiPhile
7ba63a6302
Also cleanup unaddressed device.
Signed-off-by: HiFiPhile <admin@hifiphile.com>
2025-04-22 16:58:13 +07:00
HiFiPhile
3c4e6a779d
Move decouncing delay before USB reset.
Signed-off-by: HiFiPhile <admin@hifiphile.com>
2025-04-22 16:58:12 +07:00
HiFiPhile
9f096ac56b
host: fix enumerate racing
- if a previous enumeration failed _ctrl_xfer status could stuck, it needs to be cleared before next attempt.
- after _dev0.enumerating is reset in hcd_event_handler(), if an attach event arrived before _ctrl_xfer clean up in remove event, a racing condition will happen.

Signed-off-by: HiFiPhile <admin@hifiphile.com>
2025-04-22 16:58:10 +07:00
Ha Thach
18d7a993be
Merge pull request #3075 from maximevince/dwc2-proper-attach-debouncing
dwc2/host: attach debouncing fixes
2025-04-21 22:46:15 +07:00
hathach
5725d33121
improve usbh stability with failed setup send, prevent control stage locked out 2025-04-21 20:39:23 +07:00
Ha Thach
56ed51c8fb
Merge pull request #3088 from HiFiPhile/intv
Fix 1st nak retry one frame shorter.
2025-04-21 18:31:43 +07:00
HiFiPhile
b3a9b6e37f enable SOF interrupt only if not already enabled
Signed-off-by: HiFiPhile <admin@hifiphile.com>
2025-04-19 11:43:28 +02:00
Ha Thach
5572168994
Merge pull request #3077 from HiFiPhile/ping_out 2025-04-19 00:03:51 +07:00
hathach
d51863d1a0
- correctly do_ping if received nyet as transfer complete e.g msc 31 byte command
- correctly carry out OUT transfer when PING is ack
2025-04-18 22:46:37 +07:00
HiFiPhile
1efc9007b2 Merge branch 'dwc2-proper-attach-debouncing' of github.com:maximevince/tinyusb into dwc2-proper-attach-debouncing 2025-04-18 14:58:59 +02:00
HiFiPhile
b3d20442e2 Fix usbh racing later.
Signed-off-by: HiFiPhile <admin@hifiphile.com>
2025-04-18 14:57:53 +02:00
HiFiPhile
4c6736c277 Merge branch 'master' into dwc2-proper-attach-debouncing
Signed-off-by: HiFiPhile <admin@hifiphile.com>
2025-04-18 14:54:20 +02:00
hathach
8111e53ff0
minor rename 2025-04-18 18:21:42 +07:00
hathach
2fd0301f0e
Merge branch 'master' into fork/HiFiPhile/ping_out
# Conflicts:
#	src/portable/synopsys/dwc2/hcd_dwc2.c
2025-04-18 17:59:38 +07:00
HiFiPhile
b7a26cc33c Fix 1st nak retry one frame shorter.
Signed-off-by: HiFiPhile <admin@hifiphile.com>
2025-04-18 12:46:20 +02:00
Ha Thach
e44f556a95
Merge pull request #3072 from maximevince/dwc2-retry-in-token-immediately
dwc2/host: immediately retry IN token for bInterval=1
2025-04-18 17:12:07 +07:00
HiFiPhile
ee1a5dbac0
Merge pull request #3084 from joelpmichael/hcd-template-comments
note potential issues using ep_desc in hcd_edpt_open()
2025-04-18 11:25:59 +02:00
HiFiPhile
91163c9217
Merge pull request #3067 from maximevince/dwc2-host-fix-disconnect
dwc2/host: enable disconnect interrupt + handle it
2025-04-18 11:24:23 +02:00
hathach
1b888a3311
clean up, remove halted_sof_schedule flags since channel_xfer_in_retry() is only called when channel is halted. 2025-04-18 16:17:35 +07:00
HiFiPhile
b6abc9022a Merge remote-tracking branch 'upstream/master' into hcd-template-comments
Signed-off-by: HiFiPhile <admin@hifiphile.com>
2025-04-18 11:13:15 +02:00
HiFiPhile
7134109973 Update hcd_edpt_open() note.
Signed-off-by: HiFiPhile <admin@hifiphile.com>
2025-04-18 11:12:14 +02:00
Ha Thach
3fd7854a91
Merge pull request #3081 from hathach/usbh-enum-get-string-desc-first
usbh enum get string descriptor length first
2025-04-18 15:24:42 +07:00
hathach
ba45625ea4
minor ci update 2025-04-18 14:29:06 +07:00
hathach
5c7ca2acad
change gh ci iar to push event 2025-04-18 12:07:08 +07:00
hathach
e8a84f9076
enum For string descriptor (langid, manufacturer product, serila): always get the first 2 bytes to determine the length first. otherwise, some device may have buffer overflow. 2025-04-18 10:53:12 +07:00
Ha Thach
edbea218b9
Merge pull request #3086 from hathach/ci-add-picow-host
Ci add picow host test
2025-04-17 23:51:50 +07:00
hathach
46d2d4199e
run arm-iar with non-forked PR 2025-04-17 21:36:09 +07:00
hathach
0220852a6e
- hil test max retry = 3
- fix h7 unused function
2025-04-17 16:58:26 +07:00
hathach
d4983acd3a
github ci support setup/install iar toolchain 2025-04-17 16:50:25 +07:00
hathach
3851c7c97a
- run arm-iar using github action
- add skip_ci.txt to family folder to skip boards in ci run
2025-04-17 16:07:10 +07:00
hathach
9eb0ae7636
fix iar make build with stm32 l0, f2, f3, u5, wb 2025-04-17 15:15:07 +07:00
hathach
b1eedf4d1d
fix iar make build with wb and u5 2025-04-17 14:40:43 +07:00
hathach
eea42fd119
update iar build 2025-04-17 13:05:18 +07:00
hathach
ccb34dbbdb
add toolchain.json for toolchain url 2025-04-17 12:20:05 +07:00
hathach
f479b02ea6
ci add pico_w for native host test 2025-04-17 11:22:38 +07:00
Ha Thach
e426c8c876
Merge pull request #3085 from hathach/ci-add-s3-host
Ci add s3 host
2025-04-17 11:07:04 +07:00
hathach
7ef17a85cb
de-duplicate flash board_test for board with multiple flags_on 2025-04-16 23:47:17 +07:00
hathach
4d601545eb
add TS3USB30 to test s3 host with slave/dma 2025-04-16 21:15:07 +07:00
Joel Michael
0d2c08efd7 note potential issues using ep_desc in hcd_edpt_open() 2025-04-16 20:26:35 +10:00
Maxime Vincent
62d06e7b19
dwc2/host: fix all retry intervals
Signed-off-by: Maxime Vincent <maxime@veemax.be>
2025-04-15 09:07:48 +02:00
Maxime Vincent
384e191fdc
dwc2/host: immediately retry IN token for bInterval=1
Signed-off-by: Maxime Vincent <maxime@veemax.be>
2025-04-15 09:01:39 +02:00
Maxime Vincent
de5cc0b830
Merge branch 'master' into dwc2-proper-attach-debouncing 2025-04-15 09:00:57 +02:00
Maxime Vincent
cea2c97248
Merge branch 'master' into dwc2-host-fix-disconnect 2025-04-15 09:00:16 +02:00
Ha Thach
bfe08176e5
Merge pull request #3070 from HiFiPhile/bitfield
host/dwc2: fix bitfields access width
2025-04-15 10:44:01 +07:00
hathach
d039d54a89
channge DWC2_CHANNEL_COUNT/DWC2_EP_COUNT to inline function 2025-04-14 23:45:20 +07:00
HiFiPhile
c183108a82 Skip net_lwip_webserver, too big for h7rs
Signed-off-by: HiFiPhile <admin@hifiphile.com>
2025-04-13 12:24:30 +02:00
HiFiPhile
8b69dc32d4 Increase RTT buffer size
Signed-off-by: HiFiPhile <admin@hifiphile.com>
2025-04-12 20:01:10 +02:00
HiFiPhile
b2a4407bd5 Merge remote-tracking branch 'upstream/master' into h7rs 2025-04-12 17:08:49 +02:00
HiFiPhile
b4a762dd58 Fix RTT buffer not detected.
Signed-off-by: HiFiPhile <admin@hifiphile.com>
2025-04-12 17:08:29 +02:00
HiFiPhile
7f246d4b76 Fix swo logger case.
Signed-off-by: HiFiPhile <admin@hifiphile.com>
2025-04-12 17:08:29 +02:00
HiFiPhile
6689a0142d
Merge pull request #3079 from byteit101/version-string-fix
Fix version string to actually be the version
2025-04-12 16:41:04 +02:00
HiFiPhile
af0c47e06e Fix typo
Signed-off-by: HiFiPhile <admin@hifiphile.com>
2025-04-12 15:21:42 +02:00
HiFiPhile
5e4decb4a3
Merge pull request #3074 from maximevince/dwc2-fix-hfir-off-by-one
dwc2/host: HFIR: Fix timing off-by-one
2025-04-12 13:40:36 +02:00
HiFiPhile
aecfd3433c Fix handle_hprt_irq
Signed-off-by: HiFiPhile <admin@hifiphile.com>
2025-04-12 13:36:54 +02:00
Patrick Plenefisch
937b07cdc0
Fix version string to actually be the version 2025-04-11 18:19:39 -04:00
HiFiPhile
459e2cd39e Merge remote-tracking branch 'upstream/master' into async_io
Signed-off-by: HiFiPhile <admin@hifiphile.com>
2025-04-11 23:07:22 +02:00
HiFiPhile
925010fd84 host/dwc2: resume OUT transfer when PING ACKed
Signed-off-by: HiFiPhile <admin@hifiphile.com>
2025-04-11 17:18:36 +02:00
Maxime Vincent
2064ee470d
dwc2/host: attach debouncing fixes 2025-04-11 12:26:36 +02:00
Maxime Vincent
72357cdb20
dwc2/host: HFIR: Fix timing off-by-one 2025-04-11 12:20:24 +02:00
HiFiPhile
2aff61ccb3 Fix CI.
Signed-off-by: HiFiPhile <admin@hifiphile.com>
2025-04-09 19:40:03 +02:00
HiFiPhile
3acaffd64d build fix.
Signed-off-by: HiFiPhile <admin@hifiphile.com>
2025-04-09 19:34:56 +02:00
HiFiPhile
084c0802c3 dwc2: refactor bitfields.
Signed-off-by: HiFiPhile <admin@hifiphile.com>
2025-04-09 19:34:56 +02:00
Maxime Vincent
6607b76c76
dwc2/host: remove hcd_event_device_remove() call from handle_hptr_irq to prevent double removal
Signed-off-by: Maxime Vincent <maxime@veemax.be>
2025-04-08 14:34:21 +02:00
HiFiPhile
1be4171d2a Fix espressif build with presets.
Signed-off-by: HiFiPhile <admin@hifiphile.com>
2025-04-07 23:41:55 +02:00
Maxime Vincent
7d8433abab
dwc2/host: enable disconnect interrupt + handle it
Signed-off-by: Maxime Vincent <maxime@veemax.be>
2025-04-07 11:36:06 +02:00
HiFiPhile
865e3488f9
Merge pull request #3014 from deshipu/master
Allow different port and mode for LED on ch32v boards
2025-04-06 18:35:28 +02:00
Radomir Dopieralski
1f2f92d97a Allow different port and mode for LED on ch32v boards
While there is a define for the port, the clock enable is hardcoded for
GPIOA, so setting a different port than GPIOA doesn't work. This fixes
it by adding a define for enabling the port clock.

It also adds a define for the pin mode, because not all boards have the
LED connected in a way that open drain works with it.
2025-04-06 17:14:32 +02:00
HiFiPhile
b4252c426f
Merge pull request #3015 from Dazza0/docs/fix_formatting
Fix .rst document formatting
2025-04-06 14:15:08 +02:00
HiFiPhile
42213eff2b
Merge pull request #3063 from maximevince/dwc2-host-fix-sof-flag
dwc2/host: clear SOF flag in handle_sof_irq()
2025-04-06 14:05:28 +02:00
Maxime Vincent
255ccf26ea
dwc2/host: clear SOF flag in handle_sof_irq() 2025-04-04 14:21:20 +02:00
Ha Thach
60e6d53d10
Merge pull request #3061 from hathach/update-endpoint-open
fix(hcd) hcd_edpt_open() return true if endpoint is already opened.
2025-04-03 21:22:01 +07:00
hathach
4787cd5f54
fix(hcd) hcd_edpt_open() return true if endpoint is already opened. 2025-04-03 18:11:33 +07:00
Ha Thach
8c1802e41d
Merge pull request #3043 from hathach/hcd-close-ep
feat(host) add endpoint close API and feat(HIL) improvement
2025-03-27 10:47:10 +07:00
hathach
5531de4f2c
add clion debugserver 2025-03-26 23:20:00 +07:00
hathach
e511d00f34
added hcd_edpt_close() stub for other ports 2025-03-26 22:11:44 +07:00
hathach
901ce2ad93
hcd/ehci: hcd_edpt_open() return false if ep is already opened. implement hcd_edpt_close() 2025-03-26 21:32:18 +07:00
hathach
1615120bca
added mimxrt1064_evk to hil test pool 2025-03-26 15:32:19 +07:00
hathach
69dca9518c
added mimxrt1064_evk to hil test pool 2025-03-26 15:20:27 +07:00
hathach
73e810a7ba
imxrt: disable BOARD_ConfigMPU() since it cause issue with imxrt1060/64. Update imxrt configtool forr some board to get uart pin init. 2025-03-26 15:20:02 +07:00
hathach
99673cdbb8
fix wanings 2025-03-25 17:36:15 +07:00
hathach
65e01fff2e
add tuh_edpt_close() API, it will abort any pending transfer
implement hcd_edpt_close() for pio-usb and max3421e, also move max3421e api into its own header.
2025-03-25 16:15:58 +07:00
hathach
b99b811308
more hil improvement 2025-03-25 14:43:40 +07:00
hathach
1fd5c12316
HIL: add flag CFG_TUH_RPI_PIO_USB to pico/pico2 2025-03-25 10:43:55 +07:00
HiFiPhile
5086d2a04f Add SWO config.
Signed-off-by: HiFiPhile <admin@hifiphile.com>
2025-03-24 23:06:22 +01:00
HiFiPhile
c3a6efc29e Implement ITM_SendChar().
Signed-off-by: HiFiPhile <admin@hifiphile.com>
2025-03-24 23:06:09 +01:00
HiFiPhile
3caff80c8e Merge remote-tracking branch 'upstream/master' into h7rs
Signed-off-by: HiFiPhile <admin@hifiphile.com>
2025-03-24 21:09:17 +01:00
hathach
875e645b32
update hil test to include dual and host for pico/pico2 2025-03-24 23:56:32 +07:00
hathach
db537861b2
device cdc: rename tud_cdc_configure_fifo/_t to tud_cdc_configure/_t
add tx_overwritabe_if_not_connected for cdc driver configure
2025-03-24 22:58:21 +07:00
hathach
9f541a3d96
host: add tuh_enum_descriptor_device_cb() and tuh_enum_descriptor_configuration_cb() callback
host: support device with multiple configurations
2025-03-24 22:55:04 +07:00
Ha Thach
cf76af1056
Merge pull request #3042 from rppicomidi/fix_3033
Fix #3033: Increase array bounds and test for overflow
2025-03-21 22:56:16 +07:00
rppicomidi
3324a327cb Fix #3033: address review comment 2025-03-21 07:14:10 -07:00
rppicomidi
b0def52f45 Move misplaced statement 2025-03-21 07:13:01 -07:00
hathach
e54753814b
enable hil dual for metro m4 with max3421 2025-03-21 00:11:18 +07:00
rppicomidi
4b46493cb4 Fix #3033: Increase array bounds and test for overflow 2025-03-20 06:27:23 -07:00
Ha Thach
c2924c51fc
Merge pull request #3032 from rppicomidi/fix_3031
Fix 3031: implement tuh_midi_itf_get_info()
2025-03-20 09:44:56 +07:00
rppicomidi
05e4f8b777 Move iInterface per review comment 2025-03-19 05:57:01 -07:00
rppicomidi
62f00bdf5d Fix compiler conversion error warning 2025-03-18 07:42:47 -07:00
rppicomidi
5ecea4eefe fix tuh_midi_itf_get_info() desc->iInterface value 2025-03-18 07:41:49 -07:00
rppicomidi
31b3a2f63b Fix 3031: implement tuh_midi_itf_get_info() 2025-03-17 07:41:51 -07:00
Ha Thach
40ddf0628a
Merge pull request #3038 from hathach/update-pio-usb
change pio-usb to upstream
2025-03-17 13:06:10 +07:00
Ha Thach
e0df20f260
change pio-usb to upstream 2025-03-17 12:20:49 +07:00
Ha Thach
e9a1be7e02
Merge pull request #3034 from hathach/ctrl_fix
Fix UAC ctrl buffer alignment.
2025-03-16 11:19:43 +07:00
HiFiPhile
585bcbfcdd Fix 2 IAR warnings.
Signed-off-by: HiFiPhile <admin@hifiphile.com>
2025-03-16 00:07:15 +01:00
HiFiPhile
de45e4b01a Add ctrl buffer alignment.
Signed-off-by: HiFiPhile <admin@hifiphile.com>
2025-03-15 23:49:11 +01:00
HiFiPhile
ca750313b2 Update gitignore.
Signed-off-by: HiFiPhile <admin@hifiphile.com>
2025-03-15 21:15:52 +01:00
Ha Thach
5333d042f9
Merge pull request #3029 from rppicomidi/fix_3028
Only clear stream_read & stream_write if they are defined
2025-03-14 16:25:54 +07:00
rppicomidi
b80800f182 Only clear stream_read & stream_write if they are defined 2025-03-13 10:04:56 -07:00
HiFiPhile
f01c4be350
Merge pull request #3020 from Cynventria/fix-desc_end-calculation-in-vendor-device-open
fix desc_end in vendord_open()
2025-03-11 22:59:56 +01:00
Cynventria[CitRA]
cf94b3f5fc
fix desc_end in vendord_open()
minor fix on calculation of desc_end in vendord_open( ) for descriptor prasing
2025-03-10 14:22:29 +08:00
Ha Thach
dc45903161
Merge pull request #3019 from hathach/fix-pico-examples-build
fix(rp2040) set RTOS as cmake cache to fix pico-example build
2025-03-10 12:18:22 +07:00
hathach
683b1e9702
fix(rp2040) set RTOS as cmake cache to fix pico-example build 2025-03-10 11:20:47 +07:00
Ha Thach
02a630b3da
Merge pull request #1627 from atoktoto/midihost
RP2040 MIDI Host
2025-03-09 19:01:10 +07:00
HiFiPhile
29ffd57237
Merge pull request #2990 from dauc/master
Add full/high speed compile flag for Microchip SAME70 examples
2025-03-08 11:57:41 +01:00
Darian Leung
8f288e96a8
refactor: Fix inline literal and code blocks in .rst documents
- Added missing inline literals (double backticks) to any reference of symbol
names and macros
- Added language specifier to "code-block" directives to enable syntax
highlighting when rendered.
2025-03-07 21:21:33 +08:00
Darian Leung
5342f1255a
fix: Turn various .rst files from symbolic links to proper files
"code_of_conduct.rst" and "contributors.rst" both contain RST include
directives, but their file types are symoblic links. This commit turns them
into proper files.
2025-03-07 21:19:58 +08:00
Ha Thach
334ac80726
Merge pull request #2937 from pschatzmann/rp2040-iso
rp2040 correct dcd_edpt_iso_activate
2025-03-07 10:03:58 +07:00
Ha Thach
fd3290cbd1
Merge pull request #3011 from hathach/fix-dwc2-host-conflict-max3421e
fix(dwc2) host driver conflict with max3421e
2025-03-07 10:00:03 +07:00
hathach
65e44e0a51
fix(dwc2) host driver conflict with max3421e 2025-03-06 22:46:21 +07:00
hathach
ee234a84ca
hack: force/overwrite endpoint mps to 64 for device that incorrectly report 512 bytes for bulk in fullspeed mode. 2025-03-06 11:03:47 +07:00
hathach
39e6375b74
midi host: skip rx data with all zeroes 2025-03-06 10:26:45 +07:00
hathach
102c1991d0
rp2040: abort transfer if active in iso_activate()
add hw_endpoint_abort_xfer()
2025-03-05 22:26:28 +07:00
hathach
3ea71b67b1
Merge branch 'master' into fork/pschatzmann/rp2040-iso 2025-03-05 22:25:58 +07:00
hathach
8c0c21189c
Merge branch 'master' into fork/atoktoto/midihost
# Conflicts:
#	src/host/usbh.c
2025-03-05 18:25:31 +07:00
Ha Thach
6bba41045a
Merge pull request #3008 from hathach/add-metro-rp2350
add adafruit metro rp2350
2025-03-05 17:53:45 +07:00
hathach
7dbad0a23e
add adafruit metro rp2350 2025-03-04 22:42:27 +07:00
Ha Thach
51cfae6e97
Merge pull request #3007 from hathach/fix-8bitdo-enum
Fix(host) enumeration with 8bitdo devices
2025-03-04 10:47:31 +07:00
hathach
5f447b76ad
- add tuh_descriptor_get_string_langid() API
- host enumeration always get language id, manufacturer, product and serial string. Which is required by some device such as 8bitdo
2025-03-03 23:22:23 +07:00
hathach
93ff3daa11
fix(hcd_rp2040) assert/panic endpoint already active: when a device reset while having on-going control transfer 2025-02-28 16:41:51 +07:00
Ha Thach
a29e11404d
Merge pull request #3005 from hathach/fix-rp2-picosdk-board
add missing board.h for BOARD=pico_sdk
2025-02-28 12:28:17 +07:00
hathach
c1df796a7c
add missing board.h for BOARD=pico_sdk 2025-02-28 12:04:54 +07:00
Ha Thach
72b1fc50e5
Merge pull request #3002 from espressif/fix/remove_deprecated_includes
fix(esp): Remove deprecated include
2025-02-27 21:15:16 +07:00
Tomas Rezucha
720697b6ae fix(esp): Remove deprecated include
soc/usb_pins.h header will be deprecated in IDF v6.0
2025-02-27 12:48:31 +01:00
hathach
d132044b75
add tuh_midi_mount_cb_t struct for tuh_midi_mount_cb()
change tuh_midi_rx/tx_cb() to have xferred_bytes
rename tuh_midi_get_num_rx/tx_cables() to tuh_midi_get_rx/tx_cable_count()
use default empty callback instead of weak null to be compatible with keil compiler
2025-02-24 16:05:31 +07:00
hathach
56e84bd1a6
add desc_audio_control to midi descriptor callback 2025-02-24 14:40:32 +07:00
hathach
8c70475c23
change API to take index instead of dev address, this allow to support more than 1 midi per device. 2025-02-24 12:39:02 +07:00
hathach
71e046d9ff
add tuh_midi_descriptor_cb() 2025-02-24 10:55:03 +07:00
hathach
b12c8a9012
remove CFG_MIDI_HOST_DEVSTRINGS support, we will leave that for application to parse/extract this information if needed
rename tuh_midi_configure() to mounted() for consistency
2025-02-21 17:31:13 +07:00
hathach
6ebd362cfd
Merge branch 'master' into fork/atoktoto/midihost
# Conflicts:
#	src/host/usbh.c
2025-02-21 10:59:40 +07:00
Ha Thach
1cfc88dbcb
Merge pull request #2994 from hathach/enhance-hub
Enhance hub driver
2025-02-21 10:36:52 +07:00
hathach
61aab7a86a
pio-usb now only need sysclk to be multiple of 12Mhz 2025-02-20 22:18:33 +07:00
hathach
cafc788508
change pio-usb to wip fork for testing 2025-02-20 16:16:07 +07:00
hathach
6572c1da0d
add fruitjam bsp 2025-02-20 15:47:29 +07:00
hathach
70ddb7a867
more hub improve, handle more failed transfer with polling interrupt status endpoint 2025-02-19 15:50:42 +07:00
hathach
27a4895b79
complete separate hub epbuf from itf
add hub_get_status(), hub_clear_feature()
2025-02-19 12:58:03 +07:00
hathach
48a43a675c
move status_change to epbuf
improve hub_xfer_cb()
rename internal complete function
2025-02-19 11:27:33 +07:00
hathach
792a446405
usbh always retry control transfer (max 3) in case of XFER_RESULT_FAILED.
added tuh_connected()
2025-02-17 22:40:19 +07:00
hathach
18d566b94c
improve hub: retry if hub interrupt endpoint failed
bump up pio-usb to latest
2025-02-17 17:06:51 +07:00
Devin Auclair
aa860041b8 Add full/high speed compile flag for Microchip SAME70 examples
Default is still high speed, but setting
SPEED=high|full work as expected.

`make BOARD=same70_xplained SPEED=full`

Tested with examples/device/cdc_msc

```preformatted
lsusb -v

...

  TinyUSB Device:

    Product ID: 0x4003
    Vendor ID: 0xcafe
    Version: 1.00
    Serial Number: 0123456789ABCDEF
    Speed: Up to 12 Mb/s   <------ full speed here
    Manufacturer: TinyUSB
    Location ID: 0x03142130 / 12
    Current Available (mA): 500
    Current Required (mA): 100
    Extra Operating Current (mA): 0
    Media:
      Mass Storage:
        Capacity: 8 KB (8,192 bytes)
        Removable Media: Yes
        BSD Name: disk5
        Logical Unit: 0
        Partition Map Type: Unknown
        S.M.A.R.T. status: Verified
        USB Interface: 2
```
2025-02-14 11:06:54 -05:00
hathach
997771fdba
- rename tuh_midi_stream_flush() to tuh_midi_write_flush()
- add tuh_midi_packet_read_n() and tuh_midi_packet_write_n()
- add CFG_TUH_MIDI_STREAM_API to opt out stream API
2025-02-14 16:21:48 +07:00
Ha Thach
9d2fd6c4ac
Merge pull request #2984 from HiFiPhile/preset
Add CMake presets.
2025-02-14 11:29:33 +07:00
hathach
31a2696de7
- change signature of tuh_midi_mount/umount_cb()
- rename midi_stream_t to midi_driver_stream_t and move to midi.h (common for device and host)
2025-02-14 11:25:50 +07:00
hathach
ed88fc983f
- remove tuh_midi_read_poll(), auto schedule EP in when set_config() and xfer_cb as well as ep read()
- de-dup tuh_midi_get_num_rx/tx_cables
- add tuh_midi_read_available()
2025-02-14 10:41:05 +07:00
hathach
bad6cbe489
update midi host to use endpoint stream API 2025-02-13 15:54:31 +07:00
hathach
e0b192b633
- use CFG_TUH_MIDI as number of midi host instance
- comment out tuh_descriptor_device_cb/tuh_desc_configuration_cb since it is unrelated to this PR
2025-02-12 22:16:08 +07:00
hathach
86d371fb79
more ci fix 2025-02-12 13:58:01 +07:00
hathach
7c405236cf
fix host midi build 2025-02-12 11:50:57 +07:00
hathach
294fb268d7
pre-commit fix 2025-02-12 11:39:26 +07:00
hathach
85247e50dd
clean up 2025-02-12 11:34:32 +07:00
hathach
87adc63226
Merge branch 'master' into fork/atoktoto/midihost
# Conflicts:
#	hw/bsp/rp2040/family.cmake
#	src/class/midi/midi.h
#	src/class/midi/midi_device.c
#	src/device/usbd_control.c
#	src/host/hcd.h
#	src/host/usbh.c
#	src/host/usbh.h
2025-02-12 11:28:16 +07:00
HiFiPhile
14f1feac84 Fix path.
Signed-off-by: HiFiPhile <admin@hifiphile.com>
2025-02-11 20:56:41 +01:00
Ha Thach
5afcfb7522
Merge pull request #2989 from hathach/rtos-house-keeping
Rtos house keeping
2025-02-11 22:54:57 +07:00
hathach
3560ed3d98
remove board_mcu.h 2025-02-11 21:55:28 +07:00
hathach
f1ce4918c2
update make to use FreeRTOSConfig in family instead of examples 2025-02-11 21:44:35 +07:00
hathach
5a39bcf79c
remove freeeRTOSConfig in examples 2025-02-11 21:19:09 +07:00
Ha Thach
bb48e6acc8
Merge pull request #2988 from hathach/update-iar-cloud-lms
update IAR LMS CLOUD
2025-02-11 21:18:16 +07:00
hathach
f23bef5fd8
update IAR LMS CLOUD 2025-02-11 20:30:07 +07:00
Ha Thach
457c2b55da
Merge pull request #2914 from ReimuNotMoe/master
Various fixes for the Microchip Chipidea FS driver
2025-02-11 16:50:44 +07:00
Ha Thach
24b2abbb05
Merge pull request #2982 from hathach/fix-stringop-overread-warning
fix stringop-overread warning for msc device with memmove
2025-02-10 13:47:52 +07:00
HiFiPhile
1208f88b6e Sort list (bettter for Clion)
Signed-off-by: HiFiPhile <admin@hifiphile.com>
2025-02-09 18:40:30 +01:00
HiFiPhile
09bce3532c Add CMake presets.
Signed-off-by: HiFiPhile <admin@hifiphile.com>
2025-02-09 00:25:38 +01:00
Ha Thach
35e9f03324
Merge pull request #2911 from jay94ks/styluspen
Adding Stylus-Pen Device Support.
2025-02-07 16:56:22 +07:00
hathach
a232644cbd
add full hid usage for Digitizer Page (0x0D), move thing around a bit. 2025-02-07 16:38:14 +07:00
hathach
cd0ca4832d
Merge branch 'refs/heads/master' into fork/jay94ks/styluspen 2025-02-07 16:37:51 +07:00
hathach
3ffe8dbfee
fix stringop-overread warning for msc device with memmove 2025-02-07 12:48:17 +07:00
Ha Thach
2a3025eaa5
Merge pull request #2976 from JannisKonradBecker/master
ch32v3 fs: signal bus speed
2025-02-06 20:40:51 +07:00
hathach
7df510ecc9
Merge branch 'master' into fork/JannisKonradBecker/master 2025-02-06 17:56:10 +07:00
Ha Thach
9c093a30f4
Merge pull request #2981 from hathach/skip-iar-forked-pr
skip iar build for forked PR
2025-02-06 17:49:18 +07:00
hathach
7282572a56
skip iar build for forked PR 2025-02-06 17:19:18 +07:00
Jannis Konrad
169d2d7a1f use speed enum 2025-02-06 08:50:25 +01:00
Ha Thach
99b6e97080
Merge pull request #2979 from hathach/fix-407blackvet
fix build for 407blackvet
2025-02-06 12:43:46 +07:00
hathach
efd2934919
fix build for 407blackvet 2025-02-06 12:19:29 +07:00
Jannis Konrad
f7fa4d0edb ch32v3 fs: signal bus speed 2025-02-05 17:36:38 +01:00
HiFiPhile
8d2310247c Fix CI.
Signed-off-by: HiFiPhile <admin@hifiphile.com>
2025-02-02 14:01:15 +01:00
HiFiPhile
2707347dec Update example.
Signed-off-by: HiFiPhile <admin@hifiphile.com>
2025-01-31 16:29:09 +01:00
HiFiPhile
84f8876c7c Use return code to choose async io.
Signed-off-by: HiFiPhile <admin@hifiphile.com>
2025-01-31 16:26:10 +01:00
HiFiPhile
abfbcf5ccc Update build.
Signed-off-by: HiFiPhile <admin@hifiphile.com>
2025-01-31 11:09:35 +01:00
HiFiPhile
b31036dede Merge remote-tracking branch 'upstream/master' into h7rs 2025-01-31 10:38:06 +01:00
HiFiPhile
a40722b221 Enable SIM_IO_TIME_MS for normal operation.
Signed-off-by: HiFiPhile <admin@hifiphile.com>
2025-01-29 17:21:11 +01:00
HiFiPhile
f43100bdfd cdc_msc_freertos: add async IO support.
Signed-off-by: HiFiPhile <admin@hifiphile.com>
2025-01-29 15:28:19 +01:00
HiFiPhile
04b9e20310 msc_disk: fix overflow check when EP buffer size > 512.
Signed-off-by: HiFiPhile <admin@hifiphile.com>
2025-01-29 15:20:44 +01:00
HiFiPhile
cc626f35d2 msc_device: add async IO support.
Signed-off-by: HiFiPhile <admin@hifiphile.com>
2025-01-29 15:16:02 +01:00
HiFiPhile
d1ee2bf18f Fix Auto speed display.
Signed-off-by: HiFiPhile <admin@hifiphile.com>
2025-01-29 15:14:25 +01:00
HiFiPhile
eca025f714
Merge pull request #2959 from ho-ho-ho/master
stm32: fix compilation error when not using uart
2025-01-27 20:23:52 +01:00
HiFiPhile
67f0d610e5
Merge branch 'master' into master 2025-01-27 19:27:47 +01:00
Ha Thach
0d4f945bdc
Merge pull request #2962 from hathach/zephyr-support
Initial Zephyr support
2025-01-26 00:24:25 +07:00
HiFiPhile
9cfa328261 Merge branch 'master' into h7rs 2025-01-25 18:04:00 +01:00
hathach
882cb1406d
update cmake.xml 2025-01-25 23:50:09 +07:00
hathach
7641060252
Merge branch 'master' into zephyr-support 2025-01-25 23:48:05 +07:00
Ha Thach
37e6f49619
Merge pull request #2964 from hathach/fix-2939
fix bug introduced by 2939, with correct offset check logic
2025-01-25 23:46:06 +07:00
hathach
f6f02f1893
correct offset check logic 2025-01-25 23:07:34 +07:00
hathach
8c7998b0e9
fix ci 2025-01-25 22:24:00 +07:00
hathach
6b3a5957c2
cmake remove EXAMPLE-tinyusb target as library 2025-01-25 16:08:40 +07:00
hathach
dc514c6230
use board alias for pca10056 2025-01-25 15:12:57 +07:00
hathach
1003aba690
use board alias for pca10056 2025-01-25 12:39:08 +07:00
hathach
13856af935
add -DRTOS=zephyr to ci west build 2025-01-25 12:19:24 +07:00
HiFiPhile
979d790959 Fix CI.
Signed-off-by: HiFiPhile <admin@hifiphile.com>
2025-01-24 17:17:06 +01:00
HiFiPhile
f6f20e17ab Add NUCLEO-H7S3L8 BSP.
Signed-off-by: HiFiPhile <admin@hifiphile.com>
2025-01-24 16:56:40 +01:00
hathach
b53801a8ac
add cmake RTOS=zephyr (default noos) for zephyr build 2025-01-24 15:06:05 +07:00
hathach
201b9707b9
try build zephyr with ci 2025-01-24 11:54:42 +07:00
hohoho
5ca3822830 stm32: fix conditional compilation error when not using uart 2025-01-23 19:56:57 +01:00
hathach
9f45e25b1c
msc_dual_lun and cdc_msc work with zephyr on pca10056 2025-01-24 00:39:48 +07:00
hathach
0162d6ab32
kind of work with zephyr with pca10056 with cmake -DBUILD_ZEPHYR 2025-01-23 17:35:05 +07:00
hathach
31071ccf0e
kind of work with zephyr with pca10056 with cmake -DBUILD_ZEPHYR 2025-01-23 17:10:48 +07:00
HiFiPhile
597446fbea
Merge pull request #2939 from PwnVerse/patch-1
Fix potential out of bounds access in msc_disk.c
2025-01-22 23:48:57 +01:00
HiFiPhile
6d1ed1ed86 Update deps.
Signed-off-by: HiFiPhile <admin@hifiphile.com>
2025-01-22 22:40:01 +01:00
HiFiPhile
19d28a9d15 Fix also cdc_msc example. 2025-01-22 21:24:14 +01:00
HiFiPhile
bd08753583 Fix CI. 2025-01-22 21:22:32 +01:00
HiFiPhile
586d284e6b
Merge branch 'master' into patch-1 2025-01-22 21:19:19 +01:00
HiFiPhile
feb41eeceb
Merge pull request #2950 from espressif/fix/ncm_buffer_validation
fix(ncm): Return invalid NTBs to free list
2025-01-22 21:02:35 +01:00
hathach
6080f89f3d
- change to use CMAKE_SYSTEM_CPU to prevent CMAKE_SYSTEM_PROCESSOR conflict with zephyr
- change tinyusb CMakeLists.txt to function tinyusb_target_add() instead of defining tinyusb lib target
2025-01-22 22:31:08 +07:00
hathach
91214b4614
zephyr 2025-01-21 16:28:29 +07:00
hathach
c8130afe9b
bump up cmake min to 3.20 2025-01-21 16:28:26 +07:00
Ha Thach
2d7d1070fc
Merge pull request #2955 from hathach/fix-dwc2-issue
Work around for esp32s3 racing/timing issue with macos
2025-01-21 00:09:51 +07:00
hathach
786aa2cd1c
use IAR toke for hfp runner since normal IAR license is expired 2025-01-20 23:45:57 +07:00
hathach
5b32df5abd
add s3 undefined speed note for racing issue with reset.
fix dcd_event_sof() with frame number
2025-01-20 22:47:32 +07:00
hathach
2109b801d4
update esp-idf to 5.3.2 2025-01-16 11:56:19 +07:00
Tomas Rezucha
6476ff1241 fix(ncm): Return invalid NTBs to free list
In case we received invalid datagram, we silently fail
a the buffer was not returned to empty list -> it was lost.
If this happened more than CFG_TUD_NCM_OUT_NTB_N times, we run out of
NTBs and all OUT transfers are NACKed.

Closes https://github.com/espressif/esp-usb/issues/107
2025-01-15 19:16:58 +01:00
pschatzmann
b91d5ebb45 rp2040 correct dcd_edpt_iso_activate 2025-01-15 10:18:16 +01:00
HiFiPhile
880aae4be2
Merge pull request #2947 from espressif/fix/ncm_buffer_checks
fix(ncm): Use IN buffer for transmit checks
2025-01-15 10:16:16 +01:00
Dan Halbert
76fe0393ed src/class/hid/hid_host.c: fix logging calls for epbuf 2025-01-15 14:54:49 +07:00
Ha Thach
e889c0b51e
Fix ceedling (#2949)
* fixed unit test with ceedling 1.0.0
2025-01-15 14:53:13 +07:00
Tomas Rezucha
679065c3d6
fix(ncm): Use IN buffer for transmit checks 2025-01-14 16:56:24 +01:00
Ritvik
19b6baa455
Fix potential out of bounds access in msc_disk.c 2025-01-09 15:40:21 -05:00
Ha Thach
2495563600
Merge pull request #2917 from hathach/board-doc
update docs, embed metadata to family.c and board.h
2024-12-27 21:24:36 +07:00
hathach
de38e53271
update docs, remove uses.rst, structure.rst. Refactor docs, use README.rst for docs index.rst 2024-12-27 17:48:45 +07:00
hathach
29f226c2fb
docs index.rst pointed to README.rst 2024-12-27 15:27:04 +07:00
hathach
824793a428
move mcu supported to README.rst, separated supported boards to boards.rst 2024-12-27 11:34:35 +07:00
hathach
6a36c74b10
embed metadata to family.c and board.h to generate supported boards doc 2024-12-27 09:11:09 +07:00
Reimu NotMoe
655092d568 dcd_pic: check USBBUSY bit on PIC32s 2024-12-27 04:17:26 +08:00
Reimu NotMoe
a4169114ec dcd_pic: let the user manage shared GPIO/VBUS pin 2024-12-27 01:16:15 +08:00
Reimu NotMoe
6e11406831 dcd_pic: handle EP0 timeout/stall correctly 2024-12-27 01:16:15 +08:00
Reimu NotMoe
0192b2a9b0 dcd_pic: implement dcd_deinit() 2024-12-27 00:59:45 +08:00
Reimu NotMoe
f409472998 dcd_pic: handle remote wakeup more correctly 2024-12-27 00:57:22 +08:00
Reimu NotMoe
8907a817a2 dcd_pic: handle bus resume correctly 2024-12-27 00:50:32 +08:00
Reimu NotMoe
99e6b32a7d dcd_pic: change license header and credit people accordingly 2024-12-27 00:36:42 +08:00
Reimu NotMoe
8022477031 dcd_pic: add readme 2024-12-27 00:36:31 +08:00
Jay
5c4e4b1bc2 modified invalid marked unit exponent. 2024-12-23 22:26:08 +09:00
Jay
eb1c2b83ef trimed trailing whitespaces. 2024-12-23 22:19:35 +09:00
Jay
b029c94035 Modified example app. 2024-12-23 22:15:01 +09:00
Jay
7e59b595f4 Update hid_device.h 2024-12-23 22:09:59 +09:00
Jay
15b1623aa3 add hid stylus pen device.
this works with android, for bypassing that absmouse does not support android.
note that, to hide cursor on android for every touch signal, find cursor option in android settings menu.

references:
1. https://stackoverflow.com/questions/28536602/hid-digitizer-descriptor-doesnt-perform-well-with-landscape-orientation
2. https://github.com/jonathanedgecombe/absmouse/blob/master/src/AbsMouse.cpp
2024-12-23 22:03:37 +09:00
IngHK
f00e698ae2 Merge remote-tracking branch 'remotes/hathach/master' into cdch_upgrade 2024-04-04 14:17:17 +02:00
IngHK
0c5e14cdaa updated doc 2024-04-04 14:16:39 +02:00
IngHK
68602e4add small change process config complete 2024-04-04 14:16:02 +02:00
IngHK
e02a309f1d disable PL2303 flow control config 2024-04-04 14:14:41 +02:00
IngHK
a1b1c1f552 foxed FTDI flow control config 2024-04-04 14:13:24 +02:00
IngHK
e07ee4a7b1 CP210x removed baudrate check, fixed data bits check 2024-04-04 14:12:14 +02:00
IngHK
5e67b92b8c fixed compile warnings 2024-04-04 14:10:31 +02:00
IngHK
e2a5630811 Merge remote-tracking branch 'remotes/hathach/master' into cdch_upgrade 2024-04-04 14:07:32 +02:00
IngHK
1bbd658352 Merge remote-tracking branch 'remotes/hathach/master' into work 2024-03-21 08:30:49 +01:00
IngHK
cb69ed0d04 code style and clean up CDC serial header files 2024-03-21 08:29:28 +01:00
IngHK
2786a61e8b fixed FTDI set control line 2024-03-10 08:21:11 +01:00
IngHK
ee92e582b3 added defines CFG_TUH_CDC_DTR_CONTROL_ON_ENUM & CFG_TUH_CDC_RTS_CONTROL_ON_ENUM 2024-03-10 08:20:30 +01:00
IngHK
a9cc07fc83 added line control function using cdc_line_control_state_t 2024-03-10 08:20:12 +01:00
IngHK
e0551043ca added use of cdc_line_control_state_t type in CDCh 2024-03-10 08:15:06 +01:00
IngHK
dea27d28bc added explicite (uint16_t) casts inside tu_htole16() 2024-03-10 08:14:00 +01:00
IngHK
e6d27b6d3e fixed IAR compile error 2024-03-10 08:13:22 +01:00
IngHK
e7308e313a improved TU_LOGs 2024-02-29 10:46:29 +01:00
IngHK
3cf9cb98e6 small PL2303 improvements 2024-02-29 10:46:29 +01:00
IngHK
edf1320391 removed expendable ACM check 2024-02-29 10:46:28 +01:00
IngHK
d3d61da038 improved & fixed compiler warnings device descriptor handling 2024-02-29 10:46:28 +01:00
IngHK
f97e31226a FTDI fixed itf_num and some improvement 2024-02-29 10:46:28 +01:00
IngHK
7f7576fa62 Merge remote-tracking branch 'remotes/hathach/master' into cdch_upgrade 2024-02-29 10:45:58 +01:00
IngHK
af5e75c394 Merge remote-tracking branch 'remotes/hathach/master' into cdch_upgrade 2024-02-24 13:03:51 +01:00
IngHK
46a861b0e3 improved PL2303 TU_LOGs 2024-02-24 13:01:58 +01:00
IngHK
da93fcfc6d improved TU_LOGs 2024-02-24 13:01:58 +01:00
IngHK
2b507dba4d small changes & code style 2024-02-24 13:01:38 +01:00
IngHK
ea175a78aa updated contribution, readme and some comments 2024-02-24 13:00:46 +01:00
IngHK
aabee25e18 added PL2303 support 2024-02-24 12:58:59 +01:00
IngHK
4547737833 improved CP210x support 2024-02-24 12:58:59 +01:00
IngHK
7fef5943ef improved FTDI support 2024-02-24 12:58:45 +01:00
IngHK
0b5f85eee0 created set_line_coding_sequence() and void set_line_coding_stage1_complete() to be reused by FTDI & CP210x 2024-02-24 12:57:54 +01:00
IngHK
db511fb2f3 fixed CFG_TUH_CDC_LINE_CONTROL_ON_ENUM handling. only set if defined. value 0 is also valid 2024-02-24 12:57:54 +01:00
IngHK
138567af3e fixed #2448 CH34x ch34x_set_line_coding() callback bug 2024-02-24 12:57:54 +01:00
IngHK
22a12c7668 improved ACM checks 2024-02-24 12:57:54 +01:00
IngHK
ea86bbe5f7 added continue enum after config fail 2024-02-24 12:57:53 +01:00
IngHK
dcadf8c2a2 created set_function_call() 2024-02-24 12:57:53 +01:00
IngHK
7dd435cb87 changed to use of p_cdc->requested_line_state 2024-02-24 12:57:53 +01:00
IngHK
2f50f5a426 changed to use of p_cdc->requested_line_coding 2024-02-24 12:57:53 +01:00
IngHK
829ea52873 splitted cdch_internal_control_complete() into driver's _internal_control_complete() and moved them into driver's sections. no functional change 2024-02-24 12:57:39 +01:00
IngHK
47777a6305 improved TU_LOGs 2024-02-23 23:35:59 +01:00
IngHK
069c68ad04 sorted driver functions into Control Request, Driver API, Enumeration and Helper. no functional changes 2024-02-23 23:27:38 +01:00
IngHK
ab6b9e3a5c Merge remote-tracking branch 'remotes/hathach/master' into cdch_upgrade 2024-02-22 21:06:14 +01:00
IngHK
b9c44eea76 improved tusb_config.h comment 2024-02-13 14:14:54 +01:00
Andrzej Tokarski
b41f5eadb3
Merge branch 'master' into midihost 2022-11-21 21:45:10 +01:00
atoktoto
89eac75085 Explicit type conversion 2022-11-21 13:49:43 +01:00
atoktoto
3ba0311078 Explicit type conversion 2022-11-21 12:36:50 +01:00
atoktoto
34729b1dc4 Fix usb-hub data transfer problems by AndrewCapon 2022-11-21 10:29:26 +01:00
Andrzej Tokarski
375e822770
Merge branch 'hathach:master' into midihost 2022-11-19 18:15:00 +01:00
atoktoto
0a844f2a30 Fix usb hubs 2022-11-19 18:08:31 +01:00
atoktoto
21e003af22 Added explicit conversions 2022-11-13 14:38:33 +01:00
atok
a6d4b64bec Removed unused function prototype 2022-11-13 14:31:12 +01:00
atok
c14e3e2501 Fix unused errors when LOG=0 2022-11-13 14:31:12 +01:00
atok
0763bc5979 Fix printf statement 2022-11-13 14:31:12 +01:00
atok
81de7f3d23 Add Makefile for the midi host example 2022-11-13 14:31:12 +01:00
atok
19563b4414 Simple MIDI rx example 2022-11-13 14:31:12 +01:00
atok
4fbf99621d Get rid of implicit uint conversions 2022-11-13 14:30:53 +01:00
rppicomidi
3325e2613d Make USB MIDI device code allow a device with no Audio Control interface 2022-11-13 14:29:16 +01:00
rppicomidi
70eefcb849 Add hooks to allow cloning an attached USB device descriptor 2022-11-13 14:29:16 +01:00
rppicomidi
2ddd74fada Add MIDI host support to tinyusb 2022-11-13 14:29:16 +01:00
1009 changed files with 27844 additions and 34392 deletions

View File

@ -19,13 +19,12 @@ jobs:
echo "MATRIX_JSON=$MATRIX_JSON" echo "MATRIX_JSON=$MATRIX_JSON"
BUILDSYSTEM_TOOLCHAIN=( BUILDSYSTEM_TOOLCHAIN=(
"cmake aarch64-gcc"
"cmake arm-clang" "cmake arm-clang"
"make aarch64-gcc" "cmake arm-gcc"
"make arm-gcc"
"make msp430-gcc"
"make riscv-gcc"
"make rx-gcc"
"cmake esp-idf" "cmake esp-idf"
"cmake msp430-gcc"
"cmake riscv-gcc"
) )
# only build IAR if not forked PR, since IAR token is not shared # only build IAR if not forked PR, since IAR token is not shared
@ -67,7 +66,7 @@ jobs:
FAMILY_LARGE=$(jq -n --argjson family "$FAMILY" --argjson resource "$RESOURCE_LARGE" '$family | map(select(IN($resource[])))') FAMILY_LARGE=$(jq -n --argjson family "$FAMILY" --argjson resource "$RESOURCE_LARGE" '$family | map(select(IN($resource[])))')
FAMILY=$(jq -n --argjson family "$FAMILY" --argjson resource "$RESOURCE_LARGE" '$family | map(select(IN($resource[]) | not))') FAMILY=$(jq -n --argjson family "$FAMILY" --argjson resource "$RESOURCE_LARGE" '$family | map(select(IN($resource[]) | not))')
if [[ $toolchain == esp-idf ]]; then if [[ $toolchain == esp-idf || $toolchain == arm-iar ]]; then
gen_build_entry "$build_system" "$toolchain" "$FAMILY" "large" gen_build_entry "$build_system" "$toolchain" "$FAMILY" "large"
else else
gen_build_entry "$build_system" "$toolchain" "$FAMILY" "medium+" gen_build_entry "$build_system" "$toolchain" "$FAMILY" "medium+"

View File

@ -10,17 +10,7 @@ commands:
- run: - run:
name: Set toolchain url and key name: Set toolchain url and key
command: | command: |
TOOLCHAIN_JSON='{ toolchain_url=$(jq -r '."<< parameters.toolchain >>"' .github/actions/setup_toolchain/toolchain.json)
"aarch64-gcc": "https://developer.arm.com/-/media/Files/downloads/gnu-a/10.3-2021.07/binrel/gcc-arm-10.3-2021.07-x86_64-aarch64-none-elf.tar.xz",
"arm-clang": "https://github.com/ARM-software/LLVM-embedded-toolchain-for-Arm/releases/download/release-19.1.1/LLVM-ET-Arm-19.1.1-Linux-x86_64.tar.xz",
"arm-gcc": "https://github.com/xpack-dev-tools/arm-none-eabi-gcc-xpack/releases/download/v13.2.1-1.1/xpack-arm-none-eabi-gcc-13.2.1-1.1-linux-x64.tar.gz",
"msp430-gcc": "http://software-dl.ti.com/msp430/msp430_public_sw/mcu/msp430/MSPGCC/9_2_0_0/export/msp430-gcc-9.2.0.50_linux64.tar.bz2",
"riscv-gcc": "https://github.com/xpack-dev-tools/riscv-none-elf-gcc-xpack/releases/download/v13.2.0-2/xpack-riscv-none-elf-gcc-13.2.0-2-linux-x64.tar.gz",
"rx-gcc": "https://github.com/hathach/rx_device/releases/download/0.0.1/gcc-8.3.0.202411-GNURX-ELF.run",
"arm-iar": "https://updates.iar.com/FileStore/STANDARD/001/003/322/cxarm-9.60.3.deb"
}'
toolchain_url=$(echo $TOOLCHAIN_JSON | jq -r '.["<< parameters.toolchain >>"]')
# only cache if not a github link # only cache if not a github link
if [[ $toolchain_url != "https://github.com"* ]]; then if [[ $toolchain_url != "https://github.com"* ]]; then
echo "<< parameters.toolchain >>-$toolchain_url" > toolchain_key echo "<< parameters.toolchain >>-$toolchain_url" > toolchain_key
@ -114,7 +104,7 @@ commands:
name: Build name: Build
command: | command: |
if [ << parameters.toolchain >> == esp-idf ]; then if [ << parameters.toolchain >> == esp-idf ]; then
docker run --rm -v $PWD:/project -w /project espressif/idf:v5.3.1 python tools/build.py << parameters.family >> docker run --rm -v $PWD:/project -w /project espressif/idf:v5.3.2 python tools/build.py << parameters.family >>
else else
# Toolchain option default is gcc # Toolchain option default is gcc
if [ << parameters.toolchain >> == arm-clang ]; then if [ << parameters.toolchain >> == arm-clang ]; then

View File

@ -22,10 +22,17 @@ body:
validations: validations:
required: true required: true
- type: input
attributes:
label: Commit SHA
placeholder: e.g 3a042b37da28d0ba1e5593eb1068ca5645d77b56 or version bundled by esp-idf or pico-sdk
validations:
required: true
- type: input - type: input
attributes: attributes:
label: Board label: Board
placeholder: e.g Feather nRF52840 Express placeholder: e.g Adafruit Feather nRF52840 Express
validations: validations:
required: true required: true

View File

@ -4,9 +4,6 @@ inputs:
toolchain: toolchain:
description: 'Toolchain name' description: 'Toolchain name'
required: true required: true
toolchain_version:
description: 'Toolchain version'
required: false
outputs: outputs:
build_option: build_option:
@ -20,30 +17,21 @@ runs:
if: inputs.toolchain == 'arm-gcc' if: inputs.toolchain == 'arm-gcc'
uses: carlosperate/arm-none-eabi-gcc-action@v1 uses: carlosperate/arm-none-eabi-gcc-action@v1
with: with:
release: '13.2.Rel1' release: '14.2.Rel1'
- name: Pull ESP-IDF docker - name: Pull ESP-IDF docker
if: inputs.toolchain == 'esp-idf' if: inputs.toolchain == 'esp-idf'
uses: ./.github/actions/setup_toolchain/espressif uses: ./.github/actions/setup_toolchain/espressif
with: with:
toolchain: ${{ inputs.toolchain }} toolchain: ${{ inputs.toolchain }}
toolchain_version: ${{ inputs.toolchain_version }}
- name: Get Toolchain URL - name: Get Toolchain URL
if: >- if: >-
inputs.toolchain != 'arm-gcc' && inputs.toolchain != 'arm-gcc' &&
inputs.toolchain != 'arm-iar' &&
inputs.toolchain != 'esp-idf' inputs.toolchain != 'esp-idf'
id: set-toolchain-url id: set-toolchain-url
run: | run: |
TOOLCHAIN_JSON='{ TOOLCHAIN_URL=$(jq -r '."${{ inputs.toolchain }}"' .github/actions/setup_toolchain/toolchain.json)
"aarch64-gcc": "https://developer.arm.com/-/media/Files/downloads/gnu-a/10.3-2021.07/binrel/gcc-arm-10.3-2021.07-x86_64-aarch64-none-elf.tar.xz",
"arm-clang": "https://github.com/ARM-software/LLVM-embedded-toolchain-for-Arm/releases/download/release-19.1.1/LLVM-ET-Arm-19.1.1-Linux-x86_64.tar.xz",
"msp430-gcc": "http://software-dl.ti.com/msp430/msp430_public_sw/mcu/msp430/MSPGCC/9_2_0_0/export/msp430-gcc-9.2.0.50_linux64.tar.bz2",
"riscv-gcc": "https://github.com/xpack-dev-tools/riscv-none-elf-gcc-xpack/releases/download/v13.2.0-2/xpack-riscv-none-elf-gcc-13.2.0-2-linux-x64.tar.gz",
"rx-gcc": "https://github.com/hathach/rx_device/releases/download/0.0.1/gcc-8.3.0.202411-GNURX-ELF.run"
}'
TOOLCHAIN_URL=$(echo $TOOLCHAIN_JSON | jq -r '.["${{ inputs.toolchain }}"]')
echo "toolchain_url=$TOOLCHAIN_URL" echo "toolchain_url=$TOOLCHAIN_URL"
echo "toolchain_url=$TOOLCHAIN_URL" >> $GITHUB_OUTPUT echo "toolchain_url=$TOOLCHAIN_URL" >> $GITHUB_OUTPUT
shell: bash shell: bash
@ -51,7 +39,6 @@ runs:
- name: Download Toolchain - name: Download Toolchain
if: >- if: >-
inputs.toolchain != 'arm-gcc' && inputs.toolchain != 'arm-gcc' &&
inputs.toolchain != 'arm-iar' &&
inputs.toolchain != 'esp-idf' inputs.toolchain != 'esp-idf'
uses: ./.github/actions/setup_toolchain/download uses: ./.github/actions/setup_toolchain/download
with: with:

View File

@ -23,17 +23,25 @@ runs:
if: steps.cache-toolchain-download.outputs.cache-hit != 'true' if: steps.cache-toolchain-download.outputs.cache-hit != 'true'
run: | run: |
mkdir -p ~/cache/${{ inputs.toolchain }} mkdir -p ~/cache/${{ inputs.toolchain }}
wget --progress=dot:giga ${{ inputs.toolchain_url }} -O toolchain.tar.gz
if [[ ${{ inputs.toolchain }} == rx-gcc ]]; then if [[ ${{ inputs.toolchain }} == rx-gcc ]]; then
mv toolchain.tar.gz toolchain.run wget --progress=dot:giga ${{ inputs.toolchain_url }} -O toolchain.run
chmod +x toolchain.run chmod +x toolchain.run
./toolchain.run -p ~/cache/${{ inputs.toolchain }}/gnurx -y ./toolchain.run -p ~/cache/${{ inputs.toolchain }}/gnurx -y
elif [[ ${{ inputs.toolchain }} == arm-iar ]]; then
wget --progress=dot:giga ${{ inputs.toolchain_url }} -O ~/cache/${{ inputs.toolchain }}/cxarm.deb
else else
wget --progress=dot:giga ${{ inputs.toolchain_url }} -O toolchain.tar.gz
tar -C ~/cache/${{ inputs.toolchain }} -xaf toolchain.tar.gz tar -C ~/cache/${{ inputs.toolchain }} -xaf toolchain.tar.gz
fi fi
shell: bash shell: bash
- name: Set Toolchain Path - name: Setup Toolchain
run: | run: |
echo >> $GITHUB_PATH `echo ~/cache/${{ inputs.toolchain }}/*/bin` if [[ ${{ inputs.toolchain }} == arm-iar ]]; then
sudo apt-get install -y ~/cache/${{ inputs.toolchain }}/cxarm.deb
echo >> $GITHUB_PATH "/opt/iar/cxarm/arm/bin"
else
echo >> $GITHUB_PATH `echo ~/cache/${{ inputs.toolchain }}/*/bin`
fi
shell: bash shell: bash

View File

@ -6,7 +6,8 @@ inputs:
required: true required: true
toolchain_version: toolchain_version:
description: 'Toolchain version' description: 'Toolchain version'
required: true required: false
default: 'v5.3.2'
runs: runs:
using: "composite" using: "composite"
@ -39,3 +40,9 @@ runs:
du -sh $DOCKER_ESP_IDF du -sh $DOCKER_ESP_IDF
docker load --input $DOCKER_ESP_IDF docker load --input $DOCKER_ESP_IDF
shell: bash shell: bash
- name: Tag Local Image
run: |
docker tag espressif/idf:${{ inputs.toolchain_version }} espressif/idf:tinyusb
docker images
shell: bash

View File

@ -0,0 +1,9 @@
{
"aarch64-gcc": "https://developer.arm.com/-/media/Files/downloads/gnu-a/10.3-2021.07/binrel/gcc-arm-10.3-2021.07-x86_64-aarch64-none-elf.tar.xz",
"arm-clang": "https://github.com/ARM-software/LLVM-embedded-toolchain-for-Arm/releases/download/release-19.1.1/LLVM-ET-Arm-19.1.1-Linux-x86_64.tar.xz",
"arm-gcc": "https://github.com/xpack-dev-tools/arm-none-eabi-gcc-xpack/releases/download/v14.2.1-1.1/xpack-arm-none-eabi-gcc-14.2.1-1.1-linux-x64.tar.gz",
"msp430-gcc": "http://software-dl.ti.com/msp430/msp430_public_sw/mcu/msp430/MSPGCC/9_2_0_0/export/msp430-gcc-9.2.0.50_linux64.tar.bz2",
"riscv-gcc": "https://github.com/xpack-dev-tools/riscv-none-elf-gcc-xpack/releases/download/v13.2.0-2/xpack-riscv-none-elf-gcc-13.2.0-2-linux-x64.tar.gz",
"rx-gcc": "https://github.com/hathach/rx_device/releases/download/0.0.1/gcc-8.3.0.202411-GNURX-ELF.run",
"arm-iar": "https://netstorage.iar.com/FileStore/STANDARD/001/003/583/cxarm-9.60.4.deb"
}

View File

@ -8,8 +8,8 @@ on:
- 'examples/**' - 'examples/**'
- 'lib/**' - 'lib/**'
- 'hw/**' - 'hw/**'
- 'tools/get_deps.py'
- 'tools/build.py' - 'tools/build.py'
- 'tools/get_deps.py'
- '.github/actions/**' - '.github/actions/**'
- '.github/workflows/build.yml' - '.github/workflows/build.yml'
- '.github/workflows/build_util.yml' - '.github/workflows/build_util.yml'
@ -21,8 +21,9 @@ on:
- 'examples/**' - 'examples/**'
- 'lib/**' - 'lib/**'
- 'hw/**' - 'hw/**'
- 'tools/get_deps.py' - 'test/hil/**'
- 'tools/build.py' - 'tools/build.py'
- 'tools/get_deps.py'
- '.github/actions/**' - '.github/actions/**'
- '.github/workflows/build.yml' - '.github/workflows/build.yml'
- '.github/workflows/build_util.yml' - '.github/workflows/build_util.yml'
@ -31,11 +32,15 @@ concurrency:
group: ${{ github.workflow }}-${{ github.ref }} group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true cancel-in-progress: true
env:
HIL_JSON: test/hil/tinyusb.json
jobs: jobs:
set-matrix: set-matrix:
runs-on: ubuntu-latest runs-on: ubuntu-latest
outputs: outputs:
json: ${{ steps.set-matrix-json.outputs.matrix }} json: ${{ steps.set-matrix-json.outputs.matrix }}
hil_json: ${{ steps.set-matrix-json.outputs.hil_matrix }}
steps: steps:
- name: Checkout TinyUSB - name: Checkout TinyUSB
uses: actions/checkout@v4 uses: actions/checkout@v4
@ -43,33 +48,41 @@ jobs:
- name: Generate matrix json - name: Generate matrix json
id: set-matrix-json id: set-matrix-json
run: | run: |
# build matrix
MATRIX_JSON=$(python .github/workflows/ci_set_matrix.py) MATRIX_JSON=$(python .github/workflows/ci_set_matrix.py)
echo "matrix=$MATRIX_JSON" echo "matrix=$MATRIX_JSON"
echo "matrix=$MATRIX_JSON" >> $GITHUB_OUTPUT echo "matrix=$MATRIX_JSON" >> $GITHUB_OUTPUT
# hil matrix
HIL_MATRIX_JSON=$(python test/hil/hil_ci_set_matrix.py ${{ env.HIL_JSON }})
echo "hil_matrix=$HIL_MATRIX_JSON"
echo "hil_matrix=$HIL_MATRIX_JSON" >> $GITHUB_OUTPUT
# --------------------------------------- # ---------------------------------------
# Build CMake # Build CMake: only build on push with one-per-family.
# Full built is done by CircleCI in PR
# --------------------------------------- # ---------------------------------------
cmake: cmake:
if: github.event_name == 'push'
needs: set-matrix needs: set-matrix
uses: ./.github/workflows/build_util.yml uses: ./.github/workflows/build_util.yml
strategy: strategy:
fail-fast: false fail-fast: false
matrix: matrix:
toolchain: toolchain:
# - 'arm-clang' is built by circle-ci in PR
- 'aarch64-gcc' - 'aarch64-gcc'
#- 'arm-clang'
- 'arm-gcc' - 'arm-gcc'
- 'esp-idf'
- 'msp430-gcc' - 'msp430-gcc'
- 'riscv-gcc' - 'riscv-gcc'
with: with:
build-system: 'cmake' build-system: 'cmake'
toolchain: ${{ matrix.toolchain }} toolchain: ${{ matrix.toolchain }}
build-args: ${{ toJSON(fromJSON(needs.set-matrix.outputs.json)[matrix.toolchain]) }} build-args: ${{ toJSON(fromJSON(needs.set-matrix.outputs.json)[matrix.toolchain]) }}
one-per-family: ${{ github.event_name == 'push' }} one-per-family: true
# --------------------------------------- # ---------------------------------------
# Build Make (built by circle-ci in PR, only build on push here) # Build Make: only build on push with one-per-family
# --------------------------------------- # ---------------------------------------
make: make:
if: github.event_name == 'push' if: github.event_name == 'push'
@ -79,19 +92,40 @@ jobs:
fail-fast: false fail-fast: false
matrix: matrix:
toolchain: toolchain:
# 'arm-clang'
- 'arm-gcc'
- 'aarch64-gcc' - 'aarch64-gcc'
#- 'arm-clang'
- 'arm-gcc'
- 'msp430-gcc' - 'msp430-gcc'
- 'riscv-gcc' - 'riscv-gcc'
- 'rx-gcc' - 'rx-gcc'
- 'esp-idf' # build-system is ignored
with: with:
build-system: 'make' build-system: 'make'
toolchain: ${{ matrix.toolchain }} toolchain: ${{ matrix.toolchain }}
build-args: ${{ toJSON(fromJSON(needs.set-matrix.outputs.json)[matrix.toolchain]) }} build-args: ${{ toJSON(fromJSON(needs.set-matrix.outputs.json)[matrix.toolchain]) }}
one-per-family: true one-per-family: true
# ---------------------------------------
# Build IAR
# Since IAR Token secret is not passed to forked PR, only build non-forked PR with make.
# cmake is built by circle-ci. Due to IAR limit capacity, only build oe per family
# ---------------------------------------
arm-iar:
if: false # disable for now since we got reach capacity limit too often
#if: github.event_name == 'push' && github.repository_owner == 'hathach'
needs: set-matrix
uses: ./.github/workflows/build_util.yml
secrets: inherit
strategy:
fail-fast: false
matrix:
build-system:
- 'make'
with:
build-system: ${{ matrix.build-system }}
toolchain: 'arm-iar'
build-args: ${{ toJSON(fromJSON(needs.set-matrix.outputs.json)['arm-iar']) }}
one-per-family: true
# --------------------------------------- # ---------------------------------------
# Build Make on Windows/MacOS # Build Make on Windows/MacOS
# --------------------------------------- # ---------------------------------------
@ -110,15 +144,59 @@ jobs:
one-per-family: true one-per-family: true
# --------------------------------------- # ---------------------------------------
# Build IAR on HFP self-hosted # Zephyr
# --------------------------------------- # ---------------------------------------
arm-iar: zephyr:
if: github.repository_owner == 'hathach' && github.event_name == 'push' if: github.event_name == 'push'
runs-on: ubuntu-latest
steps:
- name: Checkout TinyUSB
uses: actions/checkout@v4
- name: Setup Zephyr project
uses: zephyrproject-rtos/action-zephyr-setup@v1
with:
app-path: examples
toolchains: arm-zephyr-eabi
- name: Build
run: |
west build -b pca10056 -d examples/device/cdc_msc/build examples/device/cdc_msc -- -DRTOS=zephyr
west build -b pca10056 -d examples/device/msc_dual_lun/build examples/device/msc_dual_lun -- -DRTOS=zephyr
# ---------------------------------------
# Hardware in the loop (HIL)
# Run on PR only (hil-tinyusb), hil-hfp only run on non-forked PR
# ---------------------------------------
hil-build:
if: |
github.repository_owner == 'hathach' &&
(github.event_name == 'pull_request' || github.event_name == 'workflow_dispatch')
needs: set-matrix needs: set-matrix
runs-on: [self-hosted, Linux, X64, hifiphile] uses: ./.github/workflows/build_util.yml
env: strategy:
BUILD_ARGS: ${{ join(fromJSON(needs.set-matrix.outputs.json)['arm-iar'], ' ') }} fail-fast: false
# IAR_LMS_BEARER_TOKEN: ${{ secrets.IAR_LMS_BEARER_TOKEN }} matrix:
toolchain:
- 'arm-gcc'
- 'esp-idf'
with:
build-system: 'cmake'
toolchain: ${{ matrix.toolchain }}
build-args: ${{ toJSON(fromJSON(needs.set-matrix.outputs.hil_json)[matrix.toolchain]) }}
one-per-family: true
upload-artifacts: true
# ---------------------------------------
# Hardware in the loop (HIL)
# self-hosted on local VM, for attached hardware checkout HIL_JSON
# ---------------------------------------
hil-tinyusb:
if: |
github.repository_owner == 'hathach' &&
(github.event_name == 'pull_request' || github.event_name == 'workflow_dispatch')
needs: hil-build
runs-on: [self-hosted, X64, hathach, hardware-in-the-loop]
steps: steps:
- name: Clean workspace - name: Clean workspace
run: | run: |
@ -126,14 +204,61 @@ jobs:
rm -rf "${{ github.workspace }}" rm -rf "${{ github.workspace }}"
mkdir -p "${{ github.workspace }}" mkdir -p "${{ github.workspace }}"
- name: Checkout TinyUSB
uses: actions/checkout@v4
with:
sparse-checkout: test/hil
- name: Download Artifacts
uses: actions/download-artifact@v4
with:
path: cmake-build
merge-multiple: true
- name: Test on actual hardware
run: |
ls cmake-build/
python3 test/hil/hil_test.py ${{ env.HIL_JSON }}
# ---------------------------------------
# Hardware in the loop (HIL)
# self-hosted by HFP, build with IAR toolchain, for attached hardware checkout test/hil/hfp.json
# Since IAR Token secret is not passed to forked PR, only build non-forked PR
# ---------------------------------------
hil-hfp:
if: |
github.repository_owner == 'hathach' &&
github.event.pull_request.head.repo.fork == false &&
(github.event_name == 'pull_request' || github.event_name == 'workflow_dispatch')
runs-on: [self-hosted, Linux, X64, hifiphile]
env:
IAR_LMS_BEARER_TOKEN: ${{ secrets.IAR_LMS_BEARER_TOKEN }}
steps:
- name: Clean workspace
run: |
echo "Cleaning up previous run"
rm -rf "${{ github.workspace }}"3
mkdir -p "${{ github.workspace }}"
- name: Toolchain version - name: Toolchain version
run: iccarm --version run: |
iccarm --version
- name: Checkout TinyUSB - name: Checkout TinyUSB
uses: actions/checkout@v4 uses: actions/checkout@v4
- name: Get build boards
run: |
MATRIX_JSON=$(python test/hil/hil_ci_set_matrix.py test/hil/hfp.json)
BUILD_ARGS=$(echo $MATRIX_JSON | jq -r '.["arm-gcc"] | join(" ")')
echo "BUILD_ARGS=$BUILD_ARGS"
echo "BUILD_ARGS=$BUILD_ARGS" >> $GITHUB_ENV
- name: Get Dependencies - name: Get Dependencies
run: python3 tools/get_deps.py $BUILD_ARGS run: python3 tools/get_deps.py $BUILD_ARGS
- name: Build - name: Build
run: python3 tools/build.py --one-per-family --toolchain iar $BUILD_ARGS run: python3 tools/build.py -j 4 --toolchain iar $BUILD_ARGS
- name: Test on actual hardware (hardware in the loop)
run: python3 test/hil/hil_test.py hfp.json

View File

@ -41,7 +41,6 @@ jobs:
uses: ./.github/actions/setup_toolchain uses: ./.github/actions/setup_toolchain
with: with:
toolchain: ${{ inputs.toolchain }} toolchain: ${{ inputs.toolchain }}
toolchain_version: 'v5.3.1'
- name: Get Dependencies - name: Get Dependencies
uses: ./.github/actions/get_deps uses: ./.github/actions/get_deps
@ -59,9 +58,11 @@ jobs:
shell: bash shell: bash
- name: Build - name: Build
env:
IAR_LMS_BEARER_TOKEN: ${{ secrets.IAR_LMS_BEARER_TOKEN }}
run: | run: |
if [ "${{ inputs.toolchain }}" == "esp-idf" ]; then if [ "${{ inputs.toolchain }}" == "esp-idf" ]; then
docker run --rm -v $PWD:/project -w /project espressif/idf:v5.3.1 python tools/build.py ${{ matrix.arg }} docker run --rm -v $PWD:/project -w /project espressif/idf:tinyusb python tools/build.py ${{ matrix.arg }}
else else
python tools/build.py -s ${{ inputs.build-system }} ${{ steps.setup-toolchain.outputs.build_option }} ${{ steps.set-one-per-family.outputs.build_option }} ${{ matrix.arg }} python tools/build.py -s ${{ inputs.build-system }} ${{ steps.setup-toolchain.outputs.build_option }} ${{ steps.set-one-per-family.outputs.build_option }} ${{ matrix.arg }}
fi fi

View File

@ -24,7 +24,7 @@ family_list = {
"lpc11 lpc13 lpc15": ["arm-gcc", "arm-clang"], "lpc11 lpc13 lpc15": ["arm-gcc", "arm-clang"],
"lpc17 lpc18 lpc40 lpc43": ["arm-gcc", "arm-clang"], "lpc17 lpc18 lpc40 lpc43": ["arm-gcc", "arm-clang"],
"lpc51 lpc54 lpc55": ["arm-gcc", "arm-clang"], "lpc51 lpc54 lpc55": ["arm-gcc", "arm-clang"],
"max32650 max32666 max32690 max78002": ["arm-gcc"], "maxim": ["arm-gcc"],
"mcx": ["arm-gcc"], "mcx": ["arm-gcc"],
"mm32": ["arm-gcc"], "mm32": ["arm-gcc"],
"msp430": ["msp430-gcc"], "msp430": ["msp430-gcc"],
@ -40,13 +40,15 @@ family_list = {
"stm32f4": ["arm-gcc", "arm-clang", "arm-iar"], "stm32f4": ["arm-gcc", "arm-clang", "arm-iar"],
"stm32f7": ["arm-gcc", "arm-clang", "arm-iar"], "stm32f7": ["arm-gcc", "arm-clang", "arm-iar"],
"stm32g0 stm32g4 stm32h5": ["arm-gcc", "arm-clang", "arm-iar"], "stm32g0 stm32g4 stm32h5": ["arm-gcc", "arm-clang", "arm-iar"],
"stm32h7": ["arm-gcc", "arm-clang", "arm-iar"], "stm32h7 stm32h7rs": ["arm-gcc", "arm-clang", "arm-iar"],
"stm32l0 stm32l4": ["arm-gcc", "arm-clang", "arm-iar"], "stm32l0 stm32l4": ["arm-gcc", "arm-clang", "arm-iar"],
"stm32n6": ["arm-gcc"],
"stm32u5 stm32wb": ["arm-gcc", "arm-clang", "arm-iar"], "stm32u5 stm32wb": ["arm-gcc", "arm-clang", "arm-iar"],
"xmc4000": ["arm-gcc"], "xmc4000": ["arm-gcc"],
"-bespressif_kaluga_1": ["esp-idf"], "-bespressif_s2_devkitc": ["esp-idf"],
"-bespressif_s3_devkitm": ["esp-idf"], # S3, P4 will be built by hil test
"-bespressif_p4_function_ev": ["esp-idf"], # "-bespressif_s3_devkitm": ["esp-idf"],
# "-bespressif_p4_function_ev": ["esp-idf"],
} }

View File

@ -66,7 +66,7 @@ jobs:
# Initializes the CodeQL tools for scanning. # Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL - name: Initialize CodeQL
uses: github/codeql-action/init@v2 uses: github/codeql-action/init@v3
with: with:
languages: ${{ matrix.language }} languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file. # If you wish to specify custom queries, you can do so here or in a config file.
@ -93,7 +93,7 @@ jobs:
./.github/workflows/codeql-buildscript.sh ./.github/workflows/codeql-buildscript.sh
- name: Perform CodeQL Analysis - name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2 uses: github/codeql-action/analyze@v3
with: with:
category: "/language:${{matrix.language}}" category: "/language:${{matrix.language}}"
upload: false upload: false
@ -124,12 +124,12 @@ jobs:
output: ${{ steps.step1.outputs.sarif-output }}/cpp.sarif output: ${{ steps.step1.outputs.sarif-output }}/cpp.sarif
- name: Upload SARIF - name: Upload SARIF
uses: github/codeql-action/upload-sarif@v2 uses: github/codeql-action/upload-sarif@v3
with: with:
sarif_file: ${{ steps.step1.outputs.sarif-output }} sarif_file: ${{ steps.step1.outputs.sarif-output }}
category: "/language:${{matrix.language}}" category: "/language:${{matrix.language}}"
- name: Archive CodeQL results - name: Upload CodeQL results as an artifact
uses: actions/upload-artifact@v4 uses: actions/upload-artifact@v4
with: with:
name: codeql-results name: codeql-results

View File

@ -1,126 +0,0 @@
name: Hardware Test
on:
workflow_dispatch:
pull_request:
branches: [ master ]
paths:
- 'src/**'
- 'examples/**'
- 'lib/**'
- 'hw/**'
- 'test/hil/**'
- 'tools/get_deps.py'
- '.github/actions/**'
- '.github/workflows/hil_test.yml'
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
env:
HIL_JSON: test/hil/tinyusb.json
jobs:
set-matrix:
runs-on: ubuntu-latest
outputs:
json: ${{ steps.set-matrix-json.outputs.matrix }}
steps:
- name: Checkout TinyUSB
uses: actions/checkout@v4
- name: Generate matrix json
id: set-matrix-json
run: |
MATRIX_JSON=$(python test/hil/hil_ci_set_matrix.py ${{ env.HIL_JSON }})
echo "matrix=$MATRIX_JSON"
echo "matrix=$MATRIX_JSON" >> $GITHUB_OUTPUT
# ---------------------------------------
# Build arm-gcc
# ---------------------------------------
build:
if: github.repository_owner == 'hathach'
needs: set-matrix
uses: ./.github/workflows/build_util.yml
strategy:
fail-fast: false
matrix:
toolchain:
- 'arm-gcc'
- 'esp-idf'
with:
build-system: 'cmake'
toolchain: ${{ matrix.toolchain }}
build-args: ${{ toJSON(fromJSON(needs.set-matrix.outputs.json)[matrix.toolchain]) }}
one-per-family: true
upload-artifacts: true
# ---------------------------------------
# Hardware in the loop (HIL)
# self-hosted on local VM, for attached hardware checkout HIL_JSON
# ---------------------------------------
hil-tinyusb:
if: github.repository_owner == 'hathach'
needs: build
runs-on: [self-hosted, X64, hathach, hardware-in-the-loop]
steps:
- name: Clean workspace
run: |
echo "Cleaning up previous run"
rm -rf "${{ github.workspace }}"
mkdir -p "${{ github.workspace }}"
- name: Checkout TinyUSB
uses: actions/checkout@v4
with:
sparse-checkout: test/hil
- name: Download Artifacts
uses: actions/download-artifact@v4
with:
path: cmake-build
merge-multiple: true
- name: Test on actual hardware
run: |
ls cmake-build/
python3 test/hil/hil_test.py ${{ env.HIL_JSON }}
# ---------------------------------------
# Hardware in the loop (HIL)
# self-hosted by HFP, build with IAR toolchain, for attached hardware checkout test/hil/hfp.json
# ---------------------------------------
hil-hfp:
if: github.repository_owner == 'hathach'
runs-on: [self-hosted, Linux, X64, hifiphile]
#env:
# IAR_LMS_BEARER_TOKEN: ${{ secrets.IAR_LMS_BEARER_TOKEN }}
steps:
- name: Clean workspace
run: |
echo "Cleaning up previous run"
rm -rf "${{ github.workspace }}"
mkdir -p "${{ github.workspace }}"
- name: Toolchain version
run: iccarm --version
- name: Checkout TinyUSB
uses: actions/checkout@v4
- name: Get build boards
run: |
MATRIX_JSON=$(python test/hil/hil_ci_set_matrix.py test/hil/hfp.json)
BUILD_ARGS=$(echo $MATRIX_JSON | jq -r '.["arm-gcc"] | join(" ")')
echo "BUILD_ARGS=$BUILD_ARGS"
echo "BUILD_ARGS=$BUILD_ARGS" >> $GITHUB_ENV
- name: Get Dependencies
run: python3 tools/get_deps.py $BUILD_ARGS
- name: Build
run: python3 tools/build.py --toolchain iar $BUILD_ARGS
- name: Test on actual hardware (hardware in the loop)
run: python3 test/hil/hil_test.py hfp.json

16
.gitignore vendored
View File

@ -15,6 +15,14 @@ latex
*.jlink *.jlink
*.emSession *.emSession
*.ninja* *.ninja*
*.eww
*.ewp
*.ewt
*.ewd
*.hex
cmake_install.cmake
CMakeCache.txt
settings/
.settings/ .settings/
.vscode/ .vscode/
.gdb_history .gdb_history
@ -37,4 +45,10 @@ cmake-build-*
sdkconfig sdkconfig
.PVS-Studio .PVS-Studio
.vscode/ .vscode/
build/ build
CMakeFiles
Debug
RelWithDebInfo
Release
BrowseInfo
.cmake_build

12
.idea/cmake.xml generated
View File

@ -6,12 +6,14 @@
<configuration PROFILE_NAME="raspberrypi_zero2" ENABLED="false" CONFIG_NAME="Debug" GENERATION_OPTIONS="-DBOARD=raspberrypi_zero2 -DLOG=1" /> <configuration PROFILE_NAME="raspberrypi_zero2" ENABLED="false" CONFIG_NAME="Debug" GENERATION_OPTIONS="-DBOARD=raspberrypi_zero2 -DLOG=1" />
<configuration PROFILE_NAME="raspberrypi_cm4" ENABLED="false" CONFIG_NAME="Debug" GENERATION_OPTIONS="-DBOARD=raspberrypi_cm4 -DLOG=1" /> <configuration PROFILE_NAME="raspberrypi_cm4" ENABLED="false" CONFIG_NAME="Debug" GENERATION_OPTIONS="-DBOARD=raspberrypi_cm4 -DLOG=1" />
<configuration PROFILE_NAME="raspberry_pi_pico" ENABLED="false" CONFIG_NAME="Debug" GENERATION_OPTIONS="-DBOARD=raspberry_pi_pico -DLOG=1" /> <configuration PROFILE_NAME="raspberry_pi_pico" ENABLED="false" CONFIG_NAME="Debug" GENERATION_OPTIONS="-DBOARD=raspberry_pi_pico -DLOG=1" />
<configuration PROFILE_NAME="raspberry_pi_pico2" ENABLED="false" CONFIG_NAME="Debug" GENERATION_OPTIONS="-DBOARD=raspberry_pi_pico2 -DLOG=1" />
<configuration PROFILE_NAME="raspberry_pi_pico2_riscv" ENABLED="false" CONFIG_NAME="Debug" GENERATION_OPTIONS="-DBOARD=raspberry_pi_pico2_riscv -DLOG=1" />
<configuration PROFILE_NAME="raspberry_pi_pico-pio_host" ENABLED="false" CONFIG_NAME="Debug" GENERATION_OPTIONS="-DBOARD=raspberry_pi_pico -DLOG=1 -DCFLAGS_CLI=&quot;-DCFG_TUH_RPI_PIO_USB=1&quot;" /> <configuration PROFILE_NAME="raspberry_pi_pico-pio_host" ENABLED="false" CONFIG_NAME="Debug" GENERATION_OPTIONS="-DBOARD=raspberry_pi_pico -DLOG=1 -DCFLAGS_CLI=&quot;-DCFG_TUH_RPI_PIO_USB=1&quot;" />
<configuration PROFILE_NAME="raspberry_pi_pico2" ENABLED="false" CONFIG_NAME="Debug" GENERATION_OPTIONS="-DBOARD=raspberry_pi_pico2 -DLOG=1" />
<configuration PROFILE_NAME="raspberry_pi_pico2-pio_host" ENABLED="false" CONFIG_NAME="Debug" GENERATION_OPTIONS="-DBOARD=raspberry_pi_pico2 -DLOG=1 -DCFLAGS_CLI=&quot;-DCFG_TUH_RPI_PIO_USB=1&quot;" />
<configuration PROFILE_NAME="feather_rp2040" ENABLED="false" CONFIG_NAME="Debug" GENERATION_OPTIONS="-DBOARD=pico_sdk -DPICO_BOARD=adafruit_feather_rp2040 -DLOG=1" /> <configuration PROFILE_NAME="feather_rp2040" ENABLED="false" CONFIG_NAME="Debug" GENERATION_OPTIONS="-DBOARD=pico_sdk -DPICO_BOARD=adafruit_feather_rp2040 -DLOG=1" />
<configuration PROFILE_NAME="feather_rp2040_max3421" ENABLED="false" CONFIG_NAME="Debug" GENERATION_OPTIONS="-DBOARD=feather_rp2040_max3421 -DLOG=1" /> <configuration PROFILE_NAME="feather_rp2040_max3421" ENABLED="false" CONFIG_NAME="Debug" GENERATION_OPTIONS="-DBOARD=feather_rp2040_max3421 -DLOG=1" />
<configuration PROFILE_NAME="metro_rp2040" ENABLED="false" CONFIG_NAME="Debug" GENERATION_OPTIONS="-DBOARD=pico_sdk -DPICO_BOARD=adafruit_metro_rp2040 -DLOG=1 -DMAX3421_HOST=1" /> <configuration PROFILE_NAME="metro_rp2040" ENABLED="false" CONFIG_NAME="Debug" GENERATION_OPTIONS="-DBOARD=pico_sdk -DPICO_BOARD=adafruit_metro_rp2040 -DLOG=1 -DMAX3421_HOST=1" />
<configuration PROFILE_NAME="adafruit_metro_rp2350" ENABLED="false" CONFIG_NAME="Debug" GENERATION_OPTIONS="-DBOARD=adafruit_metro_rp2350 -DLOG=1 -DCFLAGS_CLI=&quot;-DCFG_TUH_RPI_PIO_USB=1&quot;" />
<configuration PROFILE_NAME="adafruit_fruit_jam" ENABLED="false" CONFIG_NAME="Debug" GENERATION_OPTIONS="-DBOARD=adafruit_fruit_jam -DLOG=1 -DCFLAGS_CLI=&quot;-DCFG_TUH_RPI_PIO_USB=1&quot;" />
<configuration PROFILE_NAME="adafruit_feather_esp32_v2" ENABLED="false" TOOLCHAIN_NAME="ESP-IDF" GENERATION_OPTIONS="-DBOARD=adafruit_feather_esp32_v2 -DMAX3421_HOST=1 -DLOG=1"> <configuration PROFILE_NAME="adafruit_feather_esp32_v2" ENABLED="false" TOOLCHAIN_NAME="ESP-IDF" GENERATION_OPTIONS="-DBOARD=adafruit_feather_esp32_v2 -DMAX3421_HOST=1 -DLOG=1">
<ADDITIONAL_GENERATION_ENVIRONMENT> <ADDITIONAL_GENERATION_ENVIRONMENT>
<envs> <envs>
@ -81,16 +83,19 @@
<configuration PROFILE_NAME="atsaml21_xpro" ENABLED="false" GENERATION_OPTIONS="-DBOARD=atsaml21_xpro" /> <configuration PROFILE_NAME="atsaml21_xpro" ENABLED="false" GENERATION_OPTIONS="-DBOARD=atsaml21_xpro" />
<configuration PROFILE_NAME="feather_m4_express" ENABLED="false" CONFIG_NAME="Debug" GENERATION_OPTIONS="-DBOARD=feather_m4_express -DLOG=1 -DLOGGER=RTT -DMAX3421_HOST=1" /> <configuration PROFILE_NAME="feather_m4_express" ENABLED="false" CONFIG_NAME="Debug" GENERATION_OPTIONS="-DBOARD=feather_m4_express -DLOG=1 -DLOGGER=RTT -DMAX3421_HOST=1" />
<configuration PROFILE_NAME="metro_m4_express" ENABLED="false" CONFIG_NAME="Debug" GENERATION_OPTIONS="-DBOARD=metro_m4_express -DLOG=1 -DLOGGER=RTT -DMAX3421_HOST=1" /> <configuration PROFILE_NAME="metro_m4_express" ENABLED="false" CONFIG_NAME="Debug" GENERATION_OPTIONS="-DBOARD=metro_m4_express -DLOG=1 -DLOGGER=RTT -DMAX3421_HOST=1" />
<configuration PROFILE_NAME="feather_m4_express-zephyr" ENABLED="false" CONFIG_NAME="Debug" GENERATION_OPTIONS="-DBOARD=feather_m4_express -DLOG=1 -DMAX3421_HOST=1 -DRTOS=zephyr" />
<configuration PROFILE_NAME="itsybitsy_m4" ENABLED="false" CONFIG_NAME="Debug" GENERATION_OPTIONS="-DBOARD=itsybitsy_m4" /> <configuration PROFILE_NAME="itsybitsy_m4" ENABLED="false" CONFIG_NAME="Debug" GENERATION_OPTIONS="-DBOARD=itsybitsy_m4" />
<configuration PROFILE_NAME="same54_xplained" ENABLED="false" GENERATION_OPTIONS="-DBOARD=same54_xplained -DLOG=1 -DLOGGER=RTT" /> <configuration PROFILE_NAME="same54_xplained" ENABLED="false" GENERATION_OPTIONS="-DBOARD=same54_xplained -DLOG=1 -DLOGGER=RTT" />
<configuration PROFILE_NAME="samg55_xplained" ENABLED="false" GENERATION_OPTIONS="-DBOARD=samg55_xplained" /> <configuration PROFILE_NAME="samg55_xplained" ENABLED="false" GENERATION_OPTIONS="-DBOARD=samg55_xplained" />
<configuration PROFILE_NAME="feather_nrf52840_express" ENABLED="false" CONFIG_NAME="Debug" GENERATION_OPTIONS="-DBOARD=feather_nrf52840_express -DLOG=1 -DLOGGER=RTT -DMAX3421_HOST=1" /> <configuration PROFILE_NAME="feather_nrf52840_express" ENABLED="false" CONFIG_NAME="Debug" GENERATION_OPTIONS="-DBOARD=feather_nrf52840_express -DLOG=1 -DLOGGER=RTT -DMAX3421_HOST=1" />
<configuration PROFILE_NAME="pca10056" ENABLED="false" CONFIG_NAME="Debug" GENERATION_OPTIONS="-DBOARD=pca10056 -DLOG=1 -DLOGGER=RTT -DTRACE_ETM=1" /> <configuration PROFILE_NAME="pca10056" ENABLED="false" CONFIG_NAME="Debug" GENERATION_OPTIONS="-DBOARD=pca10056 -DLOG=1 -DLOGGER=RTT -DTRACE_ETM=1" />
<configuration PROFILE_NAME="pca10056-zephyr" ENABLED="false" CONFIG_NAME="Debug" GENERATION_OPTIONS="-DBOARD=pca10056 -DLOG=1 -DTRACE_ETM=1 -DRTOS=zephyr" BUILD_OPTIONS="-v" />
<configuration PROFILE_NAME="pca10095" ENABLED="false" CONFIG_NAME="Debug" GENERATION_OPTIONS="-DBOARD=pca10095 -DLOG=1 -DLOGGER=RTT -DTRACE_ETM=1" /> <configuration PROFILE_NAME="pca10095" ENABLED="false" CONFIG_NAME="Debug" GENERATION_OPTIONS="-DBOARD=pca10095 -DLOG=1 -DLOGGER=RTT -DTRACE_ETM=1" />
<configuration PROFILE_NAME="metro m7 1011 sd" ENABLED="false" CONFIG_NAME="Debug" GENERATION_OPTIONS="-DBOARD=metro_m7_1011_sd -DLOG=1 -DLOGGER=RTT -DTRACE_ETM=1" /> <configuration PROFILE_NAME="metro m7 1011 sd" ENABLED="false" CONFIG_NAME="Debug" GENERATION_OPTIONS="-DBOARD=metro_m7_1011_sd -DLOG=1 -DLOGGER=RTT -DTRACE_ETM=1" />
<configuration PROFILE_NAME="metro_m7_1011" ENABLED="false" CONFIG_NAME="Debug" GENERATION_OPTIONS="-DBOARD=metro_m7_1011 -DLOG=1 -DLOGGER=RTT" /> <configuration PROFILE_NAME="metro_m7_1011" ENABLED="false" CONFIG_NAME="Debug" GENERATION_OPTIONS="-DBOARD=metro_m7_1011 -DLOG=1 -DLOGGER=RTT" />
<configuration PROFILE_NAME="rt1010 evk" ENABLED="false" CONFIG_NAME="Debug" GENERATION_OPTIONS="-DBOARD=mimxrt1010_evk -DLOG=1 -DLOGGER=RTT" /> <configuration PROFILE_NAME="rt1010 evk" ENABLED="false" CONFIG_NAME="Debug" GENERATION_OPTIONS="-DBOARD=mimxrt1010_evk -DLOG=1 -DLOGGER=RTT" />
<configuration PROFILE_NAME="mimxrt1060_evk" ENABLED="false" CONFIG_NAME="Debug" GENERATION_OPTIONS="-DBOARD=mimxrt1060_evk -DLOG=1 -DLOGGER=RTT" /> <configuration PROFILE_NAME="mimxrt1060_evk" ENABLED="false" CONFIG_NAME="Debug" GENERATION_OPTIONS="-DBOARD=mimxrt1060_evk -DLOG=1" />
<configuration PROFILE_NAME="mimxrt1064_evk" ENABLED="false" CONFIG_NAME="Debug" GENERATION_OPTIONS="-DBOARD=mimxrt1064_evk" />
<configuration PROFILE_NAME="rt1170 evkb" ENABLED="false" CONFIG_NAME="Debug" GENERATION_OPTIONS="-DBOARD=mimxrt1170_evkb -DLOG=1 -DLOGGER=RTT -DTRACE_ETM=1" /> <configuration PROFILE_NAME="rt1170 evkb" ENABLED="false" CONFIG_NAME="Debug" GENERATION_OPTIONS="-DBOARD=mimxrt1170_evkb -DLOG=1 -DLOGGER=RTT -DTRACE_ETM=1" />
<configuration PROFILE_NAME="stm32f072disco" ENABLED="false" CONFIG_NAME="Debug" GENERATION_OPTIONS="-DBOARD=stm32f072disco -DLOG=0 -DLOGGER=RTT" /> <configuration PROFILE_NAME="stm32f072disco" ENABLED="false" CONFIG_NAME="Debug" GENERATION_OPTIONS="-DBOARD=stm32f072disco -DLOG=0 -DLOGGER=RTT" />
<configuration PROFILE_NAME="stm32f103_mini_2" ENABLED="false" CONFIG_NAME="Debug" GENERATION_OPTIONS="-DBOARD=stm32f103_mini_2 -DLOG=1 -DLOGGGER=RTT" /> <configuration PROFILE_NAME="stm32f103_mini_2" ENABLED="false" CONFIG_NAME="Debug" GENERATION_OPTIONS="-DBOARD=stm32f103_mini_2 -DLOG=1 -DLOGGGER=RTT" />
@ -162,7 +167,6 @@
<configuration PROFILE_NAME="max32650fthr" ENABLED="false" CONFIG_NAME="Debug" GENERATION_OPTIONS="-DBOARD=max32650fthr -DLOG=0 -DLOGGER=RTT" /> <configuration PROFILE_NAME="max32650fthr" ENABLED="false" CONFIG_NAME="Debug" GENERATION_OPTIONS="-DBOARD=max32650fthr -DLOG=0 -DLOGGER=RTT" />
<configuration PROFILE_NAME="max32666fthr" ENABLED="false" CONFIG_NAME="Debug" GENERATION_OPTIONS="-DBOARD=max32666fthr -DLOG=0 -DLOGGER=RTT" /> <configuration PROFILE_NAME="max32666fthr" ENABLED="false" CONFIG_NAME="Debug" GENERATION_OPTIONS="-DBOARD=max32666fthr -DLOG=0 -DLOGGER=RTT" />
<configuration PROFILE_NAME="max32690evkit" ENABLED="false" CONFIG_NAME="Debug" GENERATION_OPTIONS="-DBOARD=max32690evkit -DLOG=1 -DLOGGER=RTT" /> <configuration PROFILE_NAME="max32690evkit" ENABLED="false" CONFIG_NAME="Debug" GENERATION_OPTIONS="-DBOARD=max32690evkit -DLOG=1 -DLOGGER=RTT" />
<configuration PROFILE_NAME="mimxrt1064_evk" ENABLED="false" CONFIG_NAME="Debug" GENERATION_OPTIONS="-DBOARD=mimxrt1064_evk" />
</configurations> </configurations>
</component> </component>
</project> </project>

14
.idea/debugServers/esp32s2.xml generated Normal file
View File

@ -0,0 +1,14 @@
<component name="DebugServers">
<generic-debug-target name="esp32s2" uniqueID="254eff00-2acf-48fe-b255-1d0c0c9c4a7a">
<debugger version="1">
<debugger kind="GDB">$USER_HOME$/.espressif/tools/xtensa-esp-elf-gdb/14.2_20240403/xtensa-esp-elf-gdb/bin/xtensa-esp32s2-elf-gdb</debugger>
<env />
</debugger>
<gdbserver exe="$USER_HOME$/.espressif/tools/openocd-esp32/v0.12.0-esp32-20241016/openocd-esp32/bin/openocd" args="-f board/esp32s2-kaluga-1.cfg">
<env />
</gdbserver>
<console port="4444" />
<target download-type="NONE" reset-command="monitor reset halt" reset-before="false" />
<connection extended-remote="false" remote-string="tcp::3333" warmup-ms="500" />
</generic-debug-target>
</component>

14
.idea/debugServers/rp2040.xml generated Normal file
View File

@ -0,0 +1,14 @@
<component name="DebugServers">
<generic-debug-target name="rp2040" uniqueID="006ce655-8571-401e-a94b-6a4f6d519724">
<debugger version="1">
<debugger kind="GDB" isBundled="true" />
<env />
</debugger>
<gdbserver exe="/usr/local/bin/openocd" args="-f interface/cmsis-dap.cfg -f target/rp2040.cfg -c &quot;adapter speed 5000&quot;">
<env />
</gdbserver>
<console enabled="true" port="4444" />
<target download-type="UPDATED_ONLY" reset-before="false" />
<connection extended-remote="false" remote-string="tcp::3333" warmup-ms="500" />
</generic-debug-target>
</component>

14
.idea/debugServers/rp2350.xml generated Normal file
View File

@ -0,0 +1,14 @@
<component name="DebugServers">
<generic-debug-target name="rp2350" uniqueID="939fdf16-9c30-4261-8435-3e8df7fd5800">
<debugger version="1">
<debugger kind="GDB" isBundled="true" />
<env />
</debugger>
<gdbserver exe="/usr/local/bin/openocd" args="-f interface/cmsis-dap.cfg -f target/rp2350.cfg -c &quot;adapter speed 5000&quot;">
<env />
</gdbserver>
<console enabled="true" port="4444" />
<target download-type="UPDATED_ONLY" reset-before="false" />
<connection extended-remote="false" remote-string="tcp::3333" warmup-ms="500" />
</generic-debug-target>
</component>

13
.idea/debugServers/rt1060.xml generated Normal file
View File

@ -0,0 +1,13 @@
<component name="DebugServers">
<jlink-debug-target name="rt1060" uniqueID="851396c6-2030-4694-b86d-21ba9547ddcb">
<debugger version="1">
<debugger kind="GDB" isBundled="true" />
<env />
</debugger>
<gdbserver exe="/usr/bin/JLinkGDBServerCLExe" />
<console port="19021" />
<target device="MIMXRT1062xxx6A" reset-before="false" />
<connection extended-remote="false" port="4444" warmup-ms="500" />
<swo />
</jlink-debug-target>
</component>

13
.idea/debugServers/rt1064.xml generated Normal file
View File

@ -0,0 +1,13 @@
<component name="DebugServers">
<jlink-debug-target name="rt1064" uniqueID="9602472b-6ce8-4a2d-9636-1c03b5fcd6da">
<debugger version="1">
<debugger kind="GDB" isBundled="true" />
<env />
</debugger>
<gdbserver exe="/usr/bin/JLinkGDBServerCLExe" />
<console port="19021" />
<target device="MIMXRT1064xxx6A" reset-before="false" />
<connection extended-remote="false" port="4444" warmup-ms="500" />
<swo />
</jlink-debug-target>
</component>

13
.idea/debugServers/sam21.xml generated Normal file
View File

@ -0,0 +1,13 @@
<component name="DebugServers">
<jlink-debug-target name="sam21" uniqueID="b22537b6-0924-4a2b-8721-48a8952239de">
<debugger version="1">
<debugger kind="GDB" isBundled="true" />
<env />
</debugger>
<gdbserver exe="/usr/bin/JLinkGDBServerCLExe" />
<console port="19021" />
<target device="ATSAMD21G18A" reset-before="false" />
<connection extended-remote="false" port="4444" warmup-ms="500" />
<swo />
</jlink-debug-target>
</component>

13
.idea/debugServers/sam51.xml generated Normal file
View File

@ -0,0 +1,13 @@
<component name="DebugServers">
<jlink-debug-target name="sam51" uniqueID="481ff0d4-6501-4394-8b6b-f7a2ca4c2675">
<debugger version="1">
<debugger kind="GDB" isBundled="true" />
<env />
</debugger>
<gdbserver exe="/usr/bin/JLinkGDBServerCLExe" />
<console port="19021" />
<target device="ATSAMD51J19A" reset-before="false" />
<connection extended-remote="false" port="4444" warmup-ms="500" />
<swo />
</jlink-debug-target>
</component>

13
.idea/debugServers/stm32f769.xml generated Normal file
View File

@ -0,0 +1,13 @@
<component name="DebugServers">
<jlink-debug-target name="stm32f769" uniqueID="7a47302f-f7e5-434b-b20b-78e95318dd0c">
<debugger version="1">
<debugger kind="GDB" isBundled="true" />
<env />
</debugger>
<gdbserver exe="/usr/bin/JLinkGDBServerCLExe" />
<console port="19021" />
<target device="STM32F769NI" reset-before="false" frequency="16000" />
<connection extended-remote="false" port="4444" warmup-ms="500" />
<swo />
</jlink-debug-target>
</component>

13
.idea/debugServers/stm32h563.xml generated Normal file
View File

@ -0,0 +1,13 @@
<component name="DebugServers">
<jlink-debug-target name="stm32h563" uniqueID="a3e9293d-113b-48b3-b83d-dd4249984abe">
<debugger version="1">
<debugger kind="GDB" isBundled="true" />
<env />
</debugger>
<gdbserver exe="/usr/bin/JLinkGDBServerCLExe" />
<console port="19021" />
<target device="STM32H562ZI" reset-before="false" frequency="16000" />
<connection extended-remote="false" port="4444" warmup-ms="500" />
<swo />
</jlink-debug-target>
</component>

13
.idea/debugServers/stm32h743.xml generated Normal file
View File

@ -0,0 +1,13 @@
<component name="DebugServers">
<jlink-debug-target name="stm32h743" uniqueID="6d6a3ed6-f66d-4f6a-9e70-6aafe5c971d0">
<debugger version="1">
<debugger kind="GDB" isBundled="true" />
<env />
</debugger>
<gdbserver exe="/usr/bin/JLinkGDBServerCLExe" />
<console port="19021" />
<target device="STM32H743XI" reset-before="false" frequency="16000" />
<connection extended-remote="false" port="4444" warmup-ms="500" />
<swo />
</jlink-debug-target>
</component>

1
.idea/vcs.xml generated
View File

@ -2,5 +2,6 @@
<project version="4"> <project version="4">
<component name="VcsDirectoryMappings"> <component name="VcsDirectoryMappings">
<mapping directory="$PROJECT_DIR$" vcs="Git" /> <mapping directory="$PROJECT_DIR$" vcs="Git" />
<mapping directory="$PROJECT_DIR$/hw/mcu/raspberry_pi/Pico-PIO-USB" vcs="Git" />
</component> </component>
</project> </project>

View File

@ -31,6 +31,13 @@ Notable contributors
- Most features development - Most features development
`Heiko Kuester <https://github.com/IngHK>`__
--------------------------------------------
- Add CH34x and PL2303 support (CDC host)
- Improve FTDI and CP210x support (CDC host)
`Hristo Gochkov <https://github.com/me-no-dev>`__ `Hristo Gochkov <https://github.com/me-no-dev>`__
------------------------------------------------- -------------------------------------------------

View File

@ -15,10 +15,7 @@ TinyUSB Project
.. figure:: docs/assets/logo.svg .. figure:: docs/assets/logo.svg
:alt: TinyUSB :alt: TinyUSB
TinyUSB is an open-source cross-platform USB Host/Device stack for TinyUSB is an open-source cross-platform USB Host/Device stack for embedded system, designed to be memory-safe with no dynamic allocation and thread-safe with all interrupt events are deferred then handled in the non-ISR task function. Check out the online `documentation <https://docs.tinyusb.org/>`__ for more details.
embedded system, designed to be memory-safe with no dynamic allocation
and thread-safe with all interrupt events are deferred then handled in
the non-ISR task function. Check out the online `documentation <https://docs.tinyusb.org/>`__ for more details.
.. figure:: docs/assets/stack.svg .. figure:: docs/assets/stack.svg
:width: 500px :width: 500px
@ -32,7 +29,7 @@ the non-ISR task function. Check out the online `documentation <https://docs.tin
├── hw ├── hw
│ ├── bsp # Supported boards source files │ ├── bsp # Supported boards source files
│ └── mcu # Low level mcu core & peripheral drivers │ └── mcu # Low level mcu core & peripheral drivers
├── lib # Sources from 3rd party such as freeRTOS, fatfs ... ├── lib # Sources from 3rd party such as FreeRTOS, FatFs ...
├── src # All sources files for TinyUSB stack itself. ├── src # All sources files for TinyUSB stack itself.
├── test # Tests: unit test, fuzzing, hardware test ├── test # Tests: unit test, fuzzing, hardware test
└── tools # Files used internally └── tools # Files used internally
@ -43,12 +40,12 @@ Getting started
See the `online documentation <https://docs.tinyusb.org>`_ for information about using TinyUSB and how it is implemented. See the `online documentation <https://docs.tinyusb.org>`_ for information about using TinyUSB and how it is implemented.
Check out `Getting Started`_ guide for adding TinyUSB to your project or building the examples. If you are new to TinyUSB, we recommend starting with the ``cdc_msc`` example. There is a handful of `Supported Boards`_ that should work out of the box.
We use `GitHub Discussions <https://github.com/hathach/tinyusb/discussions>`_ as our forum. It is a great place to ask questions and advice from the community or to discuss your TinyUSB-based projects. We use `GitHub Discussions <https://github.com/hathach/tinyusb/discussions>`_ as our forum. It is a great place to ask questions and advice from the community or to discuss your TinyUSB-based projects.
For bugs and feature requests, please `raise an issue <https://github.com/hathach/tinyusb/issues>`_ and follow the templates there. For bugs and feature requests, please `raise an issue <https://github.com/hathach/tinyusb/issues>`_ and follow the templates there.
Check out `Getting Started`_ guide for adding TinyUSB to your project or building the examples. If you are new to TinyUSB, we recommend starting with the `cdc_msc` example.
See `Porting`_ guide for adding support for new MCUs and boards. See `Porting`_ guide for adding support for new MCUs and boards.
Device Stack Device Stack
@ -69,7 +66,7 @@ Supports multiple device configurations by dynamically changing USB descriptors,
- Vendor-specific class support with generic In & Out endpoints. Can be used with MS OS 2.0 compatible descriptor to load winUSB driver without INF file. - Vendor-specific class support with generic In & Out endpoints. Can be used with MS OS 2.0 compatible descriptor to load winUSB driver without INF file.
- `WebUSB <https://github.com/WICG/webusb>`__ with vendor-specific class - `WebUSB <https://github.com/WICG/webusb>`__ with vendor-specific class
If you have a special requirement, `usbd_app_driver_get_cb()` can be used to write your own class driver without modifying the stack. Here is how the RPi team added their reset interface `raspberrypi/pico-sdk#197 <https://github.com/raspberrypi/pico-sdk/pull/197>`_ If you have a special requirement, ``usbd_app_driver_get_cb()`` can be used to write your own class driver without modifying the stack. Here is how the RPi team added their reset interface `raspberrypi/pico-sdk#197 <https://github.com/raspberrypi/pico-sdk/pull/197>`_
Host Stack Host Stack
========== ==========
@ -77,13 +74,13 @@ Host Stack
- Human Interface Device (HID): Keyboard, Mouse, Generic - Human Interface Device (HID): Keyboard, Mouse, Generic
- Mass Storage Class (MSC) - Mass Storage Class (MSC)
- Communication Device Class: CDC-ACM - Communication Device Class: CDC-ACM
- Vendor serial over USB: FTDI, CP210x, CH34x - Vendor serial over USB: FTDI, CP210x, CH34x, PL2303
- Hub with multiple-level support - Hub with multiple-level support
Similar to the Device Stack, if you have a special requirement, `usbh_app_driver_get_cb()` can be used to write your own class driver without modifying the stack. Similar to the Device Stack, if you have a special requirement, ``usbh_app_driver_get_cb()`` can be used to write your own class driver without modifying the stack.
TypeC PD Stack Power Delivery Stack
============== ====================
- Power Delivery 3.0 (PD3.0) with USB Type-C support (WIP) - Power Delivery 3.0 (PD3.0) with USB Type-C support (WIP)
- Super early stage, only for testing purpose - Super early stage, only for testing purpose
@ -102,100 +99,139 @@ TinyUSB is completely thread-safe by pushing all Interrupt Service Request (ISR)
Supported CPUs Supported CPUs
============== ==============
Following CPUs are supported, check out `Supported Devices`_ for comprehensive list of driver, features for each CPU. +--------------+-----------------------------+--------+------+-----------+------------------------+-------------------+
| Manufacturer | Family | Device | Host | Highspeed | Driver | Note |
+==============+=============================+========+======+===========+========================+===================+
| Allwinner | F1C100s/F1C200s | ✔ | | ✔ | sunxi | musb variant |
+--------------+-----------------------------+--------+------+-----------+------------------------+-------------------+
| Analog | MAX3421E | | ✔ | ✖ | max3421 | via SPI |
| +-----------------------------+--------+------+-----------+------------------------+-------------------+
| | MAX32 650, 666, 690, | ✔ | | ✔ | musb | 1-dir ep |
| | MAX78002 | | | | | |
+--------------+-----------------------------+--------+------+-----------+------------------------+-------------------+
| Brigetek | FT90x | ✔ | | ✔ | ft9xx | 1-dir ep |
+--------------+-----------------------------+--------+------+-----------+------------------------+-------------------+
| Broadcom | BCM2711, BCM2837 | ✔ | | ✔ | dwc2 | |
+--------------+-----------------------------+--------+------+-----------+------------------------+-------------------+
| Dialog | DA1469x | ✔ | ✖ | ✖ | da146xx | |
+--------------+-----------------------------+--------+------+-----------+------------------------+-------------------+
| Espressif | S2, S3 | ✔ | ✔ | ✖ | dwc2 or esp32sx | |
| ESP32 +-----------------------------+--------+------+-----------+------------------------+-------------------+
| | P4 | ✔ | ✔ | ✔ | dwc2 | |
+--------------+----+------------------------+--------+------+-----------+------------------------+-------------------+
| GigaDevice | GD32VF103 | ✔ | | ✖ | dwc2 | |
+--------------+-----------------------------+--------+------+-----------+------------------------+-------------------+
| Infineon | XMC4500 | ✔ | ✔ | ✖ | dwc2 | |
+--------------+-----+-----------------------+--------+------+-----------+------------------------+-------------------+
| MicroChip | SAM | D11, D21, L21, L22 | ✔ | | ✖ | samd | |
| | +-----------------------+--------+------+-----------+------------------------+-------------------+
| | | D51, E5x | ✔ | | ✖ | samd | |
| | +-----------------------+--------+------+-----------+------------------------+-------------------+
| | | G55 | ✔ | | ✖ | samg | 1-dir ep |
| | +-----------------------+--------+------+-----------+------------------------+-------------------+
| | | E70,S70,V70,V71 | ✔ | | ✔ | samx7x | 1-dir ep |
| +-----+-----------------------+--------+------+-----------+------------------------+-------------------+
| | PIC | 24 | ✔ | | | pic | ci_fs variant |
| | +-----------------------+--------+------+-----------+------------------------+-------------------+
| | | 32 mm, mk, mx | ✔ | | | pic | ci_fs variant |
| | +-----------------------+--------+------+-----------+------------------------+-------------------+
| | | dsPIC33 | ✔ | | | pic | ci_fs variant |
| | +-----------------------+--------+------+-----------+------------------------+-------------------+
| | | 32mz | ✔ | | | pic32mz | musb variant |
+--------------+-----+-----------------------+--------+------+-----------+------------------------+-------------------+
| Mind Montion | mm32 | ✔ | | ✖ | mm32f327x_otg | ci_fs variant |
+--------------+-----+-----------------------+--------+------+-----------+------------------------+-------------------+
| NordicSemi | nRF 52833, 52840, 5340 | ✔ | ✖ | ✖ | nrf5x | only ep8 is ISO |
+--------------+-----------------------------+--------+------+-----------+------------------------+-------------------+
| Nuvoton | NUC120 | ✔ | ✖ | ✖ | nuc120 | |
| +-----------------------------+--------+------+-----------+------------------------+-------------------+
| | NUC121/NUC125 | ✔ | ✖ | ✖ | nuc121 | |
| +-----------------------------+--------+------+-----------+------------------------+-------------------+
| | NUC126 | ✔ | ✖ | ✖ | nuc121 | |
| +-----------------------------+--------+------+-----------+------------------------+-------------------+
| | NUC505 | ✔ | | ✔ | nuc505 | |
+--------------+---------+-------------------+--------+------+-----------+------------------------+-------------------+
| NXP | iMXRT | RT 10xx, 11xx | ✔ | ✔ | ✔ | ci_hs | |
| +---------+-------------------+--------+------+-----------+------------------------+-------------------+
| | Kinetis | KL | ✔ | ⚠ | ✖ | ci_fs, khci | |
| | +-------------------+--------+------+-----------+------------------------+-------------------+
| | | K32L2 | ✔ | | ✖ | khci | ci_fs variant |
| +---------+-------------------+--------+------+-----------+------------------------+-------------------+
| | LPC | 11u, 13, 15 | ✔ | ✖ | ✖ | lpc_ip3511 | |
| | +-------------------+--------+------+-----------+------------------------+-------------------+
| | | 17, 40 | ✔ | ⚠ | ✖ | lpc17_40 | |
| | +-------------------+--------+------+-----------+------------------------+-------------------+
| | | 18, 43 | ✔ | ✔ | ✔ | ci_hs | |
| | +-------------------+--------+------+-----------+------------------------+-------------------+
| | | 51u | ✔ | ✖ | ✖ | lpc_ip3511 | |
| | +-------------------+--------+------+-----------+------------------------+-------------------+
| | | 54, 55 | ✔ | | ✔ | lpc_ip3511 | |
| +---------+-------------------+--------+------+-----------+------------------------+-------------------+
| | MCX | N9 | ✔ | | ✔ | ci_fs, ci_hs | |
| | +-------------------+--------+------+-----------+------------------------+-------------------+
| | | A15 | ✔ | | | ci_fs | |
+--------------+---------+-------------------+--------+------+-----------+------------------------+-------------------+
| Raspberry Pi | RP2040, RP2350 | ✔ | ✔ | ✖ | rp2040, pio_usb | |
+--------------+-----+-----------------------+--------+------+-----------+------------------------+-------------------+
| Renesas | RX | 63N, 65N, 72N | ✔ | ✔ | ✖ | rusb2 | |
| +-----+-----------------------+--------+------+-----------+------------------------+-------------------+
| | RA | 4M1, 4M3, 6M1 | ✔ | ✔ | ✖ | rusb2 | |
| | +-----------------------+--------+------+-----------+------------------------+-------------------+
| | | 6M5 | ✔ | ✔ | ✔ | rusb2 | |
+--------------+-----+-----------------------+--------+------+-----------+------------------------+-------------------+
| Silabs | EFM32GG12 | ✔ | | ✖ | dwc2 | |
+--------------+-----------------------------+--------+------+-----------+------------------------+-------------------+
| Sony | CXD56 | ✔ | ✖ | ✔ | cxd56 | |
+--------------+-----------------------------+--------+------+-----------+------------------------+-------------------+
| ST STM32 | F0, F3, L0, L1, L5, WBx5 | ✔ | ✖ | ✖ | stm32_fsdev | |
| +----+------------------------+--------+------+-----------+------------------------+-------------------+
| | F1 | 102, 103 | ✔ | ✖ | ✖ | stm32_fsdev | |
| | +------------------------+--------+------+-----------+------------------------+-------------------+
| | | 105, 107 | ✔ | ✔ | ✖ | dwc2 | |
| +----+------------------------+--------+------+-----------+------------------------+-------------------+
| | F2, F4, F7, H7, H7RS | ✔ | ✔ | ✔ | dwc2 | |
| +-----------------------------+--------+------+-----------+------------------------+-------------------+
| | C0, G0, H5 | ✔ | | ✖ | stm32_fsdev | |
| +-----------------------------+--------+------+-----------+------------------------+-------------------+
| | G4 | ✔ | ✖ | ✖ | stm32_fsdev | |
| +-----------------------------+--------+------+-----------+------------------------+-------------------+
| | L0, L1 | ✔ | ✖ | ✖ | stm32_fsdev | |
| +----+------------------------+--------+------+-----------+------------------------+-------------------+
| | L4 | 4x2, 4x3 | ✔ | ✖ | ✖ | stm32_fsdev | |
| | +------------------------+--------+------+-----------+------------------------+-------------------+
| | | 4x5, 4x6, 4+ | ✔ | ✔ | ✖ | dwc2 | |
| +----+------------------------+--------+------+-----------+------------------------+-------------------+
| | N6 | ✔ | ✔ | ✔ | dwc2 | |
| +----+------------------------+--------+------+-----------+------------------------+-------------------+
| | U5 | 535, 545 | ✔ | | ✖ | stm32_fsdev | |
| | +------------------------+--------+------+-----------+------------------------+-------------------+
| | | 575, 585 | ✔ | ✔ | ✖ | dwc2 | |
| | +------------------------+--------+------+-----------+------------------------+-------------------+
| | | 59x,5Ax,5Fx,5Gx | ✔ | ✔ | ✔ | dwc2 | |
+--------------+----+------------------------+--------+------+-----------+------------------------+-------------------+
| TI | MSP430 | ✔ | ✖ | ✖ | msp430x5xx | |
| +-----------------------------+--------+------+-----------+------------------------+-------------------+
| | MSP432E4, TM4C123 | ✔ | | ✖ | musb | |
+--------------+-----------------------------+--------+------+-----------+------------------------+-------------------+
| ValentyUSB | eptri | ✔ | ✖ | ✖ | eptri | |
+--------------+-----------------------------+--------+------+-----------+------------------------+-------------------+
| WCH | CH32F20x | ✔ | | ✔ | ch32_usbhs | |
| +-----------------------------+--------+------+-----------+------------------------+-------------------+
| | CH32V20x | ✔ | | ✖ | stm32_fsdev/ch32_usbfs | |
| +-----------------------------+--------+------+-----------+------------------------+-------------------+
| | CH32V307 | ✔ | | ✔ | ch32_usbfs/hs | |
+--------------+-----------------------------+--------+------+-----------+------------------------+-------------------+
+--------------+------------------------------------------------------------+ Table Legend
| Manufacturer | Family | ------------
+==============+============================================================+
| Allwinner | F1C100s/F1C200s |
+--------------+------------------------------------------------------------+
| Analog | max32: 650, 666, 690. max78002 |
| | |
| | max3421e (spi host) |
+--------------+------------------------------------------------------------+
| Brigetek | FT90x |
+--------------+------------------------------------------------------------+
| Broadcom | BCM2711, BCM2837 |
+--------------+------------------------------------------------------------+
| Dialog | DA1469x |
+--------------+------------------------------------------------------------+
| Espressif | ESP32 S2, S3 |
+--------------+------------------------------------------------------------+
| GigaDevice | GD32VF103 |
+--------------+------------------------------------------------------------+
| Infineon | XMC4500 |
+--------------+------------------------------------------------------------+
| | SAM: D11, D21, D51, E5x, G55, L2x, E7x, S7x, V7x |
| MicroChip | |
| | PIC: 24, 32mm, 32mk, 32mx, 32mz, dsPIC33 |
+--------------+------------------------------------------------------------+
| Mind Montion | mm32 |
+--------------+------------------------------------------------------------+
| NordicSemi | nRF52833, nRF52840, nRF5340 |
+--------------+------------------------------------------------------------+
| Nuvoton | NUC 120, 121, 125, 126, 505 |
+--------------+------------------------------------------------------------+
| NXP | iMXRT: RT10xx, RT11xx |
| | |
| | Kinetis: KL, K32L2 |
| | |
| | LPC: 11u, 13, 15, 17, 18, 40, 43, 51u, 54, 55 |
| | |
| | MCX: A15, N9 |
+--------------+------------------------------------------------------------+
| Raspberry Pi | RP2040, RP2350 |
+--------------+-----+------------------------------------------------------+
| Renesas | RA: 4M1, 4M3, 6M1, 6M5 |
| | |
| | RX: 63N, 65N, 72N |
+--------------+-----+------------------------------------------------------+
| Silabs | EFM32GG12 |
+--------------+------------------------------------------------------------+
| Sony | CXD56 |
+--------------+------------------------------------------------------------+
| ST STM32 | C0, F0, F1, F2, F3, F4, F7, G0, G4, H5, H7, |
| | |
| | L0, L1, L4, L4+, L5, U5, WB |
+--------------+------------------------------------------------------------+
| TI | MSP430, MSP432E4, TM4C123 |
+--------------+------------------------------------------------------------+
| ValentyUSB | eptri |
+--------------+------------------------------------------------------------+
| WCH | CH32F: F20x |
| | |
| | CH32V: V20x, V307 |
+--------------+------------------------------------------------------------+
License ========= =========================
======= ✔ Supported
⚠ Partial support
✖ Not supported by hardware
\[empty\] Unknown
========= =========================
All TinyUSB sources in the ``src`` folder are licensed under MIT
license, the `Full license is here <LICENSE>`__. However, each file can be
individually licensed especially those in ``lib`` and ``hw/mcu`` folder.
Please make sure you understand all the license term for files you use
in your project.
Docs
====
- Info
- `Uses`_
- `Changelog`_
- `Contributors`_
- `Reference`_
- `Supported Devices`_
- `Getting Started`_
- `Dependencies`_
- `Concurrency`_
- `Contributing`_
- `Code of Conduct`_
- `Structure`_
- `Porting`_
.. |Build Status| image:: https://github.com/hathach/tinyusb/actions/workflows/build.yml/badge.svg .. |Build Status| image:: https://github.com/hathach/tinyusb/actions/workflows/build.yml/badge.svg
:target: https://github.com/hathach/tinyusb/actions :target: https://github.com/hathach/tinyusb/actions
@ -209,15 +245,12 @@ Docs
:target: https://opensource.org/licenses/MIT :target: https://opensource.org/licenses/MIT
.. _Uses: docs/info/uses.rst
.. _Changelog: docs/info/changelog.rst .. _Changelog: docs/info/changelog.rst
.. _Contributors: CONTRIBUTORS.rst .. _Contributors: CONTRIBUTORS.rst
.. _Reference: docs/reference/index.rst
.. _Supported Devices: docs/reference/supported.rst
.. _Getting Started: docs/reference/getting_started.rst .. _Getting Started: docs/reference/getting_started.rst
.. _Supported Boards: docs/reference/boards.rst
.. _Dependencies: docs/reference/dependencies.rst .. _Dependencies: docs/reference/dependencies.rst
.. _Concurrency: docs/reference/concurrency.rst .. _Concurrency: docs/reference/concurrency.rst
.. _Contributing: docs/contributing/index.rst .. _Contributing: docs/contributing/index.rst
.. _Code of Conduct: CODE_OF_CONDUCT.rst .. _Code of Conduct: CODE_OF_CONDUCT.rst
.. _Structure: docs/contributing/structure.rst
.. _Porting: docs/contributing/porting.rst .. _Porting: docs/contributing/porting.rst

View File

@ -5,13 +5,16 @@
# list see the documentation: # list see the documentation:
# https://www.sphinx-doc.org/en/master/usage/configuration.html # https://www.sphinx-doc.org/en/master/usage/configuration.html
import re
from pathlib import Path
# -- Path setup -------------------------------------------------------------- # -- Path setup --------------------------------------------------------------
# -- Project information ----------------------------------------------------- # -- Project information -----------------------------------------------------
project = 'TinyUSB' project = 'TinyUSB'
copyright = '2021, Ha Thach' copyright = '2024, Ha Thach'
author = 'Ha Thach' author = 'Ha Thach'
@ -40,3 +43,16 @@ html_theme_options = {
} }
todo_include_todos = True todo_include_todos = True
# pre-process path in README.rst
def preprocess_readme():
"""Modify figure paths in README.rst for Sphinx builds."""
src = Path(__file__).parent.parent / "README.rst"
tgt = Path(__file__).parent.parent / "README_processed.rst"
if src.exists():
content = src.read_text()
content = re.sub(r"docs/", r"", content)
content = re.sub(r".rst", r".html", content)
tgt.write_text(content)
preprocess_readme()

View File

@ -1 +0,0 @@
../../CODE_OF_CONDUCT.rst

View File

@ -0,0 +1 @@
.. include:: ../../CODE_OF_CONDUCT.rst

View File

@ -19,5 +19,4 @@ Index
:maxdepth: 2 :maxdepth: 2
code_of_conduct code_of_conduct
structure
porting porting

View File

@ -9,7 +9,7 @@ data transactions on different endpoints. Porting is the process of adding low-l
the rest of the common stack. Once the low-level is implemented, it is very easy to add USB support the rest of the common stack. Once the low-level is implemented, it is very easy to add USB support
for the microcontroller to other projects, especially those already using TinyUSB such as CircuitPython. for the microcontroller to other projects, especially those already using TinyUSB such as CircuitPython.
Below are instructions on how to get the cdc_msc device example running on a new microcontroller. Doing so includes adding the common code necessary for other uses while minimizing other extra code. Whenever you see a phrase or word in <> it should be replaced. Below are instructions on how to get the cdc_msc device example running on a new microcontroller. Doing so includes adding the common code necessary for other uses while minimizing other extra code. Whenever you see a phrase or word in ``<>`` it should be replaced.
Register defs Register defs
------------- -------------
@ -18,25 +18,27 @@ The first step to adding support is including the register definitions and start
microcontroller in TinyUSB. We write the TinyUSB implementation against these structs instead of higher level functions to keep the code small and to prevent function name collisions in linking of larger projects. For ARM microcontrollers this is the CMSIS definitions. They should be microcontroller in TinyUSB. We write the TinyUSB implementation against these structs instead of higher level functions to keep the code small and to prevent function name collisions in linking of larger projects. For ARM microcontrollers this is the CMSIS definitions. They should be
placed in the ``hw/mcu/<vendor>/<chip_family>`` directory. placed in the ``hw/mcu/<vendor>/<chip_family>`` directory.
Once this is done, create a directory in ``hw/bsp/<your board name>`` for the specific board you are using to test the code. (Duplicating an existing board's directory is the best way to get started.) The board should be a readily available development board so that others can also test. Once this is done, create a directory in ``hw/bsp/<your board name>`` for the specific board you are using to test the code (duplicating an existing board's directory is the best way to get started). The board should be a readily available development board so that others can also test.
Build Build
----- -----
Now that those directories are in place, we can start our iteration process to get the example building successfully. To build, run from the root of TinyUSB: Now that those directories are in place, we can start our iteration process to get the example building successfully. To build, run from the root of TinyUSB:
``make -C examples/device/cdc_msc BOARD=<board>`` .. code-block:: bash
Unless, you've read ahead, this will fail miserably. Now, lets get it to fail less by updating the files in the board directory. The code in the board's directory is responsible for setting up the microcontroller's clocks and pins so that USB works. TinyUSB itself only operates on the USB peripheral. The board directory also includes information what files are needed to build the example. make -C examples/device/cdc_msc BOARD=<board>
One of the first things to change is the ``-DCFG_TUSB_MCU`` cflag in the ``board.mk`` file. This is used to tell TinyUSB what platform is being built. So, add an entry to ``src/tusb_option.h`` and update the CFLAG to match. Unless you've read ahead, this will fail miserably. Now, lets get it to fail less by updating the files in the board directory. The code in the board's directory is responsible for setting up the microcontroller's clocks and pins so that USB works. TinyUSB itself only operates on the USB peripheral. The board directory also includes information what files are needed to build the example.
Update ``board.mk``\ 's VENDOR and CHIP_FAMILY values when creating the directory for the struct files. Duplicate one of the other sources from ``src/portable`` into ``src/portable/<vendor>/<chip_family>`` and delete all of the implementation internals. We'll cover what everything there does later. For now, get it compiling. One of the first things to change is the ``-DCFG_TUSB_MCU`` C flag in the ``board.mk`` file. This is used to tell TinyUSB what platform is being built. So, add an entry to ``src/tusb_option.h`` and update the ``CFLAGS`` to match.
Update ``board.mk``'s VENDOR and CHIP_FAMILY values when creating the directory for the struct files. Duplicate one of the other sources from ``src/portable`` into ``src/portable/<vendor>/<chip_family>`` and delete all of the implementation internals. We'll cover what everything there does later. For now, get it compiling.
Implementation Implementation
-------------- --------------
At this point you should get an error due to an implementation issue and hopefully the build is setup for the new MCU. You will still need to modify the ``board.mk`` to include specific CFLAGS, the linker script, linker flags, source files, include directories. All file paths are relative to the top of the TinyUSB repo. At this point you should get an error due to an implementation issue and hopefully the build is setup for the new MCU. You will still need to modify the ``board.mk`` to include specific ``CFLAGS``, the linker script, linker flags, source files, include directories. All file paths are relative to the top of the TinyUSB repo.
Board Support (BSP) Board Support (BSP)
^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^
@ -45,17 +47,17 @@ The board support code is only used for self-contained examples and testing. It
It is located in ``hw/bsp/<board name>/board_<board name>.c``. It is located in ``hw/bsp/<board name>/board_<board name>.c``.
board_init ``board_init()``
~~~~~~~~~~ ~~~~~~~~~~~~~~~~
``board_init`` is responsible for starting the MCU, setting up the USB clock and USB pins. It is also responsible for initializing LED pins. ``board_init()`` is responsible for starting the MCU, setting up the USB clock and USB pins. It is also responsible for initializing LED pins.
One useful clock debugging technique is to set up a PWM output at a known value such as 500hz based on the USB clock so that you can verify it is correct with a logic probe or oscilloscope. One useful clock debugging technique is to set up a PWM output at a known value such as 500hz based on the USB clock so that you can verify it is correct with a logic probe or oscilloscope.
Setup your USB in a crystal-less mode when available. That makes the code easier to port across boards. Setup your USB in a crystal-less mode when available. That makes the code easier to port across boards.
board_led_write ``board_led_write()``
~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~
Feel free to skip this until you want to verify your demo code is running. To implement, set the pin corresponding to the led to output a value that lights the LED when ``state`` is true. Feel free to skip this until you want to verify your demo code is running. To implement, set the pin corresponding to the led to output a value that lights the LED when ``state`` is true.
@ -64,48 +66,48 @@ OS Abstraction Layer (OSAL)
The OS Abstraction Layer is responsible for providing basic data structures for TinyUSB that may allow for concurrency when used with an RTOS. Without an RTOS it simply handles concurrency issues between the main code and interrupts. The code is almost entirely agnostic of MCU and lives in ``src/osal``. The OS Abstraction Layer is responsible for providing basic data structures for TinyUSB that may allow for concurrency when used with an RTOS. Without an RTOS it simply handles concurrency issues between the main code and interrupts. The code is almost entirely agnostic of MCU and lives in ``src/osal``.
In RTOS configurations, tud_task()/tuh_task() blocks behind a synchronization structure when the event queue is empty, so that the scheduler may give the CPU to a different task. To take advantage of the library's capability to yield the CPU when there are no actionable USB device events, ensure that the `CFG_TUSB_OS` symbol is defined, e.g `OPT_OS_FREERTOS` enables the FreeRTOS scheduler to schedule other threads than that which calls `tud_task()/tuh_task()`. In RTOS configurations, ``tud_task()``/``tuh_task()`` blocks behind a synchronization structure when the event queue is empty, so that the scheduler may give the CPU to a different task. To take advantage of the library's capability to yield the CPU when there are no actionable USB device events, ensure that the ``CFG_TUSB_OS`` symbol is defined, e.g ``OPT_OS_FREERTOS`` enables the FreeRTOS scheduler to schedule other threads than that which calls ``tud_task()``/``tuh_task()``.
Device API Device API
^^^^^^^^^^ ^^^^^^^^^^
After the USB device is setup, the USB device code works by processing events on the main thread (by calling ``tud_task``\ ). These events are queued by the USB interrupt handler. So, there are three parts to the device low-level API: device setup, endpoint setup and interrupt processing. After the USB device is setup, the USB device code works by processing events on the main thread (by calling ``tud_task()``). These events are queued by the USB interrupt handler. So, there are three parts to the device low-level API: device setup, endpoint setup and interrupt processing.
All of the code for the low-level device API is in ``src/portable/<vendor>/<chip family>/dcd_<chip family>.c``. All of the code for the low-level device API is in ``src/portable/<vendor>/<chip family>/dcd_<chip family>.c``.
Device Setup Device Setup
~~~~~~~~~~~~ ~~~~~~~~~~~~
dcd_init ``dcd_init()``
"""""""" """"""""""""""
Initializes the USB peripheral for device mode and enables it. Initializes the USB peripheral for device mode and enables it.
This function should enable internal D+/D- pull-up for enumeration. This function should enable internal D+/D- pull-up for enumeration.
dcd_int_enable / dcd_int_disable ``dcd_int_enable()`` / ``dcd_int_disable()``
"""""""""""""""""""""""""""""""" """"""""""""""""""""""""""""""""""""""""""""
Enables or disables the USB device interrupt(s). May be used to prevent concurrency issues when mutating data structures shared between main code and the interrupt handler. Enables or disables the USB device interrupt(s). May be used to prevent concurrency issues when mutating data structures shared between main code and the interrupt handler.
dcd_int_handler ``dcd_int_handler()``
""""""""""""""" """""""""""""""""""""
Processes all the hardware generated events e.g Bus reset, new data packet from host etc ... It will be called by application in the MCU USB interrupt handler. Processes all the hardware generated events e.g Bus reset, new data packet from host etc ... It will be called by application in the MCU USB interrupt handler.
dcd_set_address ``dcd_set_address()``
""""""""""""""" """""""""""""""""""""
Called when the device is given a new bus address. Called when the device is given a new bus address.
If your peripheral automatically changes address during enumeration (like the nrf52) you may leave this empty and also no queue an event for the corresponding SETUP packet. If your peripheral automatically changes address during enumeration (like the nrf52) you may leave this empty and also no queue an event for the corresponding SETUP packet.
dcd_remote_wakeup ``dcd_remote_wakeup()``
""""""""""""""""" """""""""""""""""""""""
Called to remote wake up host when suspended (e.g hid keyboard) Called to remote wake up host when suspended (e.g hid keyboard)
dcd_connect / dcd_disconnect ``dcd_connect()`` / ``dcd_disconnect()``
"""""""""""""""""""""""""""" """"""""""""""""""""""""""""""""""""""""
Connect or disconnect the data-line pull-up resistor. Define only if MCU has an internal pull-up. (BSP may define for MCU without internal pull-up.) Connect or disconnect the data-line pull-up resistor. Define only if MCU has an internal pull-up. (BSP may define for MCU without internal pull-up.)
@ -114,8 +116,8 @@ Special events
You must let TinyUSB know when certain events occur so that it can continue its work. There are a few methods you can call to queue events for TinyUSB to process. You must let TinyUSB know when certain events occur so that it can continue its work. There are a few methods you can call to queue events for TinyUSB to process.
dcd_event_bus_signal ``dcd_event_bus_signal()``
"""""""""""""""""""" """"""""""""""""""""""""""
There are a number of events that your peripheral may communicate about the state of the bus. Here is an overview of what they are. Events in **BOLD** must be provided for TinyUSB to work. There are a number of events that your peripheral may communicate about the state of the bus. Here is an overview of what they are. Events in **BOLD** must be provided for TinyUSB to work.
@ -125,51 +127,51 @@ There are a number of events that your peripheral may communicate about the stat
Calls to this look like: Calls to this look like:
.. code-block:: .. code-block:: c
dcd_event_bus_signal(0, DCD_EVENT_BUS_RESET, true); dcd_event_bus_signal(0, DCD_EVENT_BUS_RESET, true);
The first ``0`` is the USB peripheral number. Statically saying 0 is common for single USB device MCUs. The first ``0`` is the USB peripheral number. Statically saying ``0`` is common for single USB device MCUs.
The ``true`` indicates the call is from an interrupt handler and will always be the case when porting in this way. The ``true`` indicates the call is from an interrupt handler and will always be the case when porting in this way.
dcd_setup_received ``dcd_setup_received()``
"""""""""""""""""" """"""""""""""""""""""""
SETUP packets are a special type of transaction that can occur at any time on the control endpoint, numbered ``0``. Since they are unique, most peripherals have special handling for them. Their data is always 8 bytes in length as well. SETUP packets are a special type of transaction that can occur at any time on the control endpoint, numbered ``0``. Since they are unique, most peripherals have special handling for them. Their data is always 8 bytes in length as well.
Calls to this look like: Calls to this look like:
.. code-block:: .. code-block:: c
dcd_event_setup_received(0, setup, true); dcd_event_setup_received(0, setup, true);
As before with ``dcd_event_bus_signal`` the first argument is the USB peripheral number and the third is true to signal its being called from an interrupt handler. The middle argument is byte array of length 8 with the contents of the SETUP packet. It can be stack allocated because it is copied into the queue. As before with ``dcd_event_bus_signal()`` the first argument is the USB peripheral number and the third is true to signal its being called from an interrupt handler. The middle argument is byte array of length 8 with the contents of the SETUP packet. It can be stack allocated because it is copied into the queue.
Endpoints Endpoints
~~~~~~~~~ ~~~~~~~~~
Endpoints are the core of the USB data transfer process. They come in a few forms such as control, isochronous, bulk, and interrupt. We won't cover the details here except with some caveats in open below. In general, data is transferred by setting up a buffer of a given length to be transferred on a given endpoint address and then waiting for an interrupt to signal that the transfer is finished. Further details below. Endpoints are the core of the USB data transfer process. They come in a few forms such as control, isochronous, bulk, and interrupt. We won't cover the details here except with some caveats in open below. In general, data is transferred by setting up a buffer of a given length to be transferred on a given endpoint address and then waiting for an interrupt to signal that the transfer is finished. Further details below.
Endpoints within USB have an address which encodes both the number and direction of an endpoint. TinyUSB provides ``tu_edpt_number`` and ``tu_edpt_dir`` to unpack this data from the address. Here is a snippet that does it. Endpoints within USB have an address which encodes both the number and direction of an endpoint. TinyUSB provides ``tu_edpt_number()`` and ``tu_edpt_dir()`` to unpack this data from the address. Here is a snippet that does it.
.. code-block:: .. code-block:: c
uint8_t epnum = tu_edpt_number(ep_addr); uint8_t epnum = tu_edpt_number(ep_addr);
uint8_t dir = tu_edpt_dir(ep_addr); uint8_t dir = tu_edpt_dir(ep_addr);
dcd_edpt_open ``dcd_edpt_open()``
""""""""""""" """""""""""""""""""
Opening an endpoint is done for all non-control endpoints once the host picks a configuration that the device should use. At this point, the endpoint should be enabled in the peripheral and configured to match the endpoint descriptor. Pay special attention to the direction of the endpoint you can get from the helper methods above. It will likely change what registers you are setting. Opening an endpoint is done for all non-control endpoints once the host picks a configuration that the device should use. At this point, the endpoint should be enabled in the peripheral and configured to match the endpoint descriptor. Pay special attention to the direction of the endpoint you can get from the helper methods above. It will likely change what registers you are setting.
Also make sure to enable endpoint specific interrupts. Also make sure to enable endpoint specific interrupts.
dcd_edpt_close ``dcd_edpt_close()``
"""""""""""""" """"""""""""""""""""
Close an endpoint. his function is used for implementing alternate settings. Close an endpoint. his function is used for implementing alternate settings.
@ -177,10 +179,10 @@ After calling this, the device should not respond to any packets directed toward
Implementation is optional. Must be called from the USB task. Interrupts could be disabled or enabled during the call. Implementation is optional. Must be called from the USB task. Interrupts could be disabled or enabled during the call.
dcd_edpt_xfer ``dcd_edpt_xfer()``
""""""""""""" """""""""""""""""""
``dcd_edpt_xfer`` is responsible for configuring the peripheral to send or receive data from the host. "xfer" is short for "transfer". **This is one of the core methods you must implement for TinyUSB to work (one other is the interrupt handler).** Data from the host is the OUT direction and data to the host is IN. It is used for all endpoints including the control endpoint 0. Make sure to handle the zero-length packet STATUS packet on endpoint 0 correctly. It may be a special transaction to the peripheral. ``dcd_edpt_xfer()`` is responsible for configuring the peripheral to send or receive data from the host. "xfer" is short for "transfer". **This is one of the core methods you must implement for TinyUSB to work (one other is the interrupt handler).** Data from the host is the OUT direction and data to the host is IN. It is used for all endpoints including the control endpoint 0. Make sure to handle the zero-length packet STATUS packet on endpoint 0 correctly. It may be a special transaction to the peripheral.
Besides that, all other transactions are relatively straight-forward. The endpoint address provides the endpoint Besides that, all other transactions are relatively straight-forward. The endpoint address provides the endpoint
number and direction which usually determines where to write the buffer info. The buffer and its length are usually number and direction which usually determines where to write the buffer info. The buffer and its length are usually
@ -195,21 +197,21 @@ Others (like the nRF52) may need each USB packet queued individually. To make th
some state for yourself and queue up an intermediate USB packet from the interrupt handler. some state for yourself and queue up an intermediate USB packet from the interrupt handler.
Once the transaction is going, the interrupt handler will notify TinyUSB of transfer completion. Once the transaction is going, the interrupt handler will notify TinyUSB of transfer completion.
During transmission, the IN data buffer is guaranteed to remain unchanged in memory until the ``dcd_xfer_complete`` function is called. During transmission, the IN data buffer is guaranteed to remain unchanged in memory until the ``dcd_xfer_complete()`` function is called.
The dcd_edpt_xfer function must never add zero-length-packets (ZLP) on its own to a transfer. If a ZLP is required, The ``dcd_edpt_xfer()`` function must never add zero-length-packets (ZLP) on its own to a transfer. If a ZLP is required,
then it must be explicitly sent by the stack calling dcd_edpt_xfer(), by calling dcd_edpt_xfer() a second time with len=0. then it must be explicitly sent by the stack calling ``dcd_edpt_xfer()``, by calling ``dcd_edpt_xfer()`` a second time with len=0.
For control transfers, this is automatically done in ``usbd_control.c``. For control transfers, this is automatically done in ``usbd_control.c``.
At the moment, only a single buffer can be transmitted at once. There is no provision for double-buffering. new dcd_edpt_xfer() will not At the moment, only a single buffer can be transmitted at once. There is no provision for double-buffering. new ``dcd_edpt_xfer()`` will not
be called again on the same endpoint address until the driver calls dcd_xfer_complete() (except in cases of USB resets). be called again on the same endpoint address until the driver calls ``dcd_xfer_complete()`` (except in cases of USB resets).
dcd_xfer_complete ``dcd_xfer_complete()``
""""""""""""""""" """""""""""""""""""""""
Once a transfer completes you must call dcd_xfer_complete from the USB interrupt handler to let TinyUSB know that a transaction has completed. Here is a sample call: Once a transfer completes you must call ``dcd_xfer_complete()`` from the USB interrupt handler to let TinyUSB know that a transaction has completed. Here is a sample call:
.. code-block:: .. code-block:: c
dcd_event_xfer_complete(0, ep_addr, xfer->actual_len, XFER_RESULT_SUCCESS, true); dcd_event_xfer_complete(0, ep_addr, xfer->actual_len, XFER_RESULT_SUCCESS, true);
@ -219,23 +221,23 @@ The arguments are:
* the USB peripheral number * the USB peripheral number
* the endpoint address * the endpoint address
* the actual length of the transfer. (OUT transfers may be smaller than the buffer given in ``dcd_edpt_xfer``\ ) * the actual length of the transfer. (OUT transfers may be smaller than the buffer given in ``dcd_edpt_xfer()``)
* the result of the transfer. Failure isn't handled yet. * the result of the transfer. Failure isn't handled yet.
* ``true`` to note the call is from an interrupt handler. * ``true`` to note the call is from an interrupt handler.
dcd_edpt_stall / dcd_edpt_clear_stall ``dcd_edpt_stall()`` / ``dcd_edpt_clear_stall()``
""""""""""""""""""""""""""""""""""""" """""""""""""""""""""""""""""""""""""""""""""""""
Stalling is one way an endpoint can indicate failure such as when an unsupported command is transmitted. The pair of ``dcd_edpt_stall``\ , ``dcd_edpt_clear_stall`` help manage the stall state of all endpoints. Stalling is one way an endpoint can indicate failure such as when an unsupported command is transmitted. The pair of ``dcd_edpt_stall()``, ``dcd_edpt_clear_stall()`` help manage the stall state of all endpoints.
Woohoo! Woohoo!
------- -------
At this point you should have everything working! ;-) Of course, you may not write perfect code. Here are some tips and tricks for debugging. At this point you should have everything working! 🙂 Of course, you may not write perfect code. Here are some tips and tricks for debugging.
Use `WireShark <https://www.wireshark.org/>`_ or `a Beagle <https://www.totalphase.com/protocols/usb/>`_ to sniff the USB traffic. When things aren't working its likely very early in the USB enumeration process. Figuring out where can help clue in where the issue is. For example: Use `WireShark <https://www.wireshark.org/>`_ or `a Beagle <https://www.totalphase.com/protocols/usb/>`_ to sniff the USB traffic. When things aren't working its likely very early in the USB enumeration process. Figuring out where can help clue in where the issue is. For example:
* If the host sends a SETUP packet and its not ACKed then your USB peripheral probably isn't started correctly. * If the host sends a SETUP packet and its not ACKed then your USB peripheral probably isn't started correctly.
* If the peripheral is started correctly but it still didn't work, then verify your usb clock is correct. (You did output a PWM based on it right? ;-) ) * If the peripheral is started correctly but it still didn't work, then verify your usb clock is correct. (You did output a PWM based on it right? 🙂)
* If the SETUP packet is ACKed but nothing is sent back then you interrupt handler isn't queueing the setup packet correctly. (Also, if you are using your own code instead of an example ``tud_task`` may not be called.) If that's OK, the ``dcd_xfer_complete`` may not be setting up the next transaction correctly. * If the SETUP packet is ACKed but nothing is sent back then you interrupt handler isn't queueing the setup packet correctly. (Also, if you are using your own code instead of an example ``tud_task()`` may not be called.) If that's OK, the ``dcd_xfer_complete()`` may not be setting up the next transaction correctly.

View File

@ -1,59 +0,0 @@
*********
Structure
*********
Tree
====
::
.
├── docs
├── examples
├── hw
│   ├── bsp
│   └── mcu
├── lib
├── src
├── test
└── tools
docs
----
Documentation
examples
--------
Sample with Makefile build support
hw/bsp
------
Supported boards source files
hw/mcu
------
Low level mcu core & peripheral drivers
lib
---
Sources from 3rd party such as freeRTOS, fatfs ...
src
---
All sources files for TinyUSB stack itself.
test
----
Unit tests for the stack
tools
-----
Files used internally

View File

@ -1,12 +1,6 @@
:hide-toc: :hide-toc:
********* .. include:: ../README_processed.rst
TinyUSB
*********
TinyUSB is an open-source cross-platform USB Host/Device stack for embedded systems,
designed to be memory-safe with no dynamic allocation and thread-safe with all interrupt events being deferred and then handled in the non-ISR task function.
.. toctree:: .. toctree::
:caption: Index :caption: Index

View File

@ -15,13 +15,12 @@ General
- Better support dcache, make sure all usb-transferred buffer are cache line aligned and occupy full cache line - Better support dcache, make sure all usb-transferred buffer are cache line aligned and occupy full cache line
- Build ARM IAR with CircleCI - Build ARM IAR with CircleCI
- Improve HIL with dual/host_info_to_device_cdc optional for pico/pico2, enable dwc2 dma test - Improve HIL with `dual/host_info_to_device_cdc`` optional for pico/pico2, enable dwc2 dma test
API Changes API Changes
----------- -----------
- Change signature of ``tusb_init(rhport, tusb_rhport_init_t*)``, tusb_init(void) is now deprecated but still available for backward compatibility - Change signature of ``tusb_init(rhport, tusb_rhport_init_t*)``, ``tusb_init(void)`` is now deprecated but still available for backward compatibility
- Add new ``tusb_int_handler(rhport, in_isr)`` - Add new ``tusb_int_handler(rhport, in_isr)``
- Add time-related APIs: ``tusb_time_millis_api()`` and ``tusb_time_delay_ms_api()`` for non-RTOS, required for some ports/configuration - Add time-related APIs: ``tusb_time_millis_api()`` and ``tusb_time_delay_ms_api()`` for non-RTOS, required for some ports/configuration
- New configuration macros: - New configuration macros:
@ -31,7 +30,6 @@ API Changes
- ``CFG_TUD/TUH_DWC2_SLAVE_ENABLE`` enable dwc2 slave mode - ``CFG_TUD/TUH_DWC2_SLAVE_ENABLE`` enable dwc2 slave mode
- ``CFG_TUD/TUH_DWC2_DMA_ENABLE`` enable dwc2 dma mode - ``CFG_TUD/TUH_DWC2_DMA_ENABLE`` enable dwc2 dma mode
Controller Driver (DCD & HCD) Controller Driver (DCD & HCD)
----------------------------- -----------------------------
@ -39,17 +37,17 @@ Controller Driver (DCD & HCD)
- Add DMA support for both device and host controller - Add DMA support for both device and host controller
- Add host driver support including: full/high speed, control/bulk/interrupt (CBI) transfer, split CBI i.e FS/LS attached via highspeed hub, hub support - Add host driver support including: full/high speed, control/bulk/interrupt (CBI) transfer, split CBI i.e FS/LS attached via highspeed hub, hub support
- RP2: implement dcd_edpt_iso_alloc() and dcd_edpt_iso_activate() for isochronous endpoint - RP2: implement ``dcd_edpt_iso_alloc()`` and ``dcd_edpt_iso_activate()`` for isochronous endpoint
- iMXRT1170 support M4 core - iMXRT1170 support M4 core
Device Stack Device Stack
------------ ------------
- Vendor Fix class reset - Vendor Fix class reset
- NCM fix recursions in tud_network_recv_renew() - NCM fix recursions in ``tud_network_recv_renew()``
- Audio fix align issue of _audiod_fct.alt_setting - Audio fix align issue of ``_audiod_fct.alt_setting``
- UVC support format frame based - UVC support format frame based
- Change dcd_dcache_() return type from void to bool - Change ``dcd_dcache_()`` return type from void to bool
- HID add Usage Table for Physical Input Device Page (0x0F) - HID add Usage Table for Physical Input Device Page (0x0F)
Host Stack Host Stack
@ -91,20 +89,20 @@ Controller Driver (DCD & HCD)
- Add support for ch32 usbd e.g ch32v203 - Add support for ch32 usbd e.g ch32v203
- Add support for STM32G4 and STM32U5 microcontrollers. - Add support for STM32G4 and STM32U5 microcontrollers.
- Fix h5 (32-bit) errata 2.15.1: Buffer description table update completes after CTR interrupt triggers - Fix h5 (32-bit) errata 2.15.1: Buffer description table update completes after CTR interrupt triggers
- ISO EP buffer allocation improvements, implement dcd_edpt_close_all() - ISO EP buffer allocation improvements, implement ``dcd_edpt_close_all()``
- Fix ch32v203 race condition and stability issue with - Fix ch32v203 race condition and stability issue with
- fix ch32v203 seems to unconditionally accept ZLP on EP0 OUT. - fix ch32v203 seems to unconditionally accept ZLP on EP0 OUT.
- fix v203 race condition between rx bufsize and RX_STAT which cause PMAOVR, occurs with WRITE10 - fix v203 race condition between rx bufsize and RX_STAT which cause PMAOVR, occurs with WRITE10
- correctly handle setup prepare at dcd_edpt0_status_complete(), which fixes the race condition with windows where we could miss setup packet (setup bit set, but count = 0) - correctly handle setup prepare at ``dcd_edpt0_status_complete()``, which fixes the race condition with windows where we could miss setup packet (setup bit set, but count = 0)
- MAX3421E - MAX3421E
- Add support for rp2040, esp32 (c3, c6, h2, etc..) - Add support for rp2040, esp32 (c3, c6, h2, etc..)
- Add hcd_deinit() for max3421 - Add ``hcd_deinit()`` for max3421
- Retry NAK handling next frame to reduce CPU and SPI bus usage - Retry NAK handling next frame to reduce CPU and SPI bus usage
- add cpuctl and pinctl to tuh_configure() option for max3421 - add ``cpuctl`` and ``pinctl`` to ``tuh_configure()`` option for max3421
- Implement hcd abort transfer for Max3421 - Implement hcd abort transfer for Max3421
- Properly Handle NAK Response in MAX3421E driver: correctly switch and skip writing to 2 FIFOs when NAK received. Otherwise, the driver may hang in certain conditions. - Properly Handle NAK Response in MAX3421E driver: correctly switch and skip writing to 2 FIFOs when NAK received. Otherwise, the driver may hang in certain conditions.
@ -116,7 +114,7 @@ Controller Driver (DCD & HCD)
- nRF - nRF
- Fix dcd_edpt_open for iso endpoint - Fix ``dcd_edpt_open()`` for iso endpoint
- Handle ISOOUT CRC errors - Handle ISOOUT CRC errors
- Add compile support with old nordic sdk - Add compile support with old nordic sdk
- Fix a few race conditions - Fix a few race conditions
@ -143,7 +141,7 @@ Controller Driver (DCD & HCD)
Device Stack Device Stack
------------ ------------
- Add tud_deinit() and class driver deinit() to deinitialize TinyUSB device stack. - Add ``tud_deinit()`` and ``class driver deinit()`` to deinitialize TinyUSB device stack.
- Add support for generic SOF callback. - Add support for generic SOF callback.
- Add set address recovery time 2ms per USB spec. - Add set address recovery time 2ms per USB spec.
@ -159,7 +157,7 @@ Device Stack
- CDC - CDC
- Add tud_cdc_configure_fifo() to make RX/TX buffer persistent (not clear when disconnected) - Add ``tud_cdc_configure_fifo()`` to make RX/TX buffer persistent (not clear when disconnected)
- Add missing capability bit for CDC ACM serial break support - Add missing capability bit for CDC ACM serial break support
- Enhanced CDC class with better handling of large data transmissions. - Enhanced CDC class with better handling of large data transmissions.
- Add missing capability bit for CDC ACM serial break support - Add missing capability bit for CDC ACM serial break support
@ -177,39 +175,39 @@ Device Stack
- Net - Net
- Rewrite of NCM device driver to improve throughput - Rewrite of NCM device driver to improve throughput
- removed obsolete tud_network_link_state_cb() - removed obsolete ``tud_network_link_state_cb()``
- USBTMC Added notification support - USBTMC Added notification support
- Vendor - Vendor
- Migrate to new endpoint stream API, support non-buffered TX/RX - Migrate to new endpoint stream API, support non-buffered TX/RX
- Add ZLP for write() when needed - Add ZLP for ``write()`` when needed
- Video - Video
- Enhance UVC descriptors and example - Enhance UVC descriptors and example
- Video Added support for USB Video Class (UVC) with MJPEG. - Video Added support for USB Video Class (UVC) with MJPEG.
- Fix multiple interfaces, add an example of 2ch video capture. - Fix multiple interfaces, add an example of 2ch video capture.
- Fix race for tud_video_n_streaming check - Fix race for ``tud_video_n_streaming()`` check
Host Stack Host Stack
---------- ----------
- Added tuh_deinit() to de-initialize TinyUSB host stack. - Added ``tuh_deinit()`` to de-initialize TinyUSB host stack.
- Added support for new USB mass storage class APIs. - Added support for new USB mass storage class APIs.
- Improved error handling and retry mechanisms for unstable devices. - Improved error handling and retry mechanisms for unstable devices.
- CDC Serial - CDC Serial
- Add support for ch34x - Add support for ch34x
- Allow to overwrite CFG_TUH_CDC_FTDI/CP210X/CH32X_VID_PID_LIST - Allow to overwrite ``CFG_TUH_CDC_FTDI/CP210X/CH32X_VID_PID_LIST``
- Enhanced stability of CDC-ACM devices during enumeration. - Enhanced stability of CDC-ACM devices during enumeration.
- HID - HID
- Add tuh_hid_receive_abort() - Add ``tuh_hid_receive_abort()``
- Add tuh_hid_get_report() - Add ``tuh_hid_get_report()``
- Hub - Hub
@ -226,14 +224,14 @@ Host Stack
- Remove submodules and use python script to manage repo dependencies #1947 - Remove submodules and use python script to manage repo dependencies #1947
- Add CMake support for most families and boards, move build file from tools/ to examples/build_system - Add CMake support for most families and boards, move build file from tools/ to examples/build_system
- Add ETM trace support with JTrace for nrf52840, nrf5340, mcb1857, stm32h743eval, ra6m5 - Add ETM trace support with JTrace for nrf52840, nrf5340, mcb1857, stm32h743eval, ra6m5
- [osal] Make it possible to override the osal_task_delay() in osal_none - [osal] Make it possible to override the ``osal_task_delay()`` in osal_none
- Add CDC+UAC2 composite device example - Add CDC+UAC2 composite device example
- Enhance Hardware-in-the-loop (HIL) testing with more boards: rp2040, stm32l412nucleo, stm32f746disco, lpcxpresso43s67 - Enhance Hardware-in-the-loop (HIL) testing with more boards: rp2040, stm32l412nucleo, stm32f746disco, lpcxpresso43s67
Controller Driver (DCD & HCD) Controller Driver (DCD & HCD)
----------------------------- -----------------------------
- Add new ISO endpoint API: dcd_edpt_iso_alloc() and dcd_edpt_iso_activate() - Add new ISO endpoint API: ``dcd_edpt_iso_alloc()`` and ``dcd_edpt_iso_activate()``
- Remove legacy driver st/synopsys - Remove legacy driver st/synopsys
- EHCI - EHCI
@ -246,10 +244,10 @@ Controller Driver (DCD & HCD)
- Fix error on EHCI causes xfer error in non-queued qhd which cause memory fault - Fix error on EHCI causes xfer error in non-queued qhd which cause memory fault
- Un-roll recursive hub removal with usbh queue - Un-roll recursive hub removal with usbh queue
- Fix issue when removing queue head - Fix issue when removing queue head
- Implement hcd_edpt_abort_xfer() - Implement ``hcd_edpt_abort_xfer()``
- use standard USB complete interrupt instead of custom chipidea async/period interrupt to be more compatible with other ehci implementation - use standard USB complete interrupt instead of custom chipidea async/period interrupt to be more compatible with other ehci implementation
- refactor usb complete & error isr processing, merge, update. Fix EHCI QHD reuses QTD on wrong endpoint - refactor usb complete & error isr processing, merge, update. Fix EHCI QHD reuses QTD on wrong endpoint
- Improve bus reset, fix send_setup() not carried out if halted previously - Improve bus reset, fix ``send_setup()`` not carried out if halted previously
- Fix clear qhd halted bit if not caused by STALL protocol to allow for next transfer - Fix clear qhd halted bit if not caused by STALL protocol to allow for next transfer
- ChipIdea Highspeed - ChipIdea Highspeed
@ -275,12 +273,12 @@ Controller Driver (DCD & HCD)
- rp2040 - rp2040
- [dcd] Make writes to SIE_CTRL aware of concurrent access - [dcd] Make writes to SIE_CTRL aware of concurrent access
- [hcd] add hcd_frame_number(), hcd_edpt_abort_xfer() for pio-usb host - [hcd] add ``hcd_frame_number()``, ``hcd_edpt_abort_xfer()`` for pio-usb host
- stm32 fsdev: - stm32 fsdev:
- Add STM32L5 support - Add STM32L5 support
- Implement dcd_edpt_iso_alloc() and dcd_edpt_iso_activate() - Implement ``dcd_edpt_iso_alloc()`` and ``dcd_edpt_iso_activate()``
- OHCI - OHCI
@ -294,7 +292,7 @@ Controller Driver (DCD & HCD)
Device Stack Device Stack
------------ ------------
- Add optional hooks tud_event_hook_cb() - Add optional hooks ``tud_event_hook_cb()``
- Audio (UAC2) - Audio (UAC2)
- Fix feedback EP buffer alignment. - Fix feedback EP buffer alignment.
@ -312,12 +310,12 @@ Device Stack
- MIDI - MIDI
- Fix stream_write() always writes system messages to cable 0 - Fix ``stream_write()`` always writes system messages to cable 0
- Fix incorrect NOTE_ON, NOTE_OFF definitions - Fix incorrect NOTE_ON, NOTE_OFF definitions
- USBTMC: Fix tmc488 bit order - USBTMC: Fix tmc488 bit order
- Vendor: fix read()/write() race condition - Vendor: fix ``read()``/``write()`` race condition
- Video (UVC) - Video (UVC)
@ -328,26 +326,26 @@ Host Stack
- USBH - USBH
- Add new APIs: tuh_interface_set(), tuh_task_event_ready(), tuh_edpt_abort_xfer(), tuh_rhport_reset_bus(), tuh_rhport_is_active() - Add new APIs: ``tuh_interface_set()``, ``tuh_task_event_ready()``, ``tuh_edpt_abort_xfer()``, ``tuh_rhport_reset_bus()``, ``tuh_rhport_is_active()``
- Fix issue when device generate multiple attach/detach/attach when plugging in - Fix issue when device generate multiple attach/detach/attach when plugging in
- Prefer application callback over built-in driver on transfer complete event - Prefer application callback over built-in driver on transfer complete event
- Correct hcd_edpt_clear_stall() API signature - Correct ``hcd_edpt_clear_stall()`` API signature
- Separate bus reset delay and contact debouncing delay in enumeration - Separate bus reset delay and contact debouncing delay in enumeration
- Support usbh_app_driver_get_cb() for application drivers - Support ``usbh_app_driver_get_cb()`` for application drivers
- Fix usbh enumeration removal race condition - Fix usbh enumeration removal race condition
- Add optional hooks tuh_event_hook_cb() - Add optional hooks ``tuh_event_hook_cb()``
- CDC - CDC
- Breaking: change tuh_cdc_itf_get_info() to use tuh_itf_info_t instead of tuh_cdc_info_t - Breaking: change ``tuh_cdc_itf_get_info()`` to use tuh_itf_info_t instead of tuh_cdc_info_t
- Fix cdc host enumeration issue when device does not support line request - Fix cdc host enumeration issue when device does not support line request
- Add support for vendor usb2uart serial: ftdi, cp210x, ch9102f - Add support for vendor usb2uart serial: ftdi, cp210x, ch9102f
- Improve sync control API e.g tuh_cdc_set_control_line_state(), tuh_cdc_set_line_coding() - Improve sync control API e.g ``tuh_cdc_set_control_line_state()``, ``tuh_cdc_set_line_coding()``
- HID - HID
- Add new APIs tuh_hid_send_report(), tuh_hid_itf_get_info(), tuh_hid_receive_ready(), tuh_hid_send_ready(), tuh_hid_set_default_protocol() - Add new APIs ``tuh_hid_send_report()``, ``tuh_hid_itf_get_info()``, ``tuh_hid_receive_ready()``, ``tuh_hid_send_ready()``, ``tuh_hid_set_default_protocol()``
- Change meaning of CFG_TUH_HID to total number of HID interfaces supported. Previously CFG_TUH_HID is max number of interfaces per device which is rather limited and consume more resources than needed. - Change meaning of CFG_TUH_HID to total number of HID interfaces supported. Previously ``CFG_TUH_HID`` is max number of interfaces per device which is rather limited and consume more resources than needed.
- HUB - HUB
@ -356,7 +354,7 @@ Host Stack
- MSC - MSC
- Fix bug in tuh_msc_ready() - Fix bug in ``tuh_msc_ready()``
- Fix host msc get maxlun not using aligned section memory - Fix host msc get maxlun not using aligned section memory
0.15.0 0.15.0
@ -387,7 +385,7 @@ Controller Driver (DCD & HCD)
- [rp2040] - [rp2040]
- [dcd] Implement workaround for Errata 15. This enable SOF when bulk-in endpoint is in use and reduce its bandwidth to only 80% - [dcd] Implement workaround for Errata 15. This enable SOF when bulk-in endpoint is in use and reduce its bandwidth to only 80%
- [hcd] Fix shared irq slots filling up when hcd_init() is called multiple times - [hcd] Fix shared irq slots filling up when ``hcd_init()`` is called multiple times
- [hcd] Support host bulk endpoint using hw "interrupt" endpoint. Note speed limit is 64KB/s - [hcd] Support host bulk endpoint using hw "interrupt" endpoint. Note speed limit is 64KB/s
- [samd][dcd] Add support for ISO endpoint - [samd][dcd] Add support for ISO endpoint
@ -412,12 +410,12 @@ Device Stack
- [HID] - [HID]
- Add FIDO descriptor template - Add FIDO descriptor template
- change length in tud_hid_report_complete_cb() from uint8 to uint16 - change length in ``tud_hid_report_complete_cb()`` from ``uint8_t`` to ``uint16_t``
- [CDC] - [CDC]
- Fix autoflush for FIFO < MPS - Fix autoflush for FIFO < MPS
- Fix tx fifo memory overflown when DTR is not set and tud_cdc_write() is called repeatedly with large enough data - Fix tx fifo memory overflown when DTR is not set and ``tud_cdc_write()`` is called repeatedly with large enough data
- [USBTMC] Fix packet size with highspeed - [USBTMC] Fix packet size with highspeed
@ -425,7 +423,7 @@ Host Stack
---------- ----------
- Retry a few times with transfers in enumeration since device can be unstable when starting up - Retry a few times with transfers in enumeration since device can be unstable when starting up
- [MSC] Rework host masstorage API. Add new **host/msc_file_explorer** example - [MSC] Rework host masstorage API. Add new ``host/msc_file_explorer`` example
- [CDC] - [CDC]
- Add support for host cdc - Add support for host cdc
@ -435,22 +433,22 @@ Host Stack
====== ======
- Improve compiler support for CCRX and IAR - Improve compiler support for CCRX and IAR
- Add timeout to osal_queue_receive() - Add timeout to ``osal_queue_receive()``
- Add tud_task_ext(timeout, in_isr) as generic version of tud_task(). Same as tuh_task_ext(), tuh_task() - Add ``tud_task_ext(timeout, in_isr)`` as generic version of ``tud_task()``. Same as ``tuh_task_ext()``, ``tuh_task()``
- Enable more warnings -Wnull-dereference -Wuninitialized -Wunused -Wredundant-decls -Wconversion - Enable more warnings ``-Wnull-dereference -Wuninitialized -Wunused -Wredundant-decls -Wconversion``
- Add new examples - Add new examples
- host/bare_api to demonstrate generic (app-level) enumeration and endpoint transfer - ``host/bare_api`` to demonstrate generic (app-level) enumeration and endpoint transfer
- dual/host_hid_to_device_cdc to run both device and host stack concurrently, get HID report from host and print out to device CDC. This example only work with multiple-controller MCUs and rp2040 with the help of pio-usb as added controller. - ``dual/host_hid_to_device_cdc`` to run both device and host stack concurrently, get HID report from host and print out to device CDC. This example only work with multiple-controller MCUs and rp2040 with the help of pio-usb as added controller.
Controller Driver (DCD & HCD) Controller Driver (DCD & HCD)
----------------------------- -----------------------------
- Enhance rhports management to better support dual roles - Enhance rhports management to better support dual roles
- CFG_TUD_ENABLED/CFG_TUH_ENABLED, CFG_TUD_MAX_SPEED/CFG_TUH_MAX_SPEED can be used to replace CFG_TUSB_RHPORT0_MODE/CFG_TUSB_RHPORT1_MODE - ``CFG_TUD_ENABLED``/``CFG_TUH_ENABLED``, ``CFG_TUD_MAX_SPEED``/``CFG_TUH_MAX_SPEED`` can be used to replace ``CFG_TUSB_RHPORT0_MODE``/``CFG_TUSB_RHPORT1_MODE``
- tud_init(rphort), tuh_init(rhport) can be used to init stack on specified roothub port (controller) instead of tusb_init(void) - ``tud_init(rphort)``, ``tuh_init(rhport)`` can be used to init stack on specified roothub port (controller) instead of ``tusb_init(void)``
- Add dcd/hcd port specific defines `TUP_` (stand for tinyusb port-specific) - Add dcd/hcd port specific defines ``TUP_`` (stand for tinyusb port-specific)
- [dwc2] - [dwc2]
- Update to support stm32 h72x, h73x with only 1 otg controller - Update to support stm32 h72x, h73x with only 1 otg controller
@ -471,10 +469,10 @@ Device Stack
- [Audio] Add support for feedback endpoint computation - [Audio] Add support for feedback endpoint computation
- New API tud_audio_feedback_params_cb(), tud_audio_feedback_interval_isr(). - New API ``tud_audio_feedback_params_cb()``, ``tud_audio_feedback_interval_isr()``.
- Supported computation method are: frequency with fixed/float or power of 2. Feedback with fifo count is not yet supported. - Supported computation method are: frequency with fixed/float or power of 2. Feedback with fifo count is not yet supported.
- Fix nitfs (should be 3) in TUD_AUDIO_HEADSET_STEREO_DESCRIPTOR - Fix nitfs (should be 3) in ``TUD_AUDIO_HEADSET_STEREO_DESCRIPTOR``
- Fix typo in audiod_rx_done_cb() - Fix typo in ``audiod_rx_done_cb()``
- [DFU] Fix coexistence with other interfaces BTH, RNDIS - [DFU] Fix coexistence with other interfaces BTH, RNDIS
- [MSC] Fix inquiry response additional length field - [MSC] Fix inquiry response additional length field
@ -483,23 +481,23 @@ Device Stack
Host Stack Host Stack
---------- ----------
- Add new API tuh_configure(rhport, cfg_id, cfg_param) for dynamnic port specific behavior configuration - Add new API ``tuh_configure(rhport, cfg_id, cfg_param)`` for dynamnic port specific behavior configuration
- [HID] Open OUT endpoint if available - [HID] Open OUT endpoint if available
- [Hub] hub clear port and device interrupts - [Hub] hub clear port and device interrupts
- [USBH] Major improvement - [USBH] Major improvement
- Rework usbh control transfer with complete callback. New API tuh_control_xfer() though still only carry 1 usbh (no queueing) at a time. - Rework usbh control transfer with complete callback. New API ``tuh_control_xfer()`` though still only carry 1 usbh (no queueing) at a time.
- Add generic endpoint transfer with tuh_edpt_open(), tuh_edpt_xfer(). Require `CFG_TUH_API_EDPT_XFER=1` - Add generic endpoint transfer with ``tuh_edpt_open()``, ``tuh_edpt_xfer()``. Require ``CFG_TUH_API_EDPT_XFER=1``
- Support app-level enumeration with new APIs - Support app-level enumeration with new APIs
- tuh_descriptor_get(), tuh_descriptor_get_device(), tuh_descriptor_get_configuration(), tuh_descriptor_get_hid_report() - ``tuh_descriptor_get()``, ``tuh_descriptor_get_device()``, ``tuh_descriptor_get_configuration()``, ``tuh_descriptor_get_hid_report()``
- tuh_descriptor_get_string(), tuh_descriptor_get_manufacturer_string(), tuh_descriptor_get_product_string(), tuh_descriptor_get_serial_string() - ``tuh_descriptor_get_string()``, ``tuh_descriptor_get_manufacturer_string()``, ``tuh_descriptor_get_product_string()``, ``tuh_descriptor_get_serial_string()``
- Also add _sync() as sync/blocking version for above APIs - Also add ``_sync()`` as sync/blocking version for above APIs
0.13.0 0.13.0
====== ======
- [tu_fifo] Fix locked mutex when full, and return type in peek_n() - [tu_fifo] Fix locked mutex when full, and return type in ``peek_n()``
Controller Driver (DCD & HCD) Controller Driver (DCD & HCD)
----------------------------- -----------------------------
@ -528,7 +526,7 @@ Device Stack
------------ ------------
- [Audio] Support disabling feedback format correction (16.16 <-> 10.14 format) - [Audio] Support disabling feedback format correction (16.16 <-> 10.14 format)
- [MSC] Add tud_msc_request_sense_cb() callback, change most default sense error to medium not present (0x02, 0x3A, 0x00) - [MSC] Add ``tud_msc_request_sense_cb()`` callback, change most default sense error to medium not present (0x02, 0x3A, 0x00)
- [Video] Fix video_capture example fails enumeration when 8FPS - [Video] Fix video_capture example fails enumeration when 8FPS
Host Stack Host Stack
@ -539,22 +537,22 @@ No notable changes
0.12.0 0.12.0
====== ======
- add CFG_TUSB_OS_INC_PATH for os include path - add ``CFG_TUSB_OS_INC_PATH`` for os include path
Device Controller Driver (DCD) Device Controller Driver (DCD)
------------------------------ ------------------------------
- Getting device stack to pass USB Compliance Verification test (chapter9, HID, MSC). Ports are tested: - Getting device stack to pass USB Compliance Verification test (chapter9, HID, MSC). Ports are tested:
nRF, SAMD 21/51, rp2040, stm32f4, Renesas RX, iMXRT, ESP32-S2/3, Kinetic KL25/32, DA146xx nRF, SAMD 21/51, rp2040, stm32f4, Renesas RX, iMXRT, ESP32-S2/3, Kinetic KL25/32, DA146xx
- Added dcd_edpt_close_all() for switching configuration - Added ``dcd_edpt_close_all()`` for switching configuration
- [Transdimension] Support dcd_edpt_xfer_fifo() with auto wrap over if fifo buffer is 4K aligned and size is multiple of 4K. - [Transdimension] Support ``dcd_edpt_xfer_fifo()`` with auto wrap over if fifo buffer is 4K aligned and size is multiple of 4K.
- [DA146xx] Improve vbus, reset, suspend, resume detection, and remote wakeup. - [DA146xx] Improve vbus, reset, suspend, resume detection, and remote wakeup.
Device Stack Device Stack
------------ ------------
- Add new network driver Network Control Model (CDC-NCM), update net_lwip_webserver to work with NCM (need re-configure example) - Add new network driver Network Control Model (CDC-NCM), update ``net_lwip_webserver`` to work with NCM (need re-configure example)
- Add new USB Video Class UVC 1.5 driver and video_capture example ((work in progress) - Add new USB Video Class UVC 1.5 driver and video_capture example (work in progress)
- Fix potential buffer overflow for HID, bluetooth drivers - Fix potential buffer overflow for HID, bluetooth drivers
Host Controller Driver (HCD) Host Controller Driver (HCD)
@ -591,13 +589,13 @@ Synopsys
^^^^^^^^ ^^^^^^^^
- Fix Synopsys set address bug which could cause re-enumeration failed - Fix Synopsys set address bug which could cause re-enumeration failed
- Fix dcd_synopsys driver integer overflow in HS mode (issue #968) - Fix ``dcd_synopsys`` driver integer overflow in HS mode (issue #968)
nRF5x nRF5x
^^^^^ ^^^^^
- Add nRF5x suspend, resume and remote wakeup - Add nRF5x suspend, resume and remote wakeup
- Fix nRF5x race condition with TASKS_EP0RCVOUT - Fix nRF5x race condition with ``TASKS_EP0RCVOUT``
RP2040 RP2040
^^^^^^ ^^^^^^
@ -612,8 +610,8 @@ USBD
^^^^ ^^^^
- Better support big endian mcu - Better support big endian mcu
- Add tuh_inited() and tud_inited(), will separate tusb_init/inited() to tud/tuh init/inited - Add ``tuh_inited()`` and ``tud_inited()``, will separate ``tusb_init/inited()`` to ``tud/tuh_init/inited()``
- Add dcd_attr.h for defining common controller attribute such as max endpoints - Add ``dcd_attr.h`` for defining common controller attribute such as max endpoints
Bluetooth Bluetooth
^^^^^^^^^ ^^^^^^^^^
@ -623,8 +621,8 @@ Bluetooth
DFU DFU
^^^ ^^^
- Enhance DFU implementation to support multiple alternate interface and better support bwPollTimeout - Enhance DFU implementation to support multiple alternate interface and better support ``bwPollTimeout``
- Rename CFG_TUD_DFU_MODE to simply CFG_TUD_DFU - Rename ``CFG_TUD_DFU_MODE`` to simply ``CFG_TUD_DFU``
HID HID
^^^ ^^^
@ -649,7 +647,7 @@ Vendor
^^^^^^ ^^^^^^
- Fix vendor fifo deadlock in certain case - Fix vendor fifo deadlock in certain case
- Add tud_vendor_n_read_flush - Add ``tud_vendor_n_read_flush()``
Host Controller Driver (HCD) Host Controller Driver (HCD)
---------------------------- ----------------------------
@ -666,7 +664,7 @@ Host Stack
- Major update and rework most of host stack, still needs more improvement - Major update and rework most of host stack, still needs more improvement
- Lots of improvement and update in parsing configuration and control - Lots of improvement and update in parsing configuration and control
- Rework and major update to HID driver. Will default to enable boot interface if available - Rework and major update to HID driver. Will default to enable boot interface if available
- Separate CFG_TUH_DEVICE_MAX and CFG_TUH_HUB for better management and reduce SRAM usage - Separate ``CFG_TUH_DEVICE_MAX`` and ``CFG_TUH_HUB`` for better management and reduce SRAM usage
0.10.1 (2021-06-03) 0.10.1 (2021-06-03)
=================== ===================
@ -678,9 +676,9 @@ Host Controller Driver (HCD)
- Fix rp2040 host driver: incorrect PID with low speed device with max packet size of 8 bytes - Fix rp2040 host driver: incorrect PID with low speed device with max packet size of 8 bytes
- Improve hub driver - Improve hub driver
- Remove obsolete hcd_pipe_queue_xfer()/hcd_pipe_xfer() - Remove obsolete ``hcd_pipe_queue_xfer()``/``hcd_pipe_xfer()``
- Use hcd_frame_number() instead of micro frame - Use ``hcd_frame_number()`` instead of micro frame
- Fix OHCI endpoint address and xferred_bytes in xfer complete event - Fix OHCI endpoint address and ``xferred_bytes`` in xfer complete event
0.10.0 (2021-05-28) 0.10.0 (2021-05-28)
=================== ===================
@ -699,7 +697,7 @@ Device Controller Driver (DCD)
- Fix build with nRF5340 - Fix build with nRF5340
- Fix build with lpc15 and lpc54 - Fix build with lpc15 and lpc54
- Fix build with lpc177x_8x - Fix build with lpc177x_8x
- STM32 Synopsys: greatly improve Isochronous transfer with edpt_xfer_fifo API - STM32 Synopsys: greatly improve Isochronous transfer with ``edpt_xfer_fifo()`` API
- Support LPC55 port1 highspeed - Support LPC55 port1 highspeed
- Add support for Espressif esp32s3 - Add support for Espressif esp32s3
- nRF: fix race condition that could cause drop packet of Bulk OUT transfer - nRF: fix race condition that could cause drop packet of Bulk OUT transfer
@ -707,14 +705,14 @@ Device Controller Driver (DCD)
USB Device Driver (USBD) USB Device Driver (USBD)
------------------------ ------------------------
- Add new (optional) endpoint ADPI usbd_edpt_xfer_fifo - Add new (optional) endpoint ADPI ``usbd_edpt_xfer_fifo()``
Device Class Driver Device Class Driver
------------------- -------------------
CDC CDC
- [Breaking] tud_cdc_peek(), tud_vendor_peek() no longer support random offset and dropped position parameter. - [Breaking] ``tud_cdc_peek()``, ``tud_vendor_peek()`` no longer support random offset and dropped position parameter.
DFU DFU
@ -726,19 +724,19 @@ HID
- Add more hid keys constant from 0x6B to 0xA4 - Add more hid keys constant from 0x6B to 0xA4
- [Breaking] rename API - [Breaking] rename API
- HID_PROTOCOL_NONE/KEYBOARD/MOUST to HID_ITF_PROTOCOL_NONE/KEYBOARD/MOUSE - ``HID_PROTOCOL_NONE/KEYBOARD/MOUSE`` to ``HID_ITF_PROTOCOL_NONE/KEYBOARD/MOUSE``
- tud_hid_boot_mode() to tud_hid_get_protocol() - ``tud_hid_boot_mode()`` to ``tud_hid_get_protocol()``
- tud_hid_boot_mode_cb() to tud_hid_set_protocol_cb() - ``tud_hid_boot_mode_cb()`` to ``tud_hid_set_protocol_cb()``
MIDI MIDI
- Fix MIDI buffer overflow issue - Fix MIDI buffer overflow issue
- [Breaking] rename API - [Breaking] rename API
- Rename tud_midi_read() to tud_midi_stream_read() - Rename ``tud_midi_read()`` to ``tud_midi_stream_read()``
- Rename tud_midi_write() to tud_midi_stream_write() - Rename ``tud_midi_write()`` to ``tud_midi_stream_write()``
- Rename tud_midi_receive() to tud_midi_packet_read() - Rename ``tud_midi_receive()`` to ``tud_midi_packet_read()``
- Rename tud_midi_send() to tud_midi_packet_write() - Rename ``tud_midi_send()`` to ``tud_midi_packet_write()``
Host Controller Driver (HCD) Host Controller Driver (HCD)
---------------------------- ----------------------------
@ -785,7 +783,7 @@ NXP Transdimention
USB Device Driver (USBD) USB Device Driver (USBD)
^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^
- Fix issue with status zlp (tud_control_status) is returned by class driver with SET/CLEAR_FEATURE for endpoint. - Fix issue with status zlp (``tud_control_status()``) is returned by class driver with SET/CLEAR_FEATURE for endpoint.
- Correct endpoint size check for fullspeed bulk, can be 8, 16, 32, 64 - Correct endpoint size check for fullspeed bulk, can be 8, 16, 32, 64
- Ack SET_INTERFACE even if it is not implemented by class driver. - Ack SET_INTERFACE even if it is not implemented by class driver.
@ -794,34 +792,34 @@ Device Class Driver
DFU Runtime DFU Runtime
- rename dfu_rt to dfu_runtime for easy reading - rename ``dfu_rt()`` to ``dfu_runtime()`` for easy reading
CDC CDC
- Add tud_cdc_send_break_cb() to support break request - Add ``tud_cdc_send_break_cb()`` to support break request
- Improve CDC receive, minor behavior changes: when tud_cdc_rx_wanted_cb() is invoked wanted_char may not be the last byte in the fifo - Improve CDC receive, minor behavior changes: when ``tud_cdc_rx_wanted_cb()`` is invoked wanted_char may not be the last byte in the fifo
HID HID
- [Breaking] Add itf argument to hid API to support multiple instances, follow API has signature changes - [Breaking] Add itf argument to hid API to support multiple instances, follow API has signature changes
- tud_hid_descriptor_report_cb() - ``tud_hid_descriptor_report_cb()``
- tud_hid_get_report_cb() - ``tud_hid_get_report_cb()``
- tud_hid_set_report_cb() - ``tud_hid_set_report_cb()``
- tud_hid_boot_mode_cb() - ``tud_hid_boot_mode_cb()``
- tud_hid_set_idle_cb() - ``tud_hid_set_idle_cb()``
- Add report complete callback tud_hid_report_complete_cb() API - Add report complete callback ``tud_hid_report_complete_cb()`` API
- Add DPad/Hat support for HID Gamepad - Add DPad/Hat support for HID Gamepad
- `TUD_HID_REPORT_DESC_GAMEPAD()` now support 16 buttons, 2 joysticks, 1 hat/dpad - ``TUD_HID_REPORT_DESC_GAMEPAD()`` now support 16 buttons, 2 joysticks, 1 hat/dpad
- Add hid_gamepad_report_t along with `GAMEPAD_BUTTON_` and `GAMEPAD_HAT_` enum - Add ``hid_gamepad_report_t`` along with ``GAMEPAD_BUTTON_`` and ``GAMEPAD_HAT_`` enum
- Add Gamepad to hid_composite / hid_composite_freertos example - Add Gamepad to ``hid_composite`` / ``hid_composite_freertos`` example
MIDI MIDI
- Fix dropping MIDI sysex message when fifo is full - Fix dropping MIDI sysex message when fifo is full
- Fix typo in tud_midi_write24(), make example less ambiguous for cable and channel - Fix typo in ``tud_midi_write24()``, make example less ambiguous for cable and channel
- Fix incorrect endpoint descriptor length, MIDI v1 use Audio v1 which has 9-byte endpoint descriptor (instead of 7) - Fix incorrect endpoint descriptor length, MIDI v1 use Audio v1 which has 9-byte endpoint descriptor (instead of 7)
Host Stack Host Stack
@ -830,14 +828,14 @@ Host Stack
Host Controller Driver (HCD) Host Controller Driver (HCD)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
- Add rhport to hcd_init() - Add rhport to ``hcd_init()``
- Improve EHCI/OHCI driver abstraction - Improve EHCI/OHCI driver abstraction
- Move echi/ohci files to portable/ - Move echi/ohci files to portable/
- Rename hcd_lpc18_43 to hcd_transdimension - Rename ``hcd_lpc18_43`` to ``hcd_transdimension``
- Sub hcd API with hcd_ehci_init(), hcd_ehci_register_addr() - Sub hcd API with ``hcd_ehci_init()``, ``hcd_ehci_register_addr()``
- Update NXP transdimention hcd_init() to reset controller to host mode - Update NXP transdimension ``hcd_init()`` to reset controller to host mode
- Ported hcd to rt10xx - Ported hcd to rt10xx
@ -851,20 +849,20 @@ Host Class Driver
MSC MSC
- Rename tuh_msc_scsi_inquiry() to tuh_msc_inquiry() - Rename ``tuh_msc_scsi_inquiry()`` to ``tuh_msc_inquiry()``
- Rename tuh_msc_mounted_cb/tuh_msc_unmounted_cb to tuh_msc_mount_cb/tuh_msc_unmount_cb to match device stack naming - Rename ``tuh_msc_mounted_cb()``/``tuh_msc_unmounted_cb()`` to ``tuh_msc_mount_cb()``/``tuh_msc_unmount_cb()`` to match device stack naming
- Change tuh_msc_is_busy() to tuh_msc_ready() - Change ``tuh_msc_is_busy()`` to ``tuh_msc_ready()``
- Add read10 and write10 function: tuh_msc_read10(), tuh_msc_write10() - Add read10 and write10 function: ``tuh_msc_read10()``, ``tuh_msc_write10()``
- Read_Capacity is invoked as part of enumeration process - Read_Capacity is invoked as part of enumeration process
- Add tuh_msc_get_block_count(), tuh_msc_get_block_size() - Add ``tuh_msc_get_block_count()``, ``tuh_msc_get_block_size()``
- Add CFG_TUH_MSC_MAXLUN (default to 4) to hold lun capacities - Add ``CFG_TUH_MSC_MAXLUN`` (default to 4) to hold lun capacities
Others Others
------ ------
- Add basic support for rt-thread OS - Add basic support for rt-thread OS
- Change zero bitfield length to more explicit padding - Change zero bitfield length to more explicit padding
- Build example now fetch required submodules on the fly while running `make` without prio submodule init for mcu drivers - Build example now fetch required submodules on the fly while running ``make`` without prior submodule init for mcu drivers
- Update pico-sdk to v1.1.0 - Update pico-sdk to v1.1.0
**New Boards** **New Boards**
@ -882,7 +880,7 @@ Device Controller Driver
- Added new device support for Raspberry Pi RP2040 - Added new device support for Raspberry Pi RP2040
- Added new device support for NXP Kinetis KL25ZXX - Added new device support for NXP Kinetis KL25ZXX
- Use dcd_event_bus_reset() with link speed to replace bus_signal - Use ``dcd_event_bus_reset()`` with link speed to replace bus_signal
- ESP32-S2: - ESP32-S2:
- Add bus suspend and wakeup support - Add bus suspend and wakeup support
@ -904,8 +902,8 @@ USB Device
**USBD** **USBD**
- Rework usbd control transfer to have additional stage parameter for setup, data, status - Rework usbd control transfer to have additional stage parameter for setup, data, status
- Fix tusb_init() return true instead of TUSB_ERROR_NONE - Fix ``tusb_init()`` return true instead of ``TUSB_ERROR_NONE``
- Added new API tud_connected() that return true after device got out of bus reset and received the very first setup packet - Added new API ``tud_connected()`` that return true after device got out of bus reset and received the very first setup packet
**Class Driver** **Class Driver**
@ -913,22 +911,22 @@ USB Device
- Allow to transmit data, even if the host does not support control line states i.e set DTR - Allow to transmit data, even if the host does not support control line states i.e set DTR
- HID - HID
- change default CFG_TUD_HID_EP_BUFSIZE from 16 to 64 - change default ``CFG_TUD_HID_EP_BUFSIZE`` from 16 to 64
- MIDI - MIDI
- Fix midi sysex sending bug - Fix midi sysex sending bug
- MSC - MSC
- Invoke only scsi complete callback after status transaction is complete. - Invoke only scsi complete callback after status transaction is complete.
- Fix scsi_mode_sense6_t padding, which cause IAR compiler internal error. - Fix ``scsi_mode_sense6_t`` padding, which cause IAR compiler internal error.
- USBTMC - USBTMC
- Change interrupt endpoint example size to 8 instead of 2 for better compatibility with mcu - Change interrupt endpoint example size to 8 instead of 2 for better compatibility with mcu
**Example** **Example**
- Support make from windows cmd.exe - Support make from windows ``cmd.exe``
- Add HID Consumer Control (media keys) to hid_composite & hid_composite_freertos examples - Add HID Consumer Control (media keys) to ``hid_composite`` & ``hid_composite_freertos`` examples
USB Host USB Host
@ -969,28 +967,28 @@ Device Controller Driver
- Support multiple usb ports with rhport=1 is highspeed on selected MCUs e.g H743, F23. It is possible to have OTG_HS to run on Fullspeed PHY (e.g lacking external PHY) - Support multiple usb ports with rhport=1 is highspeed on selected MCUs e.g H743, F23. It is possible to have OTG_HS to run on Fullspeed PHY (e.g lacking external PHY)
- Add ISO transfer, fix odd/even frame - Add ISO transfer, fix odd/even frame
- Fix FIFO flush during stall - Fix FIFO flush during stall
- Implement dcd_edpt_close() API - Implement ``dcd_edpt_close()`` API
- Support F105, F107 - Support F105, F107
- Enhance STM32 fsdev - Enhance STM32 fsdev
- Improve dcd fifo allocation - Improve dcd fifo allocation
- Fix ISTR race condition - Fix ISTR race condition
- Support remap USB IRQ on supported MCUs - Support remap USB IRQ on supported MCUs
- Implement dcd_edpt_close() API - Implement ``dcd_edpt_close()`` API
- Enhance NUC 505: enhance set configure behavior - Enhance NUC 505: enhance set configure behavior
- Enhance SAMD - Enhance SAMD
- Fix race condition with setup packet - Fix race condition with setup packet
- Add SAMD11 option `OPT_MCU_SAMD11` - Add SAMD11 option ``OPT_MCU_SAMD11``
- Add SAME5x option `OPT_MCU_SAME5X` - Add SAME5x option ``OPT_MCU_SAME5X``
- Fix SAMG control data toggle and stall race condition - Fix SAMG control data toggle and stall race condition
- Enhance nRF - Enhance nRF
- Fix hanged when tud_task() is called within critical section (disabled interrupt) - Fix hanged when ``tud_task()`` is called within critical section (disabled interrupt)
- Fix disconnect bus event not submitted - Fix disconnect bus event not submitted
- Implement ISO transfer and dcd_edpt_close() - Implement ISO transfer and ``dcd_edpt_close()``
USB Device USB Device
@ -999,26 +997,26 @@ USB Device
**USBD** **USBD**
- Add new class driver for **Bluetooth HCI** class driver with example can be found in [mynewt-tinyusb-example](https://github.com/hathach/mynewt-tinyusb-example) since it needs mynewt OS to run with. - Add new class driver for **Bluetooth HCI** class driver with example can be found in [mynewt-tinyusb-example](https://github.com/hathach/mynewt-tinyusb-example) since it needs mynewt OS to run with.
- Fix USBD endpoint usage racing condition with `usbd_edpt_claim()/usbd_edpt_release()` - Fix USBD endpoint usage racing condition with ``usbd_edpt_claim()``/``usbd_edpt_release()``
- Added `tud_task_event_ready()` and `osal_queue_empty()`. This API is needed to check before enter low power mode with WFI/WFE - Added ``tud_task_event_ready()`` and ``osal_queue_empty()``. This API is needed to check before enter low power mode with WFI/WFE
- Rename USB IRQ Handler to `dcd_int_handler()`. Application must define IRQ handler in which it calls this API. - Rename USB IRQ Handler to ``dcd_int_handler()``. Application must define IRQ handler in which it calls this API.
- Add `dcd_connect()` and `dcd_disconnect()` to enable/disable internal pullup on D+/D- on supported MCUs. - Add ``dcd_connect()`` and ``dcd_disconnect()`` to enable/disable internal pullup on D+/D- on supported MCUs.
- Add `usbd_edpt_open()` - Add ``usbd_edpt_open()``
- Remove `dcd_set_config()` - Remove ``dcd_set_config()``
- Add *OPT_OS_CUMSTOM* as hook for application to overwrite and/or add their own OS implementation - Add ``OPT_OS_CUMSTOM`` as hook for application to overwrite and/or add their own OS implementation
- Support SET_INTERFACE, GET_INTERFACE request - Support SET_INTERFACE, GET_INTERFACE request
- Add Logging for debug with optional uart/rtt/swo printf retarget or `CFG_TUSB_DEBUG_PRINTF` hook - Add Logging for debug with optional uart/rtt/swo printf retarget or ``CFG_TUSB_DEBUG_PRINTF`` hook
- Add IAR compiler support - Add IAR compiler support
- Support multiple configuration descriptors. `TUD_CONFIG_DESCRIPTOR()` template has extra config_num as 1st argument - Support multiple configuration descriptors. ``TUD_CONFIG_DESCRIPTOR()`` template has extra config_num as 1st argument
- Improve USB Highspeed support with actual link speed detection with `dcd_event_bus_reset()` - Improve USB Highspeed support with actual link speed detection with ``dcd_event_bus_reset()``
- Enhance class driver management - Enhance class driver management
- `usbd_driver_open()` add max length argument, and return length of interface (0 for not supported). Return value is used for finding appropriate driver - ``usbd_driver_open()`` add max length argument, and return length of interface (0 for not supported). Return value is used for finding appropriate driver
- Add application implemented class driver via `usbd_app_driver_get_cb()` - Add application implemented class driver via ``usbd_app_driver_get_cb()``
- IAD is handled to assign driver id - IAD is handled to assign driver id
- Added `tud_descriptor_device_qualifier_cb()` callback - Added ``tud_descriptor_device_qualifier_cb()`` callback
- Optimize `tu_fifo` bulk write/read transfer - Optimize ``tu_fifo`` bulk write/read transfer
- Forward non-std control request to class driver - Forward non-std control request to class driver
- Let application handle Microsoft OS 1.0 Descriptors (the 0xEE index string) - Let application handle Microsoft OS 1.0 Descriptors (the 0xEE index string)
- Fix OSAL FreeRTOS yield from ISR - Fix OSAL FreeRTOS yield from ISR
@ -1030,8 +1028,8 @@ USB Device
- CDC: - CDC:
- Send zero length packet for end of data when needed - Send zero length packet for end of data when needed
- Add `tud_cdc_tx_complete_cb()` callback - Add ``tud_cdc_tx_complete_cb()`` callback
- Change tud_cdc_n_write_flush() return number of bytes forced to transfer, and flush when writing enough data to fifo - Change ``tud_cdc_n_write_flush()`` return number of bytes forced to transfer, and flush when writing enough data to fifo
- MIDI: - MIDI:
- Add packet interface - Add packet interface
@ -1041,10 +1039,10 @@ USB Device
- DFU Runtime: fix response to SET_INTERFACE and DFU_GETSTATUS request - DFU Runtime: fix response to SET_INTERFACE and DFU_GETSTATUS request
- Rename some configure macro to make it clear that those are used directly for endpoint transfer - Rename some configure macro to make it clear that those are used directly for endpoint transfer
- CFG_TUD_HID_BUFSIZE to CFG_TUD_HID_EP_BUFSIZE - ``CFG_TUD_HID_BUFSIZE`` to ``CFG_TUD_HID_EP_BUFSIZE``
- CFG_TUD_CDC_EPSIZE to CFG_TUD_CDC_EP_BUFSIZE - ``CFG_TUD_CDC_EPSIZE`` to ``CFG_TUD_CDC_EP_BUFSIZE``
- CFG_TUD_MSC_BUFSIZE to CFG_TUD_MSC_EP_BUFSIZE - ``CFG_TUD_MSC_BUFSIZE`` to ``CFG_TUD_MSC_EP_BUFSIZE``
- CFG_TUD_MIDI_EPSIZE to CFG_TUD_MIDI_EP_BUFSIZE - ``CFG_TUD_MIDI_EPSIZE`` to ``CFG_TUD_MIDI_EP_BUFSIZE``
- HID: - HID:
- Fix gamepad template descriptor - Fix gamepad template descriptor
@ -1063,15 +1061,15 @@ USB Host
Examples Examples
-------- --------
- Add new hid_composite_freertos - Add new ``hid_composite_freertos``
- Add new dynamic_configuration to demonstrate how to switch configuration descriptors - Add new ``dynamic_configuration`` to demonstrate how to switch configuration descriptors
- Add new hid_multiple_interface - Add new ``hid_multiple_interface``
- Enhance `net_lwip_webserver` example - Enhance ``net_lwip_webserver`` example
- Add multiple configuration: RNDIS for Windows, CDC-ECM for macOS (Linux will work with both) - Add multiple configuration: RNDIS for Windows, CDC-ECM for macOS (Linux will work with both)
- Update lwip to STABLE-2_1_2_RELEASE for net_lwip_webserver - Update lwip to STABLE-2_1_2_RELEASE for ``net_lwip_webserver``
- Added new Audio example: audio_test uac2_headsest - Added new Audio example: ``audio_test`` ``uac2_headsest``
New Boards New Boards
---------- ----------
@ -1112,37 +1110,37 @@ Added
- Added multiple instances support for CDC and MIDI - Added multiple instances support for CDC and MIDI
- Added a handful of unit test with Ceedling. - Added a handful of unit test with Ceedling.
- Added LOG support for debugging with CFG_TUSB_DEBUG - Added LOG support for debugging with CFG_TUSB_DEBUG
- Added `tud_descriptor_bos_cb()` for BOS descriptor (required for USB 2.1) - Added ``tud_descriptor_bos_cb()`` for BOS descriptor (required for USB 2.1)
- Added `dcd_edpt0_status_complete()` as optional API for DCD - Added ``dcd_edpt0_status_complete()`` as optional API for DCD
**Examples** **Examples**
Following examples are added: Following examples are added:
- board_test - ``board_test``
- cdc_dual_ports - ``cdc_dual_ports``
- dfu_rt - ``dfu_rt``
- hid_composite - ``hid_composite``
- net_lwip_webserver - ``net_lwip_webserver``
- usbtmc - ``usbtmc``
- webusb_serial - ``webusb_serial``
Changed Changed
------- -------
- Changed `tud_descriptor_string_cb()` to have additional Language ID argument - Changed ``tud_descriptor_string_cb()`` to have additional Language ID argument
- Merged hal_nrf5x.c into dcd_nrf5x.c - Merged ``hal_nrf5x.c`` into ``dcd_nrf5x.c``
- Merged dcd_samd21.c and dcd_samd51.c into dcd_samd.c - Merged ``dcd_samd21.c`` and ``dcd_samd51.c`` into ``dcd_samd.c``
- Generalized dcd_stm32f4.c to dcd_synopsys.c - Generalized ``dcd_stm32f4.c`` to ``dcd_synopsys.c``
- Changed cdc_msc_hid to cdc_msc (drop hid) due to limited endpoints number of some MCUs - Changed ``cdc_msc_hid`` to ``cdc_msc`` (drop hid) due to limited endpoints number of some MCUs
- Improved DCD SAMD stability, fix missing setup packet occasionally - Improved DCD SAMD stability, fix missing setup packet occasionally
- Improved usbd/usbd_control with proper handling of zero-length packet (ZLP) - Improved ``usbd/usbd_control`` with proper handling of zero-length packet (ZLP)
- Improved STM32 DCD FSDev - Improved STM32 DCD FSDev
- Improved STM32 DCD Synopsys - Improved STM32 DCD Synopsys
- Migrated CI from Travis to Github Action - Migrated CI from Travis to Github Action
- Updated nrfx submodule to 2.1.0 - Updated nrfx submodule to 2.1.0
- Fixed mynewt osal queue definition - Fixed mynewt osal queue definition
- Fixed cdc_msc_freertos example build for all MCUs - Fixed ``cdc_msc_freertos`` example build for all MCUs
0.5.0 (2019-06) 0.5.0 (2019-06)

View File

@ -1 +0,0 @@
../../CONTRIBUTORS.rst

View File

@ -0,0 +1 @@
.. include:: ../../CONTRIBUTORS.rst

View File

@ -8,6 +8,5 @@ Index
.. toctree:: .. toctree::
:maxdepth: 2 :maxdepth: 2
uses
changelog changelog
contributors contributors

View File

@ -1,17 +0,0 @@
****
Uses
****
TinyUSB is currently used by these other projects:
- `Adafruit nRF52 Arduino <https://github.com/adafruit/Adafruit_nRF52_Arduino>`__
- `Adafruit nRF52 Bootloader <https://github.com/adafruit/Adafruit_nRF52_Bootloader>`__
- `Adafruit SAMD Arduino <https://github.com/adafruit/ArduinoCore-samd>`__
- `CircuitPython <https://github.com/adafruit/circuitpython>`__
- `Espressif IDF <https://github.com/espressif/esp-idf>`__
- `MicroPython <https://github.com/micropython/micropython>`__
- `mynewt <https://mynewt.apache.org>`__
- `openinput <https://github.com/openinput-fw/openinput>`__
- `Raspberry Pi Pico SDK <https://github.com/raspberrypi/pico-sdk>`__
- `TinyUF2 Bootloader <https://github.com/adafruit/tinyuf2>`__
- `TinyUSB Arduino Library <https://github.com/adafruit/Adafruit_TinyUSB_Arduino>`__

330
docs/reference/boards.rst Normal file
View File

@ -0,0 +1,330 @@
****************
Supported Boards
****************
The board support code is only used for self-contained examples and testing. It is not used when TinyUSB is part of a larger project.
It is responsible for getting the MCU started and the USB peripheral clocked with minimal of on-board devices
- One LED : for status
- One Button : to get input from user
- One UART : needed for logging with LOGGER=uart, maybe required for host/dual examples
Following boards are supported
Analog Devices
--------------
============= ================ ======== ================================================================================================================= ======
Board Name Family URL Note
============= ================ ======== ================================================================================================================= ======
apard32690 APARD32690-SL maxim https://www.analog.com/en/resources/evaluation-hardware-and-software/evaluation-boards-kits/ad-apard32690-sl.html
max32650evkit MAX32650 EVKIT maxim https://www.analog.com/en/resources/evaluation-hardware-and-software/evaluation-boards-kits/max32650-evkit.html
max32650fthr MAX32650 Feather maxim https://www.analog.com/en/resources/evaluation-hardware-and-software/evaluation-boards-kits/max32650fthr.html
max32651evkit MAX32651 EVKIT maxim https://www.analog.com/en/resources/evaluation-hardware-and-software/evaluation-boards-kits/max32651-evkit.html
max32666evkit MAX32666 EVKIT maxim https://www.analog.com/en/resources/evaluation-hardware-and-software/evaluation-boards-kits/max32666evkit.html
max32666fthr MAX32666 Feather maxim https://www.analog.com/en/resources/evaluation-hardware-and-software/evaluation-boards-kits/max32666fthr.html
max32690evkit MAX32690 EVKIT maxim https://www.analog.com/en/resources/evaluation-hardware-and-software/evaluation-boards-kits/max32690evkit.html
max78002evkit MAX78002 EVKIT maxim https://www.analog.com/en/resources/evaluation-hardware-and-software/evaluation-boards-kits/max78002evkit.html
============= ================ ======== ================================================================================================================= ======
Bridgetek
---------
========= ========= ======== ===================================== ======
Board Name Family URL Note
========= ========= ======== ===================================== ======
mm900evxb MM900EVxB brtmm90x https://brtchip.com/product/mm900ev1b
========= ========= ======== ===================================== ======
Espressif
---------
========================= ============================== ========= ======================================================================================================== ======
Board Name Family URL Note
========================= ============================== ========= ======================================================================================================== ======
adafruit_feather_esp32_v2 Adafruit Feather ESP32 v2 espressif https://www.adafruit.com/product/5400
adafruit_feather_esp32c6 Adafruit Feather EPS32-C6 espressif https://www.adafruit.com/product/5933
adafruit_feather_esp32s2 Adafruit Feather ESP32S2 espressif https://www.adafruit.com/product/5000
adafruit_feather_esp32s3 Adafruit Feather ESP32S3 espressif https://www.adafruit.com/product/5323
adafruit_magtag_29gray Adafruit MagTag 2.9" Grayscale espressif https://www.adafruit.com/product/4800
adafruit_metro_esp32s2 Adafruit Metro ESP32-S2 espressif https://www.adafruit.com/product/4775
espressif_addax_1 Espresif Addax-1 espressif n/a
espressif_c3_devkitc Espresif C3 DevKitC espressif https://docs.espressif.com/projects/esp-dev-kits/en/latest/esp32c3/esp32-c3-devkitc-02/index.html
espressif_c6_devkitc Espresif C6 DevKitC espressif https://docs.espressif.com/projects/esp-dev-kits/en/latest/esp32c6/esp32-c6-devkitc-1/index.html
espressif_kaluga_1 Espresif Kaluga 1 espressif https://docs.espressif.com/projects/esp-dev-kits/en/latest/esp32s2/esp32-s2-kaluga-1/index.html
espressif_p4_function_ev Espresif P4 Function EV espressif https://docs.espressif.com/projects/esp-dev-kits/en/latest/esp32p4/esp32-p4-function-ev-board/index.html
espressif_s2_devkitc Espresif S2 DevKitC espressif https://docs.espressif.com/projects/esp-dev-kits/en/latest/esp32s2/esp32-s2-devkitc-1/index.html
espressif_s3_devkitc Espresif S3 DevKitC espressif https://docs.espressif.com/projects/esp-dev-kits/en/latest/esp32s3/esp32-s3-devkitc-1/index.html
espressif_s3_devkitm Espresif S3 DevKitM espressif https://docs.espressif.com/projects/esp-dev-kits/en/latest/esp32s3/esp32-s3-devkitm-1/index.html
espressif_saola_1 Espresif S2 Saola 1 espressif https://docs.espressif.com/projects/esp-dev-kits/en/latest/esp32s2/esp32-s2-saola-1/index.html
========================= ============================== ========= ======================================================================================================== ======
GigaDevice
----------
================== ================== ========= ============================= ======
Board Name Family URL Note
================== ================== ========= ============================= ======
sipeed_longan_nano Sipeed Longan Nano gd32vf103 https://longan.sipeed.com/en/
================== ================== ========= ============================= ======
Infineon
--------
============= ================= ======== ============================================================================= ======
Board Name Family URL Note
============= ================= ======== ============================================================================= ======
xmc4500_relax XMC4500 relax kit xmc4000 https://www.infineon.com/cms/en/product/evaluation-boards/kit_xmc45_relax_v1/
xmc4700_relax XMC4700 relax kit xmc4000 https://www.infineon.com/cms/en/product/evaluation-boards/kit_xmc47_relax_v1/
============= ================= ======== ============================================================================= ======
Microchip
---------
========================= =================================== ========== ================================================================================= ======
Board Name Family URL Note
========================= =================================== ========== ================================================================================= ======
olimex_emz64 Olimex PIC32-EMZ64 pic32mz https://www.olimex.com/Products/PIC/Development/PIC32-EMZ64/open-source-hardware
olimex_hmz144 Olimex PIC32-HMZ144 pic32mz https://www.olimex.com/Products/PIC/Development/PIC32-HMZ144/open-source-hardware
cynthion_d11 Great Scott Gadgets Cynthion samd11 https://greatscottgadgets.com/cynthion/
samd11_xplained SAMD11 Xplained Pro samd11 https://www.microchip.com/en-us/development-tool/ATSAMD11-XPRO
atsamd21_xpro SAMD21 Xplained Pro samd21 https://www.microchip.com/DevelopmentTools/ProductDetails/ATSAMD21-XPRO
circuitplayground_express Adafruit Circuit Playground Express samd21 https://www.adafruit.com/product/3333
curiosity_nano SAMD21 Curiosty Nano samd21 https://www.microchip.com/en-us/development-tool/dm320119
cynthion_d21 Great Scott Gadgets Cynthion samd21 https://greatscottgadgets.com/cynthion/
feather_m0_express Adafruit Feather M0 Express samd21 https://www.adafruit.com/product/3403
itsybitsy_m0 Adafruit ItsyBitsy M0 samd21 https://www.adafruit.com/product/3727
metro_m0_express Adafruit Metro M0 Express samd21 https://www.adafruit.com/product/3505
qtpy Adafruit QT Py samd21 https://www.adafruit.com/product/4600
seeeduino_xiao Seeeduino XIAO samd21 https://wiki.seeedstudio.com/Seeeduino-XIAO/
sparkfun_samd21_mini_usb SparkFun SAMD21 Mini samd21 https://www.sparkfun.com/products/13664
trinket_m0 Adafruit Trinket M0 samd21 https://www.adafruit.com/product/3500
d5035_01 D5035-01 samd5x_e5x https://github.com/RudolphRiedel/USB_CAN-FD
feather_m4_express Adafruit Feather M4 Express samd5x_e5x https://www.adafruit.com/product/3857
itsybitsy_m4 Adafruit ItsyBitsy M4 samd5x_e5x https://www.adafruit.com/product/3800
metro_m4_express Adafruit Metro M4 Express samd5x_e5x https://www.adafruit.com/product/3382
pybadge Adafruit PyBadge samd5x_e5x https://www.adafruit.com/product/4200
pyportal Adafruit PyPortal samd5x_e5x https://www.adafruit.com/product/4116
same54_xplained SAME54 Xplained Pro samd5x_e5x https://www.microchip.com/DevelopmentTools/ProductDetails/ATSAME54-XPRO
samg55_xplained SAMG55 Xplained Pro samg https://www.microchip.com/DevelopmentTools/ProductDetails/ATSAMG55-XPRO
atsaml21_xpro SAML21 Xplained Pro saml2x https://www.microchip.com/en-us/development-tool/atsaml21-xpro-b
saml22_feather SAML22 Feather saml2x https://github.com/joeycastillo/Feather-Projects/tree/main/SAML22%20Feather
sensorwatch_m0 SensorWatch saml2x https://github.com/joeycastillo/Sensor-Watch
========================= =================================== ========== ================================================================================= ======
MindMotion
----------
===================== ====================================== ======== =============================================================================================== ======
Board Name Family URL Note
===================== ====================================== ======== =============================================================================================== ======
mm32f327x_mb39 MM32F3273G9P MB-039 mm32 https://www.mindmotion.com.cn/support/development_tools/evaluation_boards/evboard/mm32f3273g9p/
mm32f327x_pitaya_lite DshanMCU Pitaya Lite with MM32F3273G8P mm32 https://gitee.com/weidongshan/DshanMCU-Pitaya-c
===================== ====================================== ======== =============================================================================================== ======
NXP
---
================== ========================================= ============= ========================================================================================================================================================================= ======
Board Name Family URL Note
================== ========================================= ============= ========================================================================================================================================================================= ======
metro_m7_1011 Adafruit Metro M7 1011 imxrt https://www.adafruit.com/product/5600
metro_m7_1011_sd Adafruit Metro M7 1011 SD imxrt https://www.adafruit.com/product/5600
mimxrt1010_evk i.MX RT1010 Evaluation Kit imxrt https://www.nxp.com/design/design-center/development-boards-and-designs/i-mx-evaluation-and-development-boards/i-mx-rt1010-evaluation-kit:MIMXRT1010-EVK
mimxrt1015_evk i.MX RT1015 Evaluation Kit imxrt https://www.nxp.com/design/design-center/development-boards-and-designs/MIMXRT1015-EVK
mimxrt1020_evk i.MX RT1020 Evaluation Kit imxrt https://www.nxp.com/design/design-center/development-boards-and-designs/MIMXRT1020-EVK
mimxrt1024_evk i.MX RT1024 Evaluation Kit imxrt https://www.nxp.com/design/design-center/development-boards-and-designs/i-mx-evaluation-and-development-boards/i-mx-rt1024-evaluation-kit:MIMXRT1024-EVK
mimxrt1050_evkb i.MX RT1050 Evaluation Kit revB imxrt https://www.nxp.com/part/IMXRT1050-EVKB
mimxrt1060_evk i.MX RT1060 Evaluation Kit revB imxrt https://www.nxp.com/design/design-center/development-boards-and-designs/MIMXRT1060-EVKB
mimxrt1064_evk i.MX RT1064 Evaluation Kit imxrt https://www.nxp.com/design/design-center/development-boards-and-designs/MIMXRT1064-EVK
mimxrt1170_evkb i.MX RT1070 Evaluation Kit imxrt https://www.nxp.com/design/design-center/development-boards-and-designs/i-mx-evaluation-and-development-boards/i-mx-rt1170-evaluation-kit:MIMXRT1170-EVKB
teensy_40 Teensy 4.0 imxrt https://www.pjrc.com/store/teensy40.html
teensy_41 Teensy 4.1 imxrt https://www.pjrc.com/store/teensy41.html
frdm_k64f Freedom K64F kinetis_k https://www.nxp.com/design/design-center/development-boards-and-designs/general-purpose-mcus/freedom-development-platform-for-kinetis-k64-k63-and-k24-mcus:FRDM-K64F
teensy_35 Teensy 3.5 kinetis_k https://www.pjrc.com/store/teensy35.html
frdm_k32l2a4s Freedom K32L2A4S kinetis_k32l2 https://www.nxp.com/design/design-center/development-boards-and-designs/FRDM-K32L2A4S
frdm_k32l2b Freedom K32L2B3 kinetis_k32l2 https://www.nxp.com/design/design-center/development-boards-and-designs/general-purpose-mcus/nxp-freedom-development-platform-for-k32-l2b-mcus:FRDM-K32L2B3
kuiic Kuiic kinetis_k32l2 https://github.com/nxf58843/kuiic
frdm_kl25z fomu kinetis_kl https://www.nxp.com/design/design-center/development-boards-and-designs/general-purpose-mcus/freedom-development-platform-for-kinetis-kl14-kl15-kl24-kl25-mcus:FRDM-KL25Z
lpcxpresso11u37 LPCXpresso11U37 lpc11 https://www.nxp.com/design/design-center/development-boards-and-designs/OM13074
lpcxpresso11u68 LPCXpresso11U68 lpc11 https://www.nxp.com/design/design-center/development-boards-and-designs/OM13058
lpcxpresso1347 LPCXpresso1347 lpc13 https://www.nxp.com/products/no-longer-manufactured/lpcxpresso-board-for-lpc1347:OM13045
lpcxpresso1549 LPCXpresso1549 lpc15 https://www.nxp.com/design/design-center/development-boards-and-designs/OM13056
lpcxpresso1769 LPCXpresso1769 lpc17 https://www.nxp.com/design/design-center/development-boards-and-designs/OM13000
mbed1768 mbed 1768 lpc17 https://www.nxp.com/products/processors-and-microcontrollers/arm-microcontrollers/general-purpose-mcus/lpc1700-arm-cortex-m3/arm-mbed-lpc1768-board:OM11043
lpcxpresso18s37 LPCXpresso18s37 lpc18 https://www.nxp.com/design/design-center/software/development-software/mcuxpresso-software-and-tools-/lpcxpresso-boards/lpcxpresso18s37-development-board:OM13076
mcb1800 Keil MCB1800 lpc18 https://www.keil.com/arm/mcb1800/
ea4088_quickstart Embedded Artists LPC4088 QuickStart Board lpc40 https://www.embeddedartists.com/products/lpc4088-quickstart-board/
ea4357 Embedded Artists LPC4357 Development Kit lpc43 https://www.embeddedartists.com/products/lpc4357-developers-kit/
lpcxpresso43s67 LPCXpresso43S67 lpc43 https://www.nxp.com/design/design-center/software/development-software/mcuxpresso-software-and-tools-/lpcxpresso-boards/lpcxpresso43s67-development-board:OM13084
lpcxpresso51u68 LPCXpresso51u68 lpc51 https://www.nxp.com/products/processors-and-microcontrollers/arm-microcontrollers/general-purpose-mcus/lpcxpresso51u68-for-the-lpc51u68-mcus:OM40005
lpcxpresso54114 LPCXpresso54114 lpc54 https://www.nxp.com/design/design-center/software/development-software/mcuxpresso-software-and-tools-/lpcxpresso-boards/lpcxpresso54114-board:OM13089
lpcxpresso54608 LPCXpresso54608 lpc54 https://www.nxp.com/design/design-center/software/development-software/mcuxpresso-software-and-tools-/lpcxpresso-development-board-for-lpc5460x-mcus:OM13092
lpcxpresso54628 LPCXpresso54628 lpc54 https://www.nxp.com/design/design-center/software/development-software/mcuxpresso-software-and-tools-/lpcxpresso-boards/lpcxpresso54628-development-board:OM13098
double_m33_express Double M33 Express lpc55 https://www.crowdsupply.com/steiert-solutions/double-m33-express
lpcxpresso55s28 LPCXpresso55s28 lpc55 https://www.nxp.com/design/design-center/software/development-software/mcuxpresso-software-and-tools-/lpcxpresso-boards/lpcxpresso55s28-development-board:LPC55S28-EVK
lpcxpresso55s69 LPCXpresso55s69 lpc55 https://www.nxp.com/design/design-center/software/development-software/mcuxpresso-software-and-tools-/lpcxpresso-boards/lpcxpresso55s69-development-board:LPC55S69-EVK
mcu_link MCU Link lpc55 https://www.nxp.com/design/design-center/software/development-software/mcuxpresso-software-and-tools-/mcu-link-debug-probe:MCU-LINK
frdm_mcxa153 Freedom MCXA153 mcx https://www.nxp.com/design/design-center/development-boards-and-designs/FRDM-MCXA153
frdm_mcxa156 Freedom MCXA156 mcx https://www.nxp.com/design/design-center/development-boards-and-designs/FRDM-MCXA156
frdm_mcxn947 Freedom MCXN947 mcx https://www.nxp.com/design/design-center/development-boards-and-designs/FRDM-MCXN947
mcxn947brk MCXN947 Breakout mcx n/a
================== ========================================= ============= ========================================================================================================================================================================= ======
Nordic Semiconductor
--------------------
=========================== ===================================== ======== ============================================================================== ======
Board Name Family URL Note
=========================== ===================================== ======== ============================================================================== ======
adafruit_clue Adafruit CLUE nrf https://www.adafruit.com/product/4500
arduino_nano33_ble Arduino Nano 33 BLE nrf https://store.arduino.cc/arduino-nano-33-ble
circuitplayground_bluefruit Adafruit Circuit Playground Bluefruit nrf https://www.adafruit.com/product/4333
feather_nrf52840_express Adafruit Feather nRF52840 Express nrf https://www.adafruit.com/product/4062
feather_nrf52840_sense Adafruit Feather nRF52840 Sense nrf https://www.adafruit.com/product/4516
itsybitsy_nrf52840 Adafruit ItsyBitsy nRF52840 Express nrf https://www.adafruit.com/product/4481
pca10056 Nordic nRF52840DK nrf https://www.nordicsemi.com/Software-and-Tools/Development-Kits/nRF52840-DK
pca10059 Nordic nRF52840 Dongle nrf https://www.nordicsemi.com/Software-and-Tools/Development-Kits/nRF52840-Dongle
pca10095 Nordic nRF5340 DK nrf https://www.nordicsemi.com/Software-and-Tools/Development-Kits/nRF5340-DK
pca10100 Nordic nRF52833 DK nrf https://www.nordicsemi.com/Software-and-Tools/Development-Kits/nRF52833-DK
=========================== ===================================== ======== ============================================================================== ======
Raspberry Pi
------------
================================ ============================================ ============== ========================================================== ======
Board Name Family URL Note
================================ ============================================ ============== ========================================================== ======
raspberrypi_zero Raspberry Pi Zero broadcom_32bit https://www.raspberrypi.org/products/raspberry-pi-zero/
raspberrypi_cm4 Raspberry CM4 broadcom_64bit https://www.raspberrypi.org/products/compute-module-4
raspberrypi_zero2 Raspberry Zero2 broadcom_64bit https://www.raspberrypi.org/products/raspberry-pi-zero-2-w
adafruit_feather_rp2040_usb_host Adafruit Feather RP2040 with USB Type A Host rp2040 https://www.adafruit.com/product/5723
adafruit_fruit_jam Adafruit Fruit Jam - Mini RP2350 rp2040 https://www.adafruit.com/product/6200
adafruit_metro_rp2350 Adafruit Metro RP2350 rp2040 https://www.adafruit.com/product/6003
raspberry_pi_pico Pico rp2040 https://www.raspberrypi.com/products/raspberry-pi-pico/
raspberry_pi_pico2 Pico2 rp2040 https://www.raspberrypi.com/products/raspberry-pi-pico-2/
raspberry_pi_pico_w Pico rp2040 https://www.raspberrypi.com/products/raspberry-pi-pico/
================================ ============================================ ============== ========================================================== ======
Renesas
-------
============== =========================== ======== ================================================================================================================================================================ ======
Board Name Family URL Note
============== =========================== ======== ================================================================================================================================================================ ======
da14695_dk_usb DA14695-00HQDEVKT-U da1469x https://www.renesas.com/en/products/wireless-connectivity/bluetooth-low-energy/da14695-00hqdevkt-u-smartbond-da14695-bluetooth-low-energy-52-usb-development-kit
da1469x_dk_pro DA1469x Development Kit Pro da1469x https://lpccs-docs.renesas.com/um-b-090-da1469x_getting_started/DA1469x_The_hardware/DA1469x_The_hardware.html
portenta_c33 Arduino Portenta C33 ra https://www.arduino.cc/pro/hardware-product-portenta-c33/
ra2a1_ek RA2A1 EK ra https://www.renesas.com/en/products/microcontrollers-microprocessors/ra-cortex-m-mcus/ek-ra2a1-evaluation-kit-ra2a1-mcu-group
ra4m1_ek RA4M1 EK ra https://www.renesas.com/en/products/microcontrollers-microprocessors/ra-cortex-m-mcus/ek-ra4m1-evaluation-kit-ra4m1-mcu-group
ra4m3_ek RA4M3 EK ra https://www.renesas.com/en/products/microcontrollers-microprocessors/ra-cortex-m-mcus/ek-ra4m3-evaluation-kit-ra4m3-mcu-group
ra6m1_ek RA6M1 EK ra https://www.renesas.com/en/products/microcontrollers-microprocessors/ra-cortex-m-mcus/ek-ra6m1-evaluation-kit-ra6m1-mcu-group
ra6m5_ek RA6M5 EK ra https://www.renesas.com/en/products/microcontrollers-microprocessors/ra-cortex-m-mcus/ek-ra6m5-evaluation-kit-ra6m5-mcu-group
ra8m1_ek RA8M1 EK ra https://www.renesas.com/en/products/microcontrollers-microprocessors/ra-cortex-m-mcus/ek-ra8m1-evaluation-kit-ra8m1-mcu-group
uno_r4 Arduino UNO R4 ra https://store-usa.arduino.cc/pages/uno-r4
============== =========================== ======== ================================================================================================================================================================ ======
STMicroelectronics
------------------
=================== ================================= ========= ================================================================= ======
Board Name Family URL Note
=================== ================================= ========= ================================================================= ======
stm32c071nucleo STM32C071 Nucleo stm32c0 https://www.st.com/en/evaluation-tools/nucleo-g071rb.html
stm32f070rbnucleo STM32 F070 Nucleo stm32f0 https://www.st.com/en/evaluation-tools/nucleo-f070rb.html
stm32f072disco STM32 F072 Discovery stm32f0 https://www.st.com/en/evaluation-tools/32f072bdiscovery.html
stm32f072eval STM32 F072 Eval stm32f0 https://www.st.com/en/evaluation-tools/stm32072b-eval.html
stm32f103_bluepill STM32 F103 Bluepill stm32f1 https://stm32-base.org/boards/STM32F103C8T6-Blue-Pill
stm32f103_mini_2 STM32 F103 Mini v2 stm32f1 https://stm32-base.org/boards/STM32F103RCT6-STM32-Mini-V2.0
stm32f103ze_iar IAR STM32 F103ze starter kit stm32f1 n/a
stm32f207nucleo STM32 F207 Nucleo stm32f2 https://www.st.com/en/evaluation-tools/nucleo-f207zg.html
stm32f303disco STM32 F303 Discovery stm32f3 https://www.st.com/en/evaluation-tools/stm32f3discovery.html
feather_stm32f405 Adafruit Feather STM32F405 stm32f4 https://www.adafruit.com/product/4382
pyboardv11 Pyboard v1.1 stm32f4 https://www.adafruit.com/product/2390
stm32f401blackpill STM32 F401 Blackpill stm32f4 https://stm32-base.org/boards/STM32F401CCU6-WeAct-Black-Pill-V1.2
stm32f407blackvet STM32 F407 Blackvet stm32f4 https://stm32-base.org/boards/STM32F407VET6-STM32-F4VE-V2.0
stm32f407disco STM32 F407 Discovery stm32f4 https://www.st.com/en/evaluation-tools/stm32f4discovery.html
stm32f411blackpill STM32 F411 Blackpill stm32f4 https://stm32-base.org/boards/STM32F411CEU6-WeAct-Black-Pill-V2.0
stm32f411disco STM32 F411 Discovery stm32f4 https://www.st.com/en/evaluation-tools/32f411ediscovery.html
stm32f412disco STM32 F412 Discovery stm32f4 https://www.st.com/en/evaluation-tools/32f412gdiscovery.html
stm32f412nucleo STM32 F412 Nucleo stm32f4 https://www.st.com/en/evaluation-tools/nucleo-f412zg.html
stm32f439nucleo STM32 F439 Nucleo stm32f4 https://www.st.com/en/evaluation-tools/nucleo-f439zi.html
stlinkv3mini Stlink-v3 mini stm32f7 https://www.st.com/en/development-tools/stlink-v3mini.html
stm32f723disco STM32 F723 Discovery stm32f7 https://www.st.com/en/evaluation-tools/32f723ediscovery.html
stm32f746disco STM32 F746 Discovery stm32f7 https://www.st.com/en/evaluation-tools/32f746gdiscovery.html
stm32f746nucleo STM32 F746 Nucleo stm32f7 https://www.st.com/en/evaluation-tools/nucleo-f746zg.html
stm32f767nucleo STM32 F767 Nucleo stm32f7 https://www.st.com/en/evaluation-tools/nucleo-f767zi.html
stm32f769disco STM32 F769 Discovery stm32f7 https://www.st.com/en/evaluation-tools/32f769idiscovery.html
stm32g0b1nucleo STM32 G0B1 Nucleo stm32g0 https://www.st.com/en/evaluation-tools/nucleo-g0b1re.html
b_g474e_dpow1 STM32 B-G474E-DPOW1 Discovery kit stm32g4 https://www.st.com/en/evaluation-tools/b-g474e-dpow1.html
stm32g474nucleo STM32 G474 Nucleo stm32g4 https://www.st.com/en/evaluation-tools/nucleo-g474re.html
stm32g491nucleo STM32 G491 Nucleo stm32g4 https://www.st.com/en/evaluation-tools/nucleo-g491re.html
stm32h503nucleo STM32 H503 Nucleo stm32h5 https://www.st.com/en/evaluation-tools/nucleo-h503rb.html
stm32h563nucleo STM32 H563 Nucleo stm32h5 https://www.st.com/en/evaluation-tools/nucleo-h563zi.html
stm32h573i_dk STM32 H573i Discovery stm32h5 https://www.st.com/en/evaluation-tools/stm32h573i-dk.html
daisyseed Daisy Seed stm32h7 https://electro-smith.com/products/daisy-seed
stm32h723nucleo STM32 H723 Nucleo stm32h7 https://www.st.com/en/evaluation-tools/nucleo-h723zg.html
stm32h743eval STM32 H743 Eval stm32h7 https://www.st.com/en/evaluation-tools/stm32h743i-eval.html
stm32h743nucleo STM32 H743 Nucleo stm32h7 https://www.st.com/en/evaluation-tools/nucleo-h743zi.html
stm32h745disco STM32 H745 Discovery stm32h7 https://www.st.com/en/evaluation-tools/stm32h745i-disco.html
stm32h750_weact STM32 H750 WeAct stm32h7 https://www.adafruit.com/product/5032
stm32h750bdk STM32 H750b Discovery Kit stm32h7 https://www.st.com/en/evaluation-tools/stm32h750b-dk.html
waveshare_openh743i Waveshare Open H743i stm32h7 https://www.waveshare.com/openh743i-c-standard.htm
stm32h7s3nucleo STM32 H7S3L8 Nucleo stm32h7rs https://www.st.com/en/evaluation-tools/nucleo-h7s3l8.html
stm32l052dap52 STM32 L052 DAP stm32l0 n/a
stm32l0538disco STM32 L0538 Discovery stm32l0 https://www.st.com/en/evaluation-tools/32l0538discovery.html
stm32l412nucleo STM32 L412 Nucleo stm32l4 https://www.st.com/en/evaluation-tools/nucleo-l412kb.html
stm32l476disco STM32 L476 Disco stm32l4 https://www.st.com/en/evaluation-tools/32l476gdiscovery.html
stm32l4p5nucleo STM32 L4P5 Nucleo stm32l4 https://www.st.com/en/evaluation-tools/nucleo-l4p5zg.html
stm32l4r5nucleo STM32 L4R5 Nucleo stm32l4 https://www.st.com/en/evaluation-tools/nucleo-l4r5zi.html
stm32n657nucleo STM32 N657X0-Q Nucleo stm32n6 https://www.st.com/en/evaluation-tools/nucleo-n657x0-q.html
b_u585i_iot2a STM32 B-U585i IOT2A Discovery kit stm32u5 https://www.st.com/en/evaluation-tools/b-u585i-iot02a.html
stm32u545nucleo STM32 U545 Nucleo stm32u5 https://www.st.com/en/evaluation-tools/nucleo-u545re-q.html
stm32u575eval STM32 U575 Eval stm32u5 https://www.st.com/en/evaluation-tools/stm32u575i-ev.html
stm32u575nucleo STM32 U575 Nucleo stm32u5 https://www.st.com/en/evaluation-tools/nucleo-u575zi-q.html
stm32u5a5nucleo STM32 U5a5 Nucleo stm32u5 https://www.st.com/en/evaluation-tools/nucleo-u5a5zj-q.html
stm32wb55nucleo STM32 P-NUCLEO-WB55 stm32wb https://www.st.com/en/evaluation-tools/p-nucleo-wb55.html
=================== ================================= ========= ================================================================= ======
Sunxi
-----
======= ================= ======== ========================================= ======
Board Name Family URL Note
======= ================= ======== ========================================= ======
f1c100s Lctech Pi F1C200s f1c100s https://linux-sunxi.org/Lctech_Pi_F1C200s
======= ================= ======== ========================================= ======
Texas Instruments
-----------------
================= ===================== ======== ========================================= ======
Board Name Family URL Note
================= ===================== ======== ========================================= ======
msp_exp430f5529lp MSP430F5529 LaunchPad msp430 https://www.ti.com/tool/MSP-EXP430F5529LP
msp_exp432e401y MSP432E401Y LaunchPad msp432e4 https://www.ti.com/tool/MSP-EXP432E401Y
ek_tm4c123gxl TM4C123G LaunchPad tm4c https://www.ti.com/tool/EK-TM4C123GXL
================= ===================== ======== ========================================= ======
Tomu
----
======= ====== ======== ========================= ======
Board Name Family URL Note
======= ====== ======== ========================= ======
fomu fomu fomu https://tomu.im/fomu.html
======= ====== ======== ========================= ======
WCH
---
================ ================ ======== ===================================================================== ======
Board Name Family URL Note
================ ================ ======== ===================================================================== ======
ch32f205r-r0 CH32F205r-r0 ch32f20x https://github.com/openwch/ch32f20x
ch32v103r_r1_1v0 CH32V103R-R1-1v1 ch32v10x https://github.com/openwch/ch32v103/tree/main/SCHPCB/CH32V103R-R1-1v1
ch32v203c_r0_1v0 CH32V203C-R0-1v0 ch32v20x https://github.com/openwch/ch32v20x/tree/main/SCHPCB/CH32V203C-R0
ch32v203g_r0_1v0 CH32V203G-R0-1v0 ch32v20x https://github.com/openwch/ch32v20x/tree/main/SCHPCB/CH32V203C-R0
nanoch32v203 nanoCH32V203 ch32v20x https://github.com/wuxx/nanoCH32V203
ch32v307v_r1_1v0 CH32V307V-R1-1v0 ch32v307 https://github.com/openwch/ch32v307/tree/main/SCHPCB/CH32V307V-R1-1v0
================ ================ ======== ===================================================================== ======

View File

@ -4,70 +4,74 @@ Dependencies
MCU low-level peripheral driver and external libraries for building TinyUSB examples MCU low-level peripheral driver and external libraries for building TinyUSB examples
======================================== ============================================================== ======================================== ==================================================================================================================================================================================================================================================================================================================================== ======================================== ================================================================ ======================================== ======================================================================================================================================================================================================================================================================================================================================================
Local Path Repo Commit Required by Local Path Repo Commit Required by
======================================== ============================================================== ======================================== ==================================================================================================================================================================================================================================================================================================================================== ======================================== ================================================================ ======================================== ======================================================================================================================================================================================================================================================================================================================================================
hw/mcu/allwinner https://github.com/hathach/allwinner_driver.git 8e5e89e8e132c0fd90e72d5422e5d3d68232b756 fc100s hw/mcu/allwinner https://github.com/hathach/allwinner_driver.git 8e5e89e8e132c0fd90e72d5422e5d3d68232b756 fc100s
hw/mcu/analog/max32 https://github.com/analogdevicesinc/msdk.git b20b398d3e5e2007594e54a74ba3d2a2e50ddd75 max32650 max32666 max32690 max78002 hw/mcu/analog/msdk https://github.com/analogdevicesinc/msdk.git b20b398d3e5e2007594e54a74ba3d2a2e50ddd75 maxim
hw/mcu/bridgetek/ft9xx/ft90x-sdk https://github.com/BRTSG-FOSS/ft90x-sdk.git 91060164afe239fcb394122e8bf9eb24d3194eb1 brtmm90x hw/mcu/bridgetek/ft9xx/ft90x-sdk https://github.com/BRTSG-FOSS/ft90x-sdk.git 91060164afe239fcb394122e8bf9eb24d3194eb1 brtmm90x
hw/mcu/broadcom https://github.com/adafruit/broadcom-peripherals.git 08370086080759ed54ac1136d62d2ad24c6fa267 broadcom_32bit broadcom_64bit hw/mcu/broadcom https://github.com/adafruit/broadcom-peripherals.git 08370086080759ed54ac1136d62d2ad24c6fa267 broadcom_32bit broadcom_64bit
hw/mcu/gd/nuclei-sdk https://github.com/Nuclei-Software/nuclei-sdk.git 7eb7bfa9ea4fbeacfafe1d5f77d5a0e6ed3922e7 gd32vf103 hw/mcu/gd/nuclei-sdk https://github.com/Nuclei-Software/nuclei-sdk.git 7eb7bfa9ea4fbeacfafe1d5f77d5a0e6ed3922e7 gd32vf103
hw/mcu/infineon/mtb-xmclib-cat3 https://github.com/Infineon/mtb-xmclib-cat3.git daf5500d03cba23e68c2f241c30af79cd9d63880 xmc4000 hw/mcu/infineon/mtb-xmclib-cat3 https://github.com/Infineon/mtb-xmclib-cat3.git daf5500d03cba23e68c2f241c30af79cd9d63880 xmc4000
hw/mcu/microchip https://github.com/hathach/microchip_driver.git 9e8b37e307d8404033bb881623a113931e1edf27 sam3x samd11 samd21 samd51 samd5x_e5x same5x same7x saml2x samg hw/mcu/microchip https://github.com/hathach/microchip_driver.git 9e8b37e307d8404033bb881623a113931e1edf27 sam3x samd11 samd21 samd51 samd5x_e5x same5x same7x saml2x samg
hw/mcu/mindmotion/mm32sdk https://github.com/hathach/mm32sdk.git b93e856211060ae825216c6a1d6aa347ec758843 mm32 hw/mcu/mindmotion/mm32sdk https://github.com/hathach/mm32sdk.git b93e856211060ae825216c6a1d6aa347ec758843 mm32
hw/mcu/nordic/nrfx https://github.com/NordicSemiconductor/nrfx.git 7c47cc0a56ce44658e6da2458e86cd8783ccc4a2 nrf hw/mcu/nordic/nrfx https://github.com/NordicSemiconductor/nrfx.git 7c47cc0a56ce44658e6da2458e86cd8783ccc4a2 nrf
hw/mcu/nuvoton https://github.com/majbthrd/nuc_driver.git 2204191ec76283371419fbcec207da02e1bc22fa nuc hw/mcu/nuvoton https://github.com/majbthrd/nuc_driver.git 2204191ec76283371419fbcec207da02e1bc22fa nuc
hw/mcu/nxp/lpcopen https://github.com/hathach/nxp_lpcopen.git b41cf930e65c734d8ec6de04f1d57d46787c76ae lpc11 lpc13 lpc15 lpc17 lpc18 lpc40 lpc43 hw/mcu/nxp/lpcopen https://github.com/hathach/nxp_lpcopen.git b41cf930e65c734d8ec6de04f1d57d46787c76ae lpc11 lpc13 lpc15 lpc17 lpc18 lpc40 lpc43
hw/mcu/nxp/mcux-sdk https://github.com/hathach/mcux-sdk.git 144f1eb7ea8c06512e12f12b27383601c0272410 kinetis_k kinetis_k32l2 kinetis_kl lpc51 lpc54 lpc55 mcx imxrt hw/mcu/nxp/mcux-sdk https://github.com/nxp-mcuxpresso/mcux-sdk a1bdae309a14ec95a4f64a96d3315a4f89c397c6 kinetis_k kinetis_k32l2 kinetis_kl lpc51 lpc54 lpc55 mcx imxrt
hw/mcu/raspberry_pi/Pico-PIO-USB https://github.com/sekigon-gonnoc/Pico-PIO-USB.git fe9133fc513b82cc3dc62c67cb51f2339cf29ef7 rp2040 hw/mcu/raspberry_pi/Pico-PIO-USB https://github.com/sekigon-gonnoc/Pico-PIO-USB.git 3c1eec341a5232640e4c00628b889b641af34b28 rp2040
hw/mcu/renesas/fsp https://github.com/renesas/fsp.git edcc97d684b6f716728a60d7a6fea049d9870bd6 ra hw/mcu/renesas/fsp https://github.com/renesas/fsp.git edcc97d684b6f716728a60d7a6fea049d9870bd6 ra
hw/mcu/renesas/rx https://github.com/kkitayam/rx_device.git 706b4e0cf485605c32351e2f90f5698267996023 rx hw/mcu/renesas/rx https://github.com/kkitayam/rx_device.git 706b4e0cf485605c32351e2f90f5698267996023 rx
hw/mcu/silabs/cmsis-dfp-efm32gg12b https://github.com/cmsis-packs/cmsis-dfp-efm32gg12b.git f1c31b7887669cb230b3ea63f9b56769078960bc efm32 hw/mcu/silabs/cmsis-dfp-efm32gg12b https://github.com/cmsis-packs/cmsis-dfp-efm32gg12b.git f1c31b7887669cb230b3ea63f9b56769078960bc efm32
hw/mcu/sony/cxd56/spresense-exported-sdk https://github.com/sonydevworld/spresense-exported-sdk.git 2ec2a1538362696118dc3fdf56f33dacaf8f4067 spresense hw/mcu/sony/cxd56/spresense-exported-sdk https://github.com/sonydevworld/spresense-exported-sdk.git 2ec2a1538362696118dc3fdf56f33dacaf8f4067 spresense
hw/mcu/st/cmsis_device_c0 https://github.com/STMicroelectronics/cmsis_device_c0.git fb56b1b70c73b74eacda2a4bcc36886444364ab3 stm32c0 hw/mcu/st/cmsis_device_c0 https://github.com/STMicroelectronics/cmsis_device_c0.git fb56b1b70c73b74eacda2a4bcc36886444364ab3 stm32c0
hw/mcu/st/cmsis_device_f0 https://github.com/STMicroelectronics/cmsis_device_f0.git 2fc25ee22264bc27034358be0bd400b893ef837e stm32f0 hw/mcu/st/cmsis_device_f0 https://github.com/STMicroelectronics/cmsis_device_f0.git 2fc25ee22264bc27034358be0bd400b893ef837e stm32f0
hw/mcu/st/cmsis_device_f1 https://github.com/STMicroelectronics/cmsis_device_f1.git 6601104a6397299b7304fd5bcd9a491f56cb23a6 stm32f1 hw/mcu/st/cmsis_device_f1 https://github.com/STMicroelectronics/cmsis_device_f1.git 6601104a6397299b7304fd5bcd9a491f56cb23a6 stm32f1
hw/mcu/st/cmsis_device_f2 https://github.com/STMicroelectronics/cmsis_device_f2.git 182fcb3681ce116816feb41b7764f1b019ce796f stm32f2 hw/mcu/st/cmsis_device_f2 https://github.com/STMicroelectronics/cmsis_device_f2.git 182fcb3681ce116816feb41b7764f1b019ce796f stm32f2
hw/mcu/st/cmsis_device_f3 https://github.com/STMicroelectronics/cmsis_device_f3.git 5e4ee5ed7a7b6c85176bb70a9fd3c72d6eb99f1b stm32f3 hw/mcu/st/cmsis_device_f3 https://github.com/STMicroelectronics/cmsis_device_f3.git 5e4ee5ed7a7b6c85176bb70a9fd3c72d6eb99f1b stm32f3
hw/mcu/st/cmsis_device_f4 https://github.com/STMicroelectronics/cmsis_device_f4.git 2615e866fa48fe1ff1af9e31c348813f2b19e7ec stm32f4 hw/mcu/st/cmsis_device_f4 https://github.com/STMicroelectronics/cmsis_device_f4.git 2615e866fa48fe1ff1af9e31c348813f2b19e7ec stm32f4
hw/mcu/st/cmsis_device_f7 https://github.com/STMicroelectronics/cmsis_device_f7.git 25b0463439303b7a38f0d27b161f7d2f3c096e79 stm32f7 hw/mcu/st/cmsis_device_f7 https://github.com/STMicroelectronics/cmsis_device_f7.git 25b0463439303b7a38f0d27b161f7d2f3c096e79 stm32f7
hw/mcu/st/cmsis_device_g0 https://github.com/STMicroelectronics/cmsis_device_g0.git 3a23e1224417f3f2d00300ecd620495e363f2094 stm32g0 hw/mcu/st/cmsis_device_g0 https://github.com/STMicroelectronics/cmsis_device_g0.git 3a23e1224417f3f2d00300ecd620495e363f2094 stm32g0
hw/mcu/st/cmsis_device_g4 https://github.com/STMicroelectronics/cmsis_device_g4.git ce822adb1dc552b3aedd13621edbc7fdae124878 stm32g4 hw/mcu/st/cmsis_device_g4 https://github.com/STMicroelectronics/cmsis_device_g4.git ce822adb1dc552b3aedd13621edbc7fdae124878 stm32g4
hw/mcu/st/cmsis_device_h5 https://github.com/STMicroelectronics/cmsis_device_h5.git cd2d1d579743de57b88ccaf61a968b9c05848ffc stm32h5 hw/mcu/st/cmsis_device_h5 https://github.com/STMicroelectronics/cmsis_device_h5.git cd2d1d579743de57b88ccaf61a968b9c05848ffc stm32h5
hw/mcu/st/cmsis_device_h7 https://github.com/STMicroelectronics/cmsis_device_h7.git 60dc2c913203dc8629dc233d4384dcc41c91e77f stm32h7 hw/mcu/st/cmsis_device_h7 https://github.com/STMicroelectronics/cmsis_device_h7.git 60dc2c913203dc8629dc233d4384dcc41c91e77f stm32h7
hw/mcu/st/cmsis_device_l0 https://github.com/STMicroelectronics/cmsis_device_l0.git 69cd5999fd40ae6e546d4905b21635c6ca1bcb92 stm32l0 hw/mcu/st/cmsis_device_h7rs https://github.com/STMicroelectronics/cmsis_device_h7rs.git 832649d1fd09bd901e9f68e979522e5c209ebf20 stm32h7rs
hw/mcu/st/cmsis_device_l1 https://github.com/STMicroelectronics/cmsis_device_l1.git 7f16ec0a1c4c063f84160b4cc6bf88ad554a823e stm32l1 hw/mcu/st/cmsis_device_l0 https://github.com/STMicroelectronics/cmsis_device_l0.git 69cd5999fd40ae6e546d4905b21635c6ca1bcb92 stm32l0
hw/mcu/st/cmsis_device_l4 https://github.com/STMicroelectronics/cmsis_device_l4.git 6ca7312fa6a5a460b5a5a63d66da527fdd8359a6 stm32l4 hw/mcu/st/cmsis_device_l1 https://github.com/STMicroelectronics/cmsis_device_l1.git 7f16ec0a1c4c063f84160b4cc6bf88ad554a823e stm32l1
hw/mcu/st/cmsis_device_l5 https://github.com/STMicroelectronics/cmsis_device_l5.git d922865fc0326a102c26211c44b8e42f52c1e53d stm32l5 hw/mcu/st/cmsis_device_l4 https://github.com/STMicroelectronics/cmsis_device_l4.git 6ca7312fa6a5a460b5a5a63d66da527fdd8359a6 stm32l4
hw/mcu/st/cmsis_device_u5 https://github.com/STMicroelectronics/cmsis_device_u5.git 5ad9797c54ec3e55eff770fc9b3cd4a1aefc1309 stm32u5 hw/mcu/st/cmsis_device_l5 https://github.com/STMicroelectronics/cmsis_device_l5.git d922865fc0326a102c26211c44b8e42f52c1e53d stm32l5
hw/mcu/st/cmsis_device_wb https://github.com/STMicroelectronics/cmsis_device_wb.git 9c5d1920dd9fabbe2548e10561d63db829bb744f stm32wb hw/mcu/st/cmsis_device_n6 https://github.com/STMicroelectronics/cmsis-device-n6.git f818b00f775444e8d19ef6cad822534c345e054f stm32n6
hw/mcu/st/stm32-mfxstm32l152 https://github.com/STMicroelectronics/stm32-mfxstm32l152.git 7f4389efee9c6a655b55e5df3fceef5586b35f9b stm32h7 hw/mcu/st/cmsis_device_u5 https://github.com/STMicroelectronics/cmsis_device_u5.git 5ad9797c54ec3e55eff770fc9b3cd4a1aefc1309 stm32u5
hw/mcu/st/stm32c0xx_hal_driver https://github.com/STMicroelectronics/stm32c0xx_hal_driver.git 41253e2f1d7ae4a4d0c379cf63f5bcf71fcf8eb3 stm32c0 hw/mcu/st/cmsis_device_wb https://github.com/STMicroelectronics/cmsis_device_wb.git d6a7fa2e7de084f5e5e47f2ab88b022fe9b50e5a stm32wb
hw/mcu/st/stm32f0xx_hal_driver https://github.com/STMicroelectronics/stm32f0xx_hal_driver.git 0e95cd88657030f640a11e690a8a5186c7712ea5 stm32f0 hw/mcu/st/stm32-mfxstm32l152 https://github.com/STMicroelectronics/stm32-mfxstm32l152.git 7f4389efee9c6a655b55e5df3fceef5586b35f9b stm32h7
hw/mcu/st/stm32f1xx_hal_driver https://github.com/STMicroelectronics/stm32f1xx_hal_driver.git 1dd9d3662fb7eb2a7f7d3bc0a4c1dc7537915a29 stm32f1 hw/mcu/st/stm32c0xx_hal_driver https://github.com/STMicroelectronics/stm32c0xx_hal_driver.git 41253e2f1d7ae4a4d0c379cf63f5bcf71fcf8eb3 stm32c0
hw/mcu/st/stm32f2xx_hal_driver https://github.com/STMicroelectronics/stm32f2xx_hal_driver.git c75ace9b908a9aca631193ebf2466963b8ea33d0 stm32f2 hw/mcu/st/stm32f0xx_hal_driver https://github.com/STMicroelectronics/stm32f0xx_hal_driver.git 0e95cd88657030f640a11e690a8a5186c7712ea5 stm32f0
hw/mcu/st/stm32f3xx_hal_driver https://github.com/STMicroelectronics/stm32f3xx_hal_driver.git 1761b6207318ede021706e75aae78f452d72b6fa stm32f3 hw/mcu/st/stm32f1xx_hal_driver https://github.com/STMicroelectronics/stm32f1xx_hal_driver.git 1dd9d3662fb7eb2a7f7d3bc0a4c1dc7537915a29 stm32f1
hw/mcu/st/stm32f4xx_hal_driver https://github.com/STMicroelectronics/stm32f4xx_hal_driver.git 04e99fbdabd00ab8f370f377c66b0a4570365b58 stm32f4 hw/mcu/st/stm32f2xx_hal_driver https://github.com/STMicroelectronics/stm32f2xx_hal_driver.git c75ace9b908a9aca631193ebf2466963b8ea33d0 stm32f2
hw/mcu/st/stm32f7xx_hal_driver https://github.com/STMicroelectronics/stm32f7xx_hal_driver.git f7ffdf6bf72110e58b42c632b0a051df5997e4ee stm32f7 hw/mcu/st/stm32f3xx_hal_driver https://github.com/STMicroelectronics/stm32f3xx_hal_driver.git 1761b6207318ede021706e75aae78f452d72b6fa stm32f3
hw/mcu/st/stm32g0xx_hal_driver https://github.com/STMicroelectronics/stm32g0xx_hal_driver.git e911b12c7f67084d7f6b76157a4c0d4e2ec3779c stm32g0 hw/mcu/st/stm32f4xx_hal_driver https://github.com/STMicroelectronics/stm32f4xx_hal_driver.git 04e99fbdabd00ab8f370f377c66b0a4570365b58 stm32f4
hw/mcu/st/stm32g4xx_hal_driver https://github.com/STMicroelectronics/stm32g4xx_hal_driver.git 8b4518417706d42eef5c14e56a650005abf478a8 stm32g4 hw/mcu/st/stm32f7xx_hal_driver https://github.com/STMicroelectronics/stm32f7xx_hal_driver.git f7ffdf6bf72110e58b42c632b0a051df5997e4ee stm32f7
hw/mcu/st/stm32h5xx_hal_driver https://github.com/STMicroelectronics/stm32h5xx_hal_driver.git 2cf77de584196d619cec1b4586c3b9e2820a254e stm32h5 hw/mcu/st/stm32g0xx_hal_driver https://github.com/STMicroelectronics/stm32g0xx_hal_driver.git e911b12c7f67084d7f6b76157a4c0d4e2ec3779c stm32g0
hw/mcu/st/stm32h7xx_hal_driver https://github.com/STMicroelectronics/stm32h7xx_hal_driver.git d8461b980b59b1625207d8c4f2ce0a9c2a7a3b04 stm32h7 hw/mcu/st/stm32g4xx_hal_driver https://github.com/STMicroelectronics/stm32g4xx_hal_driver.git 8b4518417706d42eef5c14e56a650005abf478a8 stm32g4
hw/mcu/st/stm32l0xx_hal_driver https://github.com/STMicroelectronics/stm32l0xx_hal_driver.git fbdacaf6f8c82a4e1eb9bd74ba650b491e97e17b stm32l0 hw/mcu/st/stm32h5xx_hal_driver https://github.com/STMicroelectronics/stm32h5xx_hal_driver.git 2cf77de584196d619cec1b4586c3b9e2820a254e stm32h5
hw/mcu/st/stm32l1xx_hal_driver https://github.com/STMicroelectronics/stm32l1xx_hal_driver.git 44efc446fa69ed8344e7fd966e68ed11043b35d9 stm32l1 hw/mcu/st/stm32h7rsxx_hal_driver https://github.com/STMicroelectronics/stm32h7rsxx-hal-driver.git 7ca2e07ca21bc66b53654e845b4c85c884343b60 stm32h7rs
hw/mcu/st/stm32l4xx_hal_driver https://github.com/STMicroelectronics/stm32l4xx_hal_driver.git aee3d5bf283ae5df87532b781bdd01b7caf256fc stm32l4 hw/mcu/st/stm32h7xx_hal_driver https://github.com/STMicroelectronics/stm32h7xx_hal_driver.git d8461b980b59b1625207d8c4f2ce0a9c2a7a3b04 stm32h7
hw/mcu/st/stm32l5xx_hal_driver https://github.com/STMicroelectronics/stm32l5xx_hal_driver.git 675c32a75df37f39d50d61f51cb0dcf53f07e1cb stm32l5 hw/mcu/st/stm32l0xx_hal_driver https://github.com/STMicroelectronics/stm32l0xx_hal_driver.git fbdacaf6f8c82a4e1eb9bd74ba650b491e97e17b stm32l0
hw/mcu/st/stm32u5xx_hal_driver https://github.com/STMicroelectronics/stm32u5xx_hal_driver.git 4d93097a67928e9377e655ddd14622adc31b9770 stm32u5 hw/mcu/st/stm32l1xx_hal_driver https://github.com/STMicroelectronics/stm32l1xx_hal_driver.git 44efc446fa69ed8344e7fd966e68ed11043b35d9 stm32l1
hw/mcu/st/stm32wbxx_hal_driver https://github.com/STMicroelectronics/stm32wbxx_hal_driver.git 2c5f06638be516c1b772f768456ba637f077bac8 stm32wb hw/mcu/st/stm32l4xx_hal_driver https://github.com/STMicroelectronics/stm32l4xx_hal_driver.git aee3d5bf283ae5df87532b781bdd01b7caf256fc stm32l4
hw/mcu/ti https://github.com/hathach/ti_driver.git 143ed6cc20a7615d042b03b21e070197d473e6e5 msp430 msp432e4 tm4c hw/mcu/st/stm32l5xx_hal_driver https://github.com/STMicroelectronics/stm32l5xx_hal_driver.git 675c32a75df37f39d50d61f51cb0dcf53f07e1cb stm32l5
hw/mcu/wch/ch32f20x https://github.com/openwch/ch32f20x.git 77c4095087e5ed2c548ec9058e655d0b8757663b ch32f20x hw/mcu/st/stm32n6xx_hal_driver https://github.com/STMicroelectronics/stm32n6xx-hal-driver.git 49f9989d10cf6817d4b07ac01848956b46bd0fd6 stm32n6
hw/mcu/wch/ch32v103 https://github.com/openwch/ch32v103.git 7578cae0b21f86dd053a1f781b2fc6ab99d0ec17 ch32v10x hw/mcu/st/stm32u5xx_hal_driver https://github.com/STMicroelectronics/stm32u5xx_hal_driver.git 4d93097a67928e9377e655ddd14622adc31b9770 stm32u5
hw/mcu/wch/ch32v20x https://github.com/openwch/ch32v20x.git c4c38f507e258a4e69b059ccc2dc27dde33cea1b ch32v20x hw/mcu/st/stm32wbxx_hal_driver https://github.com/STMicroelectronics/stm32wbxx_hal_driver.git 2c5f06638be516c1b772f768456ba637f077bac8 stm32wb
hw/mcu/wch/ch32v307 https://github.com/openwch/ch32v307.git 184f21b852cb95eed58e86e901837bc9fff68775 ch32v307 hw/mcu/ti https://github.com/hathach/ti_driver.git 143ed6cc20a7615d042b03b21e070197d473e6e5 msp430 msp432e4 tm4c
lib/CMSIS_5 https://github.com/ARM-software/CMSIS_5.git 2b7495b8535bdcb306dac29b9ded4cfb679d7e5c imxrt kinetis_k32l2 kinetis_kl lpc51 lpc54 lpc55 mcx mm32 msp432e4 nrf saml2x lpc11 lpc13 lpc15 lpc17 lpc18 lpc40 lpc43 stm32c0 stm32f0 stm32f1 stm32f2 stm32f3 stm32f4 stm32f7 stm32g0 stm32g4 stm32h5 stm32h7 stm32l0 stm32l1 stm32l4 stm32l5 stm32u5 stm32wb sam3x samd11 samd21 samd51 samd5x_e5x same5x same7x saml2x samg tm4c hw/mcu/wch/ch32f20x https://github.com/openwch/ch32f20x.git 77c4095087e5ed2c548ec9058e655d0b8757663b ch32f20x
lib/CMSIS_6 https://github.com/ARM-software/CMSIS_6.git b0bbb0423b278ca632cfe1474eb227961d835fd2 ra hw/mcu/wch/ch32v103 https://github.com/openwch/ch32v103.git 7578cae0b21f86dd053a1f781b2fc6ab99d0ec17 ch32v10x
lib/FreeRTOS-Kernel https://github.com/FreeRTOS/FreeRTOS-Kernel.git cc0e0707c0c748713485b870bb980852b210877f all hw/mcu/wch/ch32v20x https://github.com/openwch/ch32v20x.git c4c38f507e258a4e69b059ccc2dc27dde33cea1b ch32v20x
lib/lwip https://github.com/lwip-tcpip/lwip.git 159e31b689577dbf69cf0683bbaffbd71fa5ee10 all hw/mcu/wch/ch32v307 https://github.com/openwch/ch32v307.git 184f21b852cb95eed58e86e901837bc9fff68775 ch32v307
lib/sct_neopixel https://github.com/gsteiert/sct_neopixel.git e73e04ca63495672d955f9268e003cffe168fcd8 lpc55 lib/CMSIS_5 https://github.com/ARM-software/CMSIS_5.git 2b7495b8535bdcb306dac29b9ded4cfb679d7e5c imxrt kinetis_k32l2 kinetis_kl lpc51 lpc54 lpc55 mcx mm32 msp432e4 nrf saml2x lpc11 lpc13 lpc15 lpc17 lpc18 lpc40 lpc43 stm32c0 stm32f0 stm32f1 stm32f2 stm32f3 stm32f4 stm32f7 stm32g0 stm32g4 stm32h5 stm32h7 stm32h7rs stm32l0 stm32l1 stm32l4 stm32l5 stm32n6 stm32u5 stm32wb sam3x samd11 samd21 samd51 samd5x_e5x same5x same7x saml2x samg tm4c
tools/uf2 https://github.com/microsoft/uf2.git c594542b2faa01cc33a2b97c9fbebc38549df80a all lib/CMSIS_6 https://github.com/ARM-software/CMSIS_6.git b0bbb0423b278ca632cfe1474eb227961d835fd2 ra
======================================== ============================================================== ======================================== ==================================================================================================================================================================================================================================================================================================================================== lib/FreeRTOS-Kernel https://github.com/FreeRTOS/FreeRTOS-Kernel.git cc0e0707c0c748713485b870bb980852b210877f all
lib/lwip https://github.com/lwip-tcpip/lwip.git 159e31b689577dbf69cf0683bbaffbd71fa5ee10 all
lib/sct_neopixel https://github.com/gsteiert/sct_neopixel.git e73e04ca63495672d955f9268e003cffe168fcd8 lpc55
tools/uf2 https://github.com/microsoft/uf2.git c594542b2faa01cc33a2b97c9fbebc38549df80a all
======================================== ================================================================ ======================================== ======================================================================================================================================================================================================================================================================================================================================================

View File

@ -5,19 +5,19 @@ Getting Started
Add TinyUSB to your project Add TinyUSB to your project
--------------------------- ---------------------------
It is relatively simple to incorporate tinyusb to your project To incorporate tinyusb to your project
* Copy or ``git submodule`` this repo into your project in a subfolder. Let's say it is *your_project/tinyusb* * Copy or ``git submodule`` this repo into your project in a subfolder. Let's say it is ``your_project/tinyusb``
* Add all the .c in the ``tinyusb/src`` folder to your project * Add all the ``.c`` in the ``tinyusb/src`` folder to your project
* Add *your_project/tinyusb/src* to your include path. Also make sure your current include path also contains the configuration file tusb_config.h. * Add ``your_project/tinyusb/src`` to your include path. Also make sure your current include path also contains the configuration file ``tusb_config.h``.
* Make sure all required macros are all defined properly in tusb_config.h (configure file in demo application is sufficient, but you need to add a few more such as ``CFG_TUSB_MCU``, ``CFG_TUSB_OS`` since they are passed by IDE/compiler to maintain a unique configure for all boards). * Make sure all required macros are all defined properly in ``tusb_config.h`` (configure file in demo application is sufficient, but you need to add a few more such as ``CFG_TUSB_MCU``, ``CFG_TUSB_OS`` since they are passed by make/cmake to maintain a unique configure for all boards).
* If you use the device stack, make sure you have created/modified usb descriptors for your own need. Ultimately you need to implement all **tud descriptor** callbacks for the stack to work. * If you use the device stack, make sure you have created/modified usb descriptors for your own need. Ultimately you need to implement all **tud descriptor** callbacks for the stack to work.
* Add tusb_init(rhport, role) call to your reset initialization code. * Add ``tusb_init(rhport, role)`` call to your reset initialization code.
* Call ``tusb_int_handler(rhport, in_isr)`` in your USB IRQ Handler * Call ``tusb_int_handler(rhport, in_isr)`` in your USB IRQ Handler
* Implement all enabled classes's callbacks. * Implement all enabled classes's callbacks.
* If you don't use any RTOSes at all, you need to continuously and/or periodically call tud_task()/tuh_task() function. All of the callbacks and functionality are handled and invoked within the call of that task runner. * If you don't use any RTOSes at all, you need to continuously and/or periodically call ``tud_task()``/``tuh_task()`` function. All of the callbacks and functionality are handled and invoked within the call of that task runner.
.. code-block:: .. code-block:: c
int main(void) { int main(void) {
tusb_rhport_init_t dev_init = { tusb_rhport_init_t dev_init = {
@ -50,9 +50,9 @@ It is relatively simple to incorporate tinyusb to your project
Examples Examples
-------- --------
For your convenience, TinyUSB contains a handful of examples for both host and device with/without RTOS to quickly test the functionality as well as demonstrate how API() should be used. Most examples will work on most of `the supported boards <supported.rst>`_. Firstly we need to ``git clone`` if not already For your convenience, TinyUSB contains a handful of examples for both host and device with/without RTOS to quickly test the functionality as well as demonstrate how API should be used. Most examples will work on most of `the supported boards <boards.rst>`_. Firstly we need to ``git clone`` if not already
.. code-block:: .. code-block:: bash
$ git clone https://github.com/hathach/tinyusb tinyusb $ git clone https://github.com/hathach/tinyusb tinyusb
$ cd tinyusb $ cd tinyusb
@ -62,41 +62,53 @@ Some ports will also require a port-specific SDK (e.g. RP2040) or binary (e.g. S
Dependencies Dependencies
^^^^^^^^^^^^ ^^^^^^^^^^^^
The hardware code is located in ``hw/bsp`` folder, and is organized by family/boards. e.g raspberry_pi_pico is located in ``hw/bsp/rp2040/boards/raspberry_pi_pico`` where FAMILY=rp2040 and BOARD=raspberry_pi_pico. Before building, we firstly need to download dependencies such as: MCU low-level peripheral driver and external libraries e.g FreeRTOS (required by some examples). We can do that by either ways: The hardware code is located in ``hw/bsp`` folder, and is organized by family/boards. e.g raspberry_pi_pico is located in ``hw/bsp/rp2040/boards/raspberry_pi_pico`` where ``FAMILY=rp2040`` and ``BOARD=raspberry_pi_pico``. Before building, we firstly need to download dependencies such as: MCU low-level peripheral driver and external libraries e.g FreeRTOS (required by some examples). We can do that by either ways:
1. Run ``tools/get_deps.py {FAMILY}`` script to download all dependencies for a family as follow. Note: For TinyUSB developer to download all dependencies, use FAMILY=all. 1. Run ``tools/get_deps.py {FAMILY}`` script to download all dependencies for a family as follow. Note: For TinyUSB developer to download all dependencies, use FAMILY=all.
.. code-block:: .. code-block:: bash
$ python tools/get_deps.py rp2040 $ python tools/get_deps.py rp2040
2. Or run the ``get-deps`` target in one of the example folder as follow. 2. Or run the ``get-deps`` target in one of the example folder as follow.
.. code-block:: .. code-block:: bash
$ cd examples/device/cdc_msc $ cd examples/device/cdc_msc
$ make BOARD=raspberry_pi_pico get-deps $ make BOARD=feather_nrf52840_express get-deps
You only need to do this once per family. Check out `complete list of dependencies and their designated path here <dependencies.rst>`_ You only need to do this once per family. Check out `complete list of dependencies and their designated path here <dependencies.rst>`_
Build Build Examples
^^^^^ ^^^^^^^^^^^^^^
To build example, first change directory to an example folder. Examples support make and cmake build system for most MCUs, however some MCU families such as espressif or rp2040 only support cmake. First change directory to an example folder.
.. code-block:: .. code-block:: bash
$ cd examples/device/cdc_msc $ cd examples/device/cdc_msc
Then compile with ``make BOARD={board_name} all`` , for example Then compile with make or cmake
.. code-block:: .. code-block:: bash
$ make BOARD=raspberry_pi_pico all $ # make
$ make BOARD=feather_nrf52840_express all
$ # cmake
$ mkdir build && cd build
$ cmake -DBOARD=raspberry_pi_pico ..
$ make
To list all available targets with cmake
.. code-block:: bash
$ cmake --build . --target help
Note: some examples especially those that uses Vendor class (e.g webUSB) may requires udev permission on Linux (and/or macOS) to access usb device. It depends on your OS distro, typically copy ``99-tinyusb.rules`` and reload your udev is good to go Note: some examples especially those that uses Vendor class (e.g webUSB) may requires udev permission on Linux (and/or macOS) to access usb device. It depends on your OS distro, typically copy ``99-tinyusb.rules`` and reload your udev is good to go
.. code-block:: .. code-block:: bash
$ cp examples/device/99-tinyusb.rules /etc/udev/rules.d/ $ cp examples/device/99-tinyusb.rules /etc/udev/rules.d/
$ sudo udevadm control --reload-rules && sudo udevadm trigger $ sudo udevadm control --reload-rules && sudo udevadm trigger
@ -104,27 +116,31 @@ Note: some examples especially those that uses Vendor class (e.g webUSB) may req
RootHub Port Selection RootHub Port Selection
~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~
If a board has several ports, one port is chosen by default in the individual board.mk file. Use option ``PORT=x`` To choose another port. For example to select the HS port of a STM32F746Disco board, use: If a board has several ports, one port is chosen by default in the individual board.mk file. Use option ``RHPORT_DEVICE=x`` or ``RHPORT_HOST=x`` To choose another port. For example to select the HS port of a STM32F746Disco board, use:
.. code-block:: .. code-block:: bash
$ make BOARD=stm32f746disco PORT=1 all $ make BOARD=stm32f746disco RHPORT_DEVICE=1 all
$ cmake -DBOARD=stm32f746disco -DRHPORT_DEVICE=1 ..
Port Speed Port Speed
~~~~~~~~~~ ~~~~~~~~~~
A MCU can support multiple operational speed. By default, the example build system will use the fastest supported on the board. Use option ``SPEED=full/high`` e.g To force F723 operate at full instead of default high speed A MCU can support multiple operational speed. By default, the example build system will use the fastest supported on the board. Use option ``RHPORT_DEVICE_SPEED=OPT_MODE_FULL/HIGH_SPEED/`` or ``RHPORT_HOST_SPEED=OPT_MODE_FULL/HIGH_SPEED/`` e.g To force F723 operate at full instead of default high speed
.. code-block:: .. code-block:: bash
$ make BOARD=stm32f746disco SPEED=full all $ make BOARD=stm32f746disco RHPORT_DEVICE_SPEED=OPT_MODE_FULL_SPEED all
$ cmake -DBOARD=stm32f746disco -DRHPORT_DEVICE_SPEED=OPT_MODE_FULL_SPEED ..
Size Analysis Size Analysis
~~~~~~~~~~~~~ ~~~~~~~~~~~~~
First install `linkermap tool <https://github.com/hathach/linkermap>`_ then ``linkermap`` target can be used to analyze code size. You may want to compile with ``NO_LTO=1`` since -flto merges code across .o files and make it difficult to analyze. First install `linkermap tool <https://github.com/hathach/linkermap>`_ then ``linkermap`` target can be used to analyze code size. You may want to compile with ``NO_LTO=1`` since ``-flto`` merges code across ``.o`` files and make it difficult to analyze.
.. code-block:: .. code-block:: bash
$ make BOARD=feather_nrf52840_express NO_LTO=1 all linkermap $ make BOARD=feather_nrf52840_express NO_LTO=1 all linkermap
@ -133,19 +149,23 @@ Debug
To compile for debugging add ``DEBUG=1``\ , for example To compile for debugging add ``DEBUG=1``\ , for example
.. code-block:: .. code-block:: bash
$ make BOARD=feather_nrf52840_express DEBUG=1 all $ make BOARD=feather_nrf52840_express DEBUG=1 all
$ cmake -DBOARD=feather_nrf52840_express -DCMAKE_BUILD_TYPE=Debug ..
Log Log
~~~ ~~~
Should you have an issue running example and/or submitting an bug report. You could enable TinyUSB built-in debug logging with optional ``LOG=``. LOG=1 will only print out error message, LOG=2 print more information with on-going events. LOG=3 or higher is not used yet. Should you have an issue running example and/or submitting an bug report. You could enable TinyUSB built-in debug logging with optional ``LOG=``. ``LOG=1`` will only print out error message, ``LOG=2`` print more information with on-going events. ``LOG=3`` or higher is not used yet.
.. code-block:: .. code-block:: bash
$ make BOARD=feather_nrf52840_express LOG=2 all $ make BOARD=feather_nrf52840_express LOG=2 all
$ cmake -DBOARD=feather_nrf52840_express -DLOG=2 ..
Logger Logger
~~~~~~ ~~~~~~
@ -164,74 +184,80 @@ By default log message is printed via on-board UART which is slow and take lots
* Pros: should be compatible with more debugger that support SWO. * Pros: should be compatible with more debugger that support SWO.
* Software viewer should be provided along with your debugger driver. * Software viewer should be provided along with your debugger driver.
.. code-block:: .. code-block:: bash
$ make BOARD=feather_nrf52840_express LOG=2 LOGGER=rtt all $ make BOARD=feather_nrf52840_express LOG=2 LOGGER=rtt all
$ make BOARD=feather_nrf52840_express LOG=2 LOGGER=swo all $ make BOARD=feather_nrf52840_express LOG=2 LOGGER=swo all
$ cmake -DBOARD=feather_nrf52840_express -DLOG=2 -DLOGGER=rtt ..
$ cmake -DBOARD=feather_nrf52840_express -DLOG=2 -DLOGGER=swo ..
Flash Flash
^^^^^ ^^^^^
``flash`` target will use the default on-board debugger (jlink/cmsisdap/stlink/dfu) to flash the binary, please install those support software in advance. Some board use bootloader/DFU via serial which is required to pass to make command ``flash`` target will use the default on-board debugger (jlink/cmsisdap/stlink/dfu) to flash the binary, please install those support software in advance. Some board use bootloader/DFU via serial which is required to pass to make command
.. code-block:: .. code-block:: bash
$ make BOARD=feather_nrf52840_express flash $ make BOARD=feather_nrf52840_express flash
$ make SERIAL=/dev/ttyACM0 BOARD=feather_nrf52840_express flash $ make SERIAL=/dev/ttyACM0 BOARD=feather_nrf52840_express flash
Since jlink can be used with most of the boards, there is also ``flash-jlink`` target for your convenience. Since jlink/openocd can be used with most of the boards, there is also ``flash-jlink/openocd`` (make) and ``EXAMPLE-jlink/openocd`` target for your convenience. Note for stm32 board with stlink, you can use ``flash-stlink`` target as well.
.. code-block:: .. code-block:: bash
$ make BOARD=feather_nrf52840_express flash-jlink $ make BOARD=feather_nrf52840_express flash-jlink
$ make BOARD=feather_nrf52840_express flash-openocd
$ cmake --build . --target cdc_msc-jlink
$ cmake --build . --target cdc_msc-openocd
Some board use uf2 bootloader for drag & drop in to mass storage device, uf2 can be generated with ``uf2`` target Some board use uf2 bootloader for drag & drop in to mass storage device, uf2 can be generated with ``uf2`` target
.. code-block:: .. code-block:: bash
$ make BOARD=feather_nrf52840_express all uf2 $ make BOARD=feather_nrf52840_express all uf2
$ cmake --build . --target cdc_msc-uf2
IAR Support IAR Support
----------- ^^^^^^^^^^^
Use project connection Use project connection
^^^^^^^^^^^^^^^^^^^^^^ ~~~~~~~~~~~~~~~~~~~~~~
IAR Project Connection files are provided to import TinyUSB stack into your project. IAR Project Connection files are provided to import TinyUSB stack into your project.
* A buldable project of your MCU need to be created in advance. * A buildable project of your MCU need to be created in advance.
* Take example of STM32F0: * Take example of STM32F0:
- You need `stm32l0xx.h`, `startup_stm32f0xx.s`, `system_stm32f0xx.c`. - You need ``stm32l0xx.h``, ``startup_stm32f0xx.s``, ``system_stm32f0xx.c``.
- `STM32L0xx_HAL_Driver` is only needed to run examples, TinyUSB stack itself doesn't rely on MCU's SDKs. - ``STM32L0xx_HAL_Driver`` is only needed to run examples, TinyUSB stack itself doesn't rely on MCU's SDKs.
* Open ``Tools -> Configure Custom Argument Variables`` (Switch to `Global` tab if you want to do it for all your projects) * Open ``Tools -> Configure Custom Argument Variables`` (Switch to ``Global`` tab if you want to do it for all your projects)
Click `New Group ...`, name it to `TUSB`, Click `Add Variable ...`, name it to `TUSB_DIR`, change it's value to the path of your TinyUSB stack, Click ``New Group ...``, name it to ``TUSB``, Click ``Add Variable ...``, name it to ``TUSB_DIR``, change it's value to the path of your TinyUSB stack,
for example `C:\\tinyusb` for example ``C:\\tinyusb``
Import stack only **Import stack only**
~~~~~~~~~~~~~~~~~
1. Open ``Project -> Add project Connection ...``, click `OK`, choose `tinyusb\\tools\\iar_template.ipcf`. Open ``Project -> Add project Connection ...``, click ``OK``, choose ``tinyusb\\tools\\iar_template.ipcf``.
Run examples **Run examples**
~~~~~~~~~~~~
1. (Python3 is needed) Run ``iar_gen.py`` to generate .ipcf files of examples: 1. Run ``iar_gen.py`` to generate .ipcf files of examples:
.. code-block:: .. code-block::
cd C:\tinyusb\tools > cd C:\tinyusb\tools
python iar_gen.py > python iar_gen.py
2. Open `Project -> Add project Connection ...`, click `OK`, choose `tinyusb\\examples\\(.ipcf of example)`. 2. Open ``Project -> Add project Connection ...``, click ``OK``, choose ``tinyusb\\examples\\(.ipcf of example)``.
For example `C:\\tinyusb\\examples\\device\\cdc_msc\\iar_cdc_msc.ipcf` For example ``C:\\tinyusb\\examples\\device\\cdc_msc\\iar_cdc_msc.ipcf``
Native CMake support (9.50.1+) Native CMake support
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ~~~~~~~~~~~~~~~~~~~~
With 9.50.1 release, IAR added experimental native CMake support (strangely not mentioned in public release note). Now it's possible to import CMakeLists.txt then build and debug as a normal project. With 9.50.1 release, IAR added experimental native CMake support (strangely not mentioned in public release note). Now it's possible to import CMakeLists.txt then build and debug as a normal project.
@ -239,5 +265,5 @@ Following these steps:
1. Add IAR compiler binary path to system ``PATH`` environment variable, such as ``C:\Program Files\IAR Systems\Embedded Workbench 9.2\arm\bin``. 1. Add IAR compiler binary path to system ``PATH`` environment variable, such as ``C:\Program Files\IAR Systems\Embedded Workbench 9.2\arm\bin``.
2. Create new project in IAR, in Tool chain dropdown menu, choose CMake for Arm then Import ``CMakeLists.txt`` from chosen example directory. 2. Create new project in IAR, in Tool chain dropdown menu, choose CMake for Arm then Import ``CMakeLists.txt`` from chosen example directory.
3. Set up board option in ``Option - CMake/CMSIS-TOOLBOX - CMake``, for example :code:`-DBOARD=stm32f439nucleo -DTOOLCHAIN=iar`, **Uncheck 'Override tools in env'**. 3. Set up board option in ``Option - CMake/CMSIS-TOOLBOX - CMake``, for example ``-DBOARD=stm32f439nucleo -DTOOLCHAIN=iar``, **Uncheck 'Override tools in env'**.
4. (For debug only) Choose correct CPU model in ``Option - General Options - Target``, to profit register and memory view. 4. (For debug only) Choose correct CPU model in ``Option - General Options - Target``, to profit register and memory view.

View File

@ -1,85 +1,10 @@
*********
Reference
*********
.. figure:: ../assets/stack.svg
:width: 1600px
:alt: TinyUSB
::
.
├── docs # Documentation
├── examples # Examples with make and cmake build system
├── hw
│ ├── bsp # Supported boards source files
│ └── mcu # Low level mcu core & peripheral drivers
├── lib # Sources from 3rd party such as freeRTOS, fatfs ...
├── src # All sources files for TinyUSB stack itself.
├── test # Tests: unit test, fuzzing, hardware test
└── tools # Files used internally
Device Stack
============
Supports multiple device configurations by dynamically changing USB descriptors, low power functions such like suspend, resume, and remote wakeup. The following device classes are supported:
- Audio Class 2.0 (UAC2)
- Bluetooth Host Controller Interface (BTH HCI)
- Communication Device Class (CDC)
- Device Firmware Update (DFU): DFU mode (WIP) and Runtime
- Human Interface Device (HID): Generic (In & Out), Keyboard, Mouse, Gamepad etc ...
- Mass Storage Class (MSC): with multiple LUNs
- Musical Instrument Digital Interface (MIDI)
- Network with RNDIS, Ethernet Control Model (ECM), Network Control Model (NCM)
- Test and Measurement Class (USBTMC)
- Video class 1.5 (UVC): work in progress
- Vendor-specific class support with generic In & Out endpoints. Can be used with MS OS 2.0 compatible descriptor to load winUSB driver without INF file.
- `WebUSB <https://github.com/WICG/webusb>`__ with vendor-specific class
If you have a special requirement, `usbd_app_driver_get_cb()` can be used to write your own class driver without modifying the stack. Here is how the RPi team added their reset interface `raspberrypi/pico-sdk#197 <https://github.com/raspberrypi/pico-sdk/pull/197>`_
Host Stack
==========
- Human Interface Device (HID): Keyboard, Mouse, Generic
- Mass Storage Class (MSC)
- Communication Device Class: CDC-ACM
- Vendor serial over USB: FTDI, CP210x
- Hub with multiple-level support
Similar to the Device Stack, if you have a special requirement, `usbh_app_driver_get_cb()` can be used to write your own class driver without modifying the stack.
TypeC PD Stack
==============
- Power Delivery 3.0 (PD3.0) with USB Type-C support (WIP)
- Super early stage, only for testing purpose
- Only support STM32 G4
OS Abstraction layer
====================
TinyUSB is completely thread-safe by pushing all Interrupt Service Request (ISR) events into a central queue, then processing them later in the non-ISR context task function. It also uses semaphore/mutex to access shared resources such as Communication Device Class (CDC) FIFO. Therefore the stack needs to use some of the OS's basic APIs. Following OSes are already supported out of the box.
- **No OS**
- **FreeRTOS**
- `RT-Thread <https://github.com/RT-Thread/rt-thread>`_: `repo <https://github.com/RT-Thread-packages/tinyusb>`_
- **Mynewt** Due to the newt package build system, Mynewt examples are better to be on its `own repo <https://github.com/hathach/mynewt-tinyusb-example>`_
License
=======
All TinyUSB sources in the `src` folder are licensed under MIT license. However, each file can be individually licensed especially those in `lib` and `hw/mcu` folder. Please make sure you understand all the license term for files you use in your project.
Index Index
===== =====
.. toctree:: .. toctree::
:maxdepth: 2 :maxdepth: 2
supported
getting_started getting_started
boards
dependencies dependencies
concurrency concurrency

View File

@ -1,442 +0,0 @@
*****************
Supported Devices
*****************
Supported MCUs
==============
+--------------+-----------------------------+--------+------+-----------+------------------------+-------------------+
| Manufacturer | Family | Device | Host | Highspeed | Driver | Note |
+==============+=============================+========+======+===========+========================+===================+
| Allwinner | F1C100s/F1C200s | ✔ | | ✔ | sunxi | musb variant |
+--------------+-----------------------------+--------+------+-----------+------------------------+-------------------+
| Analog | MAX3421E | | ✔ | ✖ | max3421 | via SPI |
| +-----------------------------+--------+------+-----------+------------------------+-------------------+
| | MAX32 650, 666, 690, | ✔ | | ✔ | musb | 1-dir ep |
| | MAX78002 | | | | | |
+--------------+-----------------------------+--------+------+-----------+------------------------+-------------------+
| Brigetek | FT90x | ✔ | | ✔ | ft9xx | 1-dir ep |
+--------------+-----------------------------+--------+------+-----------+------------------------+-------------------+
| Broadcom | BCM2711, BCM2837 | ✔ | | ✔ | dwc2 | |
+--------------+-----------------------------+--------+------+-----------+------------------------+-------------------+
| Dialog | DA1469x | ✔ | ✖ | ✖ | da146xx | |
+--------------+-----------------------------+--------+------+-----------+------------------------+-------------------+
| Espressif | S2, S3 | ✔ | ✔ | ✖ | dwc2 or esp32sx | |
| ESP32 +-----------------------------+--------+------+-----------+------------------------+-------------------+
| | P4 | ✔ | ✔ | ✔ | dwc2 | |
+--------------+----+------------------------+--------+------+-----------+------------------------+-------------------+
| GigaDevice | GD32VF103 | ✔ | | ✖ | dwc2 | |
+--------------+-----------------------------+--------+------+-----------+------------------------+-------------------+
| Infineon | XMC4500 | ✔ | ✔ | ✖ | dwc2 | |
+--------------+-----+-----------------------+--------+------+-----------+------------------------+-------------------+
| MicroChip | SAM | D11, D21, L21, L22 | ✔ | | ✖ | samd | |
| | +-----------------------+--------+------+-----------+------------------------+-------------------+
| | | D51, E5x | ✔ | | ✖ | samd | |
| | +-----------------------+--------+------+-----------+------------------------+-------------------+
| | | G55 | ✔ | | ✖ | samg | 1-dir ep |
| | +-----------------------+--------+------+-----------+------------------------+-------------------+
| | | E70,S70,V70,V71 | ✔ | | ✔ | samx7x | 1-dir ep |
| +-----+-----------------------+--------+------+-----------+------------------------+-------------------+
| | PIC | 24 | ✔ | | | pic | ci_fs variant |
| | +-----------------------+--------+------+-----------+------------------------+-------------------+
| | | 32 mm, mk, mx | ✔ | | | pic | ci_fs variant |
| | +-----------------------+--------+------+-----------+------------------------+-------------------+
| | | dsPIC33 | ✔ | | | pic | ci_fs variant |
| | +-----------------------+--------+------+-----------+------------------------+-------------------+
| | | 32mz | ✔ | | | pic32mz | musb variant |
+--------------+-----+-----------------------+--------+------+-----------+------------------------+-------------------+
| Mind Montion | mm32 | ✔ | | ✖ | mm32f327x_otg | ci_fs variant |
+--------------+-----+-----------------------+--------+------+-----------+------------------------+-------------------+
| NordicSemi | nRF 52833, 52840, 5340 | ✔ | ✖ | ✖ | nrf5x | only ep8 is ISO |
+--------------+-----------------------------+--------+------+-----------+------------------------+-------------------+
| Nuvoton | NUC120 | ✔ | ✖ | ✖ | nuc120 | |
| +-----------------------------+--------+------+-----------+------------------------+-------------------+
| | NUC121/NUC125 | ✔ | ✖ | ✖ | nuc121 | |
| +-----------------------------+--------+------+-----------+------------------------+-------------------+
| | NUC126 | ✔ | ✖ | ✖ | nuc121 | |
| +-----------------------------+--------+------+-----------+------------------------+-------------------+
| | NUC505 | ✔ | | ✔ | nuc505 | |
+--------------+---------+-------------------+--------+------+-----------+------------------------+-------------------+
| NXP | iMXRT | RT 10xx, 11xx | ✔ | ✔ | ✔ | ci_hs | |
| +---------+-------------------+--------+------+-----------+------------------------+-------------------+
| | Kinetis | KL | ✔ | ⚠ | ✖ | ci_fs, khci | |
| | +-------------------+--------+------+-----------+------------------------+-------------------+
| | | K32L2 | ✔ | | ✖ | khci | ci_fs variant |
| +---------+-------------------+--------+------+-----------+------------------------+-------------------+
| | LPC | 11u, 13, 15 | ✔ | ✖ | ✖ | lpc_ip3511 | |
| | +-------------------+--------+------+-----------+------------------------+-------------------+
| | | 17, 40 | ✔ | ⚠ | ✖ | lpc17_40 | |
| | +-------------------+--------+------+-----------+------------------------+-------------------+
| | | 18, 43 | ✔ | ✔ | ✔ | ci_hs | |
| | +-------------------+--------+------+-----------+------------------------+-------------------+
| | | 51u | ✔ | ✖ | ✖ | lpc_ip3511 | |
| | +-------------------+--------+------+-----------+------------------------+-------------------+
| | | 54, 55 | ✔ | | ✔ | lpc_ip3511 | |
| +---------+-------------------+--------+------+-----------+------------------------+-------------------+
| | MCX | N9, A15 | ✔ | | ✔ | ci_fs, ci_hs | |
+--------------+---------+-------------------+--------+------+-----------+------------------------+-------------------+
| Raspberry Pi | RP2040, RP2350 | ✔ | ✔ | ✖ | rp2040, pio_usb | |
+--------------+-----+-----------------------+--------+------+-----------+------------------------+-------------------+
| Renesas | RX | 63N, 65N, 72N | ✔ | ✔ | ✖ | rusb2 | |
| +-----+-----------------------+--------+------+-----------+------------------------+-------------------+
| | RA | 4M1, 4M3, 6M1 | ✔ | ✔ | ✖ | rusb2 | |
| | +-----------------------+--------+------+-----------+------------------------+-------------------+
| | | 6M5 | ✔ | ✔ | ✔ | rusb2 | |
+--------------+-----+-----------------------+--------+------+-----------+------------------------+-------------------+
| Silabs | EFM32GG12 | ✔ | | ✖ | dwc2 | |
+--------------+-----------------------------+--------+------+-----------+------------------------+-------------------+
| Sony | CXD56 | ✔ | ✖ | ✔ | cxd56 | |
+--------------+-----------------------------+--------+------+-----------+------------------------+-------------------+
| ST STM32 | F0 | ✔ | ✖ | ✖ | stm32_fsdev | |
| +----+------------------------+--------+------+-----------+------------------------+-------------------+
| | F1 | 102, 103 | ✔ | ✖ | ✖ | stm32_fsdev | |
| | +------------------------+--------+------+-----------+------------------------+-------------------+
| | | 105, 107 | ✔ | ✔ | ✖ | dwc2 | |
| +----+------------------------+--------+------+-----------+------------------------+-------------------+
| | F2, F4, F7, H7 | ✔ | ✔ | ✔ | dwc2 | |
| +-----------------------------+--------+------+-----------+------------------------+-------------------+
| | F3 | ✔ | ✖ | ✖ | stm32_fsdev | |
| +-----------------------------+--------+------+-----------+------------------------+-------------------+
| | C0, G0, H5 | ✔ | | ✖ | stm32_fsdev | |
| +-----------------------------+--------+------+-----------+------------------------+-------------------+
| | G4 | ✔ | ✖ | ✖ | stm32_fsdev | |
| +-----------------------------+--------+------+-----------+------------------------+-------------------+
| | L0, L1 | ✔ | ✖ | ✖ | stm32_fsdev | |
| +----+------------------------+--------+------+-----------+------------------------+-------------------+
| | L4 | 4x2, 4x3 | ✔ | ✖ | ✖ | stm32_fsdev | |
| | +------------------------+--------+------+-----------+------------------------+-------------------+
| | | 4x5, 4x6 | ✔ | ✔ | ✖ | dwc2 | |
| +----+------------------------+--------+------+-----------+------------------------+-------------------+
| | L4+ | ✔ | ✔ | ✖ | dwc2 | |
| +-----------------------------+--------+------+-----------+------------------------+-------------------+
| | L5 | ✔ | ✖ | ✖ | stm32_fsdev | |
| +----+------------------------+--------+------+-----------+------------------------+-------------------+
| | U5 | 535, 545 | ✔ | | ✖ | stm32_fsdev | |
| | +------------------------+--------+------+-----------+------------------------+-------------------+
| | | 575, 585 | ✔ | ✔ | ✖ | dwc2 | |
| | +------------------------+--------+------+-----------+------------------------+-------------------+
| | | 59x,5Ax,5Fx,5Gx | ✔ | ✔ | ✔ | dwc2 | |
| +----+------------------------+--------+------+-----------+------------------------+-------------------+
| | WBx5 | ✔ | ✖ | ✖ | stm32_fsdev | |
+--------------+-----------------------------+--------+------+-----------+------------------------+-------------------+
| TI | MSP430 | ✔ | ✖ | ✖ | msp430x5xx | |
| +-----------------------------+--------+------+-----------+------------------------+-------------------+
| | MSP432E4 | ✔ | | ✖ | musb | |
| +-----------------------------+--------+------+-----------+------------------------+-------------------+
| | TM4C123 | ✔ | | ✖ | musb | |
+--------------+-----------------------------+--------+------+-----------+------------------------+-------------------+
| ValentyUSB | eptri | ✔ | ✖ | ✖ | eptri | |
+--------------+-----------------------------+--------+------+-----------+------------------------+-------------------+
| WCH | CH32F20x | ✔ | | ✔ | ch32_usbhs | |
| +-----------------------------+--------+------+-----------+------------------------+-------------------+
| | CH32V20x | ✔ | | ✖ | stm32_fsdev/ch32_usbfs | |
| +-----------------------------+--------+------+-----------+------------------------+-------------------+
| | CH32V307 | ✔ | | ✔ | ch32_usbfs/hs | |
+--------------+-----------------------------+--------+------+-----------+------------------------+-------------------+
Table Legend
------------
========= =========================
✔ Supported
⚠ Partial support
✖ Not supported by hardware
\[empty\] Unknown
========= =========================
Supported Boards
================
The board support code is only used for self-contained examples and testing. It is not used when TinyUSB is part of a larger project. It is responsible for getting the MCU started and the USB peripheral clocked with minimal of on-board devices
- One LED : for status
- One Button : to get input from user
- One UART : optional for device, but required for host examples
The following boards are supported (sorted alphabetically):
Broadcom
--------
- `Raspberry Pi CM4 <https://www.raspberrypi.com/products/compute-module-4>`__
Dialog DA146xx
--------------
- `DA14695 Development Kit USB <https://www.dialog-semiconductor.com/products/da14695-development-kit-usb>`__
- `DA1469x Development Kit Pro <https://www.dialog-semiconductor.com/products/da14695-development-kit-pro>`__
Espressif ESP32-S2
------------------
- `Adafruit Feather ESP32-S2 <https://www.adafruit.com/product/5000>`__
- `Adafruit Magtag 2.9" E-Ink WiFi Display <https://www.adafruit.com/product/4800>`__
- `Adafruit Metro ESP32-S2 <https://www.adafruit.com/product/4775>`__
- `ESP32-S2-Kaluga-1 <https://docs.espressif.com/projects/esp-idf/en/latest/esp32s2/hw-reference/esp32s2/user-guide-esp32-s2-kaluga-1-kit.html>`__
- `ESP32-S2-Saola-1 <https://docs.espressif.com/projects/esp-idf/en/latest/esp32s2/hw-reference/esp32s2/user-guide-saola-1-v1.2.html>`__
GigaDevice
----------
- `Sipeed Longan Nano <https://longan.sipeed.com/en/>`__
Infineon
---------
XMC4000
^^^^^^^
- `XMC4500 Relax (Lite) Kit <https://www.infineon.com/cms/en/product/evaluation-boards/kit_xmc45_relax_lite_v1/>`__
MicroChip
---------
SAMD11 & SAMD21
^^^^^^^^^^^^^^^
- `Adafruit Circuit Playground Express <https://www.adafruit.com/product/3333>`__
- `Adafruit Feather M0 Express <https://www.adafruit.com/product/3403>`__
- `Adafruit ItsyBitsy M0 Express <https://www.adafruit.com/product/3727>`__
- `Adafruit Metro M0 Express <https://www.adafruit.com/product/3505>`__
- `Great Scott Gadgets Cynthion <https://greatscottgadgets.com/cynthion/>`__
- `Microchip SAMD11 Xplained Pro <https://www.microchip.com/developmenttools/ProductDetails/atsamd11-xpro>`__
- `Microchip SAMD21 Xplained Pro <https://www.microchip.com/DevelopmentTools/ProductDetails/ATSAMD21-XPRO>`__
- `Seeeduino Xiao <https://www.seeedstudio.com/Seeeduino-XIAO-Arduino-Microcontroller-SAMD21-Cortex-M0+-p-4426.html>`__
SAMD51 & SAME54
^^^^^^^^^^^^^^^
- `Adafruit Feather M4 Express <https://www.adafruit.com/product/3857>`__
- `Adafruit ItsyBitsy M4 Express <https://www.adafruit.com/product/3800>`__
- `Adafruit PyBadge <https://www.adafruit.com/product/4200>`__
- `Adafruit PyPortal <https://www.adafruit.com/product/4116>`__
- `Adafruit Metro M4 Express <https://www.adafruit.com/product/3382>`__
- `D5035-01 <https://github.com/RudolphRiedel/USB_CAN-FD>`__
- `Microchip SAME54 Xplained Pro <https://www.microchip.com/developmenttools/productdetails/atsame54-xpro>`__
SAME7x
^^^^^^
- `Microchip SAME70 Xplained <https://www.microchip.com/en-us/development-tool/ATSAME70-XPLD>`_
- `QMTECH ATSAME70N19 <https://www.aliexpress.com/item/1005003173783268.html>`_
SAMG
^^^^
- `Microchip SAMG55 Xplained Pro <https://www.microchip.com/DevelopmentTools/ProductDetails/PartNO/ATSAMG55-XPRO>`__
SAML2x
^^^^^^
- `SAML21 Xplaind Pro <https://www.microchip.com/DevelopmentTools/ProductDetails/ATSAML21-XPRO-B>`__
- `SAML22 Feather <https://github.com/joeycastillo/Feather-Projects/tree/main/SAML22%20Feather>`__
- `Sensor Watch <https://github.com/joeycastillo/Sensor-Watch>`__
Nordic nRF5x
------------
- `Adafruit Circuit Playground Bluefruit <https://www.adafruit.com/product/4333>`__
- `Adafruit CLUE <https://www.adafruit.com/product/4500>`__
- `Adafruit Feather nRF52840 Express <https://www.adafruit.com/product/4062>`__
- `Adafruit Feather nRF52840 Sense <https://www.adafruit.com/product/4516>`__
- `Adafruit ItsyBitsy nRF52840 Express <https://www.adafruit.com/product/4481>`__
- `Arduino Nano 33 BLE <https://store.arduino.cc/usa/nano-33-ble>`__
- `Arduino Nano 33 BLE Sense <https://store.arduino.cc/usa/nano-33-ble-sense>`__
- `Maker Diary nRF52840 MDK Dongle <https://wiki.makerdiary.com/nrf52840-mdk-usb-dongle>`__
- `Nordic nRF52840 Development Kit (aka pca10056) <https://www.nordicsemi.com/Software-and-Tools/Development-Kits/nRF52840-DK>`__
- `Nordic nRF52840 Dongle (aka pca10059) <https://www.nordicsemi.com/Software-and-Tools/Development-Kits/nRF52840-Dongle>`__
- `Nordic nRF52833 Development Kit (aka pca10100) <https://www.nordicsemi.com/Software-and-Tools/Development-Kits/nRF52833-DK>`__
- `Raytac MDBT50Q-RX Dongle <https://www.raytac.com/product/ins.php?index_id=89>`__
Nuvoton
-------
- NuTiny SDK NUC120
- `NuTiny NUC121S <https://direct.nuvoton.com/en/nutiny-nuc121s>`__
- `NuTiny NUC125S <https://direct.nuvoton.com/en/nutiny-nuc125s>`__
- `NuTiny NUC126V <https://direct.nuvoton.com/en/nutiny-nuc126v>`__
- `NuTiny SDK NUC505Y <https://direct.nuvoton.com/en/nutiny-nuc505y>`__
NXP
---
iMX RT
^^^^^^
- `MIMX RT1010 Evaluation Kit <https://www.nxp.com/design/development-boards/i.mx-evaluation-and-development-boards/i.mx-rt1010-evaluation-kit:MIMXRT1010-EVK>`__
- `MIMX RT1015 Evaluation Kit <https://www.nxp.com/design/development-boards/i.mx-evaluation-and-development-boards/i.mx-rt1015-evaluation-kit:MIMXRT1015-EVK>`__
- `MIMX RT1020 Evaluation Kit <https://www.nxp.com/design/development-boards/i.mx-evaluation-and-development-boards/i.mx-rt1020-evaluation-kit:MIMXRT1020-EVK>`__
- `MIMX RT1050 Evaluation Kit <https://www.nxp.com/design/development-boards/i.mx-evaluation-and-development-boards/i.mx-rt1050-evaluation-kit:MIMXRT1050-EVK>`__
- `MIMX RT1060 Evaluation Kit <https://www.nxp.com/design/development-boards/i.mx-evaluation-and-development-boards/mimxrt1060-evk-i.mx-rt1060-evaluation-kit:MIMXRT1060-EVK>`__
- `MIMX RT1064 Evaluation Kit <https://www.nxp.com/design/development-boards/i.mx-evaluation-and-development-boards/mimxrt1064-evk-i.mx-rt1064-evaluation-kit:MIMXRT1064-EVK>`__
- `Teensy 4.0 Development Board <https://www.pjrc.com/store/teensy40.html>`__
- `Teensy 4.1 Development Board <https://www.pjrc.com/store/teensy41.html>`__
Kinetis
^^^^^^^
- `Freedom FRDM-KL25Z <https://www.nxp.com/design/development-boards/freedom-development-boards/mcu-boards/freedom-development-platform-for-kinetis-kl14-kl15-kl24-kl25-mcus:FRDM-KL25Z>`__
- `Freedom FRDM-K32L2A4S <https://www.nxp.com/design/development-boards/freedom-development-boards/mcu-boards/nxp-freedom-platform-for-k32-l2a-mcus:FRDM-K32L2A4S>`__
- `Freedom FRDM-K32L2B3 <https://www.nxp.com/design/development-boards/freedom-development-boards/mcu-boards/nxp-freedom-development-platform-for-k32-l2b-mcus:FRDM-K32L2B3>`__
- `KUIIC <https://github.com/nxf58843/kuiic>`__
LPC 11-13-15
^^^^^^^^^^^^
- `LPCXpresso 11u37 <https://www.nxp.com/design/microcontrollers-developer-resources/lpcxpresso-boards/lpcxpresso-board-for-lpc11u37h:OM13074>`__
- `LPCXpresso 11u68 <https://www.nxp.com/support/developer-resources/evaluation-and-development-boards/lpcxpresso-boards/lpcxpresso-board-for-lpc11u68:OM13058>`__
- `LPCXpresso 1347 <https://www.nxp.com/support/developer-resources/evaluation-and-development-boards/lpcxpresso-boards/lpcxpresso-board-for-lpc1347:OM13045>`__
- `LPCXpresso 1549 <https://www.nxp.com/products/processors-and-microcontrollers/arm-microcontrollers/general-purpose-mcus/lpc1500-cortex-m3/lpcxpresso-board-for-lpc1549:OM13056>`__
LPC 17-40
^^^^^^^^^
- `ARM mbed LPC1768 <https://www.nxp.com/products/processors-and-microcontrollers/arm-microcontrollers/general-purpose-mcus/lpc1700-cortex-m3/arm-mbed-lpc1768-board:OM11043>`__
- `Embedded Artists LPC4088 Quick Start board <https://www.embeddedartists.com/products/lpc4088-quickstart-board>`__
- `LPCXpresso 1769 <https://www.nxp.com/support/developer-resources/evaluation-and-development-boards/lpcxpresso-boards/lpcxpresso-board-for-lpc1769:OM13000>`__
LPC 18-43
^^^^^^^^^
- `Embedded Artists LPC4357 Developer Kit <http://www.embeddedartists.com/products/kits/lpc4357_kit.php>`__
- `Keil MCB1800 Evaluation Board <http://www.keil.com/mcb1800>`__
- `LPCXpresso18S37 Development Board <https://www.nxp.com/products/processors-and-microcontrollers/arm-microcontrollers/general-purpose-mcus/lpc4000-cortex-m4/lpcxpresso18s37-development-board:OM13076>`__
LPC 51
^^^^^^
- `LPCXpresso 51U68 <https://www.nxp.com/products/processors-and-microcontrollers/arm-microcontrollers/general-purpose-mcus/lpcxpresso51u68-for-the-lpc51u68-mcus:OM40005>`__
LPC 54
^^^^^^
- `LPCXpresso 54114 <https://www.nxp.com/design/microcontrollers-developer-resources/lpcxpresso-boards/lpcxpresso54114-board:OM13089>`__
LPC55
^^^^^
- `Double M33 Express <https://www.crowdsupply.com/steiert-solutions/double-m33-express>`__
- `LPCXpresso 55s28 EVK <https://www.nxp.com/design/software/development-software/lpcxpresso55s28-development-board:LPC55S28-EVK>`__
- `LPCXpresso 55s69 EVK <https://www.nxp.com/design/development-boards/lpcxpresso-boards/lpcxpresso55s69-development-board:LPC55S69-EVK>`__
- `MCU-Link <https://www.nxp.com/design/development-boards/lpcxpresso-boards/mcu-link-debug-probe:MCU-LINK>`__
Renesas
-------
RA
^^
- `Evaluation Kit for RA4M1 <https://www.renesas.com/us/en/products/microcontrollers-microprocessors/ra-cortex-m-mcus/ek-ra4m1-evaluation-kit-ra4m1-mcu-group>`__
- `Evaluation Kit for RA4M3 <https://www.renesas.com/us/en/products/microcontrollers-microprocessors/ra-cortex-m-mcus/ek-ra4m3-evaluation-kit-ra4m3-mcu-group>`__
RX
^^
- `GR-CITRUS <https://www.renesas.com/us/en/products/gadget-renesas/boards/gr-citrus>`__
- `Renesas RX65N Target Board <https://www.renesas.com/us/en/products/microcontrollers-microprocessors/rx-32-bit-performance-efficiency-mcus/rtk5rx65n0c00000br-target-board-rx65n>`__
Raspberry Pi RP2040
-------------------
- `Adafruit Feather RP2040 <https://www.adafruit.com/product/4884>`__
- `Adafruit ItsyBitsy RP2040 <https://www.adafruit.com/product/4888>`__
- `Adafruit QT Py RP2040 <https://www.adafruit.com/product/4900>`__
- `Raspberry Pi Pico <https://www.raspberrypi.org/products/raspberry-pi-pico/>`__
Silabs
------
- `EFM32GG12 Thunderboard Kit (SLTB009A) <https://www.silabs.com/development-tools/thunderboard/thunderboard-gg12-kit>`__
Sony
----
- `Sony Spresense CXD5602 <https://developer.sony.com/develop/spresense>`__
ST STM32
--------
F0
^^
- `STM32 F070rb Nucleo <https://www.st.com/en/evaluation-tools/nucleo-f070rb.html>`__
- `STM32 F072 Evaluation <https://www.st.com/en/evaluation-tools/stm32072b-eval.html>`__
- `STM32 F072rb Discovery <https://www.st.com/en/evaluation-tools/32f072bdiscovery.html>`__
F1
^^
- `STM32 F103c8 Blue Pill <https://stm32-base.org/boards/STM32F103C8T6-Blue-Pill>`__
- `STM32 F103rc Mini v2.0 <https://stm32-base.org/boards/STM32F103RCT6-STM32-Mini-V2.0>`__
F2
^^
- `STM32 F207zg Nucleo <https://www.st.com/en/evaluation-tools/nucleo-f207zg.html>`__
F3
^^
- `STM32 F303vc Discovery <https://www.st.com/en/evaluation-tools/stm32f3discovery.html>`__
F4
^^
- `Adafruit Feather STM32F405 <https://www.adafruit.com/product/4382>`__
- `Micro Python PyBoard v1.1 <https://store.micropython.org/product/PYBv1.1>`__
- `STM32 F401cc Black Pill <https://stm32-base.org/boards/STM32F401CCU6-WeAct-Black-Pill-V1.2>`__
- `STM32 F407vg Discovery <https://www.st.com/en/evaluation-tools/stm32f4discovery.html>`__
- `STM32 F411ce Black Pill <https://www.adafruit.com/product/4877>`__
- `STM32 F411ve Discovery <https://www.st.com/en/evaluation-tools/32f411ediscovery.html>`__
- `STM32 F412zg Discovery <https://www.st.com/en/evaluation-tools/32f412gdiscovery.html>`__
- `STM32 F412zg Nucleo <https://www.st.com/en/evaluation-tools/nucleo-f412zg.html>`__
- `STM32 F439zi Nucleo <https://www.st.com/en/evaluation-tools/nucleo-f439zi.html>`__
F7
^^
- `STLink-V3 Mini <https://www.st.com/en/development-tools/stlink-v3mini.html>`__
- `STM32 F723e Discovery <https://www.st.com/en/evaluation-tools/32f723ediscovery.html>`__
- `STM32 F746zg Nucleo <https://www.st.com/en/evaluation-tools/nucleo-f746zg.html>`__
- `STM32 F746g Discovery <https://www.st.com/en/evaluation-tools/32f746gdiscovery.html>`__
- `STM32 F767zi Nucleo <https://www.st.com/en/evaluation-tools/nucleo-f767zi.html>`__
- `STM32 F769i Discovery <https://www.st.com/en/evaluation-tools/32f769idiscovery.html>`__
H7
^^
- `STM32 H743zi Nucleo <https://www.st.com/en/evaluation-tools/nucleo-h743zi.html>`__
- `STM32 H743i Evaluation <https://www.st.com/en/evaluation-tools/stm32h743i-eval.html>`__
- `STM32 H745i Discovery <https://www.st.com/en/evaluation-tools/stm32h745i-disco.html>`__
- `Waveshare OpenH743I-C <https://www.waveshare.com/openh743i-c-standard.htm>`__
G4
^^
- `STM32 G474RE Nucleo <https://www.st.com/en/evaluation-tools/nucleo-g474re.html>`__
L0
^^
- `STM32 L035c8 Discovery <https://www.st.com/en/evaluation-tools/32l0538discovery.html>`__
L4
^^
- `STM32 L476vg Discovery <https://www.st.com/en/evaluation-tools/32l476gdiscovery.html>`__
- `STM32 L4P5zg Nucleo <https://www.st.com/en/evaluation-tools/nucleo-l4p5zg.html>`__
- `STM32 L4R5zi Nucleo <https://www.st.com/en/evaluation-tools/nucleo-l4r5zi.html>`__
WB
^^
- `STM32 WB55 Nucleo <https://www.st.com/en/evaluation-tools/p-nucleo-wb55.html>`__
TI
--
- `MSP430F5529 USB LaunchPad Evaluation Kit <http://www.ti.com/tool/MSP-EXP430F5529LP>`__
- `MSP-EXP432E401Y LaunchPad Evaluation Kit <https://www.ti.com/tool/MSP-EXP432E401Y>`__
- `TM4C123GXL LaunchPad Evaluation Kit <https://www.ti.com/tool/EK-TM4C123GXL>`__
Tomu
----
- `Fomu <https://www.crowdsupply.com/sutajio-kosagi/fomu>`__
WCH
---
- `CH32V307V-R1-1v0 <https://lcsc.com/product-detail/Development-Boards-Kits_WCH-Jiangsu-Qin-Heng-CH32V307V-EVT-R1_C2943980.html>`__
- `CH32F205R-R0-1v0 <https://github.com/openwch/ch32f20x/blob/main/EVT/PUB/CH32F20x%20Evaluation%20Board%20Reference-EN.pdf>`__

View File

@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 3.17) cmake_minimum_required(VERSION 3.20)
#set(CMAKE_EXPORT_COMPILE_COMMANDS ON) #set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
include(${CMAKE_CURRENT_SOURCE_DIR}/../hw/bsp/family_support.cmake) include(${CMAKE_CURRENT_SOURCE_DIR}/../hw/bsp/family_support.cmake)

View File

@ -0,0 +1,6 @@
{
"version": 6,
"include": [
"../hw/bsp/BoardPresets.json"
]
}

View File

@ -1,7 +1,7 @@
if (TOOLCHAIN STREQUAL "gcc") if (TOOLCHAIN STREQUAL "gcc")
set(TOOLCHAIN_COMMON_FLAGS set(TOOLCHAIN_COMMON_FLAGS
-mthumb -mthumb
-mcpu=cortex-m0plus -mcpu=cortex-m0
-mfloat-abi=soft -mfloat-abi=soft
) )
set(FREERTOS_PORT GCC_ARM_CM0 CACHE INTERNAL "") set(FREERTOS_PORT GCC_ARM_CM0 CACHE INTERNAL "")

View File

@ -0,0 +1,26 @@
if (TOOLCHAIN STREQUAL "gcc")
set(TOOLCHAIN_COMMON_FLAGS
-mthumb
-mcpu=cortex-m55
-mfloat-abi=hard
-mfpu=fpv5-d16
-mcmse
)
set(FREERTOS_PORT GCC_ARM_CM55_NTZ_NONSECURE CACHE INTERNAL "")
elseif (TOOLCHAIN STREQUAL "clang")
set(TOOLCHAIN_COMMON_FLAGS
--target=arm-none-eabi
-mcpu=cortex-m55
-mfpu=fpv5-d16
)
set(FREERTOS_PORT GCC_ARM_CM55_NTZ_NONSECURE CACHE INTERNAL "")
elseif (TOOLCHAIN STREQUAL "iar")
set(TOOLCHAIN_COMMON_FLAGS
--cpu cortex-m55
--fpu VFPv5_D16
)
set(FREERTOS_PORT IAR_ARM_CM55_NTZ_NONSECURE CACHE INTERNAL "")
endif ()

View File

@ -1,3 +1,7 @@
if (RTOS STREQUAL zephyr)
return()
endif ()
if (NOT DEFINED CMAKE_C_COMPILER) if (NOT DEFINED CMAKE_C_COMPILER)
set(CMAKE_C_COMPILER "arm-none-eabi-gcc") set(CMAKE_C_COMPILER "arm-none-eabi-gcc")
endif () endif ()

View File

@ -4,6 +4,7 @@ include(CMakePrintHelpers)
# Common # Common
# ---------------------------------------------------------------------------- # ----------------------------------------------------------------------------
set(CMAKE_SYSTEM_NAME Generic) set(CMAKE_SYSTEM_NAME Generic)
set(CMAKE_SYSTEM_PROCESSOR ${CMAKE_SYSTEM_CPU})
set_property(GLOBAL PROPERTY TARGET_SUPPORTS_SHARED_LIBS FALSE) set_property(GLOBAL PROPERTY TARGET_SUPPORTS_SHARED_LIBS FALSE)
# Look for includes and libraries only in the target system prefix. # Look for includes and libraries only in the target system prefix.
@ -13,8 +14,8 @@ set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY)
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
# pass TOOLCHAIN_CPU to # pass TOOLCHAIN_CPU to
set(CMAKE_TRY_COMPILE_PLATFORM_VARIABLES CMAKE_SYSTEM_PROCESSOR) set(CMAKE_TRY_COMPILE_PLATFORM_VARIABLES CMAKE_SYSTEM_PROCESSOR CMAKE_SYSTEM_CPU)
include(${CMAKE_CURRENT_LIST_DIR}/../cpu/${CMAKE_SYSTEM_PROCESSOR}.cmake) include(${CMAKE_CURRENT_LIST_DIR}/../cpu/${CMAKE_SYSTEM_CPU}.cmake)
# ---------------------------------------------------------------------------- # ----------------------------------------------------------------------------
# Compile flags # Compile flags

View File

@ -12,8 +12,8 @@ else ifeq ($(TOOLCHAIN),clang)
-mfpu=fpv4-sp-d16 \ -mfpu=fpv4-sp-d16 \
else ifeq ($(TOOLCHAIN),iar) else ifeq ($(TOOLCHAIN),iar)
CFLAGS += --cpu cortex-m4 --fpu VFPv4 CFLAGS += --cpu cortex-m4 --fpu VFPv4-SP
ASFLAGS += --cpu cortex-m4 --fpu VFPv4 ASFLAGS += --cpu cortex-m4 --fpu VFPv4-SP
else else
$(error "TOOLCHAIN is not supported") $(error "TOOLCHAIN is not supported")

View File

@ -0,0 +1,28 @@
ifeq ($(TOOLCHAIN),gcc)
CFLAGS += \
-mthumb \
-mcpu=cortex-m55 \
-mfloat-abi=hard \
-mfpu=fpv5-d16 \
-mcmse
else ifeq ($(TOOLCHAIN),clang)
CFLAGS += \
--target=arm-none-eabi \
-mcpu=cortex-m55 \
-mfpu=fpv5-d16 \
else ifeq ($(TOOLCHAIN),iar)
CFLAGS += \
--cpu cortex-m55 \
--fpu VFPv5_D16 \
ASFLAGS += \
--cpu cortex-m55 \
--fpu VFPv5_D16 \
else
$(error "TOOLCHAIN is not supported")
endif
FREERTOS_PORTABLE_SRC ?= $(FREERTOS_PORTABLE_PATH)/ARM_CM55_NTZ/non_secure

View File

@ -2,11 +2,13 @@
# Common make definition for all examples # Common make definition for all examples
# --------------------------------------- # ---------------------------------------
# upper helper function
to_upper = $(subst a,A,$(subst b,B,$(subst c,C,$(subst d,D,$(subst e,E,$(subst f,F,$(subst g,G,$(subst h,H,$(subst i,I,$(subst j,J,$(subst k,K,$(subst l,L,$(subst m,M,$(subst n,N,$(subst o,O,$(subst p,P,$(subst q,Q,$(subst r,R,$(subst s,S,$(subst t,T,$(subst u,U,$(subst v,V,$(subst w,W,$(subst x,X,$(subst y,Y,$(subst z,Z,$(subst -,_,$(1))))))))))))))))))))))))))))
#------------------------------------------------------------- #-------------------------------------------------------------
# Toolchain # Toolchain
# Can be changed via TOOLCHAIN=gcc|iar or CC=arm-none-eabi-gcc|iccarm|clang # Can be changed via TOOLCHAIN=gcc|iar or CC=arm-none-eabi-gcc|iccarm|clang
#------------------------------------------------------------- #-------------------------------------------------------------
ifneq (,$(findstring clang,$(CC))) ifneq (,$(findstring clang,$(CC)))
TOOLCHAIN = clang TOOLCHAIN = clang
else ifneq (,$(findstring iccarm,$(CC))) else ifneq (,$(findstring iccarm,$(CC)))
@ -65,7 +67,9 @@ BUILD := _build/$(BOARD)
PROJECT := $(notdir $(CURDIR)) PROJECT := $(notdir $(CURDIR))
BIN := $(TOP)/_bin/$(BOARD)/$(notdir $(CURDIR)) BIN := $(TOP)/_bin/$(BOARD)/$(notdir $(CURDIR))
#-------------- Select the board to build for. ------------ #-------------------------------------------------------------
# Board / Family
#-------------------------------------------------------------
# Board without family # Board without family
ifneq ($(wildcard $(TOP)/hw/bsp/$(BOARD)/board.mk),) ifneq ($(wildcard $(TOP)/hw/bsp/$(BOARD)/board.mk),)
@ -93,7 +97,9 @@ else
SRC_C += $(subst $(TOP)/,,$(wildcard $(TOP)/$(FAMILY_PATH)/*.c)) SRC_C += $(subst $(TOP)/,,$(wildcard $(TOP)/$(FAMILY_PATH)/*.c))
endif endif
#-------------- Source files and compiler flags -------------- #-------------------------------------------------------------
# Source files and compiler flags
#-------------------------------------------------------------
# tinyusb makefile # tinyusb makefile
include $(TOP)/src/tinyusb.mk include $(TOP)/src/tinyusb.mk
SRC_C += $(TINYUSB_SRC_C) SRC_C += $(TINYUSB_SRC_C)
@ -106,7 +112,7 @@ INC += \
$(TOP)/$(FAMILY_PATH) \ $(TOP)/$(FAMILY_PATH) \
$(TOP)/src \ $(TOP)/src \
BOARD_UPPER = $(subst a,A,$(subst b,B,$(subst c,C,$(subst d,D,$(subst e,E,$(subst f,F,$(subst g,G,$(subst h,H,$(subst i,I,$(subst j,J,$(subst k,K,$(subst l,L,$(subst m,M,$(subst n,N,$(subst o,O,$(subst p,P,$(subst q,Q,$(subst r,R,$(subst s,S,$(subst t,T,$(subst u,U,$(subst v,V,$(subst w,W,$(subst x,X,$(subst y,Y,$(subst z,Z,$(subst -,_,$(BOARD)))))))))))))))))))))))))))) BOARD_UPPER = $(call to_upper,$(BOARD))
CFLAGS += -DBOARD_$(BOARD_UPPER) CFLAGS += -DBOARD_$(BOARD_UPPER)
ifdef CFLAGS_CLI ifdef CFLAGS_CLI
@ -117,27 +123,24 @@ endif
ifeq (${MAX3421_HOST},1) ifeq (${MAX3421_HOST},1)
SRC_C += src/portable/analog/max3421/hcd_max3421.c SRC_C += src/portable/analog/max3421/hcd_max3421.c
CFLAGS += -DCFG_TUH_MAX3421=1 CFLAGS += -DCFG_TUH_MAX3421=1
CMAKE_DEFSYM += -DMAX3421_HOST=1
endif endif
# Log level is mapped to TUSB DEBUG option # Log level is mapped to TUSB DEBUG option
ifneq ($(LOG),) ifneq ($(LOG),)
CMAKE_DEFSYM += -DLOG=$(LOG)
CFLAGS += -DCFG_TUSB_DEBUG=$(LOG) CFLAGS += -DCFG_TUSB_DEBUG=$(LOG)
endif endif
# Logger: default is uart, can be set to rtt or swo # Logger: default is uart, can be set to rtt or swo
ifneq ($(LOGGER),)
CMAKE_DEFSYM += -DLOGGER=$(LOGGER)
endif
ifeq ($(LOGGER),rtt) ifeq ($(LOGGER),rtt)
CFLAGS += -DLOGGER_RTT -DSEGGER_RTT_MODE_DEFAULT=SEGGER_RTT_MODE_BLOCK_IF_FIFO_FULL CFLAGS += -DLOGGER_RTT
RTT_SRC = lib/SEGGER_RTT #CFLAGS += -DSEGGER_RTT_MODE_DEFAULT=SEGGER_RTT_MODE_BLOCK_IF_FIFO_FULL
INC += $(TOP)/$(RTT_SRC)/RTT INC += $(TOP)/$(lib/SEGGER_RTT)/RTT
SRC_C += $(RTT_SRC)/RTT/SEGGER_RTT.c SRC_C += $(lib/SEGGER_RTT)/RTT/SEGGER_RTT.c
else ifeq ($(LOGGER),swo) endif
ifeq ($(LOGGER),swo)
CFLAGS += -DLOGGER_SWO CFLAGS += -DLOGGER_SWO
else
CFLAGS += -DLOGGER_UART
endif endif
# CPU specific flags # CPU specific flags
@ -148,7 +151,37 @@ endif
# toolchain specific # toolchain specific
include ${TOP}/examples/build_system/make/toolchain/arm_$(TOOLCHAIN).mk include ${TOP}/examples/build_system/make/toolchain/arm_$(TOOLCHAIN).mk
# Handy check parameter function #---------------------- FreeRTOS -----------------------
FREERTOS_SRC = lib/FreeRTOS-Kernel
FREERTOS_PORTABLE_PATH = $(FREERTOS_SRC)/portable/$(if $(findstring iar,$(TOOLCHAIN)),IAR,GCC)
ifeq ($(RTOS),freertos)
SRC_C += \
$(FREERTOS_SRC)/list.c \
$(FREERTOS_SRC)/queue.c \
$(FREERTOS_SRC)/tasks.c \
$(FREERTOS_SRC)/timers.c \
$(subst $(TOP)/,,$(wildcard $(TOP)/$(FREERTOS_PORTABLE_SRC)/*.c))
SRC_S += $(subst $(TOP)/,,$(wildcard $(TOP)/$(FREERTOS_PORTABLE_SRC)/*.s))
INC += \
$(TOP)/hw/bsp/$(FAMILY)/FreeRTOSConfig \
$(TOP)/$(FREERTOS_SRC)/include \
$(TOP)/$(FREERTOS_PORTABLE_SRC)
CFLAGS += -DCFG_TUSB_OS=OPT_OS_FREERTOS
# Suppress FreeRTOSConfig.h warnings
CFLAGS_GCC += -Wno-error=redundant-decls
# Suppress FreeRTOS source warnings
CFLAGS_GCC += -Wno-error=cast-qual
# FreeRTOS (lto + Os) linker issue
LDFLAGS_GCC += -Wl,--undefined=vTaskSwitchContext
endif
#---------------- Helper ----------------
check_defined = \ check_defined = \
$(strip $(foreach 1,$1, \ $(strip $(foreach 1,$1, \
$(call __check_defined,$1,$(strip $(value 2))))) $(call __check_defined,$1,$(strip $(value 2)))))

View File

@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 3.17) cmake_minimum_required(VERSION 3.20)
include(${CMAKE_CURRENT_SOURCE_DIR}/../../hw/bsp/family_support.cmake) include(${CMAKE_CURRENT_SOURCE_DIR}/../../hw/bsp/family_support.cmake)

View File

@ -0,0 +1,6 @@
{
"version": 6,
"include": [
"../../hw/bsp/BoardPresets.json"
]
}

View File

@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 3.17) cmake_minimum_required(VERSION 3.20)
include(${CMAKE_CURRENT_SOURCE_DIR}/../../../hw/bsp/family_support.cmake) include(${CMAKE_CURRENT_SOURCE_DIR}/../../../hw/bsp/family_support.cmake)

View File

@ -0,0 +1,6 @@
{
"version": 6,
"include": [
"../../../hw/bsp/BoardPresets.json"
]
}

View File

@ -69,13 +69,8 @@ uint8_t clkValid;
audio_control_range_2_n_t(1) volumeRng[CFG_TUD_AUDIO_FUNC_1_N_CHANNELS_TX+1]; // Volume range state audio_control_range_2_n_t(1) volumeRng[CFG_TUD_AUDIO_FUNC_1_N_CHANNELS_TX+1]; // Volume range state
audio_control_range_4_n_t(1) sampleFreqRng; // Sample frequency range state audio_control_range_4_n_t(1) sampleFreqRng; // Sample frequency range state
#if CFG_TUD_AUDIO_ENABLE_ENCODING
// Audio test data, each buffer contains 2 channels, buffer[0] for CH0-1, buffer[1] for CH1-2
uint16_t i2s_dummy_buffer[CFG_TUD_AUDIO_FUNC_1_N_TX_SUPP_SW_FIFO][CFG_TUD_AUDIO_FUNC_1_N_CHANNELS_TX*CFG_TUD_AUDIO_FUNC_1_SAMPLE_RATE/1000/CFG_TUD_AUDIO_FUNC_1_N_TX_SUPP_SW_FIFO];
#else
// Audio test data, 4 channels muxed together, buffer[0] for CH0, buffer[1] for CH1, buffer[2] for CH2, buffer[3] for CH3 // Audio test data, 4 channels muxed together, buffer[0] for CH0, buffer[1] for CH1, buffer[2] for CH2, buffer[3] for CH3
uint16_t i2s_dummy_buffer[CFG_TUD_AUDIO_FUNC_1_N_CHANNELS_TX*CFG_TUD_AUDIO_FUNC_1_SAMPLE_RATE/1000]; uint16_t i2s_dummy_buffer[CFG_TUD_AUDIO_FUNC_1_N_CHANNELS_TX*CFG_TUD_AUDIO_FUNC_1_SAMPLE_RATE/1000];
#endif
void led_blinking_task(void); void led_blinking_task(void);
void audio_task(void); void audio_task(void);
@ -106,27 +101,6 @@ int main(void)
sampleFreqRng.subrange[0].bRes = 0; sampleFreqRng.subrange[0].bRes = 0;
// Generate dummy data // Generate dummy data
#if CFG_TUD_AUDIO_ENABLE_ENCODING
uint16_t * p_buff = i2s_dummy_buffer[0];
uint16_t dataVal = 0;
for (uint16_t cnt = 0; cnt < AUDIO_SAMPLE_RATE/1000; cnt++)
{
// CH0 saw wave
*p_buff++ = dataVal;
// CH1 inverted saw wave
*p_buff++ = 3200 + AUDIO_SAMPLE_RATE/1000 - dataVal;
dataVal+= 32;
}
p_buff = i2s_dummy_buffer[1];
for (uint16_t cnt = 0; cnt < AUDIO_SAMPLE_RATE/1000; cnt++)
{
// CH3 square wave
*p_buff++ = cnt < (AUDIO_SAMPLE_RATE/1000/2) ? 3400:5000;
// CH4 sinus wave
float t = 2*3.1415f * cnt / (AUDIO_SAMPLE_RATE/1000);
*p_buff++ = (uint16_t)((int16_t)(sinf(t) * 750) + 6000);
}
#else
uint16_t * p_buff = i2s_dummy_buffer; uint16_t * p_buff = i2s_dummy_buffer;
uint16_t dataVal = 0; uint16_t dataVal = 0;
for (uint16_t cnt = 0; cnt < AUDIO_SAMPLE_RATE/1000; cnt++) for (uint16_t cnt = 0; cnt < AUDIO_SAMPLE_RATE/1000; cnt++)
@ -142,7 +116,6 @@ int main(void)
float t = 2*3.1415f * cnt / (AUDIO_SAMPLE_RATE/1000); float t = 2*3.1415f * cnt / (AUDIO_SAMPLE_RATE/1000);
*p_buff++ = (uint16_t)((int16_t)(sinf(t) * 750) + 6000); *p_buff++ = (uint16_t)((int16_t)(sinf(t) * 750) + 6000);
} }
#endif
while (1) while (1)
{ {
@ -195,15 +168,7 @@ void audio_task(void)
uint32_t curr_ms = board_millis(); uint32_t curr_ms = board_millis();
if ( start_ms == curr_ms ) return; // not enough time if ( start_ms == curr_ms ) return; // not enough time
start_ms = curr_ms; start_ms = curr_ms;
#if CFG_TUD_AUDIO_ENABLE_ENCODING
// Write I2S buffer into FIFO
for (uint8_t cnt=0; cnt < 2; cnt++)
{
tud_audio_write_support_ff(cnt, i2s_dummy_buffer[cnt], AUDIO_SAMPLE_RATE/1000 * CFG_TUD_AUDIO_FUNC_1_N_BYTES_PER_SAMPLE_TX * CFG_TUD_AUDIO_FUNC_1_CHANNEL_PER_FIFO_TX);
}
#else
tud_audio_write(i2s_dummy_buffer, AUDIO_SAMPLE_RATE/1000 * CFG_TUD_AUDIO_FUNC_1_N_BYTES_PER_SAMPLE_TX * CFG_TUD_AUDIO_FUNC_1_N_CHANNELS_TX); tud_audio_write(i2s_dummy_buffer, AUDIO_SAMPLE_RATE/1000 * CFG_TUD_AUDIO_FUNC_1_N_BYTES_PER_SAMPLE_TX * CFG_TUD_AUDIO_FUNC_1_N_CHANNELS_TX);
#endif
} }
//--------------------------------------------------------------------+ //--------------------------------------------------------------------+

View File

@ -115,26 +115,11 @@ extern "C" {
#define CFG_TUD_AUDIO_FUNC_1_N_CHANNELS_TX 4 // This value is not required by the driver, it parses this information from the descriptor once the alternate interface is set by the host - we use it for the setup #define CFG_TUD_AUDIO_FUNC_1_N_CHANNELS_TX 4 // This value is not required by the driver, it parses this information from the descriptor once the alternate interface is set by the host - we use it for the setup
#define CFG_TUD_AUDIO_EP_SZ_IN TUD_AUDIO_EP_SIZE(CFG_TUD_AUDIO_FUNC_1_SAMPLE_RATE, CFG_TUD_AUDIO_FUNC_1_N_BYTES_PER_SAMPLE_TX, CFG_TUD_AUDIO_FUNC_1_N_CHANNELS_TX) #define CFG_TUD_AUDIO_EP_SZ_IN TUD_AUDIO_EP_SIZE(CFG_TUD_AUDIO_FUNC_1_SAMPLE_RATE, CFG_TUD_AUDIO_FUNC_1_N_BYTES_PER_SAMPLE_TX, CFG_TUD_AUDIO_FUNC_1_N_CHANNELS_TX)
#define CFG_TUD_AUDIO_ENABLE_ENCODING 1
#define CFG_TUD_AUDIO_EP_IN_FLOW_CONTROL 1 #define CFG_TUD_AUDIO_EP_IN_FLOW_CONTROL 1
#if CFG_TUD_AUDIO_ENABLE_ENCODING
#define CFG_TUD_AUDIO_FUNC_1_EP_IN_SZ_MAX CFG_TUD_AUDIO_EP_SZ_IN
#define CFG_TUD_AUDIO_FUNC_1_EP_IN_SW_BUF_SZ CFG_TUD_AUDIO_EP_SZ_IN
#define CFG_TUD_AUDIO_ENABLE_TYPE_I_ENCODING 1
#define CFG_TUD_AUDIO_FUNC_1_CHANNEL_PER_FIFO_TX 2 // One I2S stream contains two channels, each stream is saved within one support FIFO - this value is currently fixed, the driver does not support a changing value
#define CFG_TUD_AUDIO_FUNC_1_N_TX_SUPP_SW_FIFO (CFG_TUD_AUDIO_FUNC_1_N_CHANNELS_TX / CFG_TUD_AUDIO_FUNC_1_CHANNEL_PER_FIFO_TX)
#define CFG_TUD_AUDIO_FUNC_1_TX_SUPP_SW_FIFO_SZ (TUD_OPT_HIGH_SPEED ? 32 : 4) * (CFG_TUD_AUDIO_EP_SZ_IN / CFG_TUD_AUDIO_FUNC_1_N_TX_SUPP_SW_FIFO) // Example write FIFO every 1ms, so it should be 8 times larger for HS device
#else
#define CFG_TUD_AUDIO_FUNC_1_EP_IN_SZ_MAX CFG_TUD_AUDIO_EP_SZ_IN #define CFG_TUD_AUDIO_FUNC_1_EP_IN_SZ_MAX CFG_TUD_AUDIO_EP_SZ_IN
#define CFG_TUD_AUDIO_FUNC_1_EP_IN_SW_BUF_SZ (TUD_OPT_HIGH_SPEED ? 32 : 4) * CFG_TUD_AUDIO_EP_SZ_IN // Example write FIFO every 1ms, so it should be 8 times larger for HS device #define CFG_TUD_AUDIO_FUNC_1_EP_IN_SW_BUF_SZ (TUD_OPT_HIGH_SPEED ? 32 : 4) * CFG_TUD_AUDIO_EP_SZ_IN // Example write FIFO every 1ms, so it should be 8 times larger for HS device
#endif
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif

View File

@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 3.17) cmake_minimum_required(VERSION 3.20)
include(${CMAKE_CURRENT_SOURCE_DIR}/../../../hw/bsp/family_support.cmake) include(${CMAKE_CURRENT_SOURCE_DIR}/../../../hw/bsp/family_support.cmake)

View File

@ -0,0 +1,6 @@
{
"version": 6,
"include": [
"../../../hw/bsp/BoardPresets.json"
]
}

View File

@ -1,14 +1,9 @@
RTOS = freertos
include ../../build_system/make/make.mk include ../../build_system/make/make.mk
FREERTOS_SRC = lib/FreeRTOS-Kernel
FREERTOS_PORTABLE_PATH = $(FREERTOS_SRC)/portable/$(if $(findstring iar,$(TOOLCHAIN)),IAR,GCC)
INC += \ INC += \
src \ src \
src/FreeRTOSConfig \
$(TOP)/hw \ $(TOP)/hw \
$(TOP)/$(FREERTOS_SRC)/include \
$(TOP)/$(FREERTOS_PORTABLE_SRC) \
# Example source # Example source
EXAMPLE_SOURCE = \ EXAMPLE_SOURCE = \
@ -17,21 +12,4 @@ EXAMPLE_SOURCE = \
SRC_C += $(addprefix $(CURRENT_PATH)/, $(EXAMPLE_SOURCE)) 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 $(TOP)/,,$(wildcard $(TOP)/$(FREERTOS_PORTABLE_SRC)/*.c))
SRC_S += \
$(subst $(TOP)/,,$(wildcard $(TOP)/$(FREERTOS_PORTABLE_SRC)/*.s))
# Suppress FreeRTOS warnings
CFLAGS += -Wno-error=cast-qual -Wno-error=redundant-decls
# FreeRTOS (lto + Os) linker issue
LDFLAGS += -Wl,--undefined=vTaskSwitchContext
include ../../build_system/make/rules.mk include ../../build_system/make/rules.mk

View File

@ -1,191 +0,0 @@
/*
* 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.
*----------------------------------------------------------*/
// skip if included from IAR assembler
#ifndef __IASMARM__
// Include MCU header
#include "bsp/board_mcu.h"
#if TUSB_MCU_VENDOR_ESPRESSIF
#error "ESP32-Sx should use IDF's FreeRTOSConfig.h"
#endif
// TODO fix later
#if CFG_TUSB_MCU == OPT_MCU_MM32F327X
extern u32 SystemCoreClock;
#else
// FIXME cause redundant-decls warnings
extern uint32_t SystemCoreClock;
#endif
#endif
/* Cortex M23/M33 port configuration. */
#define configENABLE_MPU 0
#define configENABLE_FPU 1
#define configENABLE_TRUSTZONE 0
#define configMINIMAL_SECURE_STACK_SIZE ( 1024 )
#define configRUN_FREERTOS_SECURE_ONLY 1
#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 ( configSUPPORT_DYNAMIC_ALLOCATION*4*1024 )
#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 4
#define configUSE_QUEUE_SETS 0
#define configUSE_TIME_SLICING 0
#define configUSE_NEWLIB_REENTRANT 0
#define configENABLE_BACKWARD_COMPATIBILITY 1
#define configSTACK_ALLOCATION_FROM_SEPARATE_HEAP 0
#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
#define configCHECK_HANDLER_INSTALLATION 0
/* 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
#ifdef __RX__
/* Renesas RX series */
#define vSoftwareInterruptISR INT_Excep_ICU_SWINT
#define vTickISR INT_Excep_CMT0_CMI0
#define configPERIPHERAL_CLOCK_HZ (configCPU_CLOCK_HZ/2)
#define configKERNEL_INTERRUPT_PRIORITY 1
#define configMAX_SYSCALL_INTERRUPT_PRIORITY 4
#else
/* FreeRTOS hooks to NVIC vectors */
#define xPortPendSVHandler PendSV_Handler
#define xPortSysTickHandler SysTick_Handler
#define vPortSVCHandler SVC_Handler
//--------------------------------------------------------------------+
// Interrupt nesting behavior configuration.
//--------------------------------------------------------------------+
#if defined(__NVIC_PRIO_BITS)
// For Cortex-M specific: __NVIC_PRIO_BITS is defined in core_cmx.h
#define configPRIO_BITS __NVIC_PRIO_BITS
#elif defined(__ECLIC_INTCTLBITS)
// RISC-V Bumblebee core from nuclei
#define configPRIO_BITS __ECLIC_INTCTLBITS
#elif defined(__IASMARM__)
// FIXME: IAR Assembler cannot include mcu header directly to get __NVIC_PRIO_BITS.
// Therefore we will hard coded it to minimum value of 2 to get pass ci build.
// IAR user must update this to correct value of the target MCU
#message "configPRIO_BITS is hard coded to 2 to pass IAR build only. User should update it per MCU"
#define configPRIO_BITS 2
#else
#error "FreeRTOS configPRIO_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
#endif /* __FREERTOS_CONFIG__H */

View File

@ -39,7 +39,7 @@
#include "bsp/board_api.h" #include "bsp/board_api.h"
#include "tusb.h" #include "tusb.h"
#if TUSB_MCU_VENDOR_ESPRESSIF #ifdef ESP_PLATFORM
// ESP-IDF need "freertos/" prefix in include path. // ESP-IDF need "freertos/" prefix in include path.
// CFG_TUSB_OS_INC_PATH should be defined accordingly. // CFG_TUSB_OS_INC_PATH should be defined accordingly.
#include "freertos/FreeRTOS.h" #include "freertos/FreeRTOS.h"
@ -105,13 +105,8 @@ uint8_t clkValid;
audio_control_range_2_n_t(1) volumeRng[CFG_TUD_AUDIO_FUNC_1_N_CHANNELS_TX+1]; // Volume range state audio_control_range_2_n_t(1) volumeRng[CFG_TUD_AUDIO_FUNC_1_N_CHANNELS_TX+1]; // Volume range state
audio_control_range_4_n_t(1) sampleFreqRng; // Sample frequency range state audio_control_range_4_n_t(1) sampleFreqRng; // Sample frequency range state
#if CFG_TUD_AUDIO_ENABLE_ENCODING
// Audio test data, each buffer contains 2 channels, buffer[0] for CH0-1, buffer[1] for CH1-2
uint16_t i2s_dummy_buffer[CFG_TUD_AUDIO_FUNC_1_N_TX_SUPP_SW_FIFO][CFG_TUD_AUDIO_FUNC_1_N_CHANNELS_TX*CFG_TUD_AUDIO_FUNC_1_SAMPLE_RATE/1000/CFG_TUD_AUDIO_FUNC_1_N_TX_SUPP_SW_FIFO];
#else
// Audio test data, 4 channels muxed together, buffer[0] for CH0, buffer[1] for CH1, buffer[2] for CH2, buffer[3] for CH3 // Audio test data, 4 channels muxed together, buffer[0] for CH0, buffer[1] for CH1, buffer[2] for CH2, buffer[3] for CH3
uint16_t i2s_dummy_buffer[CFG_TUD_AUDIO_FUNC_1_N_CHANNELS_TX*CFG_TUD_AUDIO_FUNC_1_SAMPLE_RATE/1000]; uint16_t i2s_dummy_buffer[CFG_TUD_AUDIO_FUNC_1_N_CHANNELS_TX*CFG_TUD_AUDIO_FUNC_1_SAMPLE_RATE/1000];
#endif
void led_blinking_task(void* param); void led_blinking_task(void* param);
void usb_device_task(void* param); void usb_device_task(void* param);
@ -132,27 +127,6 @@ int main(void)
sampleFreqRng.subrange[0].bRes = 0; sampleFreqRng.subrange[0].bRes = 0;
// Generate dummy data // Generate dummy data
#if CFG_TUD_AUDIO_ENABLE_ENCODING
uint16_t * p_buff = i2s_dummy_buffer[0];
uint16_t dataVal = 0;
for (uint16_t cnt = 0; cnt < AUDIO_SAMPLE_RATE/1000; cnt++)
{
// CH0 saw wave
*p_buff++ = dataVal;
// CH1 inverted saw wave
*p_buff++ = 3200 + AUDIO_SAMPLE_RATE/1000 - dataVal;
dataVal+= 32;
}
p_buff = i2s_dummy_buffer[1];
for (uint16_t cnt = 0; cnt < AUDIO_SAMPLE_RATE/1000; cnt++)
{
// CH3 square wave
*p_buff++ = cnt < (AUDIO_SAMPLE_RATE/1000/2) ? 3400:5000;
// CH4 sinus wave
float t = 2*3.1415f * cnt / (AUDIO_SAMPLE_RATE/1000);
*p_buff++ = (uint16_t)((int16_t)(sinf(t) * 750) + 6000);
}
#else
uint16_t * p_buff = i2s_dummy_buffer; uint16_t * p_buff = i2s_dummy_buffer;
uint16_t dataVal = 0; uint16_t dataVal = 0;
for (uint16_t cnt = 0; cnt < AUDIO_SAMPLE_RATE/1000; cnt++) for (uint16_t cnt = 0; cnt < AUDIO_SAMPLE_RATE/1000; cnt++)
@ -168,7 +142,6 @@ int main(void)
float t = 2*3.1415f * cnt / (AUDIO_SAMPLE_RATE/1000); float t = 2*3.1415f * cnt / (AUDIO_SAMPLE_RATE/1000);
*p_buff++ = (uint16_t)((int16_t)(sinf(t) * 750) + 6000); *p_buff++ = (uint16_t)((int16_t)(sinf(t) * 750) + 6000);
} }
#endif
#if configSUPPORT_STATIC_ALLOCATION #if configSUPPORT_STATIC_ALLOCATION
// blinky task // blinky task
@ -185,17 +158,16 @@ int main(void)
xTaskCreate(audio_task, "audio", AUDIO_STACK_SIZE, NULL, configMAX_PRIORITIES - 1, NULL); xTaskCreate(audio_task, "audio", AUDIO_STACK_SIZE, NULL, configMAX_PRIORITIES - 1, NULL);
#endif #endif
// skip starting scheduler (and return) for ESP32-S2 or ESP32-S3 // only start scheduler for non-espressif mcu
#if !TUSB_MCU_VENDOR_ESPRESSIF #ifndef ESP_PLATFORM
vTaskStartScheduler(); vTaskStartScheduler();
#endif #endif
return 0; return 0;
} }
#if TUSB_MCU_VENDOR_ESPRESSIF #ifdef ESP_PLATFORM
void app_main(void) void app_main(void) {
{
main(); main();
} }
#endif #endif
@ -269,15 +241,7 @@ void audio_task(void* param)
// Here we simulate a I2S receive callback every 1ms. // Here we simulate a I2S receive callback every 1ms.
while (1) { while (1) {
vTaskDelay(1); vTaskDelay(1);
#if CFG_TUD_AUDIO_ENABLE_ENCODING
// Write I2S buffer into FIFO
for (uint8_t cnt=0; cnt < 2; cnt++)
{
tud_audio_write_support_ff(cnt, i2s_dummy_buffer[cnt], AUDIO_SAMPLE_RATE/1000 * CFG_TUD_AUDIO_FUNC_1_N_BYTES_PER_SAMPLE_TX * CFG_TUD_AUDIO_FUNC_1_CHANNEL_PER_FIFO_TX);
}
#else
tud_audio_write(i2s_dummy_buffer, AUDIO_SAMPLE_RATE/1000 * CFG_TUD_AUDIO_FUNC_1_N_BYTES_PER_SAMPLE_TX * CFG_TUD_AUDIO_FUNC_1_N_CHANNELS_TX); tud_audio_write(i2s_dummy_buffer, AUDIO_SAMPLE_RATE/1000 * CFG_TUD_AUDIO_FUNC_1_N_BYTES_PER_SAMPLE_TX * CFG_TUD_AUDIO_FUNC_1_N_CHANNELS_TX);
#endif
} }
} }

View File

@ -59,7 +59,7 @@ extern "C" {
#endif #endif
// Espressif IDF requires "freertos/" prefix in include path // Espressif IDF requires "freertos/" prefix in include path
#if TUSB_MCU_VENDOR_ESPRESSIF #ifdef ESP_PLATFORM
#define CFG_TUSB_OS_INC_PATH freertos/ #define CFG_TUSB_OS_INC_PATH freertos/
#endif #endif
@ -121,26 +121,11 @@ extern "C" {
#define CFG_TUD_AUDIO_FUNC_1_N_CHANNELS_TX 4 // This value is not required by the driver, it parses this information from the descriptor once the alternate interface is set by the host - we use it for the setup #define CFG_TUD_AUDIO_FUNC_1_N_CHANNELS_TX 4 // This value is not required by the driver, it parses this information from the descriptor once the alternate interface is set by the host - we use it for the setup
#define CFG_TUD_AUDIO_EP_SZ_IN TUD_AUDIO_EP_SIZE(CFG_TUD_AUDIO_FUNC_1_SAMPLE_RATE, CFG_TUD_AUDIO_FUNC_1_N_BYTES_PER_SAMPLE_TX, CFG_TUD_AUDIO_FUNC_1_N_CHANNELS_TX) #define CFG_TUD_AUDIO_EP_SZ_IN TUD_AUDIO_EP_SIZE(CFG_TUD_AUDIO_FUNC_1_SAMPLE_RATE, CFG_TUD_AUDIO_FUNC_1_N_BYTES_PER_SAMPLE_TX, CFG_TUD_AUDIO_FUNC_1_N_CHANNELS_TX)
#define CFG_TUD_AUDIO_ENABLE_ENCODING 1
#define CFG_TUD_AUDIO_EP_IN_FLOW_CONTROL 1 #define CFG_TUD_AUDIO_EP_IN_FLOW_CONTROL 1
#if CFG_TUD_AUDIO_ENABLE_ENCODING
#define CFG_TUD_AUDIO_FUNC_1_EP_IN_SZ_MAX CFG_TUD_AUDIO_EP_SZ_IN
#define CFG_TUD_AUDIO_FUNC_1_EP_IN_SW_BUF_SZ CFG_TUD_AUDIO_EP_SZ_IN
#define CFG_TUD_AUDIO_ENABLE_TYPE_I_ENCODING 1
#define CFG_TUD_AUDIO_FUNC_1_CHANNEL_PER_FIFO_TX 2 // One I2S stream contains two channels, each stream is saved within one support FIFO - this value is currently fixed, the driver does not support a changing value
#define CFG_TUD_AUDIO_FUNC_1_N_TX_SUPP_SW_FIFO (CFG_TUD_AUDIO_FUNC_1_N_CHANNELS_TX / CFG_TUD_AUDIO_FUNC_1_CHANNEL_PER_FIFO_TX)
#define CFG_TUD_AUDIO_FUNC_1_TX_SUPP_SW_FIFO_SZ (TUD_OPT_HIGH_SPEED ? 32 : 4) * (CFG_TUD_AUDIO_EP_SZ_IN / CFG_TUD_AUDIO_FUNC_1_N_TX_SUPP_SW_FIFO) // Example write FIFO every 1ms, so it should be 8 times larger for HS device
#else
#define CFG_TUD_AUDIO_FUNC_1_EP_IN_SZ_MAX CFG_TUD_AUDIO_EP_SZ_IN #define CFG_TUD_AUDIO_FUNC_1_EP_IN_SZ_MAX CFG_TUD_AUDIO_EP_SZ_IN
#define CFG_TUD_AUDIO_FUNC_1_EP_IN_SW_BUF_SZ (TUD_OPT_HIGH_SPEED ? 32 : 4) * CFG_TUD_AUDIO_EP_SZ_IN // Example write FIFO every 1ms, so it should be 8 times larger for HS device #define CFG_TUD_AUDIO_FUNC_1_EP_IN_SW_BUF_SZ (TUD_OPT_HIGH_SPEED ? 32 : 4) * CFG_TUD_AUDIO_EP_SZ_IN // Example write FIFO every 1ms, so it should be 8 times larger for HS device
#endif
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif

View File

@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 3.17) cmake_minimum_required(VERSION 3.20)
include(${CMAKE_CURRENT_SOURCE_DIR}/../../../hw/bsp/family_support.cmake) include(${CMAKE_CURRENT_SOURCE_DIR}/../../../hw/bsp/family_support.cmake)

View File

@ -0,0 +1,6 @@
{
"version": 6,
"include": [
"../../../hw/bsp/BoardPresets.json"
]
}

View File

@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 3.17) cmake_minimum_required(VERSION 3.20)
include(${CMAKE_CURRENT_SOURCE_DIR}/../../../hw/bsp/family_support.cmake) include(${CMAKE_CURRENT_SOURCE_DIR}/../../../hw/bsp/family_support.cmake)

View File

@ -0,0 +1,6 @@
{
"version": 6,
"include": [
"../../../hw/bsp/BoardPresets.json"
]
}

View File

@ -1,14 +1,9 @@
RTOS = freertos
include ../../build_system/make/make.mk include ../../build_system/make/make.mk
FREERTOS_SRC = lib/FreeRTOS-Kernel
FREERTOS_PORTABLE_PATH = $(FREERTOS_SRC)/portable/$(if $(findstring iar,$(TOOLCHAIN)),IAR,GCC)
INC += \ INC += \
src \ src \
src/FreeRTOSConfig \
$(TOP)/hw \ $(TOP)/hw \
$(TOP)/$(FREERTOS_SRC)/include \
$(TOP)/$(FREERTOS_PORTABLE_SRC) \
# Example source # Example source
EXAMPLE_SOURCE = \ EXAMPLE_SOURCE = \
@ -17,21 +12,4 @@ EXAMPLE_SOURCE = \
SRC_C += $(addprefix $(CURRENT_PATH)/, $(EXAMPLE_SOURCE)) 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 $(TOP)/,,$(wildcard $(TOP)/$(FREERTOS_PORTABLE_SRC)/*.c))
SRC_S += \
$(subst $(TOP)/,,$(wildcard $(TOP)/$(FREERTOS_PORTABLE_SRC)/*.s))
# Suppress FreeRTOS warnings
CFLAGS += -Wno-error=cast-qual -Wno-error=redundant-decls
# FreeRTOS (lto + Os) linker issue
LDFLAGS += -Wl,--undefined=vTaskSwitchContext
include ../../build_system/make/rules.mk include ../../build_system/make/rules.mk

View File

@ -1,191 +0,0 @@
/*
* 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.
*----------------------------------------------------------*/
// skip if included from IAR assembler
#ifndef __IASMARM__
// Include MCU header
#include "bsp/board_mcu.h"
#if TUSB_MCU_VENDOR_ESPRESSIF
#error "ESP32-Sx should use IDF's FreeRTOSConfig.h"
#endif
// TODO fix later
#if CFG_TUSB_MCU == OPT_MCU_MM32F327X
extern u32 SystemCoreClock;
#else
// FIXME cause redundant-decls warnings
extern uint32_t SystemCoreClock;
#endif
#endif
/* Cortex M23/M33 port configuration. */
#define configENABLE_MPU 0
#define configENABLE_FPU 1
#define configENABLE_TRUSTZONE 0
#define configMINIMAL_SECURE_STACK_SIZE ( 1024 )
#define configRUN_FREERTOS_SECURE_ONLY 1
#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 ( configSUPPORT_DYNAMIC_ALLOCATION*4*1024 )
#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 4
#define configUSE_QUEUE_SETS 0
#define configUSE_TIME_SLICING 0
#define configUSE_NEWLIB_REENTRANT 0
#define configENABLE_BACKWARD_COMPATIBILITY 1
#define configSTACK_ALLOCATION_FROM_SEPARATE_HEAP 0
#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
#define configCHECK_HANDLER_INSTALLATION 0
/* 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
#ifdef __RX__
/* Renesas RX series */
#define vSoftwareInterruptISR INT_Excep_ICU_SWINT
#define vTickISR INT_Excep_CMT0_CMI0
#define configPERIPHERAL_CLOCK_HZ (configCPU_CLOCK_HZ/2)
#define configKERNEL_INTERRUPT_PRIORITY 1
#define configMAX_SYSCALL_INTERRUPT_PRIORITY 4
#else
/* FreeRTOS hooks to NVIC vectors */
#define xPortPendSVHandler PendSV_Handler
#define xPortSysTickHandler SysTick_Handler
#define vPortSVCHandler SVC_Handler
//--------------------------------------------------------------------+
// Interrupt nesting behavior configuration.
//--------------------------------------------------------------------+
#if defined(__NVIC_PRIO_BITS)
// For Cortex-M specific: __NVIC_PRIO_BITS is defined in core_cmx.h
#define configPRIO_BITS __NVIC_PRIO_BITS
#elif defined(__ECLIC_INTCTLBITS)
// RISC-V Bumblebee core from nuclei
#define configPRIO_BITS __ECLIC_INTCTLBITS
#elif defined(__IASMARM__)
// FIXME: IAR Assembler cannot include mcu header directly to get __NVIC_PRIO_BITS.
// Therefore we will hard coded it to minimum value of 2 to get pass ci build.
// IAR user must update this to correct value of the target MCU
#message "configPRIO_BITS is hard coded to 2 to pass IAR build only. User should update it per MCU"
#define configPRIO_BITS 2
#else
#error "FreeRTOS configPRIO_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
#endif /* __FREERTOS_CONFIG__H */

View File

@ -38,7 +38,7 @@
#include "bsp/board_api.h" #include "bsp/board_api.h"
#include "tusb.h" #include "tusb.h"
#if TUSB_MCU_VENDOR_ESPRESSIF #ifdef ESP_PLATFORM
// ESP-IDF need "freertos/" prefix in include path. // ESP-IDF need "freertos/" prefix in include path.
// CFG_TUSB_OS_INC_PATH should be defined accordingly. // CFG_TUSB_OS_INC_PATH should be defined accordingly.
#include "freertos/FreeRTOS.h" #include "freertos/FreeRTOS.h"
@ -132,15 +132,15 @@ int main(void)
xTaskCreate(usb_device_task, "usbd", USBD_STACK_SIZE, NULL, configMAX_PRIORITIES - 1, NULL); xTaskCreate(usb_device_task, "usbd", USBD_STACK_SIZE, NULL, configMAX_PRIORITIES - 1, NULL);
#endif #endif
// skip starting scheduler (and return) for ESP32-S2 or ESP32-S3 // only start scheduler for non-espressif mcu
#if !TUSB_MCU_VENDOR_ESPRESSIF #ifndef ESP_PLATFORM
vTaskStartScheduler(); vTaskStartScheduler();
#endif #endif
return 0; return 0;
} }
#if TUSB_MCU_VENDOR_ESPRESSIF #ifdef ESP_PLATFORM
void app_main(void) { void app_main(void) {
main(); main();
} }

View File

@ -59,7 +59,7 @@ extern "C" {
#endif #endif
// Espressif IDF requires "freertos/" prefix in include path // Espressif IDF requires "freertos/" prefix in include path
#if TUSB_MCU_VENDOR_ESPRESSIF #ifdef ESP_PLATFORM
#define CFG_TUSB_OS_INC_PATH freertos/ #define CFG_TUSB_OS_INC_PATH freertos/
#endif #endif

View File

@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 3.17) cmake_minimum_required(VERSION 3.20)
include(${CMAKE_CURRENT_SOURCE_DIR}/../../../hw/bsp/family_support.cmake) include(${CMAKE_CURRENT_SOURCE_DIR}/../../../hw/bsp/family_support.cmake)

View File

@ -0,0 +1,6 @@
{
"version": 6,
"include": [
"../../../hw/bsp/BoardPresets.json"
]
}

View File

@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 3.17) cmake_minimum_required(VERSION 3.20)
include(${CMAKE_CURRENT_SOURCE_DIR}/../../../hw/bsp/family_support.cmake) include(${CMAKE_CURRENT_SOURCE_DIR}/../../../hw/bsp/family_support.cmake)
@ -15,18 +15,23 @@ if(FAMILY STREQUAL "espressif")
return() return()
endif() endif()
add_executable(${PROJECT}) if (RTOS STREQUAL zephyr)
set(EXE_NAME app)
else()
set(EXE_NAME ${PROJECT})
add_executable(${EXE_NAME})
endif()
# Example source # Example source
target_sources(${PROJECT} PUBLIC target_sources(${EXE_NAME} PRIVATE
${CMAKE_CURRENT_SOURCE_DIR}/src/main.c ${CMAKE_CURRENT_SOURCE_DIR}/src/main.c
) )
# Example include # Example include
target_include_directories(${PROJECT} PUBLIC target_include_directories(${EXE_NAME} PUBLIC
${CMAKE_CURRENT_SOURCE_DIR}/src ${CMAKE_CURRENT_SOURCE_DIR}/src
) )
# Configure compilation flags and libraries for the example without RTOS. # Configure compilation flags and libraries for the example without RTOS.
# See the corresponding function in hw/bsp/FAMILY/family.cmake for details. # See the corresponding function in hw/bsp/FAMILY/family.cmake for details.
family_configure_device_example(${PROJECT} noos) family_configure_device_example(${EXE_NAME} ${RTOS})

View File

@ -0,0 +1,6 @@
{
"version": 6,
"include": [
"../../../hw/bsp/BoardPresets.json"
]
}

View File

@ -49,25 +49,34 @@ int main(void) {
while (1) { while (1) {
uint32_t interval_ms = board_button_read() ? BLINK_PRESSED : BLINK_UNPRESSED; uint32_t interval_ms = board_button_read() ? BLINK_PRESSED : BLINK_UNPRESSED;
int ch = board_getchar();
if (ch > 0) {
board_putchar(ch);
#ifndef LOGGER_UART
board_uart_write(&ch, 1);
#endif
}
// Blink and print every interval ms // Blink and print every interval ms
if (!(board_millis() - start_ms < interval_ms)) { if (!(board_millis() - start_ms < interval_ms)) {
board_uart_write(HELLO_STR, strlen(HELLO_STR));
start_ms = board_millis(); start_ms = board_millis();
if (ch < 0) {
// skip if echoing
printf(HELLO_STR);
#ifndef LOGGER_UART
board_uart_write(HELLO_STR, strlen(HELLO_STR));
#endif
}
board_led_write(led_state); board_led_write(led_state);
led_state = 1 - led_state; // toggle led_state = 1 - led_state; // toggle
} }
// echo
uint8_t ch;
if (board_uart_read(&ch, 1) > 0) {
board_uart_write(&ch, 1);
}
} }
} }
#if TUSB_MCU_VENDOR_ESPRESSIF #ifdef ESP_PLATFORM
void app_main(void) { void app_main(void) {
main(); main();
} }

View File

@ -44,7 +44,7 @@
#endif #endif
// Espressif IDF requires "freertos/" prefix in include path // Espressif IDF requires "freertos/" prefix in include path
#if TUSB_MCU_VENDOR_ESPRESSIF #ifdef ESP_PLATFORM
#define CFG_TUSB_OS_INC_PATH freertos/ #define CFG_TUSB_OS_INC_PATH freertos/
#endif #endif

View File

@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 3.17) cmake_minimum_required(VERSION 3.20)
include(${CMAKE_CURRENT_SOURCE_DIR}/../../../hw/bsp/family_support.cmake) include(${CMAKE_CURRENT_SOURCE_DIR}/../../../hw/bsp/family_support.cmake)

View File

@ -0,0 +1,6 @@
{
"version": 6,
"include": [
"../../../hw/bsp/BoardPresets.json"
]
}

View File

@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 3.17) cmake_minimum_required(VERSION 3.20)
#set_property(GLOBAL PROPERTY USE_FOLDERS ON) #set_property(GLOBAL PROPERTY USE_FOLDERS ON)
include(${CMAKE_CURRENT_SOURCE_DIR}/../../../hw/bsp/family_support.cmake) include(${CMAKE_CURRENT_SOURCE_DIR}/../../../hw/bsp/family_support.cmake)
@ -16,20 +16,25 @@ if(FAMILY STREQUAL "espressif")
return() return()
endif() endif()
add_executable(${PROJECT}) if (RTOS STREQUAL zephyr)
set(EXE_NAME app)
else()
set(EXE_NAME ${PROJECT})
add_executable(${EXE_NAME})
endif()
# Example source # Example source
target_sources(${PROJECT} PUBLIC target_sources(${EXE_NAME} PRIVATE
${CMAKE_CURRENT_SOURCE_DIR}/src/main.c ${CMAKE_CURRENT_SOURCE_DIR}/src/main.c
${CMAKE_CURRENT_SOURCE_DIR}/src/msc_disk.c ${CMAKE_CURRENT_SOURCE_DIR}/src/msc_disk.c
${CMAKE_CURRENT_SOURCE_DIR}/src/usb_descriptors.c ${CMAKE_CURRENT_SOURCE_DIR}/src/usb_descriptors.c
) )
# Example include # Example include
target_include_directories(${PROJECT} PUBLIC target_include_directories(${EXE_NAME} PUBLIC
${CMAKE_CURRENT_SOURCE_DIR}/src ${CMAKE_CURRENT_SOURCE_DIR}/src
) )
# Configure compilation flags and libraries for the example... see the corresponding function # Configure compilation flags and libraries for the example without RTOS.
# in hw/bsp/FAMILY/family.cmake for details. # See the corresponding function in hw/bsp/FAMILY/family.cmake for details.
family_configure_device_example(${PROJECT} noos) family_configure_device_example(${EXE_NAME} ${RTOS})

View File

@ -0,0 +1,6 @@
{
"version": 6,
"include": [
"../../../hw/bsp/BoardPresets.json"
]
}

View File

@ -0,0 +1,6 @@
CONFIG_GPIO=y
CONFIG_FPU=y
CONFIG_NO_OPTIMIZATIONS=y
CONFIG_UART_INTERRUPT_DRIVEN=y
CONFIG_NRFX_POWER=y
CONFIG_NRFX_UARTE0=y

View File

@ -40,17 +40,15 @@ static bool ejected = false;
If you find any bugs or get any questions, feel free to file an\r\n\ If you find any bugs or get any questions, feel free to file an\r\n\
issue at github.com/hathach/tinyusb" issue at github.com/hathach/tinyusb"
enum enum {
{ DISK_BLOCK_NUM = 16,// 8KB is the smallest size that windows allow to mount
DISK_BLOCK_NUM = 16, // 8KB is the smallest size that windows allow to mount
DISK_BLOCK_SIZE = 512 DISK_BLOCK_SIZE = 512
}; };
#ifdef CFG_EXAMPLE_MSC_READONLY #ifdef CFG_EXAMPLE_MSC_READONLY
const const
#endif #endif
uint8_t msc_disk[DISK_BLOCK_NUM][DISK_BLOCK_SIZE] = uint8_t msc_disk[DISK_BLOCK_NUM][DISK_BLOCK_SIZE] = {
{
//------------- Block0: Boot Sector -------------// //------------- Block0: Boot Sector -------------//
// byte_per_sector = DISK_BLOCK_SIZE; fat12_sector_num_16 = DISK_BLOCK_NUM; // byte_per_sector = DISK_BLOCK_SIZE; fat12_sector_num_16 = DISK_BLOCK_NUM;
// sector_per_cluster = 1; reserved_sectors = 1; // sector_per_cluster = 1; reserved_sectors = 1;
@ -59,60 +57,59 @@ uint8_t msc_disk[DISK_BLOCK_NUM][DISK_BLOCK_SIZE] =
// drive_number = 0x80; media_type = 0xf8; extended_boot_signature = 0x29; // drive_number = 0x80; media_type = 0xf8; extended_boot_signature = 0x29;
// filesystem_type = "FAT12 "; volume_serial_number = 0x1234; volume_label = "TinyUSB MSC"; // filesystem_type = "FAT12 "; volume_serial_number = 0x1234; volume_label = "TinyUSB MSC";
// FAT magic code at offset 510-511 // FAT magic code at offset 510-511
{ {
0xEB, 0x3C, 0x90, 0x4D, 0x53, 0x44, 0x4F, 0x53, 0x35, 0x2E, 0x30, 0x00, 0x02, 0x01, 0x01, 0x00, 0xEB, 0x3C, 0x90, 0x4D, 0x53, 0x44, 0x4F, 0x53, 0x35, 0x2E, 0x30, 0x00, 0x02, 0x01, 0x01, 0x00,
0x01, 0x10, 0x00, 0x10, 0x00, 0xF8, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x10, 0x00, 0x10, 0x00, 0xF8, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0x29, 0x34, 0x12, 0x00, 0x00, 'T' , 'i' , 'n' , 'y' , 'U' , 0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0x29, 0x34, 0x12, 0x00, 0x00, 'T', 'i', 'n', 'y', 'U',
'S' , 'B' , ' ' , 'M' , 'S' , 'C' , 0x46, 0x41, 0x54, 0x31, 0x32, 0x20, 0x20, 0x20, 0x00, 0x00, 'S', 'B', ' ', 'M', 'S', 'C', 0x46, 0x41, 0x54, 0x31, 0x32, 0x20, 0x20, 0x20, 0x00, 0x00,
// Zero up to 2 last bytes of FAT magic code // Zero up to 2 last bytes of FAT magic code
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x55, 0xAA 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x55, 0xAA},
},
//------------- Block1: FAT12 Table -------------// //------------- Block1: FAT12 Table -------------//
{ {
0xF8, 0xFF, 0xFF, 0xFF, 0x0F // // first 2 entries must be F8FF, third entry is cluster end of readme file 0xF8, 0xFF, 0xFF, 0xFF, 0x0F// // first 2 entries must be F8FF, third entry is cluster end of readme file
}, },
//------------- Block2: Root Directory -------------// //------------- Block2: Root Directory -------------//
{ {
// first entry is volume label // first entry is volume label
'T' , 'i' , 'n' , 'y' , 'U' , 'S' , 'B' , ' ' , 'M' , 'S' , 'C' , 0x08, 0x00, 0x00, 0x00, 0x00, 'T', 'i', 'n', 'y', 'U', 'S', 'B', ' ', 'M', 'S', 'C', 0x08, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x4F, 0x6D, 0x65, 0x43, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x4F, 0x6D, 0x65, 0x43, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
// second entry is readme file // second entry is readme file
'R' , 'E' , 'A' , 'D' , 'M' , 'E' , ' ' , ' ' , 'T' , 'X' , 'T' , 0x20, 0x00, 0xC6, 0x52, 0x6D, 'R', 'E', 'A', 'D', 'M', 'E', ' ', ' ', 'T', 'X', 'T', 0x20, 0x00, 0xC6, 0x52, 0x6D,
0x65, 0x43, 0x65, 0x43, 0x00, 0x00, 0x88, 0x6D, 0x65, 0x43, 0x02, 0x00, 0x65, 0x43, 0x65, 0x43, 0x00, 0x00, 0x88, 0x6D, 0x65, 0x43, 0x02, 0x00,
sizeof(README_CONTENTS)-1, 0x00, 0x00, 0x00 // readme's files size (4 Bytes) sizeof(README_CONTENTS) - 1, 0x00, 0x00, 0x00// readme's files size (4 Bytes)
}, },
//------------- Block3: Readme Content -------------// //------------- Block3: Readme Content -------------//
@ -121,23 +118,21 @@ uint8_t msc_disk[DISK_BLOCK_NUM][DISK_BLOCK_SIZE] =
// Invoked when received SCSI_CMD_INQUIRY // Invoked when received SCSI_CMD_INQUIRY
// Application fill vendor id, product id and revision with string up to 8, 16, 4 characters respectively // Application fill vendor id, product id and revision with string up to 8, 16, 4 characters respectively
void tud_msc_inquiry_cb(uint8_t lun, uint8_t vendor_id[8], uint8_t product_id[16], uint8_t product_rev[4]) void tud_msc_inquiry_cb(uint8_t lun, uint8_t vendor_id[8], uint8_t product_id[16], uint8_t product_rev[4]) {
{
(void) lun; (void) lun;
const char vid[] = "TinyUSB"; const char vid[] = "TinyUSB";
const char pid[] = "Mass Storage"; const char pid[] = "Mass Storage";
const char rev[] = "1.0"; const char rev[] = "1.0";
memcpy(vendor_id , vid, strlen(vid)); memcpy(vendor_id, vid, strlen(vid));
memcpy(product_id , pid, strlen(pid)); memcpy(product_id, pid, strlen(pid));
memcpy(product_rev, rev, strlen(rev)); memcpy(product_rev, rev, strlen(rev));
} }
// Invoked when received Test Unit Ready command. // Invoked when received Test Unit Ready command.
// return true allowing host to read/write this LUN e.g SD card inserted // return true allowing host to read/write this LUN e.g SD card inserted
bool tud_msc_test_unit_ready_cb(uint8_t lun) bool tud_msc_test_unit_ready_cb(uint8_t lun) {
{
(void) lun; (void) lun;
// RAM disk is ready until ejected // RAM disk is ready until ejected
@ -152,29 +147,24 @@ bool tud_msc_test_unit_ready_cb(uint8_t lun)
// Invoked when received SCSI_CMD_READ_CAPACITY_10 and SCSI_CMD_READ_FORMAT_CAPACITY to determine the disk size // Invoked when received SCSI_CMD_READ_CAPACITY_10 and SCSI_CMD_READ_FORMAT_CAPACITY to determine the disk size
// Application update block count and block size // Application update block count and block size
void tud_msc_capacity_cb(uint8_t lun, uint32_t* block_count, uint16_t* block_size) void tud_msc_capacity_cb(uint8_t lun, uint32_t *block_count, uint16_t *block_size) {
{
(void) lun; (void) lun;
*block_count = DISK_BLOCK_NUM; *block_count = DISK_BLOCK_NUM;
*block_size = DISK_BLOCK_SIZE; *block_size = DISK_BLOCK_SIZE;
} }
// Invoked when received Start Stop Unit command // Invoked when received Start Stop Unit command
// - Start = 0 : stopped power mode, if load_eject = 1 : unload disk storage // - Start = 0 : stopped power mode, if load_eject = 1 : unload disk storage
// - Start = 1 : active mode, if load_eject = 1 : load disk storage // - Start = 1 : active mode, if load_eject = 1 : load disk storage
bool tud_msc_start_stop_cb(uint8_t lun, uint8_t power_condition, bool start, bool load_eject) bool tud_msc_start_stop_cb(uint8_t lun, uint8_t power_condition, bool start, bool load_eject) {
{
(void) lun; (void) lun;
(void) power_condition; (void) power_condition;
if ( load_eject ) if (load_eject) {
{ if (start) {
if (start)
{
// load disk storage // load disk storage
}else } else {
{
// unload disk storage // unload disk storage
ejected = true; ejected = true;
} }
@ -185,45 +175,51 @@ bool tud_msc_start_stop_cb(uint8_t lun, uint8_t power_condition, bool start, boo
// Callback invoked when received READ10 command. // Callback invoked when received READ10 command.
// Copy disk's data to buffer (up to bufsize) and return number of copied bytes. // Copy disk's data to buffer (up to bufsize) and return number of copied bytes.
int32_t tud_msc_read10_cb(uint8_t lun, uint32_t lba, uint32_t offset, void* buffer, uint32_t bufsize) int32_t tud_msc_read10_cb(uint8_t lun, uint32_t lba, uint32_t offset, void *buffer, uint32_t bufsize) {
{
(void) lun; (void) lun;
// out of ramdisk // out of ramdisk
if ( lba >= DISK_BLOCK_NUM ) return -1; if (lba >= DISK_BLOCK_NUM) {
return -1;
}
uint8_t const* addr = msc_disk[lba] + offset; // Check for overflow of offset + bufsize
if (lba * DISK_BLOCK_SIZE + offset + bufsize > DISK_BLOCK_NUM * DISK_BLOCK_SIZE) {
return -1;
}
uint8_t const *addr = msc_disk[lba] + offset;
memcpy(buffer, addr, bufsize); memcpy(buffer, addr, bufsize);
return (int32_t) bufsize; return (int32_t) bufsize;
} }
bool tud_msc_is_writable_cb (uint8_t lun) bool tud_msc_is_writable_cb(uint8_t lun) {
{
(void) lun; (void) lun;
#ifdef CFG_EXAMPLE_MSC_READONLY #ifdef CFG_EXAMPLE_MSC_READONLY
return false; return false;
#else #else
return true; return true;
#endif #endif
} }
// Callback invoked when received WRITE10 command. // Callback invoked when received WRITE10 command.
// Process data in buffer to disk's storage and return number of written bytes // Process data in buffer to disk's storage and return number of written bytes
int32_t tud_msc_write10_cb(uint8_t lun, uint32_t lba, uint32_t offset, uint8_t* buffer, uint32_t bufsize) int32_t tud_msc_write10_cb(uint8_t lun, uint32_t lba, uint32_t offset, uint8_t *buffer, uint32_t bufsize) {
{
(void) lun; (void) lun;
// out of ramdisk // out of ramdisk
if ( lba >= DISK_BLOCK_NUM ) return -1; if (lba >= DISK_BLOCK_NUM) return -1;
#ifndef CFG_EXAMPLE_MSC_READONLY #ifndef CFG_EXAMPLE_MSC_READONLY
uint8_t* addr = msc_disk[lba] + offset; uint8_t *addr = msc_disk[lba] + offset;
memcpy(addr, buffer, bufsize); memcpy(addr, buffer, bufsize);
#else #else
(void) lba; (void) offset; (void) buffer; (void) lba;
#endif (void) offset;
(void) buffer;
#endif
return (int32_t) bufsize; return (int32_t) bufsize;
} }
@ -231,42 +227,18 @@ int32_t tud_msc_write10_cb(uint8_t lun, uint32_t lba, uint32_t offset, uint8_t*
// Callback invoked when received an SCSI command not in built-in list below // Callback invoked when received an SCSI command not in built-in list below
// - READ_CAPACITY10, READ_FORMAT_CAPACITY, INQUIRY, MODE_SENSE6, REQUEST_SENSE // - READ_CAPACITY10, READ_FORMAT_CAPACITY, INQUIRY, MODE_SENSE6, REQUEST_SENSE
// - READ10 and WRITE10 has their own callbacks // - READ10 and WRITE10 has their own callbacks
int32_t tud_msc_scsi_cb (uint8_t lun, uint8_t const scsi_cmd[16], void* buffer, uint16_t bufsize) int32_t tud_msc_scsi_cb(uint8_t lun, uint8_t const scsi_cmd[16], void *buffer, uint16_t bufsize) {
{ (void) buffer;
// read10 & write10 has their own callback and MUST not be handled here (void) bufsize;
void const* response = NULL; switch (scsi_cmd[0]) {
int32_t resplen = 0;
// most scsi handled is input
bool in_xfer = true;
switch (scsi_cmd[0])
{
default: default:
// Set Sense = Invalid Command Operation // Set Sense = Invalid Command Operation
tud_msc_set_sense(lun, SCSI_SENSE_ILLEGAL_REQUEST, 0x20, 0x00); tud_msc_set_sense(lun, SCSI_SENSE_ILLEGAL_REQUEST, 0x20, 0x00);
// negative means error -> tinyusb could stall and/or response with failed status // negative means error -> tinyusb could stall and/or response with failed status
resplen = -1; return -1;
break;
} }
// return resplen must not larger than bufsize
if ( resplen > bufsize ) resplen = bufsize;
if ( response && (resplen > 0) )
{
if(in_xfer)
{
memcpy(buffer, response, (size_t) resplen);
}else
{
// SCSI output
}
}
return (int32_t) resplen;
} }
#endif #endif

View File

@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 3.17) cmake_minimum_required(VERSION 3.20)
include(${CMAKE_CURRENT_SOURCE_DIR}/../../../hw/bsp/family_support.cmake) include(${CMAKE_CURRENT_SOURCE_DIR}/../../../hw/bsp/family_support.cmake)

View File

@ -0,0 +1,6 @@
{
"version": 6,
"include": [
"../../../hw/bsp/BoardPresets.json"
]
}

View File

@ -1,14 +1,9 @@
RTOS = freertos
include ../../build_system/make/make.mk include ../../build_system/make/make.mk
FREERTOS_SRC = lib/FreeRTOS-Kernel
FREERTOS_PORTABLE_PATH = $(FREERTOS_SRC)/portable/$(if $(findstring iar,$(TOOLCHAIN)),IAR,GCC)
INC += \ INC += \
src \ src \
src/FreeRTOSConfig \
$(TOP)/hw \ $(TOP)/hw \
$(TOP)/$(FREERTOS_SRC)/include \
$(TOP)/$(FREERTOS_PORTABLE_SRC) \
# Example source # Example source
EXAMPLE_SOURCE = \ EXAMPLE_SOURCE = \
@ -18,28 +13,4 @@ EXAMPLE_SOURCE = \
SRC_C += $(addprefix $(CURRENT_PATH)/, $(EXAMPLE_SOURCE)) 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 $(TOP)/,,$(wildcard $(TOP)/$(FREERTOS_PORTABLE_SRC)/*.c))
SRC_S += \
$(subst $(TOP)/,,$(wildcard $(TOP)/$(FREERTOS_PORTABLE_SRC)/*.s))
# include heap manage if configSUPPORT_DYNAMIC_ALLOCATION = 1
# SRC_C += $(FREERTOS_SRC)/portable/MemMang/heap_1.c
# CFLAGS += -Wno-error=sign-compare
# Suppress FreeRTOSConfig.h warnings
CFLAGS_GCC += -Wno-error=redundant-decls
# Suppress FreeRTOS source warnings
CFLAGS_GCC += -Wno-error=cast-qual
# FreeRTOS (lto + Os) linker issue
LDFLAGS_GCC += -Wl,--undefined=vTaskSwitchContext
include ../../build_system/make/rules.mk include ../../build_system/make/rules.mk

View File

@ -1,191 +0,0 @@
/*
* 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.
*----------------------------------------------------------*/
// skip if included from IAR assembler
#ifndef __IASMARM__
// Include MCU header
#include "bsp/board_mcu.h"
#if TUSB_MCU_VENDOR_ESPRESSIF
#error "ESP32-Sx should use IDF's FreeRTOSConfig.h"
#endif
// TODO fix later
#if CFG_TUSB_MCU == OPT_MCU_MM32F327X
extern u32 SystemCoreClock;
#else
// FIXME cause redundant-decls warnings
extern uint32_t SystemCoreClock;
#endif
#endif
/* Cortex M23/M33 port configuration. */
#define configENABLE_MPU 0
#define configENABLE_FPU 1
#define configENABLE_TRUSTZONE 0
#define configMINIMAL_SECURE_STACK_SIZE ( 1024 )
#define configRUN_FREERTOS_SECURE_ONLY 1
#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 ( configSUPPORT_DYNAMIC_ALLOCATION*4*1024 )
#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 4
#define configUSE_QUEUE_SETS 0
#define configUSE_TIME_SLICING 0
#define configUSE_NEWLIB_REENTRANT 0
#define configENABLE_BACKWARD_COMPATIBILITY 1
#define configSTACK_ALLOCATION_FROM_SEPARATE_HEAP 0
#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
#define configCHECK_HANDLER_INSTALLATION 0
/* 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
#ifdef __RX__
/* Renesas RX series */
#define vSoftwareInterruptISR INT_Excep_ICU_SWINT
#define vTickISR INT_Excep_CMT0_CMI0
#define configPERIPHERAL_CLOCK_HZ (configCPU_CLOCK_HZ/2)
#define configKERNEL_INTERRUPT_PRIORITY 1
#define configMAX_SYSCALL_INTERRUPT_PRIORITY 4
#else
/* FreeRTOS hooks to NVIC vectors */
#define xPortPendSVHandler PendSV_Handler
#define xPortSysTickHandler SysTick_Handler
#define vPortSVCHandler SVC_Handler
//--------------------------------------------------------------------+
// Interrupt nesting behavior configuration.
//--------------------------------------------------------------------+
#if defined(__NVIC_PRIO_BITS)
// For Cortex-M specific: __NVIC_PRIO_BITS is defined in core_cmx.h
#define configPRIO_BITS __NVIC_PRIO_BITS
#elif defined(__ECLIC_INTCTLBITS)
// RISC-V Bumblebee core from nuclei
#define configPRIO_BITS __ECLIC_INTCTLBITS
#elif defined(__IASMARM__)
// FIXME: IAR Assembler cannot include mcu header directly to get __NVIC_PRIO_BITS.
// Therefore we will hard coded it to minimum value of 2 to get pass ci build.
// IAR user must update this to correct value of the target MCU
#message "configPRIO_BITS is hard coded to 2 to pass IAR build only. User should update it per MCU"
#define configPRIO_BITS 2
#else
#error "FreeRTOS configPRIO_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
#endif /* __FREERTOS_CONFIG__H */

View File

@ -30,7 +30,7 @@
#include "bsp/board_api.h" #include "bsp/board_api.h"
#include "tusb.h" #include "tusb.h"
#if TUSB_MCU_VENDOR_ESPRESSIF #ifdef ESP_PLATFORM
#define USBD_STACK_SIZE 4096 #define USBD_STACK_SIZE 4096
#else #else
// Increase stack size when debug log is enabled // Increase stack size when debug log is enabled
@ -72,7 +72,7 @@ static uint32_t blink_interval_ms = BLINK_NOT_MOUNTED;
static void usb_device_task(void *param); static void usb_device_task(void *param);
void led_blinking_task(void* param); void led_blinking_task(void* param);
void cdc_task(void *params); void cdc_task(void *params);
extern void msc_disk_init(void);
//--------------------------------------------------------------------+ //--------------------------------------------------------------------+
// Main // Main
//--------------------------------------------------------------------+ //--------------------------------------------------------------------+
@ -91,15 +91,15 @@ int main(void) {
xTaskCreate(cdc_task, "cdc", CDC_STACK_SZIE, NULL, configMAX_PRIORITIES - 2, NULL); xTaskCreate(cdc_task, "cdc", CDC_STACK_SZIE, NULL, configMAX_PRIORITIES - 2, NULL);
#endif #endif
#if !TUSB_MCU_VENDOR_ESPRESSIF #ifndef ESP_PLATFORM
// skip starting scheduler (and return) for ESP32-S2 or ESP32-S3 // only start scheduler for non-espressif mcu
vTaskStartScheduler(); vTaskStartScheduler();
#endif #endif
return 0; return 0;
} }
#if TUSB_MCU_VENDOR_ESPRESSIF #ifdef ESP_PLATFORM
void app_main(void) { void app_main(void) {
main(); main();
} }
@ -123,6 +123,7 @@ static void usb_device_task(void *param) {
board_init_after_tusb(); board_init_after_tusb();
} }
msc_disk_init();
// RTOS forever loop // RTOS forever loop
while (1) { while (1) {
// put this thread to waiting state until there is new events // put this thread to waiting state until there is new events

View File

@ -28,6 +28,37 @@
#if CFG_TUD_MSC #if CFG_TUD_MSC
// Use async IO in example or not
#define CFG_EXAMPLE_MSC_ASYNC_IO 1
// Simulate read/write operation delay
#define CFG_EXAMPLE_MSC_IO_DELAY_MS 0
#if CFG_EXAMPLE_MSC_ASYNC_IO
#define IO_STACK_SIZE configMINIMAL_STACK_SIZE
typedef struct {
uint8_t lun;
bool is_read;
uint32_t lba;
uint32_t offset;
void* buffer;
uint32_t bufsize;
} io_ops_t;
QueueHandle_t io_queue;
#if configSUPPORT_STATIC_ALLOCATION
uint8_t io_queue_buf[sizeof(io_ops_t)];
StaticQueue_t io_queue_static;
StackType_t io_stack[IO_STACK_SIZE];
StaticTask_t io_taskdef;
#endif
static void io_task(void *params);
#endif
void msc_disk_init(void);
// whether host does safe-eject // whether host does safe-eject
static bool ejected = false; static bool ejected = false;
@ -40,8 +71,7 @@ static bool ejected = false;
If you find any bugs or get any questions, feel free to file an\r\n\ If you find any bugs or get any questions, feel free to file an\r\n\
issue at github.com/hathach/tinyusb" issue at github.com/hathach/tinyusb"
enum enum {
{
DISK_BLOCK_NUM = 16, // 8KB is the smallest size that windows allow to mount DISK_BLOCK_NUM = 16, // 8KB is the smallest size that windows allow to mount
DISK_BLOCK_SIZE = 512 DISK_BLOCK_SIZE = 512
}; };
@ -119,16 +149,52 @@ uint8_t msc_disk[DISK_BLOCK_NUM][DISK_BLOCK_SIZE] =
README_CONTENTS README_CONTENTS
}; };
#if CFG_EXAMPLE_MSC_ASYNC_IO
void msc_disk_init() {
#if configSUPPORT_STATIC_ALLOCATION
io_queue = xQueueCreateStatic(1, sizeof(io_ops_t), io_queue_buf, &io_queue_static);
xTaskCreateStatic(io_task, "io", IO_STACK_SIZE, NULL, 2, io_stack, &io_taskdef);
#else
io_queue = xQueueCreate(1, sizeof(io_ops_t));
xTaskCreate(io_task, "io", IO_STACK_SIZE, NULL, 2, NULL);
#endif
}
static void io_task(void *params) {
(void) params;
io_ops_t io_ops;
while (1) {
if (xQueueReceive(io_queue, &io_ops, portMAX_DELAY)) {
const uint8_t* addr = msc_disk[io_ops.lba] + io_ops.offset;
int32_t nbytes = io_ops.bufsize;
if (io_ops.is_read) {
memcpy(io_ops.buffer, addr, io_ops.bufsize);
} else {
#ifndef CFG_EXAMPLE_MSC_READONLY
memcpy((uint8_t*) addr, io_ops.buffer, io_ops.bufsize);
#else
nbytes = -1; // failed to write
#endif
}
tusb_time_delay_ms_api(CFG_EXAMPLE_MSC_IO_DELAY_MS);
tud_msc_async_io_done(nbytes, false);
}
}
}
#else
void msc_disk_init() {}
#endif
// Invoked when received SCSI_CMD_INQUIRY // Invoked when received SCSI_CMD_INQUIRY
// Application fill vendor id, product id and revision with string up to 8, 16, 4 characters respectively // Application fill vendor id, product id and revision with string up to 8, 16, 4 characters respectively
void tud_msc_inquiry_cb(uint8_t lun, uint8_t vendor_id[8], uint8_t product_id[16], uint8_t product_rev[4]) void tud_msc_inquiry_cb(uint8_t lun, uint8_t vendor_id[8], uint8_t product_id[16], uint8_t product_rev[4]) {
{
(void) lun; (void) lun;
const char vid[] = "TinyUSB"; const char vid[] = "TinyUSB";
const char pid[] = "Mass Storage"; const char pid[] = "Mass Storage";
const char rev[] = "1.0"; const char rev[] = "1.0";
memcpy(vendor_id , vid, strlen(vid)); memcpy(vendor_id , vid, strlen(vid));
memcpy(product_id , pid, strlen(pid)); memcpy(product_id , pid, strlen(pid));
memcpy(product_rev, rev, strlen(rev)); memcpy(product_rev, rev, strlen(rev));
@ -136,8 +202,7 @@ void tud_msc_inquiry_cb(uint8_t lun, uint8_t vendor_id[8], uint8_t product_id[16
// Invoked when received Test Unit Ready command. // Invoked when received Test Unit Ready command.
// return true allowing host to read/write this LUN e.g SD card inserted // return true allowing host to read/write this LUN e.g SD card inserted
bool tud_msc_test_unit_ready_cb(uint8_t lun) bool tud_msc_test_unit_ready_cb(uint8_t lun) {
{
(void) lun; (void) lun;
// RAM disk is ready until ejected // RAM disk is ready until ejected
@ -152,10 +217,8 @@ bool tud_msc_test_unit_ready_cb(uint8_t lun)
// Invoked when received SCSI_CMD_READ_CAPACITY_10 and SCSI_CMD_READ_FORMAT_CAPACITY to determine the disk size // Invoked when received SCSI_CMD_READ_CAPACITY_10 and SCSI_CMD_READ_FORMAT_CAPACITY to determine the disk size
// Application update block count and block size // Application update block count and block size
void tud_msc_capacity_cb(uint8_t lun, uint32_t* block_count, uint16_t* block_size) void tud_msc_capacity_cb(uint8_t lun, uint32_t* block_count, uint16_t* block_size) {
{
(void) lun; (void) lun;
*block_count = DISK_BLOCK_NUM; *block_count = DISK_BLOCK_NUM;
*block_size = DISK_BLOCK_SIZE; *block_size = DISK_BLOCK_SIZE;
} }
@ -163,18 +226,14 @@ void tud_msc_capacity_cb(uint8_t lun, uint32_t* block_count, uint16_t* block_siz
// Invoked when received Start Stop Unit command // Invoked when received Start Stop Unit command
// - Start = 0 : stopped power mode, if load_eject = 1 : unload disk storage // - Start = 0 : stopped power mode, if load_eject = 1 : unload disk storage
// - Start = 1 : active mode, if load_eject = 1 : load disk storage // - Start = 1 : active mode, if load_eject = 1 : load disk storage
bool tud_msc_start_stop_cb(uint8_t lun, uint8_t power_condition, bool start, bool load_eject) bool tud_msc_start_stop_cb(uint8_t lun, uint8_t power_condition, bool start, bool load_eject) {
{
(void) lun; (void) lun;
(void) power_condition; (void) power_condition;
if ( load_eject ) if (load_eject) {
{ if (start) {
if (start)
{
// load disk storage // load disk storage
}else } else {
{
// unload disk storage // unload disk storage
ejected = true; ejected = true;
} }
@ -185,83 +244,107 @@ bool tud_msc_start_stop_cb(uint8_t lun, uint8_t power_condition, bool start, boo
// Callback invoked when received READ10 command. // Callback invoked when received READ10 command.
// Copy disk's data to buffer (up to bufsize) and return number of copied bytes. // Copy disk's data to buffer (up to bufsize) and return number of copied bytes.
int32_t tud_msc_read10_cb(uint8_t lun, uint32_t lba, uint32_t offset, void* buffer, uint32_t bufsize) int32_t tud_msc_read10_cb(uint8_t lun, uint32_t lba, uint32_t offset, void* buffer, uint32_t bufsize) {
{
(void) lun; (void) lun;
// out of ramdisk // out of ramdisk
if ( lba >= DISK_BLOCK_NUM ) return -1; if (lba >= DISK_BLOCK_NUM) {
return TUD_MSC_RET_ERROR;
}
uint8_t const* addr = msc_disk[lba] + offset; // Check for overflow of offset + bufsize
if (lba * DISK_BLOCK_SIZE + offset + bufsize > DISK_BLOCK_NUM * DISK_BLOCK_SIZE) {
return TUD_MSC_RET_ERROR;
}
#if CFG_EXAMPLE_MSC_ASYNC_IO
io_ops_t io_ops = {.is_read = true, .lun = lun, .lba = lba, .offset = offset, .buffer = buffer, .bufsize = bufsize};
// Send IO operation to IO task
TU_ASSERT(xQueueSend(io_queue, &io_ops, 0) == pdPASS);
return TUD_MSC_RET_ASYNC;
#else
uint8_t const *addr = msc_disk[lba] + offset;
memcpy(buffer, addr, bufsize); memcpy(buffer, addr, bufsize);
return bufsize;
return (int32_t) bufsize; #endif
} }
bool tud_msc_is_writable_cb (uint8_t lun) bool tud_msc_is_writable_cb (uint8_t lun) {
{
(void) lun; (void) lun;
#ifdef CFG_EXAMPLE_MSC_READONLY #ifdef CFG_EXAMPLE_MSC_READONLY
return false; return false;
#else #else
return true; return true;
#endif #endif
} }
// Callback invoked when received WRITE10 command. // Callback invoked when received WRITE10 command.
// Process data in buffer to disk's storage and return number of written bytes // Process data in buffer to disk's storage and return number of written bytes
int32_t tud_msc_write10_cb(uint8_t lun, uint32_t lba, uint32_t offset, uint8_t* buffer, uint32_t bufsize) int32_t tud_msc_write10_cb(uint8_t lun, uint32_t lba, uint32_t offset, uint8_t* buffer, uint32_t bufsize) {
{
(void) lun;
// out of ramdisk // out of ramdisk
if ( lba >= DISK_BLOCK_NUM ) return -1; if (lba >= DISK_BLOCK_NUM) {
return TUD_MSC_RET_ERROR;
}
#ifndef CFG_EXAMPLE_MSC_READONLY // Check for overflow of offset + bufsize
uint8_t* addr = msc_disk[lba] + offset; if (lba * DISK_BLOCK_SIZE + offset + bufsize > DISK_BLOCK_NUM * DISK_BLOCK_SIZE) {
return TUD_MSC_RET_ERROR;
}
#ifdef CFG_EXAMPLE_MSC_READONLY
(void) lun;
(void) buffer;
return bufsize;
#endif
#if CFG_EXAMPLE_MSC_ASYNC_IO
io_ops_t io_ops = {.is_read = false, .lun = lun, .lba = lba, .offset = offset, .buffer = buffer, .bufsize = bufsize};
// Send IO operation to IO task
TU_ASSERT(xQueueSend(io_queue, &io_ops, 0) == pdPASS);
return TUD_MSC_RET_ASYNC;
#else
uint8_t *addr = msc_disk[lba] + offset;
memcpy(addr, buffer, bufsize); memcpy(addr, buffer, bufsize);
#else tusb_time_delay_ms_api(CFG_EXAMPLE_MSC_IO_DELAY_MS);
(void) lba; (void) offset; (void) buffer;
#endif
return (int32_t) bufsize; return bufsize;
#endif
} }
// Callback invoked when received an SCSI command not in built-in list below // Callback invoked when received an SCSI command not in built-in list below
// - READ_CAPACITY10, READ_FORMAT_CAPACITY, INQUIRY, MODE_SENSE6, REQUEST_SENSE // - READ_CAPACITY10, READ_FORMAT_CAPACITY, INQUIRY, MODE_SENSE6, REQUEST_SENSE
// - READ10 and WRITE10 has their own callbacks // - READ10 and WRITE10 has their own callbacks
int32_t tud_msc_scsi_cb (uint8_t lun, uint8_t const scsi_cmd[16], void* buffer, uint16_t bufsize) int32_t tud_msc_scsi_cb (uint8_t lun, uint8_t const scsi_cmd[16], void* buffer, uint16_t bufsize) {
{
// read10 & write10 has their own callback and MUST not be handled here // read10 & write10 has their own callback and MUST not be handled here
void const* response = NULL; void const *response = NULL;
int32_t resplen = 0; int32_t resplen = 0;
// most scsi handled is input // most scsi handled is input
bool in_xfer = true; bool in_xfer = true;
switch (scsi_cmd[0]) switch (scsi_cmd[0]) {
{
default: default:
// Set Sense = Invalid Command Operation // Set Sense = Invalid Command Operation
tud_msc_set_sense(lun, SCSI_SENSE_ILLEGAL_REQUEST, 0x20, 0x00); tud_msc_set_sense(lun, SCSI_SENSE_ILLEGAL_REQUEST, 0x20, 0x00);
// negative means error -> tinyusb could stall and/or response with failed status // negative means error -> tinyusb could stall and/or response with failed status
resplen = -1; resplen = -1;
break; break;
} }
// return resplen must not larger than bufsize // return resplen must not larger than bufsize
if ( resplen > bufsize ) resplen = bufsize; if (resplen > bufsize) { resplen = bufsize; }
if ( response && (resplen > 0) ) if (response && (resplen > 0)) {
{ if (in_xfer) {
if(in_xfer)
{
memcpy(buffer, response, (size_t) resplen); memcpy(buffer, response, (size_t) resplen);
}else } else {
{
// SCSI output // SCSI output
} }
} }

View File

@ -59,7 +59,7 @@
#endif #endif
// Espressif IDF requires "freertos/" prefix in include path // Espressif IDF requires "freertos/" prefix in include path
#if TUSB_MCU_VENDOR_ESPRESSIF #ifdef ESP_PLATFORM
#define CFG_TUSB_OS_INC_PATH freertos/ #define CFG_TUSB_OS_INC_PATH freertos/
#endif #endif

View File

@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 3.17) cmake_minimum_required(VERSION 3.20)
include(${CMAKE_CURRENT_SOURCE_DIR}/../../../hw/bsp/family_support.cmake) include(${CMAKE_CURRENT_SOURCE_DIR}/../../../hw/bsp/family_support.cmake)

View File

@ -0,0 +1,6 @@
{
"version": 6,
"include": [
"../../../hw/bsp/BoardPresets.json"
]
}

View File

@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 3.17) cmake_minimum_required(VERSION 3.20)
include(${CMAKE_CURRENT_SOURCE_DIR}/../../../hw/bsp/family_support.cmake) include(${CMAKE_CURRENT_SOURCE_DIR}/../../../hw/bsp/family_support.cmake)

View File

@ -0,0 +1,6 @@
{
"version": 6,
"include": [
"../../../hw/bsp/BoardPresets.json"
]
}

View File

@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 3.17) cmake_minimum_required(VERSION 3.20)
include(${CMAKE_CURRENT_SOURCE_DIR}/../../../hw/bsp/family_support.cmake) include(${CMAKE_CURRENT_SOURCE_DIR}/../../../hw/bsp/family_support.cmake)

View File

@ -0,0 +1,6 @@
{
"version": 6,
"include": [
"../../../hw/bsp/BoardPresets.json"
]
}

View File

@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 3.17) cmake_minimum_required(VERSION 3.20)
include(${CMAKE_CURRENT_SOURCE_DIR}/../../../hw/bsp/family_support.cmake) include(${CMAKE_CURRENT_SOURCE_DIR}/../../../hw/bsp/family_support.cmake)

View File

@ -0,0 +1,6 @@
{
"version": 6,
"include": [
"../../../hw/bsp/BoardPresets.json"
]
}

Some files were not shown because too many files have changed in this diff Show More