I am working on a emwin project, to display some images on the lcd, at the beginning, I put the image data in the internal flash, it works good. As I need to use many pictures in the project, later I move the image data to external board flash, with this statement:
#include <cr_section_macros.h>
__RODATA(BOARD_FLASH) const U8 _acImage_0[5862] = {.....};
but the screen is all black, I debuged the programm, found the address of &_acImage_0[0] is at 0x10000000, which is the start of the BOARD_FLASH (Flash2), but the content of it is all zero, and another finding is, the two satement get different result:
1,
const U8* pData =&_acImage_0[0];
printf("%x\n", *pData);
2,
printf("%x\n", _acImage_0[0]);
the first statment gets 0, but the second gets the correct value.
what's the difference between these two methods? in my emwin function, I have to pass the _acImage_0 address as a pointer, so this may be the point.
已解决! 转到解答。
Now the issue is resolved, it's caused by the un-initialize of the spifi driver, so any data access to the spi flash will return 0.
for the details of initializing the SPIFI driver, please refer to the sample project of spifi_polling_transfer.
Now the issue is resolved, it's caused by the un-initialize of the spifi driver, so any data access to the spi flash will return 0.
for the details of initializing the SPIFI driver, please refer to the sample project of spifi_polling_transfer.
I can guess the reason why the second sentence gets correct data, maybe because of the compiler refines the procedure, just assign _acImage_0[0] to the printf input, because it can be determined at compile time. right? now I tried many methods, all get zero while reading the content of the board flash.
Hi rui wang,
U8* const pData =&_acImage_0[0];
printf("%x\n", *pData);
Have a great day,
TIC
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!