C
Linker script setup
A linker script is a file containing information about the platform's memory configuration. It specifies regions where application code and data resides. The linker script is used by the toolchain's linker to organize the data and code in the final binary at the appropriate memory addresses. In this section, you will get to know what needs to be configured in your linker script to get Qt Quick Ultralite working.
Adding your linker script
cmake\<YOUR_COMPILER>\<YOUR_LINKER_SCRIPT>
is the linker script your platform uses.
The linker script has to be set in LinkerScriptConfig.cmake
to be used by CMake. Below you can find an example from the example-baremetal
platform:
if(IAR) qul_platform_add_default_linker_script("${QUL_PRIVATE_PLATFORM_BOARD_CMAKE_DIR}/${QUL_COMPILER_NAME}/example-platform.icf") else() qul_platform_add_default_linker_script("${QUL_PRIVATE_PLATFORM_BOARD_CMAKE_DIR}/${QUL_COMPILER_NAME}/example-platform.ld") endif()
The argument to the function defines the linker script to use.
Creating the linker script
The following examples are snippets from platform\boards\qt\example-baremetal\cmake\armgcc\example-platform.ld
. There is also a variant for IAR linkers available at platform\boards\qt\example-baremetal\cmake\iar\example-platform.icf
for your reference. You can copy these files to your project to use as a basis for your own linker script. However, it is recommended that you have your own linker script where you insert additional memory sections explained here.
Note: The examples use GNU linker script syntax. Some things may be implemented differently between different toolchain linker scripts. Refer your toolchain's manual for more information about the syntax for linker scripts.
To assign program sections to the device, its memory layout must be configured:
MEMORY { FLASH (rx) : ORIGIN = 0x08000000, LENGTH = 2048K /* internal flash */ RAM (xrw) : ORIGIN = 0x20000000, LENGTH = 512K /* internal sram */ SDRAM (xrw) : ORIGIN = 0xc0400000, LENGTH = 6M /* external sdram memory */ SDRAM_PRELOAD (xrw) : ORIGIN = 0xc0a00000, LENGTH = 2M /* external sdram memory - preload */ QSPI (rx) : ORIGIN = 0x90000000, LENGTH = 64M /* external flash */ }
This layout has five regions: FLASH, RAM, SDRAM, SDRAM_PRELOAD and QSPI.
- RAM, SDRAM and SDRAM_PRELOAD have execute, read, and write access.
- FLASH and QSPI are read-only flash memories and thus have only read and execute access.
Warning: Do not use this layout as-is for your platform's memory layout, as it may lead to errors when flashing the binary or attempting to run it on the device. Refer to your target platform's manual for the memory layout and appropriate memory addresses for your device.
In this example, resource data is stored in the QSPI flash memory region. QulResourceData
name is hardcoded and represents the default section for the image resources. For details on how to add additional resource sections, see Managing Resources.
QulFontResourceData
name is hardcoded and represents the default section for the font files and glyph data. The custom font files section is configured with MCU.Config.fontFilesStorageSection property, and the glyphs section with MCU.Config.glyphsStorageSection.
QulFontResourceData : { . = ALIGN(4); *(QulFontResourceData) } > QSPI QulResourceData : { . = ALIGN(4); *(QulResourceData) } > QSPI
Available under certain Qt licenses.
Find out more.