cancel
Showing results for 
Search instead for 
Did you mean: 

SD FatFs Module Code Size?

tmall
Associate II
Posted on April 11, 2010 at 18:49

SD FatFs Module Code Size?

#sd-card #stm32 #stm32 #sd-card #sd #sd
6 REPLIES 6
mdeneen2
Associate II
Posted on May 17, 2011 at 13:46

How are you measuring the object size? Run readelf on the object file to see how big each section is. Obviously, not all of the sections below go into the final image.  I believe sections 7-11 will be left out of the final image.

arm-none-eabi-readelf ff.o Section Headers:

[Nr] Name Type Addr Off Size ES Flg Lk Inf Al

[ 0] NULL 00000000 000000 000000 00 0 0 0

[ 1] .text PROGBITS 00000000 000034 001f3c 00 AX 0 0 4

[ 2] .rel.text REL 00000000 0028cc 000248 08 10 1 4

[ 3] .data PROGBITS 00000000 001f70 000000 00 WA 0 0 1

[ 4] .bss NOBITS 00000000 001f70 000008 00 WA 0 0 4

[ 5] .rodata PROGBITS 00000000 001f70 000044 00 A 0 0 4

[ 6] .rodata.str1.1 PROGBITS 00000000 001fb4 000033 01 AMS 0 0 1

[ 7] .comment PROGBITS 00000000 001fe7 000022 00 0 0 1

[ 8] .ARM.attributes ARM_ATTRIBUTES 00000000 002009 000031 00 0 0 1

[ 9] .shstrtab STRTAB 00000000 00203a 000060 00 0 0 1

[10] .symtab SYMTAB 00000000 00227c 000480 10 11 44 4

[11] .strtab STRTAB 00000000 0026fc 0001d0 00 0 0 1

Key to Flags:

W (write), A (alloc), X (execute), M (merge), S (strings)

I (info), L (link order), G (group), x (unknown)

O (extra OS processing required) o (OS specific), p (processor specific)

tmall
Associate II
Posted on May 17, 2011 at 13:46

Greetings Mark:

    Thanks for the reply!

    CrossWorks displays the code size for each file. It indicates the size of code for ff.c is 19,060 Bytes - this is for a full version of ff.c except for LFN which is disabled and compiled without any optimization levels. CrossWorks also shows that ff.c uses 252 bytes of RAM.

    I have not used ''readelf'' before but I gave it a spin. I ran it from the command line but I wasn't able to duplicate your output dump. I wonder how you run readelf and which command line options you used? I am not familiar with:

''arm-none-eabi-readelf''

    By adding up the sizes for the individual components in your readelf output it would appear your ff code is roughly 9KB. Was this done for an STM32? I wonder which compiler your using and if any level of code size optimization was used? I can reduce the size significantly with optimization which is possibly what the FatFs application note is based on.

Thanks again!

Tom Alldread

mdeneen2
Associate II
Posted on May 17, 2011 at 13:46

Thomas,

I am using:

arm-none-eabi-gcc (Sourcery G++ 4.4-92) 4.4.1

Copyright (C) 2009 Free Software Foundation, Inc.

This is free software; see the source for copying conditions. There is NO

warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. If CrossWorks uses GCC, you should be able to find a readelf binary somewhere.  I am using -Os, not -O2.  Also, I am using this on a STM32F103RE.

From ffconf.h:

#define _FS_TINY     0    /* 0 or 1 */

#define _FS_READONLY    0    /* 0 or 1 */

#define _FS_MINIMIZE    0    /* 0, 1, 2 or 3 */

#define _USE_STRFUNC    0    /* 0, 1 or 2 */

#define _USE_MKFS     1    /* 0 or 1 */

#define _USE_FORWARD    0    /* 0 or 1 */

#define _CODE_PAGE     1

It's even smaller when I don't include _USE_MKFS.

Best Regards,

Mark Deneen

tmall
Associate II
Posted on May 17, 2011 at 13:46

Greetings Mark:

    We are using the same config options.

    I presume the -Os is the same as my ''optimize for size'' option. If I use that option the size drops by half to 8720 which is more or less the same as your getting. I guess that is what the application note refers to. Unfortunately optimized code does not work well for debugging and at the moment with my application the PLL doesn't appear to start for me when I use size optimization - I need to look into that in more detail.

    Thanks again for your help!

Tom Alldread

Singh.Harjit
Senior II
Posted on May 17, 2011 at 13:46

What device are you using for the file system i.e. serial flash or?

What type of read/write bandwidth are you seeing?

Thanks,

Harjit

tmall
Associate II
Posted on May 17, 2011 at 13:46

Greetings Harjit:

I am using a standard SD memory card and I have not made any bandwidth measurements. There is some example benchmark info on the FatFs website however I don't recall seeing any STM32 benchmarks. Take a look at:

http://elm-chan.org/fsw/ff/img/rwtest2.png

Best Regards,

Tom Alldread