iMX233-OLinuXino development – do not wear your SD-card flash


In my previous post I wrote how to setup GCC tools for iMX233-OLinuXino and how to make your “hello world” program.

To do compilation on the SD card though is bad idea. SD card is FLASH memory this means to write sector in it this sector first have to be erased, the number of Erase cycles of the Flash memory is limited and may be as high as 1 000 000 times and as low as 1 000 cycles (depend on the SD card vendor 😉 ), 1000 times my seems to you quite high but just imagine that you have to compile several times your code until you make it work you can wear your card for week.

Then what you should do?

There is smart work around by using SSH and shared folder on your host linux computer where you can place your working directory.

1. You need to install SSH on iMX233-OLinuXino (we assume you use ARCH Linux distribution):

$ sudo su

# pacman -Sy sshfs

2. On your host linux machine create working directory for instance “olinuxino_test” using this command:

# sshfs [user]@[host]:[dir] [mountpoint]

For example:

# sshfs olimex-server11@ /mnt/test_build

In this case the working directory is in the user home folder.

3. Simply go to the mount point and start working:

# cd /mnt/test_build

# cc testcode.c -o test

4. If you want to unmount  the remote directory use this command:

# fusermount -u /mnt/test_build

By using this approach all your compilation is done in the remote folder and your SD card flash is safe.

13 Comments (+add yours?)

  1. Jon Smirl
    Sep 17, 2012 @ 19:48:42

    Much easier to only load uboot onto the flash card and leave the card in the board. Set uboot to tftp the kernel over the net. Set the kernel to then nfs boot from the same machine.

    Hit reset – voila, new kernel and distro from your remote PC. Compile on remote PC, hit reset, repeat.

    When you finally get everything the way you want it, then copy it to the SD Card.


  2. Joshua Boyd
    Sep 17, 2012 @ 20:23:20

    Wouldn’t CIFS or NFS be about as easy to setup as sshfs?


  3. Radu - Eosif Mihailescu
    Sep 18, 2012 @ 00:30:32

    J.B.> It depends on whether you already have a CIFS/NFS server running or not 😉 SSHfs, even if exotic, will tend to work from the first attempt with no additional setup or complications.

    Also, it’s worth mentioning that, since you already have a full-featured PC at your disposal, you could do all the heavy lifting on the PC since we already have a proper toolchain for that (i.e. GCC that targets ARM + Linux).
    The board could then be used (only) for final testing of executables, especially board-specific ones (e.g. ones that talk to GPIO), and this could be done once again without involving the flash by running a gdb server on the board and uploading the binary from the remote gdb on the PC straight to RAM.

    Since the initial commands to connect and upload can be scripted and, apart from that, the gdb running on the PC behaves exactly like a “real” local gdb, usual development tools can be used from that point onwards (e.g. DDD or Eclipse’s gdb support).

    Advantages: compilation is fast, upload is fast, development iterations are fast, product gets finished and delivered earlier 🙂


  4. Galland
    Sep 18, 2012 @ 10:20:58

    What about a very small partition in memory (ramfs)?


  5. Trackback: Hands on olimex olinuxino board
  6. Raashid Muhammed
    Jan 04, 2013 @ 09:51:02

    FSL u-boot causes problems on imx233-olinuxino-maxi… The board hangs after booting u-boot….Any idea on this problem…?


  7. Martin
    Oct 22, 2014 @ 01:37:45

    Or use a ramdisk 🙂


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: