[libc-commits] [libc] [libc] Prepare baremetal Armv8.1-M.Main no-FP CMake cache file for running tests (PR #243440)

Victor Campos via libc-commits libc-commits at lists.llvm.org
Tue Nov 17 04:07:04 PST 2026


https://github.com/vhscampos created https://github.com/llvm/llvm-project/pull/243440

None

>From 94c93ea998989061c987845d89b85a0d2a216e2a Mon Sep 17 00:00:00 2001
From: Victor Campos <victor.campos at arm.com>
Date: Tue, 17 Nov 2026 11:30:31 +0000
Subject: [PATCH] [libc] Prepare baremetal Armv8.1-M.Main no-FP CMake cache
 file for running tests

---
 .../caches/armv8.1m.main-none-eabi.cmake      | 48 ++++++++++++++++++-
 1 file changed, 47 insertions(+), 1 deletion(-)

diff --git a/libc/cmake/caches/armv8.1m.main-none-eabi.cmake b/libc/cmake/caches/armv8.1m.main-none-eabi.cmake
index 09e87b6d12553e..1f64f17ecdfb15 100644
--- a/libc/cmake/caches/armv8.1m.main-none-eabi.cmake
+++ b/libc/cmake/caches/armv8.1m.main-none-eabi.cmake
@@ -1,8 +1,54 @@
 set(CMAKE_SYSTEM_PROCESSOR arm CACHE STRING "")
 set(RUNTIMES_TARGET_TRIPLE "armv8.1m.main-none-eabi" CACHE STRING "")
+set(LLVM_LIBC_FULL_BUILD ON CACHE BOOL "")
 
 foreach(lang C;CXX;ASM)
-  set(CMAKE_${lang}_FLAGS "-mfloat-abi=hard -march=armv8.1-m.main+mve.fp+fp.dp -mcpu=cortex-m55" CACHE STRING "")
+  set(CMAKE_${lang}_FLAGS "-march=armv8.1m.main+nomve -mcpu=cortex-m55 -mfloat-abi=soft" CACHE STRING "")
 endforeach()
 
+# Offload the errno definition to libc
+set(LIBC_CONF_ERRNO_MODE LIBC_ERRNO_MODE_SHARED CACHE STRING "")
+# Enable floating-point conversions in printf. This became practical with the
+# introduction of float320.
+set(LIBC_CONF_PRINTF_DISABLE_FLOAT OFF CACHE BOOL "")
+set(LIBC_CONF_PRINTF_FLOAT_TO_STR_USE_FLOAT320 ON CACHE BOOL "")
+# Discard unused printf functionality
+set(LIBC_CONF_PRINTF_MODULAR ON CACHE BOOL "")
+
+# Configs for testing and applications are only done if compiler-rt is enabled,
+# as the latter is a dependency for full programs.
+if(compiler-rt IN_LIST LLVM_ENABLE_RUNTIMES)
+  set(LLVM_INCLUDE_TESTS ON CACHE BOOL "")
+  set(LIBC_TEST_BUILTINS_TARGET "clang_rt.builtins-armv8.1m.main" CACHE STRING "")
+
+  # Memory mappings
+  set(__boot_flash 0x00000000)
+  set(__boot_flash_size 0x80000)
+  set(__flash 0x60000000)
+  set(__flash_size 0x1000000)
+  set(__ram 0x61000000)
+  set(__ram_size 0x1000000)
+  set(__stack_size 0x20000)
+  set(SYMBOLS
+    __boot_flash
+    __boot_flash_size
+    __flash
+    __flash_size
+    __ram
+    __ram_size
+    __stack_size
+  )
+
+  set(DEFSYM_ARGS "")
+  foreach(symbol IN LISTS SYMBOLS)
+    list(APPEND DEFSYM_ARGS "-Wl,--defsym=${symbol}=${${symbol}}")
+  endforeach()
+
+  set(LINKER_SCRIPT "${CMAKE_CURRENT_LIST_DIR}/../../test/UnitTest/llvm-libc-baremetal.ld")
+
+  set(LIBC_TEST_LINK_OPTIONS_DEFAULT "-T;${LINKER_SCRIPT};${DEFSYM_ARGS}" CACHE STRING "")
+
+  set(LIBC_TEST_CMD "qemu-system-arm -M mps3-an547 -cpu cortex-m55 -chardev stdio,mux=on,id=stdio0 -semihosting-config enable=on,chardev=stdio0 -monitor none -serial none -nographic -kernel @BINARY@" CACHE STRING "")
+endif()
+
 include(${CMAKE_CURRENT_LIST_DIR}/baremetal_common.cmake)



More information about the libc-commits mailing list