[En-Nut-Discussion] spi_flash_at45d.c - compile errors with AT45D_CRC_PAGE enabled

Uwe Bonnes bon at elektron.ikp.physik.tu-darmstadt.de
Tue Apr 1 15:53:12 CEST 2014


>>>>> "Wojciech" == Wojciech Nizinski <niziak at spox.org> writes:

    Wojciech> Hello!  Currently I'm migrating my project from NutOS 4.9.10
    Wojciech> to 5.1.0-1.  Compiler found following problems (looks like
    Wojciech> copy-paste mistakes):

Probably you also migrated the compiler. It is now more picky than before.

    Wojciech> ../../ethernut/nut/dev/spi_flash_at45d.c: In function
    Wojciech> 'CalculateChecksum':
    Wojciech> ../../ethernut/nut/dev/spi_flash_at45d.c:150:15: error:
    Wojciech> assignment makes integer from pointer without a cast [-Werror]
    Wojciech> c = at->dxb_pbuf[i]; ^

This one in fishy. 
The definition is a poiter to a pointer
>     uint8_t *dxb_pbuf[FLASH_BUFFERS_AT45D];
> } AT45D_FLASH;

Try without the '*'
>     uint8_t *dxb_pbuf[FLASH_BUFFERS_AT45D];
> } AT45D_FLASH;


    Wojciech> ../../ethernut/nut/dev/spi_flash_at45d.c:137:16: error: unused
    Wojciech> variable 'bus' [-Werror=unused-variable] NUTSPIBUS *bus; ^
    Wojciech> ../../ethernut/nut/dev/spi_flash_at45d.c:136:9: error: unused
    Wojciech> variable 'rc' [-Werror=unused-variable] int rc; ^

Remove the unused variable definitions.

    Wojciech> ../../ethernut/nut/dev/spi_flash_at45d.c:160:1: error: no
    Wojciech> return statement in function returning non-void
    Wojciech> [-Werror=return-type] } ^

Replace
> static int CalculateChecksum(AT45D_FLASH * at, int_fast8_t b, uint16_t * crc16, int xlen)
with
> static void CalculateChecksum(AT45D_FLASH * at, int_fast8_t b, uint16_t * crc16, int xlen)

Let me know if the changes compile ok and work for you so I can update
trunk. Or better send me a diff...

Bye
-- 
Uwe Bonnes                bon at elektron.ikp.physik.tu-darmstadt.de

Institut fuer Kernphysik  Schlossgartenstrasse 9  64289 Darmstadt
--------- Tel. 06151 162516 -------- Fax. 06151 164321 ----------


More information about the En-Nut-Discussion mailing list