Skip to content

RP2040 cannot be compiled with C11 enabled #54190

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

Closed
ThadHouse opened this issue Jan 28, 2023 · 2 comments · Fixed by #50206
Closed

RP2040 cannot be compiled with C11 enabled #54190

ThadHouse opened this issue Jan 28, 2023 · 2 comments · Fixed by #50206
Assignees
Labels
bug The issue is a bug, or the PR is fixing a bug platform: Raspberry Pi Pico Raspberry Pi Pico (RPi Pico) priority: low Low impact/importance bug

Comments

@ThadHouse
Copy link
Contributor

Describe the bug
When compiling a project targeting RP2040 and C11 enabled, errors occur because both assert.h (from the std lib) and config_autogen.h (from zephyr) define static_assert as a macro, with the one in config_autogen not being guarded.

To Reproduce
Steps to reproduce the behavior:

  1. Set C11 flag on any project (set_property(TARGET tgt PROPERTY C_STANDARD 11))
  2. mkdir build; cd build
  3. cmake -DBOARD=rpi_pico
  4. make
  5. See error

Expected behavior
No compiler error

Impact
C11 cannot be used for RP2040 projects

Environment (please complete the following information):

  • OS: Linux and Windows
  • Toolchain: Zephyr SDK 0.15.0
  • Zephyr 3.1 (Still occurs in 3.2)
@ThadHouse ThadHouse added the bug The issue is a bug, or the PR is fixing a bug label Jan 28, 2023
@cfriedt cfriedt added area: C Library C Standard Library priority: low Low impact/importance bug labels Jan 28, 2023
@cfriedt
Copy link
Member

cfriedt commented Jan 28, 2023

Building Zephyr for C11 should likely involve using a Kconfig option rather than setting a CMake property in an arbitrary CMakeLists.txt, but this should be investigated in any case.

A Kconfig value such as CONFIG_LIBC_STD_C11 or something along those lines would probably be smart.

@stephanosio stephanosio assigned yonsch and unassigned stephanosio Jan 28, 2023
@stephanosio stephanosio added platform: Raspberry Pi Pico Raspberry Pi Pico (RPi Pico) and removed area: C Library C Standard Library labels Jan 28, 2023
@stephanosio
Copy link
Member

Building Zephyr for C11 should likely involve using a Kconfig option rather than setting a CMake property in an arbitrary CMakeLists.txt, but this should be investigated in any case.

A Kconfig value such as CONFIG_LIBC_STD_C11 or something along those lines would probably be smart.

@cfriedt I would suggest moving that discussion to #45776 since this issue does not really have much to do with C language support in Zephyr.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug The issue is a bug, or the PR is fixing a bug platform: Raspberry Pi Pico Raspberry Pi Pico (RPi Pico) priority: low Low impact/importance bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants