Optimize placement of code and data

The Arm linker uses a mechanism known as scatterloading to place code and data at appropriate addresses in your device memory map. You can use the ACLE __attribute__ ((section (“.name”))) feature to create special ELF sections which can be referenced by the scatter file. This can be used to place frequently used or high priority tasks in the fastest memory location. Many Arm devices support tightly coupled memory local to the processor for this purpose.

Within ASCET-DEVELOPER you can define MemorySections.xml to easily locate functions to particular regions. You may wish to define a section named TCMCODE for your functions to place in tightly coupled memory as you can see in the following code:

<MemClass>
	<name>TCMCODE</name>
	<prePragma/>
	<postPragma/>
	<funcSignatureDef>%return_type% __attribute__ ((section (“.ascettcm”)))
   	     %gen_name% (%argv%)</funcSignatureDef>
	<constQualifier>true</constQualifier>
	<volatileQualifier>false</volatileQualifier>
	<description>memory section for code to execute in TCM </description>
	<category>Code</category>
</MemClass>

Your scatter file can define an execution region for the tightly coupled memory and use the section name to easily place these functions within the code, as seen in the following code:

	TCM_REGION	TCM_BASE	TCM_SIZE
	{
		*(.ascettcm)
}
Previous Next