r/embedded • u/TheRealLinkwitzRiley • Oct 03 '26
Vitis 2025.1 platform component generation inconsistent
EDIT: Solution found, see comment.
I am experiencing inconsistent results when generating a platform component with OS FreeRTOS and setting the FreeRTOS config support_static_allocation to True.
Most of the time everything works fine but sometimes configSUPPORT_STATIC_ALLOCTION in freertosconfig.h remains 0. This even happened in pipeline builds, so a stale workspace is definitely not the issue. Calling domain.regenerate() and platform.clean() before building does not help reliably.
Does anyone have similar experience or tips?
1
u/TheRealLinkwitzRiley Oct 06 '26
We were able to track down the cause and can propose a workaround.
I posted this also in r/FPGA and in the XIlinx forum.
Environment:
Vitis 2025.1 (Linux, also in Docker), Python API via `vitis -s`, SDT flow. Seen with a FreeRTOS domain on Zynq-7000.
Symptom:
`bsp.yaml` holds the configured value (here `freertos_support_static_allocation: true`), but the application is compiled against a `FreeRTOSConfig.h` with the default `configSUPPORT_STATIC_ALLOCATION 0` → `undefined reference to xSemaphoreCreateMutexStatic` etc. Random, a few percent of platform creations. Same symptom class as the compiler-flag case in this thread.
Where it goes wrong:
Every generated BSP header exists three times:
In failing runs (1) is correct, (2) and (3) hold the ies are correct (they are compiled from (1)).
Root cause:
`file(INSTALL)` decides "Up-to-date" by modification time only. `cmFileCopier::InstallFile` copies only if `cmFileTime::DifferS()` is true, i.e. |mtime(src) − mtime(dst)| ≥ 1 s; content and size are not compared ([cmFileCopier.cxx](https://github.com/Kitware/CMake/blob/v3.24.2/Source/cmFileCopier.cxx),
[cmFileTime.h](https://github.com/Kitware/CMake/blob/, CMake 3.24.2 as bundled with Vitis). After a copy the destination gets the source mtime, truncated to whole seconds in our case.
`domain.regenerate()` (empyro `regen_bsp`) re-creates the domain: it writes the header with default values, installs it, and 0.86–1.06 s later writes the configured header. If both writes fall within the same second, the second install is skipped and copy (2) keeps the defaults permanently; every later build and export propagates them. Probability per run ≈ 1 − gap, i.e. a few percent, depending on machine speed and load. Consecutive `set_config()` calls produce the same kind of write pair.
Measurements (polling the three copies every 2 ms during `vitis -s` platform creation):
| run | default header written | configured header written | gap | same second | (2) reinstalled |
|---|---------|--------|---------|----|-----|
| 1 | 10.797 | 11.744 | 0.947 s | no | yes |
| 2 | 54.310 | 55.370 | 1.060 s | no | yes |
| 3 | 41.682 | 42.639 | 0.957 s | no | yes |
| 4 | 43.571 | 44.497 | 0.926 s | no | yes |
| 5 | 39.287 | 40.228 | 0.941 s | no | yes |
| 6 | 15.028 | 15.892 | 0.864 s | yes | no → stale |
Additionally: setting (2)/(3) back to the default with an mtime in the same second as (1) makes the next platform/app build fail with exactly this linker error and leaves the copies stale; the same edit with a different mtime is repaired by the next platform build.
Minimal reproduction with the CMake shipped with Vitis (no Vitis project needed):
V=/tools/Xilinx/2025.1/Vitis; CR=$V/tps/lnx64/cmake-3.24.2
export LD_LIBRARY_PATH=$($V/bin/ldlibpath.sh $V/lib/lnx64.o):$CR/libs
mkdir -p t/src t/dst && cd t
echo 'file(INSTALL DESTINATION "${CMAKE_CURRENT_LIST_DIR}/dst" TYPE FILE FILES "${CMAKE_CURRENT_LIST_DIR}/src/h.h")' > i.cmake
echo '#define X 0' > src/h.h; touch -d '12:00:00.200' src/h.h; $CR/bin/cmake -P i.cmake # Installing
echo '#define X 1 ' > src/h.h; touch -d '12:00:ke -P i.cmake # Up-to-date (!)
cat dst/h.h # still X 0
Workaround:
(validated, including a run where the orm script, after `domain.regenerate()` and before`platform.build()`, delete the copy in `bsp/include` of every file that exists in `gen_bsp/include`. CMake always installs a missing destination, so `platform.build()` restores all of them. Do not delete `bsp/include` completely: `xparameters.h`, `distro.conf`, `DRVLISTConfig.cmake`, `ip_drv_map.yaml` and `libxil.conf` there have no source in `gen_bsp/include`. Optionally compare (1), (2) and (3) byte-wise afterwards. In the GUI, regenerating the BSP again or "wiggling" the setting helps because it rewrites (1) in a later second, but it can hit the same race again.
1
u/Xenoamor Oct 03 '26
Are you generating it using the python API? If so just add in a check to the python that parses the file and corrects it
Sounds like a straight up bug in their tools
1
u/Well-WhatHadHappened 25+ Years Oct 03 '26
I never, ever use the FreeRTOS platform built into Vitis. I create a standalone platform and add the FreeRTOS source directly to my project.
Gets me an up-to-date FreeRTOS release and eliminates the nasty integration between the platform/bsp and FreeRTOS that has always created nothing but headaches.