Skip to content

Fix IAR error on memcpy and warnings.#571

Merged
hathach merged 1 commit into
hathach:masterfrom
HiFiPhile:iar_fifo
Dec 24, 2020
Merged

Fix IAR error on memcpy and warnings.#571
hathach merged 1 commit into
hathach:masterfrom
HiFiPhile:iar_fifo

Conversation

@HiFiPhile
Copy link
Copy Markdown
Collaborator

Signed-off-by: MasterPhi admin@hifiphile.com

Describe the PR
IAR complains on "unknown type" on memcpy, and gives warnings on undefined volatile access order
A clear and concise description of what this PR solve.

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.

Thanks for the pr, look great, I only want to slightly make it more portable without uintptr_t

Comment thread src/common/tusb_fifo.c Outdated

// Write data wrapped around
memcpy(f->buffer, data + nLin*f->item_size, (n - nLin) * f->item_size);
memcpy(f->buffer, (uint8_t*)((uintptr_t)data + nLin*f->item_size), (n - nLin) * f->item_size);
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.

Maybe only ((uint8_t const*) data) + nLin*item_size) is good enough. I am not entirely sure but uintptr_t seems to be optional type for some platforms. Best to keep it as portable as possible

Comment thread src/common/tusb_fifo.c Outdated

// Read data wrapped part
memcpy(p_buffer + nLin*f->item_size, f->buffer, (n - nLin) * f->item_size);
memcpy((uint8_t*)((uintptr_t)p_buffer + nLin*f->item_size), f->buffer, (n - nLin) * f->item_size);
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.

Same as above

@HiFiPhile
Copy link
Copy Markdown
Collaborator Author

make it more portable without uintptr_t

Done

Comment thread src/common/tusb_fifo.c
Signed-off-by: MasterPhi <admin@hifiphile.com>
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.

superb !! Thank you for your effort for fixing IAR compiling.

@hathach hathach merged commit 08f8f48 into hathach:master Dec 24, 2020
@HiFiPhile HiFiPhile deleted the iar_fifo branch July 22, 2021 12:39
7FM pushed a commit to 7FM/tinyusb that referenced this pull request Aug 23, 2025
Fixes build when pico_stdlib isn't included in the target libraries:
  pico-sdk/src/rp2_common/pico_divider/divider.S:8:10: fatal error: hardware/divider_helper.S: No such file or directory

Also fixes the same error in pico_double, though I'm not sure how/why:
  pico-sdk/src/rp2_common/pico_double/double_aeabi.S:9:10: fatal error: hardware/divider_helper.S: No such file or directory
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.

2 participants