Create a tiny file system

When you connect an mbed LPC11U24 with a computer, a disk named "MBED" will pop up. In the disk, there is a "MBED.HTM" file which will lead you to

I really like this feature. So when we design Arch, we use the Arch as a tiny disk to provide the feature. Implementing it takes three steps:

  1. Use USBMSD library to turn the Arch into a disk
  2. Create a tiny file system
  3. Put the file system into the Arch

Make a disk

It's quite easy to make a disk using USBMSD library. Here is a demo program. The content of the disk is in "DiskImage.c" file.

Import program

00001 #include "mbed.h"
00002 #include "USBTinyDisk.h"
00004 BusOut leds(LED1, LED2, LED3, LED4);
00005 USBTinyDisk disk;
00007 int main() {
00008     disk.connect();
00010     uint8_t count = 0;
00011     while(1) {
00012         leds = count;
00013         count++;
00014         wait(1);
00015     }
00016 }

Create a custom file system

We can easily create a custom file system on linux.

git clone
cd dosfstools
dd if=/dev/zero of=disk bs=1024 count=2
./mkfs.fat -a -n "name" -s 1 -S 512 -f 1 -h 0 -F 12 -r 16 -R 1 disk
mkdir mnt
sudo mount disk mnt
sudo echo "hello, mbed" > mnt/README.txt"
sudo umount mnt
python disk DiskImage.c

The file system is in DiskImage.c. Use it in the above program, you will get the custom tiny disk.


Please log in to post comments.