Skip to content

Commit

Permalink
trying to get a version to compile with gcc 10
Browse files Browse the repository at this point in the history
  • Loading branch information
bradjc committed Nov 7, 2023
1 parent e367f6b commit b5d3f3f
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 0 deletions.
18 changes: 18 additions & 0 deletions newlib/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,22 @@ the position independent code that Tock applications require.
Compiling a new version of Newlib
---------------------------------

This folder contains scripts to build and package newlib for libtock-c. Note,
however, that successfully building usable newlib images is heavily dependent on
the specific toolchain (both ARM and RISC-V) that you have installed on your
machine. Specifically, we are aware of two issues that can arise:

1. For ARM, the specific architectures that your GCC was compiled with support
for are the versions of newlib that will be compiled. As far as I know this
is not configurable. If you run `arm-none-eabi-gcc -print-multi-lib` you will
see the architectures.
2. For RISC-V, using a new toolchain (e.g. gcc 13) to compile the libraries, and
then using those libraries with an older toolchain (e.g. gcc 10) seems to
cause failures.


### Simple Directions

In the `Makefile`, edit the variable `NEWLIB_VERSION` with the version
you want to compile. The releases are listed
[here](http://sourceware.org/pub/newlib/).
Expand All @@ -19,3 +35,5 @@ Then:
When the build finishes (it takes a while), a zip folder named
`libtock-newlib-<version>.zip` will contain the built libraries. You can move
that folder to the `libtock-c/lib` directory to use the new version of newlib.


4 changes: 4 additions & 0 deletions newlib/build-arm.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@ if ! arm-none-eabi-gcc --print-multi-lib | grep -q 'v7e-m/nofp'; then
exit -1
fi

# Need to remove the `v5te` targets from the output of `-print-multi-lib` (if
# they exist) as they are ancient and fail to compile.
sed -i.bak 's/--print-multi-lib/--print-multi-lib | grep -v v5te/' $NEWLIB_SRC_DIR/config-ml.in

$NEWLIB_SRC_DIR/configure --target=arm-none-eabi \
--disable-newlib-supplied-syscalls \
--disable-nls \
Expand Down

0 comments on commit b5d3f3f

Please sign in to comment.