Wednesday, May 23rd 2018, 11:00am UTC+2

You are not logged in.

  • Login
  • Register

Dear visitor, welcome to SEGGER Forum. If this is your first visit here, please read the Help. It explains how this page works. You must be registered before you can use all the page's features. Please use the registration form, to register here or read more information about the registration process. If you are already registered, please login here.

danilotto

Beginner

Date of registration: Jun 9th 2017

Posts: 4

1

Saturday, November 4th 2017, 11:39pm

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
2
3
4
5
6
7
8
9
10
11
12
int GUI_GET_DATA_FUNC(void * p, const U8 ** ppData, unsigned NumBytes, U32 Off)
{
   uint16_t dataread;
   uint8_t acBuffer[1000];

   dataread = sFLASH_ReadBuffer(acBuffer, 0x0000 (image start address in flash) + Off, NumBytes);

   memcpy(*ppData, _acBuffer, NumBytesRead);

   return dataread;

} 


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