MPLAB® Harmony Graphics Suite > Designer > Microchip Aria Designer > Graphics Composer Asset Management > Memory Configuration
MPLAB® Harmony Graphics Suite
Memory Configuration

The Memory Locations window is launched from the Graphics Composer’s Asset menu. Selecting Memory Locations this brings up a window with three sub-tabs (in this example, the Aria Showcase demonstration is referenced):

 

 

Window Toolbar

The window’s tools icons support:

  1. Add New Memory Location – This supports multiple external memory resources.
  2. Delete Selected Memory Location – Removes a previously defined memory location.
  3. Rename Selected Memory Location – Renames a previously defined memory location.
  4. Configure External Media Application Callback – This allow definition of media callbacks, which must be provided in the project.

  1. Show Values as Percent – Memory utilization on the bar graph can be in bytes or as a percent of the total internal flash memory assigned to support asset storage. (That memory allocation is set using the Configuration sub-tab.)

The APIs for the external media callback functions are as follows:

GFX_Result app_externalMediaOpen(GFXU_AssetHeader* asset);
GFX_Result app_externalMediaRead(GFXU_ExternalAssetReader* reader,
                                 GFXU_AssetHeader* asset,
                                 void* address,
                                 uint32_t readSize,
                                 uint8_t* destBuffer,
                                 GFXU_MediaReadRequestCallback_FnPtr cb);
void app_externalMediaClose(GFXU_AssetHeader* asset);

The graphics demonstration project, aria_external_resources, provides an example of how to write these callbacks. This demonstration supports three types of external memory: SQI External Memory, USB Binary, and USB with File System. Examples of these callbacks are found in the project’s app.c file. The Aria demonstration projects Aria External Resources and Aria Flash provide more details on how to use external memory to store graphics assets.

Sub-tabs

There are three sub-tabs to this window. 

Summary Sub-tab 

This sub-tab summarizes program flash allocations for images, strings, and fonts.

 

 

 

The memory allocation shown for “Font Glyphs” measure the space that holds all the font glyphs used by the application, either by static strings or by glyph ranges defined in support of dynamic strings. Strings are defined by arrays of pointers to glyphs, so string memory usage measures the size of these arrays, not the actual font glyphs used. (“Glyph” is defined here.)

Note: 
The word “glyph” comes from the Greek for “carving”, as seen in the word hieroglyph – Greek for “sacred writing”. In modern usage, a glyph is an elemental or atomic symbol representing a readable character for purposes of communicating through writing. 

Configuration Sub-tab 

This sub-tab specifies the intended allocation of internal (program) flash memory to graphics assets (Total Size). (The default value is 1024 bytes.) It also names the graphics assets file name (here it will be gfx_assets.c). The allocation of flash is only used to scale the Total/Used/Available bar graph at the top of the display. Under sizing or oversizing this amount does not affect how the application is built.

If the device has 1024 Kbytes (1048576 bytes) of flash, the user can assign 40% to asset storage and 60% to code. In that case the “Total Size” in the above sub-tab would be set to 419430 (= 40% of 1048576). 

The Calculator button can assist in allocating internal flash. Click on it and then set the device flash capacity. Then the user can apply an adjustment to that value to assign that memory to asset storage. 

Example: 

If the device has 2 Mbytes of internal Flash, click 2MB.

 

 

 

Then, to assign 75% of the 2 Mbytes to asset storage, click -25% to reduce the 2 MB by 25%, leaving 75%, and then click OK to finish. This will then assign 1,536,000 bytes to asset storage.

 

 

Internal (program) Flash is shared between the application’s code and asset storage. If the application code and graphics assets (fonts, strings, images) won’t fit into the available flash memory then the linker will be unable to build the application and an error will be generated in MPLAB X IDE. 

The Output File Name must be compatible with the operating system hosting MPLAB X IDE. In most cases the default name (gfx_asset.c) will suffice, but this is provided for additional flexibility in building the application. 

Optimization Sub-tab 

The Optimization sub-tab for the Aria Quickstart demonstration is shown in the following figure.

The Size column shows the bytes allocated for storage in internal flash for the images, fonts, and binaries of the application. 

The References column shows the number of known references for these assets by the application’s widgets. A references count of zero suggests that the asset is not used by the application, but it could also mean that the asset is only used in real-time when it is dynamically assigned to a widget by the application. Clicking the title of a column (Name, Size, or References) sorts the lists of graphics assets by that column. Clicking the same column again reverses the sort order. 

The window’s tools icons support:

  1. Edit Selected Asset – This brings up the edit dialog for the image, font, or binary chosen
  2. Delete Selected Assets – Removes the selected assets
  3. Move Selected Assets – Move assets from one location to another. This is useful for moving assets to/from internal memory from/to external memory.
  4. Show Only Images – Show image assets toggle on/off
  5. Show Only Fonts – Show font assets toggle on/off
  6. Show Only Binaries – Show binary assets toggle on/off
MPLAB® Harmony Graphics Suite