Code size for SAM D20: how big is it?

Discussions around product based on ARM Cortex M0+ core.

Moderator: nferre

pozz
Posts: 67
Joined: Fri Jun 13, 2014 2:55 pm

Code size for SAM D20: how big is it?

Wed Jun 18, 2014 4:53 pm

I'm starting with SAM D20 microcontrollers and I was testing project example USART QUICK START CALLBACK.

The output binary file is 8236 bytes long (in Debug without optimization and in Release with -Os option). It seems a very big size for a trivial application!!

Incredibly this example consumes an half of the Flash memory of the smallest D20 (16KB of Flash)!!!!

It seems the Flash memory requirement for D20 micro is much more strong respect a simple 8-bit AVR micro!! I choosed to migrate from AVR to D20 to have a modern architecture that let me store much more code and have more complex application. But it seems it isn't the right direction.

Please, help me understanding how those D20 micros can be used.
pozz
Posts: 67
Joined: Fri Jun 13, 2014 2:55 pm

Re: Code size for SAM D20: how big is it?

Thu Jun 19, 2014 1:52 pm

awneil wrote:Have a look at the map file to see where it's all going.
What do I look for? I think .text sections (I'm sorry, I'm not a guru).

For example:

Code: Select all

 .text          0x000011c4      0x3b0 c:/program files (x86)/atmel/atmel toolchain/arm gcc/native/4.8.1426/arm-gnu-toolchain/bin/../lib/gcc/arm-none-eabi/4.8.3/armv6-m\libgcc.a(_divdi3.o)
                0x000011c4                __divdi3
 .text          0x00001574      0x380 c:/program files (x86)/atmel/atmel toolchain/arm gcc/native/4.8.1426/arm-gnu-toolchain/bin/../lib/gcc/arm-none-eabi/4.8.3/armv6-m\libgcc.a(_udivdi3.o)
                0x00001574                __udivdi3
says that __divdi3 needs 0x3b0=944bytes and __udivdi3 needs 0x380=896 bytes.

Why the linker includes those functions if the example doesn't use any division? Is it ASF that uses those functions?

I'm starting thinking ASF is not my friend :-)
awneil wrote:It is typical of trivial applications that the setup swamps the "real work"...
I hope, because if the memory size increases linearly with the code, I'll need a 10MB Flash microcontroller :-)
pozz
Posts: 67
Joined: Fri Jun 13, 2014 2:55 pm

Re: Code size for SAM D20: how big is it?

Fri Jun 20, 2014 2:17 pm

Regarding code space, I've found we can save about 1KB of Flash memory using newlib-nano instead of newlib.

It is possible to use newlib-nano directly in Atmel Studio in the Linker General propertis of the project.

From the activity of this group, it seems I'm the only user of this microcontroller :-(

Return to “SAM D20 Cortex-M0+ MCU”

Who is online

Users browsing this forum: No registered users and 4 guests