#2 USB mass-storage with Atmel AT91
This is a Mass-Storage Device (MSD) support to eCos, slave side only ( eCos does not currently support USB host side ). The mass-storage driver is tested with an AT91SAM7X128 evaluation kit using an external power supply. The AT91SAM7X128 evaluation kit is usually self powered from the USB port, some hardware modifications are therefore required to use an external power source. To do so, the 5 Volts pin of the USB connector is disconnected from the PCB. Instead, an external 5 Volts power supply is inserted.
I. Steps to generate the ROM application binary file
$ ecosconfig import packages/hal/arm/at91/at91sam7xek/current/misc/default_usbs_msd.ecm
$ ecosconfig remove CYGPKG_LIBC_SETJMP
$ ecosconfig remove CYGPKG_LIBC_SIGNALS
$ ecosconfig remove CYGPKG_LIBC_STARTUP
$ ecosconfig remove CYGPKG_LIBC_TIME
$ ecosconfig remove CYGPKG_LIBM
$ ecosconfig remove CYGPKG_LIBC
$ ecosconfig remove CYGPKG_DEVS_ETH_PHY
$ ecosconfig remove CYGPKG_DEVS_ETH_ARM_AT91
$ ecosconfig tree
Next step is to compile the supplied "RAM disk" test. This test application creates a tiny ram disk of around 32 sectors of 512 bytes formatted using FAT12. The 16KB RAM disk space is statically defined. The disk devtab entry is "/dev/ramdisk0". The first partition is accessible from "/dev/ramdisk0/1". The test application is located here:
II. Mass-Storage Device template configuration
The template ( default_usbs_msd.ecm ) contains the required configuration to run the RAM disk test on the AT91SAM7X128 board. The following packages are added to include disk and filesystem support:
The following options are set: EP4 is used has TX endpoint. EP4 size is set to 256 bytes. The RX endpoint remains the default endpoint ( EP2 ). The null lenght termination packet is disable and stalling is enable.
Some packages are removed from the default template to reduce the application size.
III. Testing the MSD driver
Burn the resulting binary file to the target FLASH at @0x00100000. Restart the target and plug the USB cable to the host machine. The host machine should detect a USB MSD drive under the eCos-3.0 name as shown in the following screenshot:
The USB MSD package is further documented in the updated eCos documentation here . Here is the output of lsusb under a linux based host machine:
List of file changed / added (diff from ecos public repository) :
The USB MSD package is now part of eCos public repository at:
$ cvs -z3 -d :pserver:firstname.lastname@example.org:/cvs/ecos co -P ecos