arm: make FPU configuraton consistent

Eventually we might want to start using the FPU, but the easy option
right now is to simply disable it everywhere. Previously, it depended on
whether Clang was built as part of TinyGo or it was an external binary.
By setting the floating point mode explicitly, such inconsistencies are
avoided.

This commit creates a new cortex-m4 target which can be the central
place for setting FPU-related settings across all Cortex-M4 chips.
Этот коммит содержится в:
Ayke van Laethem 2020-05-12 20:45:58 +02:00 коммит произвёл Ron Evans
родитель 3c55689566
коммит 9f4459cee1
8 изменённых файлов: 15 добавлений и 21 удалений

Просмотреть файл

@ -69,7 +69,7 @@ func (l *Library) Load(target string) (path string, err error) {
// Precalculate the flags to the compiler invocation.
args := append(l.cflags(), "-c", "-Oz", "-g", "-ffunction-sections", "-fdata-sections", "-Wno-macro-redefined", "--target="+target, "-fdebug-prefix-map="+dir+"="+remapDir)
if strings.HasPrefix(target, "arm") || strings.HasPrefix(target, "thumb") {
args = append(args, "-fshort-enums", "-fomit-frame-pointer")
args = append(args, "-fshort-enums", "-fomit-frame-pointer", "-mfloat-abi=soft")
}
if strings.HasPrefix(target, "riscv32-") {
args = append(args, "-march=rv32imac", "-mabi=ilp32", "-fforce-enable-int128")

Просмотреть файл

@ -1,9 +1,7 @@
{
"inherits": ["cortex-m"],
"llvm-target": "armv7em-none-eabi",
"inherits": ["cortex-m4"],
"build-tags": ["atsamd51g19", "atsamd51", "sam"],
"cflags": [
"--target=armv7em-none-eabi",
"-Qunused-arguments"
],
"linkerscript": "targets/atsamd51.ld",

Просмотреть файл

@ -1,9 +1,7 @@
{
"inherits": ["cortex-m"],
"llvm-target": "armv7em-none-eabi",
"inherits": ["cortex-m4"],
"build-tags": ["atsamd51j19", "atsamd51", "sam"],
"cflags": [
"--target=armv7em-none-eabi",
"-Qunused-arguments"
],
"linkerscript": "targets/atsamd51.ld",

Просмотреть файл

@ -1,9 +1,7 @@
{
"inherits": ["cortex-m"],
"llvm-target": "armv7em-none-eabi",
"inherits": ["cortex-m4"],
"build-tags": ["sam", "atsamd51", "atsamd51j20", "atsamd51j20a"],
"cflags": [
"--target=armv7em-none-eabi",
"-Qunused-arguments"
],
"linkerscript": "targets/atsamd51j20a.ld",

8
targets/cortex-m4.json Обычный файл
Просмотреть файл

@ -0,0 +1,8 @@
{
"inherits": ["cortex-m"],
"llvm-target": "armv7em-none-eabi",
"cflags": [
"--target=armv7em-none-eabi",
"-mfloat-abi=soft"
]
}

Просмотреть файл

@ -1,10 +1,7 @@
{
"inherits": ["cortex-m"],
"llvm-target": "armv7em-none-eabi",
"inherits": ["cortex-m4"],
"build-tags": ["nrf52", "nrf"],
"cflags": [
"--target=armv7em-none-eabi",
"-mfloat-abi=soft",
"-Qunused-arguments",
"-DNRF52832_XXAA",
"-I{root}/lib/CMSIS/CMSIS/Include",

Просмотреть файл

@ -1,10 +1,7 @@
{
"inherits": ["cortex-m"],
"llvm-target": "armv7em-none-eabi",
"inherits": ["cortex-m4"],
"build-tags": ["nrf52840", "nrf"],
"cflags": [
"--target=armv7em-none-eabi",
"-mfloat-abi=soft",
"-Qunused-arguments",
"-DNRF52840_XXAA",
"-I{root}/lib/CMSIS/CMSIS/Include",

Просмотреть файл

@ -1,9 +1,7 @@
{
"inherits": ["cortex-m"],
"llvm-target": "armv7em-none-eabi",
"inherits": ["cortex-m4"],
"build-tags": ["stm32f4disco", "stm32f407", "stm32"],
"cflags": [
"--target=armv7em-none-eabi",
"-Qunused-arguments"
],
"linkerscript": "targets/stm32f407.ld",