Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@ table.
### Fixed

- ESP32: improved sntp sync speed from a cold boot.
- ESP32: fixed `erlang:system_info(system_architecture)` to report `esp_idf-<version>-<arch>`
- Fixed `gen_server` internal messages to match OTP so it works across erlang distribution
- Utilize reserved `phy_init` partition on ESP32 to store wifi calibration for faster connections.
- Support for zero count in `lists:duplicate/2`.
Expand Down
12 changes: 12 additions & 0 deletions src/libAtomVM/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -310,6 +310,18 @@ else()
set(ATOMVM_VERSION ${ATOMVM_BASE_VERSION})
endif()

if (NOT DEFINED AVM_SYSTEM_NAME)
set(AVM_SYSTEM_NAME "${CMAKE_SYSTEM_NAME}")
endif()

if (NOT DEFINED AVM_SYSTEM_VERSION)
set(AVM_SYSTEM_VERSION "${CMAKE_SYSTEM_VERSION}")
endif()

if (NOT DEFINED AVM_SYSTEM_ARCHITECTURE)
set(AVM_SYSTEM_ARCHITECTURE "${CMAKE_SYSTEM_PROCESSOR}")
endif()

# Add include to directory where avm_version.h is generated so targets linking
# libAtomVM can access it
target_include_directories(libAtomVM PUBLIC ${CMAKE_CURRENT_BINARY_DIR})
Expand Down
6 changes: 3 additions & 3 deletions src/libAtomVM/version.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
* SPDX-License-Identifier: Apache-2.0 OR LGPL-2.1-or-later
*/

#define SYSTEM_NAME "${CMAKE_SYSTEM_NAME}"
#define SYSTEM_VERSION "${CMAKE_SYSTEM_VERSION}"
#define SYSTEM_ARCHITECTURE "${CMAKE_SYSTEM_PROCESSOR}"
#define SYSTEM_NAME "${AVM_SYSTEM_NAME}"
#define SYSTEM_VERSION "${AVM_SYSTEM_VERSION}"
#define SYSTEM_ARCHITECTURE "${AVM_SYSTEM_ARCHITECTURE}"
#define ATOMVM_VERSION "${ATOMVM_VERSION}"
8 changes: 8 additions & 0 deletions src/platforms/esp32/components/libatomvm/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,14 @@ idf_component_register(INCLUDE_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/../../../../lib
# "pedantic" flag should be disabled rather poluting diagnostics with warnings caused from 3rd party
option(AVM_PEDANTIC_WARNINGS "Pedantic compiler warnings" OFF)

set(AVM_SYSTEM_NAME "esp_idf")
set(AVM_SYSTEM_VERSION "${IDF_VERSION_MAJOR}.${IDF_VERSION_MINOR}.${IDF_VERSION_PATCH}")
if (CONFIG_IDF_TARGET_ARCH_RISCV)
set(AVM_SYSTEM_ARCHITECTURE "riscv32")
else()
set(AVM_SYSTEM_ARCHITECTURE "xtensa")
endif()

add_subdirectory("${CMAKE_CURRENT_SOURCE_DIR}/../../../../libAtomVM" "libAtomVM")

# Add directory with platform_atomic.h if we mean to use it
Expand Down
2 changes: 2 additions & 0 deletions src/platforms/esp32/test/main/test_erl_sources/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ compile_erlang(test_rtc_slow)
compile_erlang(test_select)
compile_erlang(test_socket)
compile_erlang(test_ssl)
compile_erlang(test_system_architecture)
compile_erlang(test_time_and_processes)
compile_erlang(test_twdt)
compile_erlang(test_tz)
Expand All @@ -96,6 +97,7 @@ set(erlang_test_beams
test_select.beam
test_socket.beam
test_ssl.beam
test_system_architecture.beam
test_time_and_processes.beam
test_twdt.beam
test_tz.beam
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
%
% This file is part of AtomVM.
%
% Copyright 2026 Peter M. Mehlsen <github@pmme.dk>
%
% Licensed under the Apache License, Version 2.0 (the "License");
% you may not use this file except in compliance with the License.
% You may obtain a copy of the License at
%
% http://www.apache.org/licenses/LICENSE-2.0
%
% Unless required by applicable law or agreed to in writing, software
% distributed under the License is distributed on an "AS IS" BASIS,
% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
% See the License for the specific language governing permissions and
% limitations under the License.
%
% SPDX-License-Identifier: Apache-2.0 OR LGPL-2.1-or-later
%

-module(test_system_architecture).
-export([start/0]).

start() ->
SystemArchitecture = erlang:system_info(system_architecture),
<<"esp_idf-", _/binary>> = SystemArchitecture,
ok =
case binary:match(SystemArchitecture, <<"-xtensa">>) of
{_, _} ->
ok;
nomatch ->
case binary:match(SystemArchitecture, <<"-riscv32">>) of
{_, _} -> ok
end
end,
nomatch = binary:match(SystemArchitecture, <<"-esp32">>),
ok.
6 changes: 6 additions & 0 deletions src/platforms/esp32/test/main/test_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -506,6 +506,12 @@ TEST_CASE("test_time_and_processes", "[test_run]")
TEST_ASSERT(term_to_int(ret_value) == 6);
}

TEST_CASE("test_system_architecture", "[test_run]")
{
term ret_value = avm_test_case("test_system_architecture.beam");
TEST_ASSERT(ret_value == OK_ATOM);
}

TEST_CASE("test_tz", "[test_run]")
{
term ret_value = avm_test_case("test_tz.beam");
Expand Down
Loading