We are using StarterWare 1.00.02.02 on CCSv5.1 Code Sourcery GCC for arm-none-eabi - v2009q1 arm-none-eabi toolchain on Windows for AM1808 Zoom eXp board.
There are 2 issues for which I would require your immediate help. My main aim is to implement TFTP/FTP server on my board for which I would require a file-system and a storage device. With the StarterWare code available I could only think of these 2 combinations.
1. FatFS over Memory Card
In the third_party/fatfs/port folder there is a file fat_mmcsd.c which contains APIs for disk related operations (init, read, write, etc). But it includes couple of header files out of which I am unable to find mmcsd_proto.h and hs_mmcsdlib.h. I came to know, as per the release notes, that MMC support is absent for current StarterWare version of AM1808. So that leaves me only with below option.
2. FatFS over USB Mass Storage
For this I used fat_usbmsc.c found under the third_party/fatfs/port folder along with usb_host_msc.c found under examples/evmAM1808/usb_host_msc folder. Now here with support of given usblib I am able to meet almost all requirements for compilation except for
C:\Program Files\CodeSourcery/arm-none-eabi/lib/\libc.a(lib_a-sbrkr.o): In function `_sbrk_r':
sbrkr.c:(.text+0x18): undefined reference to `_sbrk'
make[1]: *** [bin] Error 1
On googling I came to know that this error is generated due to malloc call and is somehow linked to libc library. Further I also found a probable solution as below
(1) Modify standalone.ld script a little bit
[...]
.bss :
{
_bss = .;
*(.bss*)
*(COMMON)
_ebss = .;
. = ALIGN (8);
_end = .;
} > SRAM
PROVIDE(__HEAP_START = _end );
[...]
(2) Create a file syscalls.c and add the following code:
/* based on a example-code from Keil for CS G++ */
/* for caddr_t (typedef char * caddr_t;) */
#include <sys/types.h>
extern int __HEAP_START;
caddr_t _sbrk ( int incr )
{
static unsigned char *heap = NULL;
unsigned char *prev_heap;
if (heap == NULL) {
heap = (unsigned char *)&__HEAP_START;
}
prev_heap = heap;
/* check removed to show basic approach */
heap += incr;
return (caddr_t) prev_heap;
}
(3) make sure the file is compiled and the object-code from it gets linked.
Source: http://embdev.net/topic/129753
I want to know if making these changes to linker script and toolchain level is advisable or not. Also as mentioned in the linked post further unforeseen modifications would be required. Have you ever come across such an issue before and if so then how did you resolve it? Was the solution reliable? Also apart from these is there any other way to implement TFTP/FTP server on the board with FatFS over some other mass storage device whose driver is available with you?
Also do you have any plans for implementing MMC support for AM1808 StarterWare upcoming version? If not can you please help us porting MMC support which may be available for AM35xx or similar platforms onto AM1808?
Regards,
jitendra