Skip to content

Using newlib-nano libraries with LPCXpresso #52

Closed
@dinau

Description

@dinau

Hi, all

I've been successful to use the newlib-nano libraries with LPCXpresso compiler (GCC_CR).
This is highly experimental,
but some simple example programs ("ticker" and "basic") work well at this moment.

  1. First, needed for the newlib-nano libraries included in
    Launchpad GCC
    https://launchpad.net/gcc-arm-embedded
    I'm using Ver.4.7-2013q2.
  2. Copy the newlib-nano libraries to the library folder of LPCXpresso.
    Assume that Launchpad GCC root folder name is "launchpad-gcc-root" and
    LPCXpresso root folder name is "lpxpresso-root".

(1) nano.specs file
[copy] launchpad-gcc-root/arm-none-eabi/armv7-m/nano.specs
[to] lpcxpresso-root/lpcxpresso/tools/arm-none-eabi/lib/

(2) Each libraries
i.e. for Cortex-M3 micros
[copy] launchpad-gcc-root/arm-none-eabi/lib/armv7-m/*_s.a
[to] lpcxpresso-root/lpcxpresso/tools/arm-none-eabi/lib/armv7-m/

i.e. for Cortex-M0 micros
[copy] launchpad-gcc-root/arm-none-eabi/lib/armv6-m/*_s.a
[to] lpcxpresso-root/lpcxpresso/tools/arm-none-eabi/lib/armv6-m/

Adding "--specs=nano.specs" option to the linker script option.

[workspace_tools/toolchains/gcc.py]:

    class GCC_CR(GCC):
        def __init__(self, target, options=None, notify=None):
            GCC.__init__(self, target, options, notify, GCC_CR_PATH)

            additional_compiler_flags = [
                "-D__NEWLIB__", "-D__CODE_RED", "-D__USE_CMSIS", "-DCPP_USE_HEAP",
            ]
            self.cc += additional_compiler_flags
            self.cppc += additional_compiler_flags
            if "nanolib" in self.options:
                # Use latest gcc nanolib
                self.ld.append("--specs=nano.specs")
                if target.name in ["LPC1768"]:
                    self.ld.extend(["-u", "_printf_float", "-u", "_scanf_float"])
            self.ld += ["-nostdlib"]

Building "basic" test program with newlib-nano libraries

    $ workspace_tools/build.py -m LPC1768 -t GCC_CR
    $ workspace_tools/make.py  -m LPC1768 -t GCC_CR -d. -p 0 -o nanolib

dinau

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions