BRT Community

Please login or register.

Login with username, password and session length
Advanced search  

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

Author Topic: ESD 4.8 - STM32 - Image  (Read 818 times)

alig

  • Newbie
  • *
  • Posts: 2
    • View Profile
ESD 4.8 - STM32 - Image
« on: July 17, 2020, 09:45:56 AM »

I have ported ESD project to STM32. I can see labels, uttons, sliders etc. but I cant see ESD Image Widget or Image Buttons. I have a image named "down" and ESD 4.8 created this for it:

Ft_Esd_BitmapInfo down__Info = {
   .Width = 75,
   .Height = 105,
   .Format = ARGB1555,
   .Stride = 150,
   .Size = 15750,
   .FlashAddress = 0x0800C000;//.File = "down.bin",
   .GpuHandle = {
      .Id = MAX_NUM_ALLOCATIONS,
      .Seq = 0
   },
   .BitmapHandle = ~0,
   .AdditionalFile = 0,
   .AdditionalInfo = 0,
   .PaletteFile = 0,
   .PaletteGpuHandle = {
      .Id = MAX_NUM_ALLOCATIONS,
      .Seq = 0
   },
   .Cells = 1,
   .Compressed = 1,
   .Persistent = 0,
   .Flash = 1,//0,
   .PreferRam = 0,
   .CoLoad = 0,
};

I changed flash parts because I put my image's bin file to STM flash memory at 0x0800C000. This binary file is also created by ESD 4.8 . Binary file's size is 2241 bytes but in the config struct above size is 15750. This is my first problem.


There are these functions:
bool EVE_Util_loadRawFile(EVE_HalContext *phost, uint32_t address, const char *filename);
bool EVE_Util_loadInflateFile(EVE_HalContext *phost, uint32_t address, const char *filename);
bool EVE_Util_loadImageFile(EVE_HalContext *phost, uint32_t address, const char *filename, uint32_t *format);
Should I use one of those before widgets initialized? If yes, how? Those functions are all reading from file, I can handle that part to read from flash but I dont know what should I put for *phost and address. How can I solve these problems? or is there any reference ESD project which displays images? Thank you.
Logged

pauljiao

  • Newbie
  • *
  • Posts: 42
    • View Profile
Re: ESD 4.8 - STM32 - Image
« Reply #1 on: July 22, 2020, 10:30:04 AM »

I rememeber the default location of assets is on the SD card unless it is specially designated to flash.
Logged

alig

  • Newbie
  • *
  • Posts: 2
    • View Profile
Re: ESD 4.8 - STM32 - Image
« Reply #2 on: July 23, 2020, 06:50:15 AM »

That flash part was not for other micro controllers, it was for FT micro controllers and I am working with ST micro controller. I could upload the image, it calls those functions itself. For my case, my image's resourceInfo->Compressed type was ESD_RESOURCE_DEFLATE, so for that image generated code calls EVE_Util_loadInflateFile(EVE_HalContext *phost, uint32_t address, const char *filename) function. It handles *phost and address part, we should take care of filename. Here filename is unique and it comes from source file that I used in ESD 4.8 . I changed that function like below
Code: [Select]
bool EVE_Util_loadInflateFile(EVE_HalContext *phost, uint32_t address, const char *filename)
{

uint32_t ftsize = 0;
uint8_t pbuff[8192];
uint16_t blocklen;

for (int i = 0; i < (sizeof(fileArray) / sizeof(fileInfo)); i++)
{
if (0 == memcmp(fileArray[i].name, filename, sizeof(filename)))
{
if (!EVE_Cmd_waitSpace(phost, 8))
return false; // Space for CMD_INFLATE

EVE_Cmd_wr32(phost, CMD_INFLATE);
EVE_Cmd_wr32(phost, address);
ftsize = fileArray[i].size;

while (ftsize > 0)
{
blocklen = ftsize > 8192 ? 8192 : ftsize;
memcpy(pbuff, fileArray[i].address + (fileArray[i].size- ftsize), blocklen);
ftsize -= blocklen;
if (!EVE_Cmd_wrMem(phost, (char *)pbuff, blocklen)) /* copy data continuously into command memory */
break;
}

return EVE_Cmd_waitFlush(phost);
}
}

return false;
}

and now I can upload any image to RAM_G.
« Last Edit: July 23, 2020, 07:13:50 AM by alig »
Logged

Kaetemi

  • Newbie
  • *
  • Posts: 11
    • View Profile
Re: ESD 4.8 - STM32 - Image
« Reply #3 on: September 05, 2020, 09:13:50 PM »

FlashAddress loading is for loading from the flash that's connected to the BT815 GPU directly, not for CPU flash.

I'm not familiar with STM32. Is the flash directly memory-addressable, or does it go through a specific interface? There's a loading mechanism for loading from memory in Esd_ResourceInfo, but it's not been carried over to Esd_BitmapInfo yet.
Logged

Debrasoare

  • Newbie
  • *
  • Posts: 5
    • View Profile
    • XEvil 4.0: revolution in automatic CAPTCHA solution
ESD 4 8 STM32 Image
« Reply #4 on: September 26, 2020, 02:04:13 AM »

Is there any way to add in defined Forests, so when it recreate the Texture image it add in some nice Forests that you can see  - is that possible ?

Or is that down to Photoshop after ?

Cyrilou

  • Newbie
  • *
  • Posts: 13
    • View Profile
Re: ESD 4.8 - STM32 - Image
« Reply #5 on: December 02, 2020, 02:03:15 PM »

That flash part was not for other micro controllers, it was for FT micro controllers and I am working with ST micro controller. I could upload the image, it calls those functions itself. For my case, my image's resourceInfo->Compressed type was ESD_RESOURCE_DEFLATE, so for that image generated code calls EVE_Util_loadInflateFile(EVE_HalContext *phost, uint32_t address, const char *filename) function. It handles *phost and address part, we should take care of filename. Here filename is unique and it comes from source file that I used in ESD 4.8 . I changed that function like below
Code: [Select]
bool EVE_Util_loadInflateFile(EVE_HalContext *phost, uint32_t address, const char *filename)
{

uint32_t ftsize = 0;
uint8_t pbuff[8192];
uint16_t blocklen;

for (int i = 0; i < (sizeof(fileArray) / sizeof(fileInfo)); i++)
{
if (0 == memcmp(fileArray[i].name, filename, sizeof(filename)))
{
if (!EVE_Cmd_waitSpace(phost, 8))
return false; // Space for CMD_INFLATE

EVE_Cmd_wr32(phost, CMD_INFLATE);
EVE_Cmd_wr32(phost, address);
ftsize = fileArray[i].size;

while (ftsize > 0)
{
blocklen = ftsize > 8192 ? 8192 : ftsize;
memcpy(pbuff, fileArray[i].address + (fileArray[i].size- ftsize), blocklen);
ftsize -= blocklen;
if (!EVE_Cmd_wrMem(phost, (char *)pbuff, blocklen)) /* copy data continuously into command memory */
break;
}

return EVE_Cmd_waitFlush(phost);
}
}

return false;
}

and now I can upload any image to RAM_G.
Hi,

I've done the same implementation and it works.
But how do you import files into MCU flash? Do you use a linker script to insert bin files in elf?
I see you ahave a struct with file name, size and address. If you have multiple files it's boring to import all those information manually at each exports...
Logged