This is the mail archive of the newlib@sourceware.org mailing list for the newlib project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Building for cortex-m3


On Monday 18 April 2011 15:11:02 Richard Earnshaw wrote:
> Yes, that's ARM code.  Newlib hasn't been ported to v6-M and v7-M (ie
> Cortex-M) yet.
>
> R.

Hello all,

NewLib works great for Cortex-M3 for us at our company,
university and for my colleagues from different company
and projects for long time (12 months or something like that).
But we use own CRT.0 for our projects.

At this moment it is bare clean GNU distribution archives
build

GNU Binutils 2.20.1.20100303 config

CFLAGS=-O2 LDFLAGS=-s \
../../../binutils/configure \
        --prefix=/usr \
        --disable-nls \
        --with-gnu-ld \
        --with-gnu-as \
        --with-mmap \
        --enable-64-bit-bfd \
        --target=arm-elf \
        --enable-targets=arm-linux \
        --enable-interwork \
        --enable-multilib

GCC 4.4.4 + mpfr-2.4.2 + gmp-4.3.2 + newlib-1.18.0
(newlib with ARM old ABI floating point fix -
pushed to NewLib CVS last summer) 

../../../src/gcc-4.4/configure -v \
         --enable-languages=c,c++ \
         --prefix=/usr \
         --enable-interwork \
         --enable-multilib \
         --with-system-zlib \
         --without-included-gettext \
         --disable-nls \
         --with-gnu-ld \
         --with-gnu-as \
         --with-newlib \
         --enable-checking=release \
         --target=arm-elf \
         --enable-version-specific-runtime-libs \
         --with-float=soft \
         --enable-target-optspace


The critical point is to link newlib-1.18.0/newlib
into GCC tree and build them together. I have seen severely
broken self made build at student machine ho used some
third party automatic build script which compiled newlib
standalone way.

The Linux 32 and 64-bit binaries are available as deb packages
at our page with compilers for studnets projects

  http://rtime.felk.cvut.cz/hw/index.php/Cross_compilers

As for the sources, there are no changes not available/sent
to mainlines and we do not have resources or intention to be
real maintainers. We intent to solve access to our build configs
and used sources tree examination such way, that we export
whole subdirectory tree of the GNU tools when we move finally
compilation to our new server. If somebody wants asks for whole
tree I have no problem to provide full tar, but I see it generally
as overhead when you can load all from original GNU archives.

As I have mentioned, we do not use CRT0 provided by NewLib
but
  /usr/arm-elf/lib/thumb/thumb2/crt0.o
is valid thumb2 code and GCC provided helpers
are working as well
  /usr/arm-elf/gcc/4.4.4/lib/thumb/thumb2

We use or sysless build tree for applications running on bare HW.
Actual version supporting LPC17xx (Cortex-M3) is at
  http://ulan.sourceforge.net/
  http://ulan.git.sourceforge.net/git/gitweb.cgi?p=ulan/sysless

In the fact, we do not use any real CRT0.o with LPC17xx (-nostartfiles option).
The Cortex-M3 is great in that you do not need any code written in assebly
to start application or even in IRQ handlers trampolines. The regular
ARM provided start code with our adaptation for dynamic IRQ table is there

  http://ulan.git.sourceforge.net/git/gitweb.cgi?p=ulan/sysless;a=blob;f=arch/arm/mach-lpc17xx/libs/hal/startup.c

For reference, there are full lines from *.c -> *.o compile

arm-elf-gcc   -I.    -DMICROWINDOWS_090 -DSUI_CANBE_CONST=const -DSUI_CANBE_CONST_VMT=const -DOMK_FOR_TARGET -mthumb -mcpu=cortex-m3 -ggdb -Os -ffunction-sections -fdata-sections -Wl,--gc-section -Wall -I/home/pi/repo/ulan/ulan-build/arm-lmc1-lcp/pikron/app/lcp61 -I/home/pi/repo/ulan/ulan-build/arm-lmc1-lcp/_compiled/include -I /home/pi/repo/ulan/ulan-build/arm-lmc1-lcp/_build/pikron/app/lcp61 -MT 
appl_actions.o -MD -MP -MF "appl_actions.o.d.tmp"  -o appl_actions.o -c /home/pi/repo/ulan/ulan-build/arm-lmc1-lcp/pikron/app/lcp61/appl_actions.

and linking

arm-elf-gcc -DMICROWINDOWS_090 -DSUI_CANBE_CONST=const -DSUI_CANBE_CONST_VMT=const -DOMK_FOR_TARGET -mthumb -mcpu=cortex-m3 -ggdb -Os -ffunction-sections -fdata-sections -Wl,--gc-section -Wall -I/home/pi/repo/ulan/ulan-build/arm-lmc1-lcp/pikron/app/lcp61 -I/home/pi/repo/ulan/ulan-build/arm-lmc1-lcp/_compiled/include -I /home/pi/repo/ulan/ulan-build/arm-lmc1-lcp/_build/pikron/app/lcp61  -Wl,--cref  -Wl,--gc-section -nostartfiles -Wl,-T,lpc1766.ld-app -Wl,-Map,lcp61-app.map 
appl_actions.o appl_cmdproc.o appl_gui_fonts.o appl_gui_style.o appl_gui_suitk.o appl_loop.o appl_main.o appl_oi.o appl_oi_dinfo.o appl_oi_sup.o appl_pxmc.o 
appl_scr_common.o appl_scr_main.o appl_scr_service.o appl_tests.o appl_usb.o cmd_uartcon.o lcp_dinfo.o lcp_engine.o lcp_gradient.o lcp_params.o lcp_prog.o 
mw2sui.o ul_idstr.o 
usb_loader.o /home/pi/repo/ulan/ulan-build/arm-lmc1-lcp/_compiled/lib/system_stub.o -L/home/pi/repo/ulan/ulan-build/arm-lmc1-lcp/_compiled/lib -lbspbase -luloi -luloicom -lul_drv -lkeyval -llpciap -llpciap_kvpb -lmach_hal -luldy -lulan -lsuitk -lsuiut -lsuitk -lsuifont -lulut -lsha1 -lmwengine -lmwfonts -lmwdrivers -lmwfonts -lmwengine -lmwdrivers -li2c_drv -lspi_drv -lpxmc -lpxmcbsp -lcmdproc -lmisc -lu2u_dcnv -lusbbase -lusbmore -llpcusb -lm  -o /home/pi/repo/ulan/ulan-build/arm-lmc1-lcp/_compiled/bin/lcp61-app

for one of our company applications. All ARM specific
support code, most of other libraries etc. are maintained
directly in public uLan code so you can take these
as references or reuse them under GPL and MPL
(even for closed projects).

Best wishes

                Pavel Pisa

==================================================
 PiKRON s.r.o.       Phone/Fax: +420 2 84684676
 Kankovskeho 1235    Phone:     +420 2 84684676
 182 00 Praha 8      WWW:   http://www.pikron.com/
 Czech Republic      e-mail:  pikron@pikron.com
==================================================


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]