invalid conversion from 'unsigned int' to 'Efc*'

Hello,

This code grabs the unique ID on the arduino DUE, but I noticed it throws an error on later versions of the IDE like 1.6.9. It does compile on IDE 1.6.5, but NOT if you include the ethernet library.

The error is: error: invalid conversion from ‘unsigned int’ to ‘Efc*’ [-fpermissive]

I can’t figure out what Efc* is…any help would be great, thank you.

//START due unique ID stuff
#define EFC_ACCESS_MODE_128    0
#define FLASH_ACCESS_MODE_128    EFC_ACCESS_MODE_128
#define EFC0       (0x400E0A00U)
#define EFC       EFC0

uint32_t ul_rc;
   uint32_t unique_id[4];

typedef enum flash_rc {
   FLASH_RC_OK = 0,        //!< Operation OK
   FLASH_RC_YES = 1,       //!< Yes
   FLASH_RC_NO = 0,        //!< No
   FLASH_RC_ERROR = 0x10,  //!< General error
   FLASH_RC_INVALID,       //!< Invalid argument input
   FLASH_RC_NOT_SUPPORT = 0xFFFFFFFF    //!< Operation is not supported
} flash_rc_t;
typedef unsigned long UL;
//END due serial

void setup() {
  // put your setup code here, to run once:
Serial.begin(115200);

ul_rc = efc_init(EFC, FLASH_ACCESS_MODE_128, 4);
if (ul_rc != 0) {
Serial.println(" FOUT" );
   }

Serial.println(F("SAM3X8E 128bit Unique ID (dwords in HEX)"));
ul_rc = flash_read_unique_id(unique_id, 4);
Serial.print(F("ID = " ));
for (uint8_t i=0; i<4;i++) {
  Serial.print((UL)unique_id[i],HEX);
  if (i<3) {Serial.print("-");}
}

}//end setup

void loop() {
  // put your main code here, to run repeatedly:
}

uint32_t flash_read_unique_id(uint32_t *pul_data, uint32_t ul_size)
{
   uint32_t uid_buf[4];
   uint32_t ul_idx;
   if (FLASH_RC_OK != efc_perform_read_sequence(EFC, EFC_FCMD_STUI,
         EFC_FCMD_SPUI, uid_buf, 4)) {
      return FLASH_RC_ERROR;
   }
   if (ul_size > 4) {
      /* Only 4 dword to store unique ID */
      ul_size = 4;
   }
   for (ul_idx = 0; ul_idx < ul_size; ul_idx++) {
      pul_data[ul_idx] = uid_buf[ul_idx];
   }
   return FLASH_RC_OK;
}//end main loop

I guess the error arises here

  ul_rc = efc_init(EFC, FLASH_ACCESS_MODE_128, 4);

EFC is just a number, defined here:

#define EFC0       (0x400E0A00U)
#define EFC       EFC0

If the magic number is correct

#define EFC ((Efc*)EFC0)

should satisfy the more picky new compiler settings.

Is "EFC0" supposed to be hexadecimal number? If so, make that 0xEFC0 ...

kind regards,

Jos

EFC0 is a name for the number 0x400E0A00 which is in reality an address.

michael_x: If the magic number is correct

#define EFC ((Efc*)EFC0)

should satisfy the more picky new compiler settings.

Thanks for the assistance, however i'm still getting the following error with that change...

'Efc' was not declared in this scope

any ideas?

#define EFC0       (0x400E0A00U)
#define EFC       EFC0

Remove the EFC0 definition, it is already defined in the header files.

Hey,

by using your sketch, I get the following error.

efc_init' was not declared in this scope

Can you help me ?