AVR32 UC3 and GCC Tools

There’s a recently identified problem with Atmel’s AVR32 UC3 build GCC build tools. The problem seems to be that the linker will include an entire library instead of scanning the library for used functions. This results in a program file bloated with unnecessary and uncalled functions. I’m working on a USB application that almost triples in size when build with the GCC tools vs. IAR’s kickstart version. To get around this I had to add tell the linker to not use the standard gcc library (-nostdlib linker option). I then had to modify the FreeRTOS source code to remove the standard library calls, replacing them with functions added to port.c. Being new to open source code I’m not sure of the procedure for modifying the code. I know I have to make changes publicly available. (This is a commercial application). It seems it may be useful to someone to not use any library calls in the main RTOS code, and include library calls only in port.c which could be removed by conditional compile flag. Would this be useful to any one else? Atmel has admitted this problem but I havent’ heard a timeframe for getting it fixed.

AVR32 UC3 and GCC Tools

Thanks for the info. Does the makefile use the -ffunction-sections and -fdata-sections compiler options, and then the –gc-sections linker option?  I think in theory this should reduce the code size by removing unused functions but it can be difficult. If you send your modification to me (r _dot_ barry _@_ freertos.org) then I can hold them on record, and then forward them to anybody else who expresses after reading this post.  That way the source code is ‘available’. Regards.

AVR32 UC3 and GCC Tools

Even with the compiler and linker options you mentioned, the program file is huge. Apparently the problem is with the gcc library crt0.o startup file. To workaround, use the startup file included in the software framework provided by Atmel (UTILS/STARTUP_FILES/GCC/crt0.S) then use the -ffunction-sections and -fdata-sections compile options, and –gc-sections and -nostdlib linker options. memset(), memcpy(), and strncpy() functions will need to be replaced. After this my program size went from 88kB to 36kB. Ideally Atmel will resolve this before production release of this product, if not, or if anybody else is interested I’ll send you the modified source code.