The function only have the read size param, My question is how to set ram address to save spi data?
>> Please let me know if you are using a second stage boot loader for reading at from SPI flash to FX3 RAM?
Please refer to FX3BootAppGcc (second stage boot loader) firmware of the SDK which writes to FX3 RAM from SPI Flash in DMA mode
Path: C:\Program Files (x86)\Cypress\EZ-USB FX3 SDK\1.3\firmware\boot_fw
Are there any updates?
Apologies for the delayed response.
As per my understanding of your application, a piece of data will be read from the SPI flash and written to the FX3 RAM location. And this will not be done from the second stage bootloader but from the application firmware. Is my understanding right?
As mentioned in my previous response you can refer to FX3BootAppGcc (second stage bootloader) for the implementation of the same.
For the RAM address, you can refer to Figure 3.2 of the FX3 TRM (in the SDK) which mentions the different regions of the system memory. assuming that the data read from SPI flash is to be written in the code area. The code Area starts from the address 0x40003000. The default code area size is 180 KB i.e. from 0x40003000 to 0x40030000.
In the Fx3BootAppGCC firmware, CyFx3BootSpiDmaXferData API is used to write, the data read from SPI Flash to FX3's RAM. The second parameter passed to this API is the address of the FX3 RAM to which the data is to be written.
status = CyFx3BootSpiDmaXferData (CyTrue, downloadAddress, SPI_DMA_XFER_SIZE, 100);
Note: Please confirm/check that the address at which the firmware code /data (current /running firmware) is written in the RAM is not overwritten by the data which is read from SPI flash.