News:

Welcome to the Bridgetek Community!

Please read our Welcome Note

Technical Support enquires
please contact the team
@ Bridgetek Support

Please refer to our website for detailed information on all our products - Bridgetek - Bridging Technology

Main Menu

FlashRead

Started by NSTtom, February 12, 2025, 03:57:30 PM

Previous topic - Next topic

NSTtom

I have been running into a similar issue as others on this forum whereby rendering too many images from flash is causing my screen to glitch and not run properly. I am now trying to render my images from RAM_G rather than the flash but I am having trouble getting this to work and am instead met by a black screen each time. The EVE is still running and is not paddling which I have checked. I think the issue is probably me not fully understanding how to use the FlashRead command and therefore not understanding how to display from RAMG. If someone could provide some code snippets with how they have pulled their bitmaps from flash into RAM_G and then displayed them that would be great.

Rudolph

CMD_FLASHREAD has a couple of requirements, I put these in the docs of the function header in my library:

/**
* @brief Copies "num" bytes from "src" in attached SPI flash storage to "dest" in RAM_G.
* @note - src must be 64-byte aligned, dest must be 4-byte aligned, num must be a multiple of 4
* @note - EVE will not do anything if the alignment requirements are not met
* @note - The src pointer is relative to the flash so the first address is 0x000000 not 0x800000.
...
*/
void EVE_cmd_flashread(const uint32_t dest, const uint32_t src, const uint32_t num)

If you are using EAB, the files should be stored 64 byte aligned already.

BRT Community

Do you have a small example of an item in the Flash map file? Please provide the code you use to read it into RAM_G, as well as the code used to display it. We can help check if there are any issues.
Best Regards, BRT Community

NSTtom

Here is my code, I can confirm that the flash address is correct since whenever I render from flash this is the addressing that is used:
   testBMprop = getBMProperties(NST_BG_OS_BM_ID);
   Cmd_FlashRead(0,(testBMprop.flashDest*EVE_FLASH_BLOCK_SIZE/EVE_FLASH_POINTER_MULTIPLIER), testBMprop.dataLength);

   Send_CMD(BITMAP_SOURCE(0));
   Send_CMD(BITMAP_LAYOUT(testBMprop.format, testBMprop.lineStride, testBMprop.height));
   Send_CMD(BITMAP_SIZE(NEAREST, BORDER, BORDER, testBMprop.width, testBMprop.height));
   startDisplayList();
    Send_CMD(BEGIN(BITMAPS));
    Send_CMD(VERTEX2F((200*16), 200*16));

   Send_CMD(END());

This above code currently just displays a big white box at the point 200, 200 which i presume is just undefined memory? Is there somewhere I should write to in RAM_G specifically?

Rudolph

Quote from: NSTtom on February 13, 2025, 12:33:45 PM
Here is my code, I can confirm that the flash address is correct since whenever I render from flash this is the addressing that is used:
   testBMprop = getBMProperties(NST_BG_OS_BM_ID);
   Cmd_FlashRead(0,(testBMprop.flashDest*EVE_FLASH_BLOCK_SIZE/EVE_FLASH_POINTER_MULTIPLIER), testBMprop.dataLength);

No, you do not render from the same address in the flash as you read from the flash.
Displaying from flash uses: (0x800000 | (address/32)) as source address - with an address from the EAB generated .map file.
And if testBMprop.flashDest retuns the address from the .map file,
then you use it directly to read with CMD_FLASHREAD.

Try:
Cmd_FlashRead(0, testBMprop.flashDest, testBMprop.dataLength);

And if that also does not work, please provide the numbers.

As I wrot above:
"src must be 64-byte aligned, dest must be 4-byte aligned, num must be a multiple of 4"
"The src pointer is relative to the flash so the first address is 0x000000 not 0x800000."


Which library is this? Or in other words, is the implementation of the command even correct? There is no way to tell.

BRT Community

To analyze your issue more accurately, we recommend that you provide the .map file generated by EAB, which will help us verify whether the image addresses in Flash are correct.

If you are unsure how to generate the .map file, you can also directly provide your image file, and we can assist in checking where the issue might be in your code.

Please confirm and share the relevant files, as this will help us further diagnose and provide the appropriate solution.

Best Regards,
BRT Community