EmbeddedRelated.com
Forums
The 2024 Embedded Online Conference

Program size on Rabbit 3900

Started by kk...@tagcords.com January 17, 2012
Hi, I am using a rabbit 3900 which has 512k Program Flash and 512k ram + a 32mb NAND Flash. My program uses both the TCP/IP and FAT libraries. I was wondering if anyone had any suggestions for reducing the size of these two entities. I am using dynamic C version 9.6.2.

The target program uses basic TCP Sockets. No UDP.

I have the NAND Flash formatted to FAT12. This particular program has no need for the SD Flash.

Any hints to save memory space in these two places would be appreciated.
Thanks

Ken
Ken,

There are a couple of options to reduce the memory footprint of the FAT file system. These are:

1) Disabling FAT12 or FAT16 support. Disabling FAT12 saves more.
2) Eliminate the loading of the SD driver since you're not using it.

I would recommend you disable FAT12 as it will save you more code space than disabling FAT16. A 32MB partition will still have adequate usable space running FAT 16. Since you're not using removable media this will not create any compatablility issues and forcing a device to FAT16 only costs you a minor amount of extra overhead on the storage medium.

To disable FAT12 make sure there are no files needed on the 32MB NAND flash as you will be reformatting it to FAT16. If you have important files on the NAND, you could use the FAT_FTP.c sample to download them through an FTP connection. To erase the NAND and prepare for reformatting run the nflash_erase.c sample. Then go into the fat.lib library and comment out #define FAT_FAT12 on line 146. Then compile Fmt_Device.c and format the NAND which will now force a FAT16 format. Remember that this is done in the library and will affect any programs that use FAT until you reverse the change.

To disable the SD driver which is automatically loaded by the FAT system edit the fat_config.lib library. Comment out lines 223 through 232, or namely:

#define FAT_REMOVABLE
#define FAT_ALLOW_HOTSWAP
#define FAT_SD_DEVICE FDDF_MOUNT_DEV_1
#define FAT_SD_PART fat_part_mounted[4]
#define PC_COMPATIBLE
//*** IMPORTANT! For removable devices use NULL label ("")
#define _DRIVER_1 "SD_FAT.LIB"
#define _DRIVER_1_INIT { "SD", sd_InitDriver, _DRIVER_CALLBACK, },
#define _DEVICE_1 { sd_InitDriver, _DEVICE_CALLBACK, 0, 0, \
FDDF_MOUNT_PART_ALL|FDDF_MOUNT_DEV_1, "", },

Remember that again this is a library file and commenting out these lines will remove SD support on any program compiled to a RCM3900 until you reverse this change. This change will not only save the code space of the driver, but will reduce the cache memory usage a bit as well. Hopefully these get you the extra memory you need.

-Bill
--- In r..., kk@... wrote:
>
> Hi, I am using a rabbit 3900 which has 512k Program Flash and 512k ram + a 32mb NAND Flash. My program uses both the TCP/IP and FAT libraries. I was wondering if anyone had any suggestions for reducing the size of these two entities. I am using dynamic C version 9.6.2.
>
> The target program uses basic TCP Sockets. No UDP.
>
> I have the NAND Flash formatted to FAT12. This particular program has no need for the SD Flash.
>
> Any hints to save memory space in these two places would be appreciated.
> Thanks
>
> Ken
>


The 2024 Embedded Online Conference