Browse Source

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.
pull/1136/head
Ayke van Laethem 5 years ago
committed by Ron Evans
parent
commit
9f4459cee1
  1. 2
      builder/library.go
  2. 4
      targets/atsamd51g19a.json
  3. 4
      targets/atsamd51j19a.json
  4. 4
      targets/atsamd51j20a.json
  5. 8
      targets/cortex-m4.json
  6. 5
      targets/nrf52.json
  7. 5
      targets/nrf52840.json
  8. 4
      targets/stm32f4disco.json

2
builder/library.go

@ -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")

4
targets/atsamd51g19a.json

@ -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",

4
targets/atsamd51j19a.json

@ -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",

4
targets/atsamd51j20a.json

@ -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"
]
}

5
targets/nrf52.json

@ -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",

5
targets/nrf52840.json

@ -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",

4
targets/stm32f4disco.json

@ -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",

Loading…
Cancel
Save