Skip to content

rp2040: don't compile in host code when in device mode#676

Merged
hathach merged 3 commits into
hathach:masterfrom
majbthrd:rp2040device
Feb 25, 2021
Merged

rp2040: don't compile in host code when in device mode#676
hathach merged 3 commits into
hathach:masterfrom
majbthrd:rp2040device

Conversation

@majbthrd
Copy link
Copy Markdown
Collaborator

Presently, there is assorted host-only rp2040 code that gets compiled into device-only operation. (Host and device modes are mutually exclusive.) Making this host-only code conditional at compile time saves code and data space.

This PR alone is good for 272 fewer bytes of code and 128 bytes less data RAM consumed.

Copy link
Copy Markdown
Owner

@hathach hathach left a comment

Choose a reason for hiding this comment

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

since it is approved by RPi team, I think it is good to merge, though I think we could merge line 74 and 89 together for easier reading.

uint len;
// Amount of data with the hardware
uint transfer_size;
#ifdef RP2040_USB_HOST_MODE
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

if the field order is not matter, we should merge this with line 89 into a single #ifdef

@hathach hathach merged commit 1ce6f76 into hathach:master Feb 25, 2021
@majbthrd majbthrd deleted the rp2040device branch February 25, 2021 18:37
7FM pushed a commit to 7FM/tinyusb that referenced this pull request Aug 23, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants