Custom flash support in xTIMEcomposer
Posted: Wed Feb 21, 2018 6:18 pm
This topic is sort of follow up to this one and that one, and few others where adding of flash that is not supported by xTIMEcomposer was already discussed. In all of them I can find that separate config file is suggested that has to be specified to xflash when flashing is performed (i.e. from command line). I'd like to know is it allowed to simply add definition of the new flash to header files SpecMacros.h, SpecEnum.h or QuadSpecMacros.h and QuadSpecEnum.h? All of them has the following notice in the header:
Why is that? How and when they were generated? I'd like to add support for QSPI flash that is not currently supported, Adesto AT25SF041 (Datasheet). Therefore I'd like to append the following code to the QuadSpecMacros.h file (FL_QUADDEVICE_ADESTO_AT25SD041 used as template):
(Please note that I added ? sign before value that I'm not sure that is applicable)
... and in QuadSpecEnum.h file:
Then I can add into my .xn file the following:
Code: Select all
/*
* Generated file - do not edit.
*/
Code: Select all
#define FL_QUADDEVICE_ADESTO_AT25SF041 \
{ \
ADESTO_AT25SF041, /* AT25SF041-SSHDT */ \
256, /* page size */ \
2048, /* num pages */ \
3, /* address size */ \
? 3, /* log2 clock divider, 16.6MHz from a 100MHz reference clock, i.e. 100 / (2*3) */ \
0x9F, /* QSPI_RDID, Section 11.1*/ \
0, /* id dummy bytes */ \
3, /* id size in bytes */ \
0x1F8401, /* device id, Table 11-2*/ \
0x20, /* QSPI_SE (Block erase command), Table 5-1 */ \
? 4096, /* Sector erase is always 4KB */ \
0x06, /* QSPI_WREN (Write Enable command), Table 5-1 */ \
0x04, /* QSPI_WRDI (Write Disable command), Table 5-1 */ \
PROT_TYPE_NONE, /* no protection */ \
? {{0,0},{0x00,0x00}}, /* QSPI_SP, QSPI_SU */ \
0x02, /* QSPI_PP (Page Program command), Table 5-1 */ \
0xEB, /* QSPI_READ_FAST (Quad I/O Read command), Table 5-1 */ \
? 1, /* 1 read dummy byte */ \
SECTOR_LAYOUT_REGULAR, /* mad sectors */ \
? {4096,{0,{0}}}, /* regular sector/block sizes */ \
0x05, /* QSPI_RDSR (Read Status Register Byte 1 command), Table 5-1 */ \
0x01, /* QSPI_WRSR (Write Status Register command), Table 5-1 */ \
0x01, /* QSPI_WIP_BIT_MASK, Table 5-1 */ \
}
... and in QuadSpecEnum.h file:
Code: Select all
ADESTO_AT25SF041 = 8,
Code: Select all
<ExternalDevices>
<Device NodeId="0" Tile="0" Class="SQIFlash" Name="bootFlash" Type="ADESTO_AT25SF041">
<Attribute Name="PORT_SQI_CS" Value="PORT_SQI_CS"/>
<Attribute Name="PORT_SQI_SCLK" Value="PORT_SQI_SCLK"/>
<Attribute Name="PORT_SQI_SIO" Value="PORT_SQI_SIO"/>
<Attribute Name="QE_REGISTER" Value="quad_spi_qe_location_status_reg_0"/>
<Attribute Name="QE_BIT" Value="quad_spi_qe_bit_6"/>
</Device>
</ExternalDevices>