Mapping Resources - MCU
We need a bit deeper understanding on Flash Memory allocation. As we are using STM32H757 with FreeRTOS, we had enabled External QSPI Flash to put the application’s assets onto it and Internal flash to store programs/BSPs onto it. Could you please explain what else will be a part of internal flash from Storyboard application apart from code/BSPs? Does reducing image/font size also impact internal flash (even when QSPI flash is enabled)?
The Storyboard application core libraries and plugins contribute between 600KB and 800KB to the flash footprint in addition to the image resources, fonts, scripts and other model content.
For MCU platforms we use the Storyboard Virtual Filesystem (SBVFS) layout which is exported by Storyboard Designer using the Storyboard Embedded Resource Header (C/C++) option. In the Export Configurations dialog (further enhanced in Storyboard 7.0) you can specify a custom configuration and then specify many options including setting a prefix either globally for all resources or now also at an individual resource level that gets merged with the exported header content. Note: By default the resources, fonts, scripts etc will get mapped to internal flash unless you specify otherwise hence the export prefixes you see below:
Currently the application model sb_model and the virtual file system sb_model_resources structures do not get mapped in the export and so these are by default placed in internal flash region though you can manually add a directive of your own and align to specific regions defined in the linker.
Additionally an example of the alignment prefix macro can be seen defined in the source code typically within sbengine_task.c:
#if defined ( __ICCARM__ )
#define EXTFLASH_ALIGNMENT \
_Pragma("data_alignment = 16")
#if defined (__GNUC__)
#define EXTFLASH_ALIGNMENT __attribute__ ((section (".ExtQSPIFlashSection"))) \
__attribute__ ((aligned (16)))
These and the associated linker section directives control how the linker maps the resource blocks from the header file to regions in the flash memory map.
For more information on managing resources for embedded applications, take a moment to watch the following "How to reduce the size of embedded GUI applications for resource-constrained MCUs" video.