[ECOS] Bugs in Legacy API for FlashV2

Rutger Hofman rutger@cs.vu.nl
Fri Feb 2 18:31:00 GMT 2007


Good evening list and eCos committers,

prompted by frequent references to the FlashV2 implementation and its 
thread-safe behaviour, I upgraded to the Flash V2 branch of the eCos 
repository.

I met a compile-time and a link-time bug, both in the wrappers for the 
Legacy Flash Interface. This made me wonder if the Legacy Flash 
interface is in fact unused?

The patches seem simple:

1. Compile time in packages/io/flash/current/src/legacy_dev.c, line 145:

in function legacy_flash_program(), there is a reference to block_size. 
However, block_size is not defined. I assume it is defined in the same 
way as in the functions around it:

    typedef int code_fun(cyg_flashaddr_t, const void *, int, unsigned 
long, int);
    code_fun *_flash_program_buf;
    /* The definition of block_size lacks here. Put it in. RFHH */
+  size_t block_size = dev->block_info[0].block_size;
    size_t block_mask = ~(block_size -1);
    int    stat;

2. Link time: undefined references to flash_lock and flash_unlock.

I think these must be added to packages/io/flash/current/src/legacy_api.c:

/*
  * Seems these are missing from the legacy interface:   RFHH
  */
#ifdef CYGHWR_IO_FLASH_BLOCK_LOCKING
int flash_lock(void *base, int len, void **err_address)
{
     return cyg_flash_lock((const cyg_flashaddr_t)base,
                           len, (cyg_flashaddr_t *)err_address);
}

int flash_unlock(void *base, int len, void **err_address)
{
     return cyg_flash_unlock((const cyg_flashaddr_t)base,
                             len, (cyg_flashaddr_t *)err_address);
}
#endif

-- 
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