Skip to content

Commit

Permalink
Merge v7-M and v7E-M library variants (#482)
Browse files Browse the repository at this point in the history
The only differece between v7-M and v7E-M is the DSP extension, which is
not useful for the C/C++ libraries, so we can simplify things by just
having v7-M builds. This fills in a gap of (v7-M, fpv4-sp-d16,
hard-float), which we did not previously have a valid library for.
  • Loading branch information
ostannard authored Sep 3, 2024
1 parent d95a4fa commit ceabe73
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 42 deletions.
34 changes: 9 additions & 25 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1654,25 +1654,9 @@ add_library_variants_for_cpu(
)
add_library_variants_for_cpu(
armv7m
SUFFIX soft_nofp
COMPILE_FLAGS "-mfloat-abi=soft -march=armv7m -mfpu=none"
MULTILIB_FLAGS "--target=thumbv7m-unknown-none-eabi -mfpu=none"
PICOLIBC_BUILD_TYPE "minsize"
QEMU_MACHINE "mps2-an385"
QEMU_CPU "cortex-m3"
BOOT_FLASH_ADDRESS 0x00000000
BOOT_FLASH_SIZE 0x1000
FLASH_ADDRESS 0x21000000
FLASH_SIZE 0x600000
RAM_ADDRESS 0x21600000
RAM_SIZE 0xa00000
STACK_SIZE 4K
)
add_library_variants_for_cpu(
armv7em
SUFFIX hard_fpv4_sp_d16
COMPILE_FLAGS "-mfloat-abi=hard -march=armv7em -mfpu=fpv4-sp-d16"
MULTILIB_FLAGS "--target=thumbv7em-unknown-none-eabihf -mfpu=fpv4-sp-d16"
COMPILE_FLAGS "-mfloat-abi=hard -march=armv7m -mfpu=fpv4-sp-d16"
MULTILIB_FLAGS "--target=thumbv7m-unknown-none-eabihf -mfpu=fpv4-sp-d16"
PICOLIBC_BUILD_TYPE "minsize"
QEMU_MACHINE "mps2-an386"
QEMU_CPU "cortex-m4"
Expand All @@ -1685,10 +1669,10 @@ add_library_variants_for_cpu(
STACK_SIZE 4K
)
add_library_variants_for_cpu(
armv7em
armv7m
SUFFIX hard_fpv5_d16
COMPILE_FLAGS "-mfloat-abi=hard -march=armv7em -mfpu=fpv5-d16"
MULTILIB_FLAGS "--target=thumbv7em-unknown-none-eabihf -mfpu=fpv5-d16"
COMPILE_FLAGS "-mfloat-abi=hard -march=armv7m -mfpu=fpv5-d16"
MULTILIB_FLAGS "--target=thumbv7m-unknown-none-eabihf -mfpu=fpv5-d16"
PICOLIBC_BUILD_TYPE "minsize"
QEMU_MACHINE "mps2-an500"
QEMU_CPU "cortex-m7"
Expand All @@ -1705,12 +1689,12 @@ add_library_variants_for_cpu(
# no-fpu variant to win, it has to be in multilab.yaml after all other
# fpu variants. The order of variants in multilab.yaml depends on the order
# of the add_library_variant calls. So the add_library_variant that adds
# the soft_nofp for armv7em is placed after all other armv7em variants.
# the soft_nofp for armv7m is placed after all other armv7m variants.
add_library_variants_for_cpu(
armv7em
armv7m
SUFFIX soft_nofp
COMPILE_FLAGS "-mfloat-abi=soft -march=armv7em -mfpu=none"
MULTILIB_FLAGS "--target=thumbv7em-unknown-none-eabi -mfpu=none"
COMPILE_FLAGS "-mfloat-abi=soft -march=armv7m -mfpu=none"
MULTILIB_FLAGS "--target=thumbv7m-unknown-none-eabi -mfpu=none"
PICOLIBC_BUILD_TYPE "minsize"
QEMU_MACHINE "mps2-an386"
QEMU_CPU "cortex-m4"
Expand Down
4 changes: 2 additions & 2 deletions test-support/picolibc-test-wrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@
# computations on types implemented in software
# https://github.com/picolibc/picolibc/pull/500
"picolibc_armv7m_soft_fpv4_sp_d16-build/test/math_errhandling",
"picolibc_armv7em_hard_fpv4_sp_d16-build/test/math_errhandling",
"picolibc_armv7m_hard_fpv4_sp_d16-build/test/math_errhandling",
"picolibc_armv8.1m.main_hard_fp_nomve-build/test/math_errhandling",
"picolibc_armv7m_soft_fpv4_sp_d16_exn_rtti-build/test/math_errhandling",
"picolibc_armv7em_hard_fpv4_sp_d16_exn_rtti-build/test/math_errhandling",
"picolibc_armv7m_hard_fpv4_sp_d16_exn_rtti-build/test/math_errhandling",
"picolibc_armv8.1m.main_hard_fp_nomve_exn_rtti-build/test/math_errhandling",
"picolibc_armv8.1m.main_hard_nofp_mve-build/test/fenv",
"picolibc_armv8.1m.main_hard_nofp_mve-build/test/math_errhandling",
Expand Down
11 changes: 0 additions & 11 deletions test/multilib/armv7em.test

This file was deleted.

27 changes: 23 additions & 4 deletions test/multilib/armv7m.test
Original file line number Diff line number Diff line change
@@ -1,9 +1,28 @@
# RUN: %clang -print-multi-directory --target=armv7m-none-eabi -mfpu=none | FileCheck %s
# RUN: %clang -print-multi-directory --target=armv7m-none-eabi -mfpu=none -mfloat-abi=softfp | FileCheck %s
# CHECK: arm-none-eabi/armv7m_soft_nofp_exn_rtti{{$}}
# CHECK-EMPTY:
# RUN: %clang -print-multi-directory --target=armv7m-none-eabi -mfpu=none | FileCheck %s --check-prefix=NONE
# RUN: %clang -print-multi-directory --target=armv7m-none-eabi -mfpu=none -mfloat-abi=softfp | FileCheck %s --check-prefix=NONE
# RUN: %clang -print-multi-directory --target=armv7em-none-eabi -mfpu=none -mfloat-abi=softfp | FileCheck %s --check-prefix=NONE
# NONE: arm-none-eabi/armv7m_soft_nofp_exn_rtti{{$}}
# NONE-EMPTY:

# RUN: %clang -print-multi-directory --target=armv7m-none-eabi -mfpu=fpv4-sp-d16 -mfloat-abi=softfp | FileCheck --check-prefix=SOFT-FPV4 %s
# RUN: %clang -print-multi-directory --target=armv7m-none-eabi -mfpu=fpv5-d16 -mfloat-abi=softfp | FileCheck --check-prefix=SOFT-FPV4 %s
# RUN: %clang -print-multi-directory --target=armv7em-none-eabi -mfpu=fpv4-sp-d16 -mfloat-abi=softfp | FileCheck --check-prefix=SOFT-FPV4 %s
# RUN: %clang -print-multi-directory --target=armv7em-none-eabi -mfpu=fpv5-d16 -mfloat-abi=softfp | FileCheck --check-prefix=SOFT-FPV4 %s
# SOFT-FPV4: arm-none-eabi/armv7m_soft_fpv4_sp_d16_exn_rtti{{$}}
# SOFT-FPV4-EMPTY:
#
# RUN: %clang -print-multi-directory --target=armv7m-none-eabihf -mfpu=fpv4-sp-d16 | FileCheck --check-prefix=FPV4 %s
# RUN: %clang -print-multi-directory --target=armv7em-none-eabihf -mfpu=fpv4-sp-d16 | FileCheck --check-prefix=FPV4 %s
# FPV4: arm-none-eabi/armv7m_hard_fpv4_sp_d16_exn_rtti{{$}}
# FPV4-EMPTY:
#
# RUN: %clang -print-multi-directory --target=armv7m-none-eabihf -mfpu=fpv5-d16 | FileCheck --check-prefix=FPV5 %s
# RUN: %clang -print-multi-directory --target=armv7em-none-eabihf -mfpu=fpv5-d16 | FileCheck --check-prefix=FPV5 %s
# FPV5: arm-none-eabi/armv7m_hard_fpv5_d16_exn_rtti{{$}}
# FPV5-EMPTY:

# %clang -print-multi-directory --target=arm-none-eabi -mcpu=cortex-m3 | FileCheck %s --check-prefix=NONE
# %clang -print-multi-directory --target=arm-none-eabi -mcpu=cortex-m4 | FileCheck %s --check-prefix=SOFT-FPV4
# %clang -print-multi-directory --target=arm-none-eabihf -mcpu=cortex-m4 | FileCheck %s --check-prefix=FPV4
# %clang -print-multi-directory --target=arm-none-eabi -mcpu=cortex-m7 | FileCheck %s --check-prefix=SOFT-FPV4
# %clang -print-multi-directory --target=arm-none-eabihf -mcpu=cortex-m7 | FileCheck %s --check-prefix=FPV4

0 comments on commit ceabe73

Please sign in to comment.