Debian newlib nano workaround

- made use of newlib's nano version configurable by make variable USE_NANO
- added paragraphs to README.md explaining how and when to use USE_NANO
  and FIX_DEBIAN
This commit is contained in:
Tido Klaassen
2015-10-14 18:48:08 +02:00
parent 0d3c29e6f2
commit 9e29fe0abd
2 changed files with 29 additions and 9 deletions

View File

@@ -8,6 +8,21 @@ ifeq ($(V),)
MAKEFLAGS += --no-print-directory
endif
# Use the size optimised nano version of newlib.
# This usually is the version of newlib you want to use, although it has some
# limitations, like printf not having support for floating point vars.
# This relies on your newlib installation to provide a working nano.specs
# file. On Debian you will need at least version 2.1.0+git20141201.db59ff3-2
# of package libnewlib-arm-none-eabi
USE_NANO := true
# Debian's libnewlib-arm-none-eabi package version 2.2.0+git20150830.5a3d536-1
# ships with a buggy nano.specs file that does not set up a proper include
# path for finding the nano version of newlib.h.
# Also, the nano version has been built with the -fshort-wchar option, making
# it incompatible with object files using the standard ABI.
#FIX_DEBIAN := true
# Build directory
ifdef O
build_dir=$(shell readlink -f $(O))
@@ -136,21 +151,15 @@ LDLIBS += -l$(LIBNAME)
NEWLIBS += -lc -lgcc
ifneq ($(BOARD),qemu)
# Use the size optimised nano version of newlib.
# This usually is the version of newlib you want to use, although it has some
# limitations, like printf not having support for floating point vars.
ifeq ($(USE_NANO),true)
SPECS := -specs=nano.specs
ifneq ($(FIX_DEBIAN),)
# Debian's libnewlib-arm-none-eabi package version 2.2.0+git20150830.5a3d536-1
# ships with a buggy nano.specs file that does not set up a proper include
# path for finding the nano version of newlib.h.
# Also, the nano version has been built with the -fshort-wchar option, making
# it incompatible with object files using the standard ABI.
ifeq ($(FIX_DEBIAN),true)
SPECS += -I/usr/include/newlib/nano
LOCM3_FLAGS += -fshort-wchar
CFLAGS += -fshort-wchar
endif
endif
# Uncomment to link against libnosys if you do not want to use the provided
# stubs.

View File

@@ -20,6 +20,17 @@ apt-get install gcc-arm-none-eabi binutils-arm-none-eabi
apt-get install libnewlib-arm-none-eabi libnewlib-dev
apt-get install openocd
```
**N.B.** Usually you will want to compile and link against the size optimised
"nano" version of newlib. This is done by default. If your version
of newlib does not support this (Debian's libnewlib package version before
2.1.0+git20141201.db59ff3-2) you will have to comment out the line
`USE_NANO := true` in the Makefile or pass `USE_NANO=` as
a command line option to make.
**N.B.** Debian's libnewlib-arm-none-eabi version 2.2.0+git20150830.5a3d536-1
ships with broken nano support. To enable necessary workarounds, uncomment
the line `#FIX_DEBIAN := true` in the Makefile or pass `FIX_DEBIAN=true`
as a command line option to make.
## Code Layout
The "classic" port components (code needed for task set-up and context