[chbot] Most puzzling arm compilation problem [SOLVED]

Robin Gilks robin at gilks.org
Fri Oct 2 12:54:19 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
>>
>>
>
> After a lot of searching of the map file I eventually found that the
> section ".ARM.exidx" was not being allocated space! A patch to the loader
> script put it out of the way in flash.
>
> This is only used for unwinding stacks etc on exception processing in c++
> so I don't need it on my c only project:)
>
> You're right about the size of the printf family brought in from newlib
> which was a surprise - using the BeRTOS sprintf implentation my app was
> 26804 bytes but with the newlib version it was 43676 bytes once I had
> removed the overlap error.
>
> Methinks that I'll look harder for a smaller embedded libc for
> cortex-m3!!!

I'm using newlib-2.1 which includes newlib-nano so by using the spec file
to include it and some tips I found here
   https://plus.google.com/+AndreyYurovsky/posts/XUr9VBPFDn7

the size of my sample application has come down from 24944 (some app level
optimisation from the figure above) to 13252. This is smaller than the AVR
although the BSS section is slightly larger with the ARM.

All I need now is some hardware!!




-- 
Robin Gilks
Internet: robin at gilks.org    http://www.gilks.org
Tel:      (+64) (3) 347 4370





More information about the Chchrobotics mailing list