Skip to content

Normalize system_architecture across platforms#2171

Open
petermm wants to merge 1 commit intoatomvm:release-0.7from
petermm:fix-system_architecture
Open

Normalize system_architecture across platforms#2171
petermm wants to merge 1 commit intoatomvm:release-0.7from
petermm:fix-system_architecture

Conversation

@petermm
Copy link
Contributor

@petermm petermm commented Mar 8, 2026

Normalize erlang:system_info(system_architecture) to a consistent
arch-vendor-os format across platforms.

Before

Values were inconsistent and sometimes poorly ordered, for example:

  • generic Unix: Darwin-25.3.0-arm64
  • some embedded builds: Generic--

After

Values now use normalized compiler-target-style strings with exactly
two hyphens, for example:

  • generic Unix: arm64-apple-darwin25.3.0
  • ESP32: xtensa-esp-esp_idf
  • RP2: arm-rp2-none
  • STM32: arm-stm32-none

Changes

  • add a shared CMake helper to normalize the compiler target string
  • use the normalized value when reporting system_architecture
  • add/update tests for generic Unix and ESP32

Fixes: #1371

These changes are made under both the "Apache 2.0" and the "GNU Lesser General
Public License 2.1 or later" license terms (dual license).

SPDX-License-Identifier: Apache-2.0 OR LGPL-2.1-or-later

@petermm petermm force-pushed the fix-system_architecture branch 5 times, most recently from 8b53a90 to a620188 Compare March 12, 2026 17:02
@petermm petermm changed the title Fix esp32 system_architecture reporting Normalize system_architecture across platforms Mar 12, 2026
@petermm
Copy link
Contributor Author

petermm commented Mar 12, 2026

Ok, made it a make things correct PR, instead of following previous patterns.

So reworked it completely - guaranteeing 3 parts/2 hyphens return, sanitised, stm32,rp2 etc

Nitpicks can be had - should arm64 be normalised to aarch64, should elf/eabi be replaced by xyz.

@bettio bettio added this to the v0.7.0 milestone Mar 14, 2026
@petermm petermm force-pushed the fix-system_architecture branch 2 times, most recently from 4b16aba to 5dae26c Compare March 20, 2026 18:42
@petermm petermm changed the base branch from main to release-0.7 March 20, 2026 18:42
Normalize system_architecture to arch-vendor-os form.

Use compiler target strings where available and normalize them to
exactly three components across generic Unix, Emscripten, ESP32,
RP2, and STM32.

Add a shared CMake helper for normalization, keep platform-specific
vendor tags for RP2 and STM32, and extend system_architecture tests
for generic Unix and ESP32.

Signed-off-by: Peter M <petermm@gmail.com>
@petermm petermm force-pushed the fix-system_architecture branch from 5dae26c to 452cf0c Compare March 20, 2026 19:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

esp32: system_architecture returns <<"Generic--">>

2 participants