Compilation errors when migrating from SDK 2.1.x to 2.5.x: [-Werror=strict-prototypes], [-Werror=unused-parameter], [-Werror=ignored-qualifiers]

Hi.

I am updating an nrf9160 B1 project on a custom board in SDK 2.1.0 to SDK 2.5.3, and I am running into a problem when building. This error does not show up when building for 2.1.0 to 2.1.3. When compiling I get a lot of errors from the different libraries, both from zephyr and nrf, here is an example for each type:

/home/user/ncs/v2.5.3/zephyr/include/zephyr/sys/cbprintf.h:302:1: error: function declaration isn't a prototype [-Werror=strict-prototypes]
  302 | typedef int (*cbprintf_cb)(/* int c, void *ctx */);
      | ^~~~~~~

/home/user/ncs/v2.5.3/zephyr/include/zephyr/net/net_mgmt.h:268:51: error: unused parameter 'timeout' [-Werror=unused-parameter]
  268 |                                       k_timeout_t timeout)
      |                                       ~~~~~~~~~~~~^~~~~~~

and

/home/user/ncs/v2.5.3/zephyr/include/zephyr/net/wifi.h:400:1: error: type qualifiers ignored on function return type [-Werror=ignored-qualifiers]
  400 | const char * const wifi_ps_wakeup_mode_txt(enum wifi_ps_wakeup_mode ps_wakeup_mode);
      | ^~~~~

These errors show up many places in different libraries in both Zephyr and nrf libriares. Both newlib and picolibc flag the same errors. It seems that there is some CMake list somewhere adding these as compile options, but it's not in any of mine. I cannot seem to find out what these stem from. Using west does not seem to yield different results.
Here are some of the options that I see added when building runs ncs/toolchains/7795df4459/opt/zephyr-sdk/arm-zephyr-eabi/bin/arm-zephyr-eabi-gcc

-Wall -Wextra -Werror -Wmissing-braces -Wmissing-field-initializers -Wswitch-default -Wswitch-enum
-Wimplicit-fallthrough=3 -Wpointer-arith -Wbad-function-cast -Wstrict-overflow=5 -Wformat=2 
-Wformat-security -Wformat-overflow=2 -Wshadow -Wcast-qual -Wcast-align -Wnested-externs 
-Wunreachable-code -Wlogical-op -Wfloat-equal -Wdouble-promotion -Wstrict-prototypes 
-Wmissing-prototypes -Wundef -Wuninitialized -Winit-self -Wduplicated-branches

I am using VS Code 1.90.2 on Fedora 40, with NRF SDK 2.5.3 and toolchain 2.5.3.

Here's a general idea of the changes I've made when migrating:

  • Changed includes throughout my project
  • Removed CONFIG_PM
  • Changed AGPS to AGNSS in configs and source files
  • Added CONFIG_FLASH_MAP=y and CONFIG_STREAM_FLASH=y

Note: I have redone the entire migration (done it twice) to make sure that I didn't miss anything.

What could be the issue? If you have any docs or anything at all I would greatly appreciate it.
Sincerely,
Smul.

Related