[ECOS] FW: Adding flash device using the flash v2 drivers

Alex Lindeijer Alex.L@3D-Perception.com
Fri Dec 19 19:28:00 GMT 2008


Hi
Thanks, for the fast response. I found the documentation and added
#include "cyg/io/am29xxxxx_dev.h"

#ifdef CYGPKG_DEVS_FLASH_AMD_AM29XXXXX_V2

#include "cyg/io/flash.h"
#include "cyg/io/flash_dev.h"


static const CYG_FLASH_FUNS(hal_mw2_flash_amd_funs,
    cyg_am29xxxxx_init_cfi_16,
    cyg_flash_devfn_query_nop,
    cyg_am29xxxxx_erase_16,
    cyg_am29xxxxx_program_16,
    (int (*)(struct cyg_flash_dev*, const cyg_flashaddr_t, void*, size_t))0,
    cyg_flash_devfn_lock_nop,
    cyg_flash_devfn_unlock_nop);

static cyg_am29xxxxx_dev hal_mw2_flash_priv;

CYG_FLASH_DRIVER(hal_mw2_flash,
                 &hal_mw2_flash_amd_funs,
                 0,
                 0xF0000000,
                 0xFFFFFFFF,
                 1,
                 hal_mw2_flash_priv.block_info,
                 &hal_mw2_flash_priv
);
#endif

In my board specific flash code mw2_flash.c and the following in the board specific cdl in the dev/flash tree
cdl_package CYGPKG_DEVS_FLASH_POWERPC_MW2 {
    display       "3DP MW2 FLASH memory support"

    parent        CYGPKG_IO_FLASH
    active_if	  CYGPKG_IO_FLASH
    requires	  CYGPKG_HAL_POWERPC_MW2

    implements    CYGHWR_IO_FLASH_DEVICE

    compile       mw2_flash.c

    # Arguably this should do in the generic package
    # but then there is a logic loop so you can never enable it.
    cdl_interface CYGINT_DEVS_FLASH_AMD_AM29XXXXX_REQUIRED {
        display   "Generic AMD flash driver required"
    }

    implements    CYGINT_DEVS_FLASH_AMD_AM29XXXXX_REQUIRED
    
}

And I have set CYGHWR_IO_FLASH_DEVICE to 1
But still I gett he "incorrect number of devices" assert
 I find the hal_mw2_flash back in the ecos library (grep) so it was included........
I assume that the error message is an result of not correctly adding an entry to the flash device table.
Br
Alex Lindeijer
3D Perception - Senior System Designer
Solbråveien 41, PO. Box 455
N-1373 Asker, Norway

-----Original Message-----
From: Andrew Lunn [mailto:andrew@lunn.ch] 
Sent: 19. desember 2008 15:31
To: Alex Lindeijer
Cc: ecos-discuss@sourceware.org
Subject: Re: [ECOS] FW: Adding flash device using the flash v2 drivers

On Fri, Dec 19, 2008 at 02:33:49PM +0100, Alex Lindeijer wrote:
> 
> Hi
> We have a controller card with a MPC8541 on it and a spansion S29GL512
> flash. We used the Python eval board from A&M to start the ecos based
> development. The ecos supplied was base don the legacy v1 flash drivers.
> We are experiencing some verification problems on certain higher
> addresses when accessing it from our application but everything is OK
> when writing to flash from Redboot.

I would check your memory controller configuration. Maybe it is not
driving the top address line, so it is left floating. Just an idea.

> Therefore I wanted to tryt he v2 flasher driver to see whether that
> makes a difference.. It seems I have (almost) everything in place but
> get at startup
> 
> ASSERT FAIL: <4>flash.c[231]cyg_flash_init() incorrect number of flash
> devices
> 
> Question is now: how do I add the flash device to the cyg_flashdevtab? I
> suppose I have to do this in the board specific python.c under
> devs/flash/....
> 
> When adding an extra ethernet port it was quit clear how to add it to
> the netdevtab using the NETDEVTAB_ENTRY macro. Is there something
> similar for adding a flash device?

Yes, CYG_FLASH_DRIVER(). The am29xxxxxv2 has good documentation. Take
a look at that as an example.
 
> And: can I run flash v2 in my applicattion and the legacy in my
> redboot(ROMRAM)?

Yes, that will work.

     Andrew

--
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss



More information about the Ecos-discuss mailing list