Skip to content

Commit

Permalink
Optimize newlib binaries size (nano variant) (#20)
Browse files Browse the repository at this point in the history
Reduce newlib size (-Os and lightweight IO formatting)

Saves ~40KB of .text in final binaries built using toolchain.

Co-authored-by: dkulacz <dkulacz>
  • Loading branch information
dkulacz authored Dec 10, 2020
1 parent b0fab48 commit 4f423f1
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
2 changes: 2 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -95,9 +95,11 @@ RUN mkdir -p ${BUILD_PATH}/gcc && \
# build newlib
RUN mkdir -p ${BUILD_PATH}/newlib && \
cd ${BUILD_PATH}/newlib && \
export CFLAGS_FOR_TARGET="-Os" && \
${SOURCES_PATH}/newlib-${NEWLIB_VERSION}/configure \
--target=${TARGET_ARCH} \
--prefix=${TOOLCHAIN_PATH} \
--enable-newlib-nano-formatted-io \
--disable-nls \
&& \
make -j$(nproc) all && \
Expand Down
2 changes: 2 additions & 0 deletions build-gcc-v850-elf-toolchain.sh
Original file line number Diff line number Diff line change
Expand Up @@ -101,9 +101,11 @@ make -w install-gcc 2>&1 | tee make.out
mkdir -p ${BUILD_PATH}/newlib
cd ${BUILD_PATH}/newlib

export CFLAGS_FOR_TARGET="-Os"
${SOURCES_PATH}/newlib-${NEWLIB_VERSION}/configure \
--target=${TARGET_ARCH} \
--prefix=${TOOLCHAIN_PATH} \
--enable-newlib-nano-formatted-io \
--disable-nls \
-v 2>&1 | tee configure.out

Expand Down

0 comments on commit 4f423f1

Please sign in to comment.