Skip to content

Commit 04006e9

Browse files
committed
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.
1 parent dda576e commit 04006e9

File tree

8 files changed

+15
-21
lines changed

8 files changed

+15
-21
lines changed

builder/library.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ func (l *Library) Load(target string) (path string, err error) {
6969
// Precalculate the flags to the compiler invocation.
7070
args := append(l.cflags(), "-c", "-Oz", "-g", "-ffunction-sections", "-fdata-sections", "-Wno-macro-redefined", "--target="+target, "-fdebug-prefix-map="+dir+"="+remapDir)
7171
if strings.HasPrefix(target, "arm") || strings.HasPrefix(target, "thumb") {
72-
args = append(args, "-fshort-enums", "-fomit-frame-pointer")
72+
args = append(args, "-fshort-enums", "-fomit-frame-pointer", "-mfloat-abi=soft")
7373
}
7474
if strings.HasPrefix(target, "riscv32-") {
7575
args = append(args, "-march=rv32imac", "-mabi=ilp32", "-fforce-enable-int128")

targets/atsamd51g19a.json

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
11
{
2-
"inherits": ["cortex-m"],
3-
"llvm-target": "armv7em-none-eabi",
2+
"inherits": ["cortex-m4"],
43
"build-tags": ["atsamd51g19", "atsamd51", "sam"],
54
"cflags": [
6-
"--target=armv7em-none-eabi",
75
"-Qunused-arguments"
86
],
97
"linkerscript": "targets/atsamd51.ld",

targets/atsamd51j19a.json

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
11
{
2-
"inherits": ["cortex-m"],
3-
"llvm-target": "armv7em-none-eabi",
2+
"inherits": ["cortex-m4"],
43
"build-tags": ["atsamd51j19", "atsamd51", "sam"],
54
"cflags": [
6-
"--target=armv7em-none-eabi",
75
"-Qunused-arguments"
86
],
97
"linkerscript": "targets/atsamd51.ld",

targets/atsamd51j20a.json

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
11
{
2-
"inherits": ["cortex-m"],
3-
"llvm-target": "armv7em-none-eabi",
2+
"inherits": ["cortex-m4"],
43
"build-tags": ["sam", "atsamd51", "atsamd51j20", "atsamd51j20a"],
54
"cflags": [
6-
"--target=armv7em-none-eabi",
75
"-Qunused-arguments"
86
],
97
"linkerscript": "targets/atsamd51j20a.ld",

targets/cortex-m4.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"inherits": ["cortex-m"],
3+
"llvm-target": "armv7em-none-eabi",
4+
"cflags": [
5+
"--target=armv7em-none-eabi",
6+
"-mfloat-abi=soft"
7+
]
8+
}

targets/nrf52.json

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,7 @@
11
{
2-
"inherits": ["cortex-m"],
3-
"llvm-target": "armv7em-none-eabi",
2+
"inherits": ["cortex-m4"],
43
"build-tags": ["nrf52", "nrf"],
54
"cflags": [
6-
"--target=armv7em-none-eabi",
7-
"-mfloat-abi=soft",
85
"-Qunused-arguments",
96
"-DNRF52832_XXAA",
107
"-I{root}/lib/CMSIS/CMSIS/Include",

targets/nrf52840.json

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,7 @@
11
{
2-
"inherits": ["cortex-m"],
3-
"llvm-target": "armv7em-none-eabi",
2+
"inherits": ["cortex-m4"],
43
"build-tags": ["nrf52840", "nrf"],
54
"cflags": [
6-
"--target=armv7em-none-eabi",
7-
"-mfloat-abi=soft",
85
"-Qunused-arguments",
96
"-DNRF52840_XXAA",
107
"-I{root}/lib/CMSIS/CMSIS/Include",

targets/stm32f4disco.json

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
11
{
2-
"inherits": ["cortex-m"],
3-
"llvm-target": "armv7em-none-eabi",
2+
"inherits": ["cortex-m4"],
43
"build-tags": ["stm32f4disco", "stm32f407", "stm32"],
54
"cflags": [
6-
"--target=armv7em-none-eabi",
75
"-Qunused-arguments"
86
],
97
"linkerscript": "targets/stm32f407.ld",

0 commit comments

Comments
 (0)