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

30 Commits

Author SHA1 Message Date
Marian Buschsieweke
c9f16f1194
build sytem: add --no-warn-rwx-segments to linker
Before we disabled the warning about RWX segments only for picolibc,
but this issue is popping up on more and more toolchains (looking
at MSP430 and RISC-V). Other than on `native`/`native64`, there is no
MMU to enforce whatever permissions the segments contain anyway.
(And writing to ROM with regular store instructions will not be possible
even without the need for an MMU.)

So let's just globally disable this warning, unless building for
`native` and `native64`.
2024-02-12 20:55:58 +01:00
Marian Buschsieweke
2b2506c052
build system: Fix linker feature test with newlib 4.3.0
Before the build system used something like

    echo "int main(){} void _exit(int n) {(void)n;while(1);}" | LC_ALL=C $(LINK) -xc - -o /dev/null -lc -Wall -Wextra -pedantic <FLAGS_TO_TEST>

to check for flags supported by the compiler (used as linker frontend).
This however no longer works with newlib 4.3.0, which requires the
symbols `_sbrk_r`, `_close_r`, `_lseek_r`, `_read_r`, and `_write_r` to
be present. Instead, now a new file `minimal_linkable.c` was added that
adds all the missing symbols and is used in the linker feature tests
instead.
2023-02-02 20:47:37 +01:00
Marian Buschsieweke
c0e997a8e7
makefiles/libc/picolibc.mk: fix compilation with modern binutils
Modern binutils complain about segments with RWX permissions. While
this is indeed a bad habit, RIOT ignores segments permissions anyway.
(We do have a `mpu_noexec_ram` module to disable execution of all of
RAM, which would do so regardless of the segment permission.) So for
now, we can safely just disable the warning.

This fixes:

    /usr/lib/gcc/arm-none-eabi/12.2.0/../../../../arm-none-eabi/bin/ld: warning: /home/maribu/Repos/software/RIOT/examples/default/bin/nucleo-f767zi/default.elf has a LOAD segment with RWX permissions
    collect2: error: ld returned 1 exit status
2022-11-12 17:09:11 +01:00
Marian Buschsieweke
0077e9ad70
makefiles/libc: fix wchar_t size warnings on LLVM
The test for the requirement of disabling wchar_t size warnings assumed
that $(CC) is used for linking, instead of $(LINK). With GCC $(LINK)
and $(CC) happen to be (in most cases) identical, but with LLVM they
are not. This results in issues with compiling with LLVM.
2022-11-07 15:02:03 +01:00
Marian Buschsieweke
e796a7394e
makefiles/libc/picolibc.mk: Fix typo 2022-05-30 12:38:19 +02:00
Gunar Schorcht
d6f86a9b7a makefiles/libc/newlibc: allow toolchains with nano version only
The check for `newlib-nano` assumes that a toolchain which provides `newlib-nano` provides both the normal version and the nano version of the `newlib`.The nano version of `newlib.h` is therefore stored in its own include directory. This is the case for toolchains which allow to use both the normal and the nano version, e.g. for ARM and RISC-V.
However, if the toolchain provides `newlib_nano` but only allows the use of the nano version, it will only have the nano version of `newlib.h` and no separate directory for it, e.g. for ESP32.
To still be able to use such toolchains with `newlib_nano`, the check is changed so that the setting of the `-isystem` option depends on the existence of the separate directory.
2022-01-23 10:48:26 +01:00
Sören Tempel
6dc6433663 picolibc: Reset color in error message if picolibc is not available
This is a regression which was introduced in #16114, without resetting
the color the red color will be used for all following text written to
the terminal and will also cause the shell prompt etc. pp. to be colored
in red which is undesirable. This commit fixes this regression by using
the ANSI escape sequences to reset the color after the error message has
been written.
2021-08-05 20:52:15 +02:00
Francisco Molina
cfe9e0f6a1
makefiles/libc/picolibc.mk: only fail when building 2021-03-01 13:47:53 +01:00
Karl Fessel
f7a8e0840d Improve meassaging suggest workarounds 2021-02-15 14:40:03 +01:00
Karl Fessel
f3c0a4e602 makefile/..picolib: make missing picolib fail louder 2021-02-15 14:07:42 +01:00
Benjamin Valentin
28d40eae6f picolibc: enable multiple heaps
We can simply re-use the same code from newlib.
2020-08-24 20:45:05 +02:00
Keith Packard
8c67544e7d picolibc: USE_MODULE += printf_float for float printf/scanf code [v2]
This makes RIOT use the integer-only printf/scanf code by default and
includes a new make parameter to select the full floating point
version. This saves about 6kB of text space when building hello-world
for the microbit board.

Signed-off-by: Keith Packard <keithp@keithp.com>

----

v2:
	Use USEMODULE=printf_float instead of separate parameter
2020-08-24 08:26:16 -07:00
79d733a1af picolibc: glue sbrk to heap start/end [v2]
---
v2:
	Squash fixes in
2020-08-24 08:26:16 -07:00
ff3bee24b9 picolibc: Provide integration into the build system [v3]
Support for picolibc as alternative libc implementation is added with
this commit. For now only cortex-m CPU's are supported.

Enable via PICOLIBC=1

---
v2:
	squash fixes in

v3:
	Remove picolibc integer printf/scanf stuff from sys/Makefile.include,
	it gets set in makefiles/libc/picolibc.mk

fixup for dependency
2020-08-23 13:12:57 -07:00
857019769f
make/newlib: remove use of export for LINKFLAGS 2020-01-02 09:51:40 +01:00
87326c7b77 make: newlib: check if newlib nano folder was found 2019-03-08 18:47:23 +01:00
Gaëtan Harter
3226918e17
newlib.mk: indent comments in conditionnal
Comments inside an if are usually also indented.
2018-08-02 17:06:54 +02:00
Gaëtan Harter
154d64ee47
newlib.mk: get NEWLIB_INCLUDE_DIR absolute and without trailing slash
It replaces

    make BOARD=iotlab-m3 info-debug-variable-NEWLIB_INCLUDE_DIR
    /usr/bin/../lib/gcc/arm-none-eabi/7.2.1/../../../../arm-none-eabi/include/

with

    make BOARD=iotlab-m3 info-debug-variable-NEWLIB_INCLUDE_DIR
    /usr/arm-none-eabi/include

Without trailing slash and without relative '..' everywhere.

It also uses `realpath` instead of `abspath` to support Mingw32.
2018-08-02 17:06:51 +02:00
Gaëtan Harter
37a92c4c5e
newlib.mk: Windows/MSYS Bash support: use realpath instead of abspath
Some versions of Mingw32 abspath implementation has trouble working with
windows formatted path.

    $(abspath "C:/A/B") returns "/C/CUR/DIR/C:/A/B" instead of "/C/A/B"

relpath does not have this problem, it does additional symlink resolution but is
not a problem.
Note: on windows it does not remove the trailing `/`.

https://github.com/zephyrproject-rtos/zephyr/issues/2061#issuecomment-331635063

Patched in

941059c69f
2018-08-02 17:06:46 +02:00
Gaëtan Harter
3a4538ee76
newlib.mk: sanitize output before getting include path
Only keep lines that are indeed include path.
It also keeps newlines as they do not matter.

It fixes Mingw32 support where `grep '^\s'` is not working the same way.
It also handles some mac `sed` that do not support `\s`.

Ouput tested with:

    make -C examples/hello-world BOARD=samr21-xpro info-debug-variable-COMPILER_INCLUDE_PATHS
    # by also putting newlines for readability

Now:

    /usr/bin/../lib/gcc/arm-none-eabi/7.2.1/include
    /usr/bin/../lib/gcc/arm-none-eabi/7.2.1/include-fixed
    /usr/bin/../lib/gcc/arm-none-eabi/7.2.1/../../../../arm-none-eabi/include

Before:

    /usr/bin/../lib/gcc/arm-none-eabi/7.2.1/cc1 -E -quiet -v -iprefix /usr/bin/../lib/gcc/arm-none-eabi/7.2.1/ -isysroot /usr/bin/../arm-none-eabi -D__USES_INITFINI__ /dev/null
    /usr/bin/../lib/gcc/arm-none-eabi/7.2.1/include
    /usr/bin/../lib/gcc/arm-none-eabi/7.2.1/include-fixed
    /usr/bin/../lib/gcc/arm-none-eabi/7.2.1/../../../../arm-none-eabi/include
2018-08-02 17:05:17 +02:00
Gaëtan Harter
18a4ccf315
newlib.mk: fix NEWLIB_INCLUDE_DIR not being set by PATTERNS
As NEWLIB_INCLUDE_DIR has already been set here, with an empty value, it is not
overwriting it because of the '?='.
2018-08-02 17:05:13 +02:00
Gaëtan Harter
a946c2c5bd
newlib.mk: fix: do not require slash terminated NEWLIB_INCLUDE_DIR
When NEWLIB_INCLUDE_DIR is set from other parts than 'COMPILER_INCLUDE_PATHS' it
does not have a trailing slash.
Also, it makes it more problematic when supplying it from the command line.

And anyway having two '/' does not break anything.
2018-08-02 17:05:10 +02:00
Gaëtan Harter
f8e1419a31
newlib.mk: llvm, fix newlib-nano header not used
In the previous state, with llvm and arm for example, newlib-nano include dir
NEWLIB_NANO_INCLUDE_DIR is placed after NEWLIB_INCLUDES and so the default
'newlib.h' is used instead of the nano version.
2018-07-25 14:29:51 +02:00
Cenk Gündoğan
db6cb1ac65 newlib: include fixes for newlib-nano 2018-06-26 15:45:54 +02:00
Toon Stegen
f1c53794fa Revert "newlib-nano: add include directory"
This reverts commit 88aaa62364.
2018-05-30 17:41:21 +02:00
Toon Stegen
88aaa62364 newlib-nano: add include directory
The newlib-nano include directory can be named either newlib-nano or
nano, so we should make sure it is added in both cases.
2018-05-27 07:13:16 +02:00
Joakim Nohlgård
30f6f0033f newlib: No need to link with -lnosys 2018-03-18 09:58:17 +01:00
Martine Lenders
af5760977d newlib: use RIOT dependency system for _GNU_SOURCE instead 2017-10-24 16:01:24 +02:00
Neil Jones
6c54360bae makefiles: Don't link libnosys for mips and put back -fdata-sections 2017-06-28 12:55:54 +01:00
Joakim Nohlgård
b81b66672e newlib: Split newlib into one generic part and one default syscalls part 2017-04-05 13:55:38 +02:00