2024-04-08 08:28 AM
Hello,
I started a new design based on an STM32H745XI with a 480x272 TFT screen.
I have some experience with TouchGFX with a previous design on an STM32H7B3 with the same screen but this development is stucked at the TouchGFX 4.17 revision.
My problem is with images stored in a non mapped external flash (an eMMMC in this case). I setup the bitmap cache as usual using the registerBitmapDatabase call in my TouchGFXConfiguration.cpp file as this :
// Use the section "TouchGFX_ImageCache" in the linker to specify the placement of the cache
LOCATION_PRAGMA("TouchGFX_ImageCache")
uint16_t imageCache[2*1024*1024/2] LOCATION_ATTRIBUTE("TouchGFX_ImageCache");
void touchgfx_init(){
Bitmap::registerBitmapDatabase(BitmapDatabase::getInstance(), BitmapDatabase::getInstanceSize(), imageCache,sizeof(imageCache),10);
I implemented the blockCopy function to detect address ranges in the ExtFlashSection and provide the copy from eMMC to RAM but this blockCopy function is never called in normal run ... It is called when I add the Bitmap::cacheAll() call at the end of touchgfx_init() ... but the bitmap images seem to be 'garbaged' and appear as gray rectangles (I have to say all images are L8_ARGB8888 encoded and the screen is on RGB565 mode).
I checked that the data in the eMMC is correct and the copy is also correct in the destination RAM when blockCopy is called
I also added a call to Bitmap::setCache() in the touchgfx_init() without success.
I put 7 bitmaps in the project :
const touchgfx::Bitmap::BitmapData bitmap_database[] = {
{ image_alternate_theme_images_widgets_button_icon_rounded_tiny_fill_action, image_alternate_theme_images_widgets_button_icon_rounded_tiny_fill_action_extra_data, 60, 60, 2, 2, 56, ((uint8_t)touchgfx::Bitmap::L8) >> 3, 56, ((uint8_t)touchgfx::Bitmap::L8) & 0x7 },
{ image_alternate_theme_images_widgets_button_icon_rounded_tiny_fill_active, image_alternate_theme_images_widgets_button_icon_rounded_tiny_fill_active_extra_data, 60, 60, 2, 2, 56, ((uint8_t)touchgfx::Bitmap::L8) >> 3, 56, ((uint8_t)touchgfx::Bitmap::L8) & 0x7 },
{ image_alternate_theme_images_widgets_button_icon_rounded_tiny_outline_action, image_alternate_theme_images_widgets_button_icon_rounded_tiny_outline_action_extra_data, 60, 60, 55, 11, 5, ((uint8_t)touchgfx::Bitmap::L8) >> 3, 38, ((uint8_t)touchgfx::Bitmap::L8) & 0x7 },
{ image_alternate_theme_images_widgets_button_icon_rounded_tiny_outline_active, image_alternate_theme_images_widgets_button_icon_rounded_tiny_outline_active_extra_data, 60, 60, 55, 11, 5, ((uint8_t)touchgfx::Bitmap::L8) >> 3, 38, ((uint8_t)touchgfx::Bitmap::L8) & 0x7 },
{ image_alternate_theme_images_widgets_swipecontainer_medium_off_normal, image_alternate_theme_images_widgets_swipecontainer_medium_off_normal_extra_data, 20, 20, 17, 6, 2, ((uint8_t)touchgfx::Bitmap::L8) >> 3, 8, ((uint8_t)touchgfx::Bitmap::L8) & 0x7 },
{ image_alternate_theme_images_widgets_swipecontainer_medium_on_active, image_alternate_theme_images_widgets_swipecontainer_medium_on_active_extra_data, 20, 20, 8, 7, 4, ((uint8_t)touchgfx::Bitmap::L8) >> 3, 6, ((uint8_t)touchgfx::Bitmap::L8) & 0x7 },
{ image_tripy_logo, image_tripy_logo_extra_data, 325, 77, 37, 24, 8, ((uint8_t)touchgfx::Bitmap::L8) >> 3, 40, ((uint8_t)touchgfx::Bitmap::L8) & 0x7 }
};
When cacheAll() is called here are the calls to blockCopy with debug output :
Addresses in the 9000_0000 area is the ExtFlashSection in the linker file (the eMMC source addresses)
Addresses in 0xD008_0000 area is the bitmap cache registered (TouchGFX_ImageCache section)
bmp copy from 90007030 to 24003F9C for 4 bytes
bmp copy from 90006220 to D00800F4 for E10 bytes
bmp copy from 90007030 to 24003F74 for 4 bytes
bmp copy from 90007030 to D0080F04 for 4 bytes
bmp copy from 90007EA4 to 24003F9C for 4 bytes
bmp copy from 90007094 to D0080F08 for E10 bytes
bmp copy from 90007EA4 to 24003F74 for 4 bytes
bmp copy from 90007EA4 to D0081D18 for 4 bytes
bmp copy from 90008CE4 to 24003F9C for 4 bytes
bmp copy from 90007ED4 to D0081D1C for E10 bytes
bmp copy from 90008CE4 to 24003F74 for 4 bytes
bmp copy from 90008CE4 to D0082B2C for 0 bytes
bmp copy from 90009B98 to 24003F9C for 4 bytes
bmp copy from 90008D88 to D0082B2C for E10 bytes
bmp copy from 90009B98 to 24003F74 for 4 bytes
bmp copy from 90009B98 to D008393C for 0 bytes
bmp copy from 90009D74 to 24003F9C for 4 bytes
bmp copy from 90009BE4 to D008393C for 190 bytes
bmp copy from 90009D74 to 24003F74 for 4 bytes
bmp copy from 90009D74 to D0083ACC for 0 bytes
bmp copy from 90009FC0 to 24003F9C for 4 bytes
bmp copy from 90009E30 to D0083ACC for 190 bytes
bmp copy from 90009FC0 to 24003F74 for 4 bytes
bmp copy from 90009FC0 to D0083C5C for 4 bytes
bmp copy from 900061C4 to 24003F9C for 4 bytes
bmp copy from 90000000 to D0083C60 for 61C4 bytes
bmp copy from 900061C4 to 24003F74 for 4 bytes
bmp copy from 900061C4 to D0089E24 for 0 bytes
The only way to have correct images is to 'pre-load' the whole ExtFlashSection in RAM as stated in the documentation : https://support.touchgfx.com/docs/development/scenarios/using-non-memory-mapped-flash#modifying-the-blockcopy-function in the last point 'Linking Images to RAM' ...
For this I use the same code as the one in 'blockCopy' to copy data from eMMC to RAM...
Is there something different to do for the new 4.23 revision vs the older 4.17 that worked fine with bitmap cache and blockCopy ??
BR
Pierre
Solved! Go to Solution.
2024-04-19 03:22 AM
2024-04-10 03:23 AM
Update to this topic .
I had an issue in my blockCopy code ... that's why the Bitmap::cacheAll() did not properly copy the bitmaps.
So my only problem is to not be forced to call the cacheAll() function and have the bmp loaded from eMMC when they are needed. Should I call the cache() function in each screen, on each bmp, or is there a way that the lib call the cache() function when the bitmap is stored in the ExternalFlash Section ?
2024-04-19 03:22 AM
2024-05-27 01:46 AM
Hi @PJEN,
I'm having some issues using images with transparency saved to an unmapped external storage. My setup is very similar to yours, so I wanted to ask if you've tried using images with transparency in ARGB8888 format.
In my case, when the Core attempts to read images with transparencies, the BlockCopy function is not called. Instead, a direct memory read is used, which causes a Hard Fault. Memory is not mapped in my project because I want to use BlockCopy.
This is the post about the problem I'm having.
Thank you and kind regards.