[En-Nut-Discussion] Nut-OS, AVR, and MMC interface....

Harald Kipp harald.kipp at egnite.de
Thu Jan 22 09:59:28 CET 2009


Hi Jim,

First of all many thanks for your plaudit. There are some pitfalls when
starting with Nut/OS and not everyone has patience and time to carry on.
Your post may encourage people not to give up too early.

Jim Patchell wrote:

> Was there an easier way to get the Nut libraries to build and include 
> PHAT without resorting to changing the Lua scripts... (I specifically 
> changed fs.nut ... think that was the name of the file)?

Apart from a few exceptions, the Configurator scripts are not really
Lua. In general they are just variable structures, which are scanned by
the C routines of the Configurator, which in turn uses the Lua
interpreter for this task. Some infos are available at

http://www.ethernut.de/en/documents/ntn-5_config.html

I have the latest CVS version here, your's may differ. It states in the
PHAT block of fs.nut

 requires = { "DEV_BLOCK" }

Unless there is no module enabled, which includes

 provides = { "DEV_BLOCK" }

then the PHAT driver will be left disabled. In my files this is provided
by the AT91 MCI driver and the "Basic MMC driver" only. While the first
requires an AT91 CPU, the second needs

 requires = { "DEV_MMCLL" }

which is provided by 5 modules, all of which require an AT91 CPU. So,
you may add your driver to conf/arch/avr.nut by simply copying and
modifying an existing entry and then add the provision of DEV_BLOCK or
DEV_MMCLL, depending on its level. You can test this without stopping
the Configurator, just reload the .conf file.

As always, do not forget to rebuild the system. In some cases you also
need to create the sample tree again. "Create" is the wrong term, it
will update the tree, not touching any modified files except Makefiles.

Btw. not many people are currently using the PHAT file system on the
AVR. On this target it may not be as rock solid as it should be.


> This experience also taught me a few things.  I already knew that Nut-OS 
> was pretty good, but after going through the pains of making this device 
> driver...I didn't realize just how sophisticated Nut-OS was.  It is 

The next release 4.8 will provide some relief. It includes a device
independent SPI/MMC bus interface, which allows to attach different low
level bus drivers, one of which is based on the device dependent GPIO
interface. The idea is, to have MMC/FAT support  on any platform as soon
as some basic port I/O is available. The low level part is done,
available in CVS HEAD, and so far it works with the new raw file system.
Making it compatible with PHAT will require some extra effort, beside
the fact that the PHAT file system has a lot of "optimization
potential", to say it in a friendly way. ;-)


Harald



More information about the En-Nut-Discussion mailing list