>When accessing the BT Flash, do we use the address 0x800000 for access/reference once its been initialized
>or use a relative address (0x00000) ?
Yes.
Some commands use a relative address like cmd_flashupdate and cmd_flashrite which start from 0x00000.
And cmd_setbitmap for example uses the number of 32 byte blocks with 0x800000 as offset:
EVE_cmd_setbitmap_burst(0x800000 | (4096/32), EVE_COMPRESSED_RGBA_ASTC_8x8_KHR, 344, 48); /* display directly from FLASH */
So in this line 4096 is the address of an image in the flash.
>Is the BT Flash persistent, or does it need to be initialized after every GPU reset?
It is nonvolatile and once it is programmed you need to use cmd_flashfast() after every GPU reset
to actually make use of the content.
I wrote this a couple of days ago as a demonstration for someone else:
#include "EVE.h"
#include "tft_data.h"
/* some pre-definded colors */
#define WHITE 0xffffffUL
#define BLACK 0x000000UL
uint8_t tft_active = 0;
void TFT_init(void)
{
if(EVE_init() != 0)
{
tft_active = 1;
EVE_memWrite8(REG_PWM_DUTY, 0x40); /* setup backlight, range is from 0 = off to 0x80 = max */
#if 1
/* this is only needed once to transfer the flash-image to the external flash */
uint32_t datasize;
EVE_cmd_inflate(0, flash, sizeof(flash)); /* de-compress flash-image to RAM_G */
datasize = EVE_cmd_getptr(); /* we unpacked to RAM_G address 0x0000, so the first address after the unpacked data also is the size */
EVE_cmd_flashupdate(0,0,4096); /* write blob first */
EVE_init_flash();
EVE_cmd_flashupdate(0,0,(datasize|4095)+1); /* size must be a multiple of 4096, so set the lower 12 bits and add 1 */
#endif
EVE_init_flash();
}
}
/*
dynamic portion of display-handling, meant to be called every 20ms or more
*/
void TFT_display(void)
{
if(tft_active != 0)
{
EVE_start_cmd_burst(); /* start writing to the cmd-fifo as one stream of bytes, only sending the address once */
EVE_cmd_dl_burst(CMD_DLSTART); /* start the display list */
EVE_cmd_dl_burst(DL_CLEAR_RGB | BLACK); /* set the default clear color to white */
EVE_cmd_dl_burst(DL_CLEAR | CLR_COL | CLR_STN | CLR_TAG); /* clear the screen - this and the previous prevent artifacts between lists, Attributes are the color, stencil and tag buffers */
EVE_cmd_dl_burst(VERTEX_FORMAT(0)); /* reduce precision for VERTEX2F to 1 pixel instead of 1/16 pixel default */
EVE_cmd_dl_burst(DL_COLOR_RGB | WHITE);
EVE_cmd_setbitmap_burst(0x800000 | (4096/32), EVE_COMPRESSED_RGBA_ASTC_8x8_KHR, 344, 48); /* display directly from FLASH */
EVE_cmd_dl_burst(DL_BEGIN | EVE_BITMAPS);
EVE_cmd_dl_burst(VERTEX2F(200, 100));
EVE_cmd_dl_burst(DL_END);
EVE_cmd_dl_burst(DL_DISPLAY); /* instruct the graphics processor to show the list */
EVE_cmd_dl_burst(CMD_SWAP); /* make this list active */
EVE_end_cmd_burst(); /* stop writing to the cmd-fifo, the cmd-FIFO will be executed automatically after this or when DMA is done */
}
}
This writes a small flash binary compressed with zlib from the microcontrollers-memory to the external FLASH, initialises the FLASH and displays an picture directly from it.
After the first run the "#if 1" in TFT_init() can be changed to "#if 0" to remove this block.
I used the EVE Asset Builder to convert the picture, generate the flash image, compress the flash image and convert the compressed flash image to a c-style array.
With 1314 bytes for the flash-image this compiles to 4886 bytes for an Arduino UNO.
So like this an UNO could write about 28k of compressed data into the FLASH.
One could use a bigger controller to copy data like this, the limit would be the 1MB of RAM_G then that needs to store the unpacked data before it is written to the FLASH.
https://github.com/RudolphRiedel/FT800-FT813