Loading images from external SPI flash (not addressable)

This site uses cookies. By continuing to browse this site, you are agreeing to our Cookie Policy.

  • Loading images from external SPI flash (not addressable)

    Hi All,

    I need to put in external SPI flash (not addressable memory space) some graphic data (icons, a logo, a couple of very small images). Microchip SST26VF064B
    I have no file system on that chip.

    Statements:
    1) emWin reserved (...)Ex function for this purpose. Like: GUI_BMP_DrawEx()
    2) ...Ex functions require a GetData function to retrieve data from the external media (in my case the SST26VF064B SPI flash memory)
    3) this is the prototype of the function is:

    Source Code

    1. int GUI_GET_DATA_FUNC(void * p, const U8 ** ppData, unsigned NumBytes, U32 Off);


    4) i will choose the DTA streamed format and I will load the converted file(s) to the external flash via an external flash programmer.
    5) I found several examples for retrieving data from SD card with FatFS. But none targeting my needs, despite finding it quite common. I have no FatFS on my flash memory.
    6) I access my SPI flash through functions like:

    Source Code

    1. uint16_t sFLASH_ReadBuffer(uint8_t* pBuffer, uint32_t ReadAddr, uint16_t NumByteToRead);

    the function returns the number of bytes read

    Questions:

    1) How to integrate the two functions in order to retrieve data:
    I figured out something like:

    Source Code

    1. int GUI_GET_DATA_FUNC(void * p, const U8 ** ppData, unsigned NumBytes, U32 Off)
    2. {
    3. uint16_t dataread;
    4. uint8_t acBuffer[1000];
    5. dataread = sFLASH_ReadBuffer(acBuffer, 0x0000 (image start address in flash) + Off, NumBytes);
    6. memcpy(*ppData, _acBuffer, NumBytesRead);
    7. return dataread;
    8. }
    Display All


    Void *p pointer is not used for my purpose, please confirm.

    2) Not having a file structure, do I need to have different __GetData functions for each image with its own starting address in memory?

    Hope it can clarify for all users once and for all.
    Many thanks

    PS: Yes I read the manual at the chapter 9.5 "Getting data with the ...Ex() functions" and once more I found it targeted at a media with a file system on it.

    Daniele