Thank you for your comment.
I found the project for this .lib and I changed the ID.
Of course, it works ! But we use the MAC address as the unique ID and the MAC address I was reading was wrong. After a quick look, I saw the MAC address was read at the end of the memory.
So in spiflash_numonyx.h
#define NUMONYX_M25P64_SIZE (8388608)
#define NUMONYX_MT25QL128ABA1EW9_SIZE (16777216)
And I changed
#define SPIFLASH_CHIP_SIZE (NUMONYX_M25P64_SIZE)
#define SPIFLASH_CHIP_SIZE (NUMONYX_MT25QL128ABA1EW9_SIZE)
At this point I was able to read the MAC address and everything else was working like usual.
The only think was kill me, from this point I will need to have two versions of code. If I want to upgrade an older device, I will need to know what version of SOM I had in the device...
To make thing simple, I decided to replace the #define by a variable.
So now, in spiflash_numonyx.h SPIFLASH_CHIP_SIZE is not a #define anymore.
extern uint32_t SPIFLASH_CHIP_SIZE;
In spiflash_numonyx.c is initialized like that :
uint32_t SPIFLASH_CHIP_SIZE = NUMONYX_M25P64_SIZE;
In function uint32_t NUMONYX_verifyDeviceID(void)
I code this :
if ((spi_data != NUMONYX_MFR_ID) ||
(spi_data != NUMONYX_DEV_ID_TYPE) ||
(spi_data != NUMONYX_DEV_ID_CAP))
if ((spi_data != NUMONYX_MFR_ID2) ||
(spi_data != NUMONYX_DEV_ID_TYPE2) ||
(spi_data != NUMONYX_DEV_ID_CAP2))
printf("spi flash id does not match expected id!\r\n");
SPIFLASH_CHIP_SIZE = NUMONYX_MT25QL128ABA1EW9_SIZE;
printf("spi flash is MT25QL128ABA1EW9 (16mb)!\r\n");
SPIFLASH_CHIP_SIZE = NUMONYX_M25P64_SIZE;
printf("spi flash is M25P64 (8mb)!\r\n");
NUMONYX_MFR_ID2, NUMONYX_DEV_ID_TYPE2 and NUMONYX_DEV_ID_CAP2 are the new ID
#define NUMONYX_MFR_ID2 (0x20)
#define NUMONYX_DEV_ID_TYPE2 (0xBA)
#define NUMONYX_DEV_ID_CAP2 (0x18)
I didn't go deeper in my tests but for now everything looks fine. I can read and write in the memory and the MAC address is ok for both version of the SOM-M1.