[chbot] Most puzzling arm compilation problem [SOLVED]

Charles Manning cdhmanning at gmail.com
Fri Oct 2 02:32:55 BST 2015


There are a lot of different libraries you can use with ARM.

Newlib is supremely ugly IMHO if you use printf() it pulls in all sorts of
stuff you really don't want for smaller bare metal apps.

printf pulls in a whole streams layer + malloc + airconditioning and hot
and cold running water. You just want a banana, but you get the gorilla it
comes with.

If you get overlapping sections it means one of:
1) The code has memory sections the linker script does not understand. It
puts them at 0 and overlaps other memory (eg. flash).
2) Trying to stuff in more code/data than you have space.

Look at the map file and other outputs from the linker step that normally
gives you hints.

Another printf worth trying is
http://www.sparetimelabs.com/tinyprintf/tinyprintf.php



On Fri, Oct 2, 2015 at 11:58 AM, Robin Gilks <robin at gilks.org> wrote:

>
> > All this works fine when compiled for the AVR but on the ARM I get the
> > following problem. No idea what the overlap means but the '_sbrk' error
> > implies that malloc is being invoked somewhere - I'm using newlib which
> > expects you to define system calls. If I turn off the callback then it
> > compiles cleanly.
>
> Its more wrapped up with malloc than I thought!! The linker script
> requires tweeking if using malloc (which the newlib sprintf uses) hence
> the overlap and the _sbrk missing issue.
>
> Fixed by using the BeRTOS version of sprintf (the avrlibc version doesn't
> do strange things!!)
>
> --
> Robin Gilks
> Internet: robin at gilks.org    http://www.gilks.org
> Tel:      (+64) (3) 347 4370
>
>
>
> _______________________________________________
> Chchrobotics mailing list Chchrobotics at lists.linuxnut.co.nz
> http://lists.ourshack.com/mailman/listinfo/chchrobotics
> Mail Archives: http://lists.ourshack.com/pipermail/chchrobotics/
> Meetings usually 3rd Monday each month. See http://kiwibots.org for
> venue, directions and dates.
> When replying, please edit your Subject line to reflect new subjects.
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ourshack.com/pipermail/chchrobotics/attachments/20151002/5ef8912a/attachment.html>


More information about the Chchrobotics mailing list