1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00
Commit Graph

25 Commits

Author SHA1 Message Date
Marian Buschsieweke
59f1b4346c
makefiles/toolchain/llvm.inc.mk: disable annoying C++ warning
Designated initializers make the code much more readable and are part
of the C standard since C99. C++ with C++20 finally caught up.
Until we switch to that C++ version, let's disable the annoying
warning rather than reducing the code quality for the sake of
strict C++ compatibility of our headers.
2023-07-18 12:24:07 +02:00
Marian Buschsieweke
33442fdb71
makefiles/toolchain/llvm.inc.mk: fix include headers
With GCC, the C++ compiler knows all builtin C include paths *and*
all builtin C++ include paths, but the C compiler only knows the
C include paths. Hence, let's use the C++ compiler to collect
the include paths.
2023-07-18 12:24:07 +02:00
Marian Buschsieweke
e8bb46ece6
makefiles/toolchain/llvm.inc.mk: provide LLVM_VERSION
We already have GCC_VERSION, so let's also have LLVM_VERSION.
2023-07-18 12:24:04 +02:00
Marian Buschsieweke
5cc92304df
makefiles/toolchain/gnu.inc.mk: fix compilation
The `--param=min-pagesize=0` needed since GCC 12 is still needed with
GCC 13. This time at least the message is more meaningful:

     note: source object is likely at address zero

This is something that is not expected in a userspace app, but with
bare metal MCUs and often flash or memory mapped I/O starting from
address zero, this warning prevents legitimate code from compiling.
2023-06-03 20:10:56 +02:00
Marian Buschsieweke
b86366e34e
makefiles/toolchain: Fix incorrect assumptions on address space layout
GCC 12 gives out of bounds warnings when the resulting address is out
of bounds of what GCC assumes to be the valid address space. It seems
that by default the address 0x0 is not considered valid (which would
be a NULL pointer and typically not mapped in a userspace behind an MMU
scenario), but in fact is valid on bare metal hardware. At least on
AVR and MSP430 this needs to be set. On many Cortex M MCUs 0x0 is also
a valid address (e.g. often the flash is mapped there), but seemingly
for them `--param=min-pagesize=0` is already the default. In any case,
it won't hurt to set it explicit for them as well.
2023-05-08 15:42:40 +02:00
Martine Lenders
212933f080
toolchain/gnu.inc.mk: don't check version if CC is not installed
With b30efeeb65 a warning was introduced when using `make term` without
the proper toolchain installed (e.g. when using BUILD_IN_DOCKER, but
`term` outside of the docker). This removes this warning
2023-01-13 11:45:04 +01:00
Benjamin Valentin
826b2ae232 makefiles/gnu.inc.mk: fix "extraneous text after 'ifneq' directive"
When trying to compile `examples/hello-world` on my 465 MHz Mendocino
I got

/home/benpicco/dev/RIOT/makefiles/toolchain/gnu.inc.mk:29: extraneous text after 'ifneq' directive

Turns out the version of `make` on Archlinux32 is newer than that in
Ubuntu 22.04, which somehow ignored the extra parenthesis.

Turns out this (t)rusty old machine is still good for writing patches :D
2022-11-20 14:53:34 +01:00
Benjamin Valentin
b30efeeb65 makefiles/gnu.inc.mk: set flags based on compiler version 2022-11-19 23:14:54 +01:00
Marian Buschsieweke
6dcd3bb8ff
build system: support wrong target triples with LLVM
clang/LLVM is a bit more finicky with what target triples it accepts compared
to GCC. However, the GCC target triple is needed to properly locate the C
libraries. In case a locally installed GCC toolchain uses a technically not
fully correct target triple, it might be impossible to build with LLVM.

The solution here is to allow specifying a TARGET_ARCH_LLVM target triple
(which defaults to TARGET_ARCH), which is passed to clang. For locating the
C lib, still TARGET_ARCH is used.
2021-02-11 17:19:15 +01:00
080d5caa17
makefiles/toolchain: don't export all variables
There are already exported globally in vars.inc.mk
2020-06-24 11:00:54 +02:00
Sören Tempel
d7104e4992 makefiles/toolchain: add support for afl 2020-04-07 14:24:10 +02:00
Leandro Lanzieri
fdff969695 makefiles/llvm.inc.mk: Use simple expansion for OBJCOPY and OBJDUMP 2020-02-04 15:22:07 +01:00
Leandro Lanzieri
a262ae4c57 makefiles/gnu.inc.mk: Use simple expansion for OBJCOPY and OBJDUMP 2020-02-04 15:21:24 +01:00
Marian Buschsieweke
716fc76f13
makefiles: Disable -Watomic-alignment on LLVM
`-Watomic-alignment` warns when C11 atomics have to be implemented via a to one
of the functions in `core/atomic_c11.c`. Unlike to the context of Desktop or
Server class machines, the performance penalty of this calls is insignificant
(and not existing with LTO). So this is not an issue in our context.

On the other hand: Keeping `-Watomic-alignment` prevents building applications
using C11 atomics on all platforms the atomic operations are not implemented
without calls to `core/atomic_c11.c` (due to `-Werror`), reducing portability.

So not only does the warning is not useful in our context, it actually prevents
portable use of C11 atomics. It is the most sensible thing to just disable it.
2019-10-18 09:18:37 +02:00
Gaëtan Harter
043534daf9
llvm: blacklist incompatible CFLAGS
Blacklist incompatible CFLAGS that are currently "optionally" included
in 'cflags.inc.mk'.

This prepares for the migration to 'OPTIONAL_CFLAGS'.
2019-08-29 17:43:54 +02:00
Gaëtan Harter
f47b09faa4
makefiles/toolchain: fallback to 'objdump'
When '$(PREFIX)objdump' is not present fallback to native '(g)objdump'.
'objdump' is used when flashing for some boards but the toolchain may
not be installed when building in docker.

This will allow using 'objdump' in 'cpu/kinetis/dist/check-fcfield.sh'.
2019-05-28 14:04:31 +02:00
Gaëtan Harter
566c990eba
makefiles/toolchain: fix command -v multiple commands
`command -v first second third` only works in `bash` and not in `sh`.
So replace with multiple calls to `command`.

This fixes using `objcopy` when the toolchain `objcopy` is not available.
2019-01-28 13:48:20 +01:00
cladmi
1802e775ad
llvm.inc.mk: completely replace detection of GCC includes
This completely removes the hardcoded/os specific path setting for includes.
It directly queries gcc include directories.

It takes what was already done by `makefiles/libc/llvm.inc.mk`.

I replaced the `GCC_MULTI_DIR` handling by givining `CFLAGS_CPU` when
searching for include directories.
`CFLAGS` cannot be used as it will crash when `-target $(CPU_ARCH)` is
added.
It currently requires using deferred variables as `CFLAGS_CPU` can be
overwritten later in the build process.
2018-10-16 12:50:01 +02:00
Gaëtan Harter
cde5a91a8a
toolchain/gnu: also define NM
llvm is defining NM already and `openthread` is using the symbol.
2018-07-23 17:29:55 +02:00
smlng
069f920466 make: export RANLIB tool with prefix 2018-03-27 19:00:28 +02:00
Sören Tempel
55b026b349 Makefile.include: Introduce LINKXX variable
This variable can be used to specify the linker which should be used to
link C++ object files. This is needed in order to use g++ for linking
with TOOLCHAIN=llvm.
2018-02-21 12:26:20 +01:00
Sören Tempel
18f99ef708 makefiles: always link with gcc even if TOOLCHAIN is set to LLVM
Fixes #8356
2018-02-21 12:26:20 +01:00
Joakim Nohlgård
0ad0a39a40 makefiles: Split GDB settings from toolchain 2017-10-18 14:34:20 +02:00
Joakim Nohlgård
7713bede99 openocd: Refactor openocd.sh script
- Merge flash and flash-elf commands since they were identical except
  for the file name of the image
- Split GDB command from DBG environment variable to allow more easily
  configure front-ends for GDB via environment variables.
- Remove verbose tests of empty variables and replace by `: ${VAR:=default}`
- Remove passed command line arguments to sub-functions, they were
  unused in the functions anyway.
- Remove TUI variable, use `export DBG_EXTRA_FLAGS=-tui` to get the same
  result.
2017-10-18 14:34:20 +02:00
Joakim Nohlgård
339a4da9dc Makefiles: move to new directory /makefiles 2017-04-04 15:11:54 +02:00