C

Preloading Qt Quick Ultralite internal resources

Qt Quick Ultralite internal resources contain the image data for example for the dials and buttons that are linked to the application from Controls library. Internal resources do not support preloading with PlatformInterface::MemoryAllocator.

The internal resources are automatically placed in a QulModuleResourceData section. For improved performance when blending these resources, the platform port can choose to load this section into RAM.

In this example preloadable internal resource data is copied from the QSPI flash memory region to SDRAM.

The linker script has to be define symbols and sections for the module data. The QulModuleResourceData section is reserved by Qt Quick Ultralite to place its internal resources. User-specified resources should not be placed in it.

For this purpose the linker script defines symbols containing the source and destination addresses of the preloadable internal resources.

    QulModuleResourceData :
    {
        . = ALIGN(4);
        __ModuleResourceDataCacheStart = .;
        *(QulModuleResourceData)
        . = ALIGN(4);
        __ModuleResourceDataCacheEnd = .;
    } > SDRAM AT> QSPI

    __ModuleResourceDataStart = LOADADDR(QulModuleResourceData);

__ModuleResourceDataCacheStart, __ModuleResourceDataCacheEnd, and __ModuleResourceDataStart must also be defined to load the resources from QSPI to SDRAM.

The copy can be performed using DMA or as shown in the following example, using memcpy when the platform initialization is called.

    ...
extern unsigned char __ModuleResourceDataStart;
extern unsigned char __ModuleResourceDataCacheStart;
extern unsigned char __ModuleResourceDataCacheEnd;
memcpy(&__ModuleResourceDataCacheStart,
       &__ModuleResourceDataStart,
       &__ModuleResourceDataCacheEnd - &__ModuleResourceDataCacheStart);
    ...
#pragma section = "QulModuleResourceData"
#pragma section = "QulModuleResourceData_init"
char *__ModuleResourceDataStart = (char *) (__section_begin("QulModuleResourceData_init"));
char *__ModuleResourceDataCacheStart = (char *) (__section_begin("QulModuleResourceData"));
char *__ModuleResourceDataCacheEnd = (char *) (__section_end("QulModuleResourceData"));
memcpy(__ModuleResourceDataCacheStart,
       __ModuleResourceDataStart,
       (unsigned) __ModuleResourceDataCacheEnd - (unsigned) __ModuleResourceDataCacheStart);

Make sure to check the example IAR linker script to see how to place these sections in your device memory.

Note: If preloading is not used, QulModuleResourceData can be added to the linker script in the same way as QulResourceData. In this case __ModuleResourceData* symbols and memcpy are not needed.

Available under certain Qt licenses.
Find out more.