Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mentor/musb: compilation errors for ARM M0 (cortex-m0plus) #2908

Open
1 task done
cdesmondee opened this issue Dec 17, 2024 · 2 comments
Open
1 task done

mentor/musb: compilation errors for ARM M0 (cortex-m0plus) #2908

cdesmondee opened this issue Dec 17, 2024 · 2 comments
Labels

Comments

@cdesmondee
Copy link

Operating System

Linux

Board

N/A

Firmware

Any example will not build.

What happened ?

I am working on an M0 device that is utilizing a Mentor Graphics USB controller. When trying to compile any of the examples the compilation fails highlighting that taking an address of packed struct can result in an unaligned memory access. Specifically for M0 unaligned memory accesses will result in hard faults.

I have been able to get the a subset of the examples working, but I had to hack the source to not utilize structs e.g. tusb_control_request_t and manipulate registers directly.

I have the intention of upstreaming support for this device, so even though these changes are functional, it is not my end goal for my project.

How to reproduce ?

Not reproducible since the target device is not currently supported.

Debug Log as txt file (LOG/CFG_TUSB_DEBUG=2)

Not applicable, binary will not compile.

Screenshots

Compiler Error:
<TINYUSB_INSTALL_PATH>/src/portable/mentor/musb/dcd_musb.c:239:24: error: taking address of packed member of 'struct ' may result in an unaligned pointer value [-Werror=address-of-packed-member]
239 | uint32_t p = (void)&_dcd.setup_packet;
| ^~~~~~~~~~~~~~~~~~
compilation terminated due to -Wfatal-errors.
cc1: all warnings being treated as errors

I have checked existing issues, dicussion and documentation

  • I confirm I have checked existing issues, dicussion and documentation.
@hathach
Copy link
Owner

hathach commented Dec 20, 2024

Can you specify which mcu you are working on ?

@cdesmondee
Copy link
Author

Can you specify which mcu you are working on ?

I am working on an M0 device that is not public yet. Once it is public I plan on sending a PR for the device so that the device will be supported in mainline.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants