aboutsummaryrefslogtreecommitdiffhomepage
path: root/targets/cortex-m0plus.json
AgeCommit message (Collapse)Author
2022-04-23all: update to LLVM 14Ayke van Laethem
Switch over to LLVM 14 for static builds. Keep using LLVM 13 for regular builds for now. This uses a branch of the upstream Espressif branch to fix an issue, see: https://github.com/espressif/llvm-project/pull/59
2022-01-09all: switch to LLVM 13Ayke van Laethem
This adds support for building with `-tags=llvm13` and switches to LLVM 13 for tinygo binaries that are statically linked against LLVM. Some notes on this commit: * Added `-mfloat-abi=soft` to all Cortex-M targets because otherwise nrfx would complain that floating point was enabled on Cortex-M0. That's not the case, but with `-mfloat-abi=soft` the `__SOFTFP__` macro is defined which silences this warning. See: https://reviews.llvm.org/D100372 * Changed from `--sysroot=<root>` to `-nostdlib -isystem <root>` for musl because with Clang 13, even with `--sysroot` some system libraries are used which we don't want. * Changed all `-Xclang -internal-isystem -Xclang` to simply `-isystem`, for consistency with the above change. It appears to have the same effect. * Moved WebAssembly function declarations to the top of the file in task_asyncify_wasm.S because (apparently) the assembler has become more strict.
2021-11-20targets: change LLVM features to match vanilla ClangAyke van Laethem
I mistakenly believed the difference was in LLVM version 11.0.0 vs LLVM 11.1.0. However, the difference is in whether we use the Debian version of Clang. The Debian version has had lots of patches. I'm not sure which is to blame, but it could be this one: https://salsa.debian.org/pkg-llvm-team/llvm-toolchain/-/blob/snapshot/debian/patches/clang-arm-default-vfp3-on-armv7a.patch
2021-11-07all: add target-features string to all targetsAyke van Laethem
This makes sure that the LLVM target features match the one generated by Clang: - This fixes a bug introduced when setting the target CPU for all targets: Cortex-M4 would now start using floating point operations while they were disabled in C. - This will make it possible in the future to inline C functions in Go and vice versa. This will need some more work though. There is a code size impact. Cortex-M4 targets are increased slightly in binary size while Cortex-M0 targets tend to be reduced a little bit. Other than that, there is little impact.
2021-11-05targets: match LLVM triple to the one Clang usesAyke van Laethem
The target triples have to match mostly to be able to link LLVM modules. Linking LLVM modules is already possible (the triples already match), but testing becomes much easier when they match exactly. For macOS, I picked "macosx10.12.0". That's an old and unsupported version, but I had to pick _something_. Clang by default uses "macos10.4.0", which is much older.
2021-11-03targets: add CPU property everywhereAyke van Laethem
This is for consistency with Clang, which always adds a CPU flag even if it's not specified in CFLAGS. This commit also adds some tests to make sure the Clang target-cpu matches the CPU property in the JSON files. This does have an effect on the generated binaries. The effect is very small though: on average just 0.2% increase in binary size, apparently because Cortex-M3 and Cortex-M4 are compiled a bit differently. However, when rebased on top of https://github.com/tinygo-org/tinygo/pull/2218 (minsize), the difference drops to -0.1% (a slight decrease on average).
2021-09-28build: normalize target triples to match ClangAyke van Laethem
This commit changes a target triple like "armv6m-none-eabi" to "armv6m-unknown-unknow-eabi". The reason is that while the former is correctly parsed in Clang (due to normalization), it wasn't parsed correctly in LLVM meaning that the environment wasn't set to EABI. This change normalizes all target triples and uses the EABI environment (-eabi in the triple) for Cortex-M targets. This change also drops the `--target=` flag in the target JSON files, the flag is now added implicitly in `(*compileopts.Config).CFlags()`. This removes some duplication in target JSON files. Unfortunately, this change also increases code size for Cortex-M targets. It looks like LLVM now emits calls like __aeabi_memmove instead of memmove, which pull in slightly more code (they basically just call the regular C functions) and the calls themself don't seem to be as efficient as they could be. Perhaps this is a LLVM bug that will be fixed in the future, as this is a very common occurrence.
2021-04-14all: clean up Cortex-M target filesAyke van Laethem
In this commit I've moved all core-specific flags to files for that specific core. This is a bit of a cleanup (less duplicated JSON) but should also help in the future when core-specific changes are made, such as core specific build tags or when the FPU finally gets supported in TinyGo. Some notable specific changes: - I've removed floating point flags from the Teensy 3.6 target. The reason is that the FPU is not yet supported in TinyGo (in goroutine stack switching for example) and floating point numbers would only be supported by C files, not Go files (because the LLVM FPU feature flags aren't used). This would create an ABI mismatch across CGo. - I've added the "cpu":"cortex-m7" to the cortex-m7.json file to match the configuration for the Teensy 4.0. This implies a change to the nucleo-f722ze (because now it has its CPU field set). Somehow that reduces the code size, so it looks like a good change. I don't believe any of these changes should have any practical consequences. One issue I've found is in the Cortex-M33 target: it uses armv7m, which is incorrect: it should be armv8m. But the chip is backwards compatible so this should mostly work. Switching to armv8m led to a compilation failure because PRIMASK isn't defined, this may be an actual bug.