Skip to content

boards/xg23-pk6068a: remove HFXO_FREQ and LFXO_FREQ#22295

Merged
basilfx merged 2 commits into
RIOT-OS:masterfrom
basilfx:feature/efm32_fix_hfxo_clock
May 19, 2026
Merged

boards/xg23-pk6068a: remove HFXO_FREQ and LFXO_FREQ#22295
basilfx merged 2 commits into
RIOT-OS:masterfrom
basilfx:feature/efm32_fix_hfxo_clock

Conversation

@basilfx
Copy link
Copy Markdown
Member

@basilfx basilfx commented May 13, 2026

Contribution description

Prior to the use of Gecko SDK 4.5, RIOT shipped with patched vendor files, such as system_xxx.c. These system files included periph_config.h, which allowed one to redefine HFXO_FREQ and LFXO_FREQ.

This was not intended, and other EFM32-based boards documented this to redefine this using compiler defines. After all, a board configuration is considered to be somewhat pre-defined and static.

With the new Gecko SDK 4.5, this (unintended) feature got lost for the xg23-pk6068a board. To bring it in-line with the other boards, remove the defines, and document how it should be used. Do note that, for some reason, Silicon Labs decided not to prefix the aforementioned defines with EFM32_.

Within the codebase, LFXO_FREQ was used for ztimer configuration. Similar to the other boards, this has been replaced with a static value.

Behind the scenes, the vendor system_xxx.c file will still use the same values.

Testing procedure

The compiler defines are equal to the values used in system_efr32zg.c, so there is effectively no change if you don't override these values. See https://github.com/basilfx/RIOT-gecko-sdk/blob/master/dist/platform/Device/SiliconLabs/EFR32ZG23/Source/system_efr32zg23.c.

I do not own this board, so I cannot test if the documented alternative works.

Issues/PRs references

Regression introduced in #22040
Fixes #22283

Declaration of AI-Tools / LLMs usage:

AI-Tools / LLMs that were used are:

  • none

@basilfx basilfx requested a review from jia200x as a code owner May 13, 2026 14:52
@github-actions github-actions Bot added Area: doc Area: Documentation Area: boards Area: Board ports labels May 13, 2026
@basilfx basilfx added Type: bug The issue reports a bug / The PR fixes a bug (including spelling errors) CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR labels May 13, 2026
@basilfx basilfx force-pushed the feature/efm32_fix_hfxo_clock branch from 5871753 to 5d6b27f Compare May 13, 2026 17:36
@github-actions github-actions Bot added the Area: tools Area: Supplementary tools label May 13, 2026
@riot-ci
Copy link
Copy Markdown

riot-ci commented May 13, 2026

Murdock results

✔️ PASSED

dc9133c dist/tools/doccheck: remove warnings

Success Failures Total Runtime
554 0 554 05m:37s

Artifacts

@basilfx basilfx force-pushed the feature/efm32_fix_hfxo_clock branch from 5d6b27f to 659ad66 Compare May 15, 2026 19:32
@basilfx
Copy link
Copy Markdown
Member Author

basilfx commented May 19, 2026

The only validation I can do, is to see if the variables end up at the right place. That's the case:

$ CFLAGS="-DHFXO_FREQ=notanint -DLFXO_FREQ=123456789123456789" BOARD=xg23-pk6068a make -j14
Building application "default" for "xg23-pk6068a" with CPU "efm32".

"make" -C pkg/cmsis/
"make" -C pkg/gecko_sdk/
"make" -C build/pkg/gecko_sdk/dist
"make" -C build/pkg/gecko_sdk/dist/platform/common
"make" -C build/pkg/gecko_sdk/dist/platform/emlib
"make" -C build/pkg/gecko_sdk/dist/platform/emlib-extra
"make" -C pkg/mpaland-printf/
"make" -C build/pkg/mpaland-printf -f pkg/mpaland-printf/mpaland-printf.mk
"make" -C boards
"make" -C boards/xg23-pk6068a
"make" -C core
"make" -C core/lib
"make" -C cpu/efm32
"make" -C drivers
"make" -C sys
"make" -C boards/common/init
"make" -C sys/auto_init
"make" -C drivers/periph_common
"make" -C sys/div
"make" -C drivers/saul
"make" -C sys/fmt
"make" -C drivers/saul/init_devs
"make" -C sys/isrpipe
"make" -C sys/libc
"make" -C sys/malloc_thread_safe
"make" -C sys/newlib_syscalls_default
"make" -C sys/phydat
"make" -C sys/pm_layered
"make" -C sys/preprocessor
"make" -C sys/ps
"make" -C sys/saul_reg
"make" -C cpu/cortexm_common
"make" -C sys/shell
"make" -C sys/shell/cmds
"make" -C sys/stdio
"make" -C sys/stdio_uart
"make" -C sys/tsrb
"make" -C cpu/cortexm_common/periph
"make" -C cpu/efm32/families/efr32zg23
"make" -C cpu/efm32/periph
In file included from <command-line>:
examples/basic/default/bin/xg23-pk6068a/riotbuild/riotbuild.h:18:19: error: unsigned conversion from 'long long int' to 'uint32_t' {aka 'long unsigned int'} changes value from '123456789123456789' to '2899336981' [-Werror=overflow]
   18 | #define LFXO_FREQ 123456789123456789
      |                   ^~~~~~~~~~~~~~~~~~
build/pkg/gecko_sdk/dist/platform/Device/SiliconLabs/EFR32ZG23/Source/system_efr32zg23.c:98:35: note: in expansion of macro 'LFXO_FREQ'
   98 | static uint32_t SystemLFXOClock = LFXO_FREQ;
      |                                   ^~~~~~~~~
build/pkg/gecko_sdk/dist/platform/Device/SiliconLabs/EFR32ZG23/Source/system_efr32zg23.c: In function 'SystemMaxCoreClockGet':
examples/basic/default/bin/xg23-pk6068a/riotbuild/riotbuild.h:17:19: error: 'notanint' undeclared (first use in this function)
   17 | #define HFXO_FREQ notanint
      |                   ^~~~~~~~
build/pkg/gecko_sdk/dist/platform/Device/SiliconLabs/EFR32ZG23/Source/system_efr32zg23.c:438:31: note: in expansion of macro 'HFXO_FREQ'
  438 |   return(HFRCODPLL_MAX_FREQ > HFXO_FREQ \
      |                               ^~~~~~~~~
examples/basic/default/bin/xg23-pk6068a/riotbuild/riotbuild.h:17:19: note: each undeclared identifier is reported only once for each function it appears in
   17 | #define HFXO_FREQ notanint
      |                   ^~~~~~~~
build/pkg/gecko_sdk/dist/platform/Device/SiliconLabs/EFR32ZG23/Source/system_efr32zg23.c:438:31: note: in expansion of macro 'HFXO_FREQ'
  438 |   return(HFRCODPLL_MAX_FREQ > HFXO_FREQ \
      |                               ^~~~~~~~~
cc1: all warnings being treated as errors
make[3]: *** [Makefile.base:162: examples/basic/default/bin/xg23-pk6068a/cpu_efr32zg23/build/pkg/gecko_sdk/dist/platform/Device/SiliconLabs/EFR32ZG23/Source/system_efr32zg23.o] Error 1
make[3]: *** Waiting for unfinished jobs....
make[2]: *** [Makefile.base:31: ALL--cpu/efm32/families/efr32zg23] Error 2
make[2]: *** Waiting for unfinished jobs....
make[1]: *** [Makefile.base:31: ALL--cpu/efm32] Error 2
make: *** [examples/basic/default/../../../Makefile.include:743: application_default.module] Error 2

@basilfx basilfx added this pull request to the merge queue May 19, 2026
@github-merge-queue github-merge-queue Bot removed this pull request from the merge queue due to failed status checks May 19, 2026
basilfx added 2 commits May 19, 2026 18:33
Prior to the use of Gecko SDK 4.5, RIOT shipped with patched vendor
files, such as `system_xxx.c`. These system files included
`periph_config.h`, which allowd one to redefine `HFXO_FREQ` and
`LFXO_FREQ`.

This was not intended, and other EFM32-based boards documented this to
redefine this using compiler defines. After all, a board configuration
is considered to be somewhat pre-defined and static.

With the new Gecko SDK 4.5, this (unintended) feature got lost for the
`xg23-pk6068a` board. To bring it in-line with the other boards,
remove the defines, and document how it should be used.

Within the codebase, `LFXO_FREQ` was used for ztimer configuration.
Similar to the other boards, this has been replaced with a static
value.

Behind the scenes, the vendor `system_xxx.c` file will still use the
same values.
@basilfx basilfx force-pushed the feature/efm32_fix_hfxo_clock branch from 659ad66 to dc9133c Compare May 19, 2026 16:33
@basilfx
Copy link
Copy Markdown
Member Author

basilfx commented May 19, 2026

Rebased to see if this fixes the build sanity checks:

  	Update manifest digest to 84746b38b9a6248a21bfa2f9bd4d7a052870c35a689d9b32a06be2f5d7042156:
  		makefiles/docker.inc.mk:8:DOCKER_TESTED_IMAGE_REPO_DIGEST := b932e0079de853104bdb579a35d5a02d8613c87dc30130c67b03aa3b2027fd26

@basilfx basilfx enabled auto-merge May 19, 2026 16:34
@crasbe
Copy link
Copy Markdown
Contributor

crasbe commented May 19, 2026

No, merging this would fix it though: #22307

I merged some PRs for the RIOT docker container.

@crasbe
Copy link
Copy Markdown
Contributor

crasbe commented May 19, 2026

And since #22255 was merged, you don't even have to rebase afterwards. Just rerun the static test job.

@basilfx basilfx added this pull request to the merge queue May 19, 2026
Merged via the queue into RIOT-OS:master with commit bb6407b May 19, 2026
26 of 28 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Area: boards Area: Board ports Area: doc Area: Documentation Area: tools Area: Supplementary tools CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR Type: bug The issue reports a bug / The PR fixes a bug (including spelling errors)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

cpu/efr32: Invalid HFXO_FREQ after #22040

4 participants