[En-Nut-Discussion] PHAT0 mount failure

Coleman Brumley cbrumley at polarsoft.biz
Wed Jan 7 23:50:56 CET 2015

Hello all.

I'm attempting to use the PHAT file system in Nut/OS v4.8.7, and I have code
as follows (mostly from the ftp example):

#define MY_FSDEV       devPhat0 
#define MY_FSDEV_NAME  "PHAT0" 
extern NUTDEVICE devAt91SpiDfc0;
#define MY_BLKDEV      devAt91SpiDfc0

#ifdef MY_BLKDEV
	printf("Registering filesystem device '" MY_FSDEV_NAME "'...");	
	if (NutRegisterDevice(&MY_FSDEV, 0, 0)) {
        puts("\nfailed, waiting for Dog");
        for (;;);
    /* Register block device. */
    printf("Registering block device '" MY_BLKDEV_NAME "'...");    
    if (NutRegisterDevice(&MY_BLKDEV, 0, 0)) {
        puts("\nfailed, waiting for Dog");
        for (;;);
	/* Mount partition. */    
    printf("Mounting partition '" MY_BLKDEV_NAME ":0/" MY_FSDEV_NAME
    if (_open(MY_BLKDEV_NAME ":0/" MY_FSDEV_NAME, _O_RDWR | _O_BINARY) ==
-1) {
        puts("\nMnt BLK DEV failed, waiting for Dog");
        for (;;);

At startup, I see the following output on the DBGU port:

Registering filesystem device 'PHAT0'...OK

Registering block device 'DFC0'...OK

Mounting partition 'DFC0:0/PHAT0'...E:/ethernut-4.8.7/nut/fs/phatvol.c:382:
Memory block at 0x205584 never alloced

Interestingly, like 382 in /nut/fs/phatvol.c is in PhatVolUnmount(), so does
that mean that open attempted a mount which failed which in turn called

Is there something I'm missing with regard to using and initializing PHAT? 


More information about the En-Nut-Discussion mailing list