Skip to content

Commit 64badd3

Browse files
committed
Merge pull request atomvm#2055 from bettio/mcu-disable-old-otp-versions
Start phasing out old OTP versions Start disabling them on MCU targets. 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
2 parents 3d6e706 + 68968c9 commit 64badd3

File tree

7 files changed

+16
-1
lines changed

7 files changed

+16
-1
lines changed

CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ find_package(Erlang)
2828
find_package(Elixir)
2929
find_package(Gleam)
3030

31+
option(AVM_ENABLE_OLD_OTP_VERSIONS "Enable OTP version < 26" ON)
3132
option(AVM_DISABLE_FP "Disable floating point support." OFF)
3233
option(AVM_DISABLE_SMP "Disable SMP." OFF)
3334
option(AVM_DISABLE_TASK_DRIVER "Disable task driver support." OFF)

src/libAtomVM/CMakeLists.txt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -199,6 +199,12 @@ if(AVM_SELECT_IN_TASK)
199199
target_compile_definitions(libAtomVM PUBLIC AVM_SELECT_IN_TASK)
200200
endif()
201201

202+
# Start phasing out old OTP versions
203+
if(NOT AVM_ENABLE_OLD_OTP_VERSIONS)
204+
target_compile_definitions(libAtomVM PUBLIC MINIMUM_OTP_COMPILER_VERSION=26)
205+
target_compile_definitions(libAtomVM PUBLIC MAXIMUM_OTP_COMPILER_VERSION=29)
206+
endif()
207+
202208
include(CheckIncludeFile)
203209
CHECK_INCLUDE_FILE(stdatomic.h STDATOMIC_INCLUDE)
204210
include(CheckCSourceCompiles)

src/libAtomVM/opcodesswitch.h

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,12 @@
4949

5050
// These constants can be used to reduce the size of the VM for a specific
5151
// range of compiler versions
52+
#ifndef MINIMUM_OTP_COMPILER_VERSION
5253
#define MINIMUM_OTP_COMPILER_VERSION 21
53-
#define MAXIMUM_OTP_COMPILER_VERSION 26
54+
#endif
55+
#ifndef MAXIMUM_OTP_COMPILER_VERSION
56+
#define MAXIMUM_OTP_COMPILER_VERSION 29
57+
#endif
5458

5559
#ifdef __cplusplus
5660
extern "C" {

src/platforms/emscripten/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ if (NOT CMAKE_TOOLCHAIN_FILE)
2929
endif ()
3030

3131
# Options that make sense for this platform
32+
option(AVM_ENABLE_OLD_OTP_VERSIONS "Enable OTP version < 26" ON)
3233
option(AVM_DISABLE_SMP "Disable SMP." OFF)
3334
option(AVM_USE_32BIT_FLOAT "Use 32 bit floats." OFF)
3435
option(AVM_VERBOSE_ABORT "Print module and line number on VM abort" OFF)

src/platforms/esp32/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@ if (-std=gnu99 IN_LIST c_compile_options )
8080
endif()
8181

8282
# Options that make sense for this platform
83+
option(AVM_ENABLE_OLD_OTP_VERSIONS "Enable OTP version < 26" OFF)
8384
option(AVM_DISABLE_SMP "Disable SMP." OFF)
8485
option(AVM_USE_32BIT_FLOAT "Use 32 bit floats." OFF)
8586
option(AVM_VERBOSE_ABORT "Print module and line number on VM abort" OFF)

src/platforms/rp2/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ set(HAVE_EXECVE "" CACHE INTERNAL "Have symbol execve" FORCE)
5858
set(HAVE_GETCWD "" CACHE INTERNAL "Have symbol getcwd" FORCE)
5959

6060
# Options that make sense for this platform
61+
option(AVM_ENABLE_OLD_OTP_VERSIONS "Enable OTP version < 26" OFF)
6162
option(AVM_DISABLE_SMP "Disable SMP support." OFF)
6263
option(AVM_USE_32BIT_FLOAT "Use 32 bit floats." OFF)
6364
option(AVM_VERBOSE_ABORT "Print module and line number on VM abort" OFF)

src/platforms/stm32/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/../../../CMakeModules
2525
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR})
2626

2727
# Options that make sense for this platform
28+
option(AVM_ENABLE_OLD_OTP_VERSIONS "Enable OTP version < 26" OFF)
2829
option(AVM_USE_32BIT_FLOAT "Use 32 bit floats." ON)
2930
option(AVM_VERBOSE_ABORT "Print module and line number on VM abort" OFF)
3031
option(AVM_CREATE_STACKTRACES "Create stacktraces" ON)

0 commit comments

Comments
 (0)