llvm/libcxx/test/configs/armv7m-picolibc-libc++.cfg.in

lit_config.load_config(config, '@CMAKE_CURRENT_BINARY_DIR@/cmake-bridge.cfg')

libc_linker_script = '@CMAKE_INSTALL_PREFIX@/lib/picolibcpp.ld'

config.substitutions.append(('%{flags}', '--sysroot=@CMAKE_INSTALL_PREFIX@'))

config.substitutions.append(('%{compile_flags}',
    '-nostdinc++ -I %{include-dir} -I %{target-include-dir} -I %{libcxx-dir}/test/support'

    # Disable warnings in cxx_atomic_impl.h:
    # "large atomic operation may incur significant performance penalty; the
    # access size (4 bytes) exceeds the max lock-free size (0 bytes)"
    ' -Wno-atomic-alignment'

    # Various libc++ headers check for the definition of _NEWLIB_VERSION
    # which for picolibc is defined in picolibc.h.
    ' -include picolibc.h'
))
config.substitutions.append(('%{link_flags}',
    '-nostdlib -nostdlib++ -L %{lib-dir} -lc++ -lc++abi'
    ' -lc -lm -lclang_rt.builtins -lsemihost -lcrt0-semihost' +
    ' -T {}'.format(libc_linker_script) +
    ' -Wl,--defsym=__flash=0x0'
    ' -Wl,--defsym=__flash_size=0x400000'
    ' -Wl,--defsym=__ram=0x21000000'
    ' -Wl,--defsym=__ram_size=0x1000000'
    ' -Wl,--defsym=__stack_size=0x1000'
))

config.executor = (
    '@LIBCXX_SOURCE_DIR@/utils/qemu_baremetal.py'
    ' --qemu @QEMU_SYSTEM_ARM@'
    ' --machine mps2-an385'
    ' --cpu cortex-m3')
config.substitutions.append(('%{exec}',
    '%{executor}'
    ' --execdir %T'
))

import os, site
site.addsitedir(os.path.join('@LIBCXX_SOURCE_DIR@', 'utils'))
import libcxx.test.params, libcxx.test.config
libcxx.test.config.configure(
    libcxx.test.params.DEFAULT_PARAMETERS,
    libcxx.test.features.DEFAULT_FEATURES,
    config,
    lit_config
)