Skip to content

Revert "modules: hal_rpi_pico: set -std=gnu11 in a toolchain independ… #90896

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

Merged

Conversation

soburi
Copy link
Member

@soburi soburi commented May 31, 2025

This reverts commit 05401b3.

Introducing c-std setting with CMake way in the commit, but the actual command line is below.

arm-zephyr-eabi-gcc -DKERNEL ... -std=gnu11 ...  -std=c99 ...

The setting CONFIG_STD_C99 in Kconfig appends the -std=c99, and (At least in gcc,) options are processed last-come-first, so this setting was meaningless.

This will cause a build error,
https://github.com/zephyrproject-rtos/zephyr/actions/runs/15357763548/job/43220292776?pr=90893
so we will revert it.

@soburi
Copy link
Member Author

soburi commented May 31, 2025

@RobinKastberg

Here, we want to maintain C99 compliance for the Zephyr source,
but hal_rpi_pico assumes gcc11, so we use gcc11 only when compiling sources under the modules/hal_rpi_pico.
(If it is not a GCC extension, C24 that includes the 'typeof' operator specs is required)
The CMake method cannot be used, and since we want to enforce C99 compatibility for the Zephyr code, setting the Kconfig value is also undesirable.
It's a workaround of sorts, but a reasonable compromise for the current situation.

Would you consider fixing this as an individual case for IAR?

I have marked this PR as a DNM for now. Please let me know if there are no problems.

…ent way."

This reverts commit 05401b3.

Introducing c-std setting with CMake way in the commit,
but the actual command line is below.

```
arm-zephyr-eabi-gcc -DKERNEL ... -std=gnu11 ...  -std=c99 ...
```

The setting `CONFIG_STD_C99` in Kconfig appends the `-std=c99`,
and (At least in gcc,) options are processed last-come-first,
so this setting was meaningless.

This will cause a build error, so we will revert it.

Signed-off-by: TOKITA Hiroshi <tokita.hiroshi@gmail.com>
@soburi soburi force-pushed the revert_hal_rpi_pico_cstd11 branch from 096efb5 to fd3174e Compare May 31, 2025 01:58
@soburi soburi self-assigned this May 31, 2025
@soburi soburi added the DNM This PR should not be merged (Do Not Merge) label May 31, 2025
@soburi soburi marked this pull request as ready for review May 31, 2025 02:29
@github-actions github-actions bot added size: XS A PR changing only a single line of code platform: Raspberry Pi Pico Raspberry Pi Pico (RPi Pico) labels May 31, 2025
@github-actions github-actions bot requested review from ajf58, ThreeEights and yonsch May 31, 2025 02:30
@soburi soburi requested a review from fabiobaltieri May 31, 2025 02:30
Copy link

@soburi soburi requested a review from RobinKastberg May 31, 2025 19:12
@RobinKastberg
Copy link
Contributor

How unfortunate. However it's not like IAR is currently working on pico and it's currently not our priority to fix so feel free to revert this.

If you could make it a generator expression or check CMAKE_C_COMPILER_ID we wouldn't have to fix it again later however.

@soburi soburi removed the DNM This PR should not be merged (Do Not Merge) label May 31, 2025
@soburi
Copy link
Member Author

soburi commented May 31, 2025

How unfortunate. However it's not like IAR is currently working on pico and it's currently not our priority to fix so feel free to revert this.

If you could make it a generator expression or check CMAKE_C_COMPILER_ID we wouldn't have to fix it again later however.

Thanks. Once, I'll proceed with the current policy.
I will consider how to respond separately.

@dancollins
Copy link
Contributor

I will also get a chance to test this fix. I know setting GNU_COMPILER_EXTENIONS allows the tests to build, and the issue was caused by exactly what is mentioned at the top - both standards being applied during compilation.

Thoughts on adding a warning or error when building pico SDK without GCC? That way, when we're using other toolchains, CMake will let you know at build-time.

@dkalowsk dkalowsk merged commit 1e14953 into zephyrproject-rtos:main Jun 4, 2025
37 of 38 checks passed
@soburi soburi deleted the revert_hal_rpi_pico_cstd11 branch June 4, 2025 04:33
@RobinKastberg
Copy link
Contributor

Thoughts on adding a warning or error when building pico SDK without GCC? That way, when we're using other toolchains, CMake will let you know at build-time.

Feel free, but I think it's kind of drastic. pico sdk has had support for other toolchains in the past, but seems to have rotten somewhat.
e.g. see https://github.com/zephyrproject-rtos/hal_rpi_pico/blob/7b57b24588797e6e7bf18b6bda168e6b96374264/src/rp2_common/pico_platform_compiler/include/pico/platform/compiler.h

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
platform: Raspberry Pi Pico Raspberry Pi Pico (RPi Pico) size: XS A PR changing only a single line of code
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants