Skip to content

remove tud cdc configure#3549

Merged
hathach merged 6 commits into
masterfrom
remove-cdc-configure
Mar 12, 2026
Merged

remove tud cdc configure#3549
hathach merged 6 commits into
masterfrom
remove-cdc-configure

Conversation

@hathach
Copy link
Copy Markdown
Owner

@hathach hathach commented Mar 12, 2026

remove tud_cdc_configure(), move tem to compile-time macro to save footprint

hathach added 3 commits March 12, 2026 15:22
…mpile-time macros for simplicity and reduced complexity
…rowse error handling

update AGENTS.md with metrics compare
Copilot AI review requested due to automatic review settings March 12, 2026 08:58
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: cd60008e89

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines 108 to 109
tusb_init(BOARD_TUD_RHPORT, &dev_init);
tud_cdc_configure_t cdc_cfg = CFG_TUD_CDC_CONFIGURE_DEFAULT();
cdc_cfg.tx_persistent = true;
cdc_cfg.tx_overwritabe_if_not_connected = false;
tud_cdc_configure(&cdc_cfg);
board_init_after_tusb();
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Restore CDC TX persistence settings in host_info example

Removing the tud_cdc_configure() call here changes this example’s runtime behavior from persistent/non-overwritable TX to the new defaults (CFG_TUD_CDC_TX_PERSISTENT=0, CFG_TUD_CDC_TX_OVERWRITABLE_IF_NOT_CONNECTED=1), so CDC output produced before the terminal is fully connected (e.g. tuh_mount_cb()/tuh_umount_cb() writes) can be dropped or cleared on reconnect/reset. This regresses the example’s ability to reliably show early host events unless equivalent compile-time macros are set in its tusb_config.h.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR removes the runtime CDC device driver configuration API (tud_cdc_configure()) and replaces it with compile-time configuration macros to reduce firmware footprint. It also updates contributor guidance for collecting code size metrics and bumps several GitHub Actions workflow dependencies.

Changes:

  • Remove tud_cdc_configure() / tud_cdc_configure_t and replace the behavior with new CFG_TUD_CDC_* compile-time macros.
  • Update CDC device implementation to use the new compile-time settings for persistence and TX FIFO overwritability behavior.
  • Update developer documentation (AGENTS.md) and refresh GitHub Actions workflow versions/behavior.

Reviewed changes

Copilot reviewed 10 out of 10 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
src/class/cdc/cdc_device.h Removes runtime configuration API and introduces new compile-time CDC configuration macros.
src/class/cdc/cdc_device.c Switches CDC driver behavior logic from runtime config struct to compile-time macros.
examples/dual/host_info_to_device_cdc/src/main.c Removes example’s runtime call to tud_cdc_configure() (now deleted).
AGENTS.md Adds instructions for generating and comparing code size metrics.
.github/workflows/metrics_comment.yml Updates artifact download action version.
.github/workflows/membrowse-onboard.yml Updates checkout and ccache action versions.
.github/workflows/claude.yml Updates checkout action version.
.github/workflows/claude-code-review.yml Updates checkout action version.
.github/workflows/cifuzz.yml Updates artifact upload action version.
.github/workflows/build_util.yml Makes “Membrowse Upload” non-fatal (continue-on-error: true).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

You can also share your feedback on Copilot code review. Take the survey.

Comment thread src/class/cdc/cdc_device.h
@github-actions
Copy link
Copy Markdown

github-actions Bot commented Mar 12, 2026

Size Difference Report

Because TinyUSB code size varies by port and configuration, the metrics below represent the averaged totals across all example builds.

Note: If there is no change, only one value is shown.

Changes >1% in size

file .text .rodata .data .bss size % diff
cdc_device.c 1302 ➙ 1245 (-57) 16 21 ➙ 1106 (+1085) 630 1933 ➙ 1874 (-59) -3.1%
TOTAL 1302 ➙ 1245 (-57) 16 21 ➙ 1106 (+1085) 630 1933 ➙ 1874 (-59) -3.1%

Changes <1% in size

No entries.

No changes
file .text .rodata .data .bss size % diff
audio_device.c 2882 0 1260 1616 4493 +0.0%
cdc_host.c 6617 487 15 1498 8327 +0.0%
dcd_ch32_usbfs.c 1473 0 0 2444 3917 +0.0%
dcd_ch32_usbhs.c 1649 0 0 448 2097 +0.0%
dcd_ci_fs.c 1925 0 0 1290 3215 +0.0%
dcd_ci_hs.c 1759 0 0 1344 2538 +0.0%
dcd_da146xx.c 3067 0 0 144 3211 +0.0%
dcd_dwc2.c 4176 25 0 265 4465 +0.0%
dcd_eptri.c 2271 0 0 259 2530 +0.0%
dcd_khci.c 1953 0 0 1290 3243 +0.0%
dcd_lpc17_40.c 1474 0 0 648 1798 +0.0%
dcd_lpc_ip3511.c 1463 0 0 264 1683 +0.0%
dcd_mm32f327x_otg.c 1478 0 0 1290 2768 +0.0%
dcd_msp430x5xx.c 1798 0 0 176 1974 +0.0%
dcd_musb.c 2445 0 0 160 2605 +0.0%
dcd_nrf5x.c 2918 0 0 292 3210 +0.0%
dcd_nuc120.c 1094 0 0 78 1172 +0.0%
dcd_nuc121.c 1168 0 0 101 1269 +0.0%
dcd_nuc505.c 0 0 1531 157 1688 +0.0%
dcd_rp2040.c 858 20 604 655 2137 +0.0%
dcd_rusb2.c 2919 0 0 156 3075 +0.0%
dcd_samd.c 1034 0 0 266 1300 +0.0%
dcd_samg.c 1320 0 0 72 1392 +0.0%
dcd_stm32_fsdev.c 2557 0 0 291 2848 +0.0%
dfu_device.c 768 28 712 128 896 +0.0%
dfu_rt_device.c 156 0 134 0 156 +0.0%
dwc2_common.c 602 30 0 0 618 +0.0%
ecm_rndis_device.c 1037 0 1 2858 3896 +0.0%
ehci.c 2763 0 0 6043 7597 +0.0%
fsdev_common.c 180 0 0 0 180 +0.0%
hcd_ch32_usbfs.c 2484 0 0 498 2982 +0.0%
hcd_ci_hs.c 184 0 0 0 184 +0.0%
hcd_dwc2.c 4994 33 1 513 5540 +0.0%
hcd_khci.c 2442 0 0 449 2891 +0.0%
hcd_musb.c 3073 0 0 157 3230 +0.0%
hcd_pio_usb.c 262 0 240 0 502 +0.0%
hcd_rp2040.c 976 73 416 384 1849 +0.0%
hcd_rusb2.c 2923 0 0 245 3168 +0.0%
hcd_samd.c 2220 0 0 324 2544 +0.0%
hcd_stm32_fsdev.c 3287 0 1 420 3708 +0.0%
hid_device.c 1118 44 997 119 1236 +0.0%
hid_host.c 1206 0 0 1251 2457 +0.0%
hub.c 1384 8 8 30 1418 +0.0%
midi_device.c 1145 0 1007 578 1721 +0.0%
midi_host.c 1358 7 7 3635 4996 +0.0%
msc_device.c 2517 108 2286 546 3063 +0.0%
msc_host.c 1587 0 0 394 1982 +0.0%
mtp_device.c 1689 22 1449 587 2283 +0.0%
ncm_device.c 1514 28 1408 5830 7358 +0.0%
ohci.c 1940 0 0 2414 4353 +0.0%
printer_device.c 826 0 706 519 1343 +0.0%
rp2040_usb.c 172 75 717 4 968 +0.0%
rusb2_common.c 160 0 16 0 176 +0.0%
tusb.c 449 0 383 3 451 +0.0%
tusb_fifo.c 848 0 480 0 843 +0.0%
typec_stm32.c 820 8 2 12 842 +0.0%
usbc.c 420 2 20 166 608 +0.0%
usbd.c 3214 57 89 275 3554 +0.0%
usbd_control.c 535 0 484 79 613 +0.0%
usbh.c 4649 55 99 961 5731 +0.0%
usbtmc_device.c 2176 24 69 294 2502 +0.0%
vendor_device.c 637 0 534 518 1154 +0.0%
video_device.c 4394 5 1852 478 4865 +0.0%
TOTAL 113407 1139 17528 45916 161413 +0.0%

@github-actions
Copy link
Copy Markdown

github-actions Bot commented Mar 12, 2026

MemBrowse Memory Report

Top 10 targets by memory change (%) (out of 2106 targets) View Project Dashboard →

target .text .rodata .data .bss total % diff
lpcxpresso1769/cdc_dual_ports 10,028 → 9,944 (-84) 10,044 → 9,960 (-84) -0.8%
lpcxpresso1347/cdc_dual_ports 9,724 → 9,644 (-80) 9,740 → 9,660 (-80) -0.8%
ea4088_quickstart/cdc_dual_ports 10,000 → 9,924 (-76) 10,016 → 9,940 (-76) -0.8%
metro_m4_express/cdc_dual_ports 10,072 → 9,996 (-76) 10,080 → 10,004 (-76) -0.8%
samg55_xplained/cdc_dual_ports 10,156 → 10,080 (-76) 10,164 → 10,088 (-76) -0.7%
mm32f327x_mb39/cdc_dual_ports 10,264 → 10,180 (-84) 11,240 → 11,156 (-84) -0.7%
lpcxpresso1549/cdc_dual_ports 11,064 → 10,984 (-80) 11,080 → 11,000 (-80) -0.7%
msp_exp432e401y/cdc_dual_ports 12,116 → 12,032 (-84) 12,136 → 12,052 (-84) -0.7%
cynthion_d11/cdc_dual_ports 9,464 → 9,400 (-64) 9,464 → 9,400 (-64) -0.7%
metro_m0_express/cdc_dual_ports 9,516 → 9,452 (-64) 9,516 → 9,452 (-64) -0.7%

@hathach hathach merged commit 1fcb49f into master Mar 12, 2026
403 of 404 checks passed
@hathach hathach deleted the remove-cdc-configure branch March 12, 2026 17:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants