This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

[FAQ] AM263P4: Text and Data placement using sysconfig tool.

Part Number: AM263P4
Other Parts Discussed in Thread: SYSCONFIG

Tool/software:

Sometimes it might be required to add certain text and data objects in particular sections of memory. Memory configurator in sysconfig enables the user to place desired parts of code in desired sections of memory.

This FAQ explains steps to place a library, file, function, text or ro data in a particular section of memory. For this FAQ, we are considering the Hello World example in AM263PX MCU PLUS SDK.

The example is configured to have its code and data region in FLASH. This can be done in Sysconfig > Memory Configurator > Section > Code and Data Region > Load & Run memory.

Since code and text in flash, the FAQ explains how to place certain code and data region in RAM for instance. 

For the sake of demonstration, the FAQ describes how to place code and data in OCRAM. One can create a memory region in Sysconfig > Memory Configurator > Memory Region and use the newly created memory region to place code and data.

 1. How to place a library in RAM?

a. Create a new section in Sysconfig > Memory Configurator > Section.

b. Give it a name and keep the load and run memory as OCRAM

c. Create an output section for this section. Keep the Alignment as 32 and keep Alignment with padding as enabled. This is the group header which appears in linker.cmd.

d. We need to add libraries to this group. For that create an input section for the same output section.

e. To include text section of a library, enter Name as -l"drivers.am263px.r5f.ti-arm-clang.debug.lib" (.text)

f. To include the ro-data section of a library, enter Name as -l"drivers.am263px.r5f.ti-arm-clang.debug.lib" (.rodata)

g. To include both you can enter the name as -l"drivers.am263px.r5f.ti-arm-clang.debug.lib".

2. How to add a particular file contents in RAM?

a. Repeat the same instruction as from a to d in 1.

b. To include a file, enter Name as <filename.o>

c. Both the text and ro data section will added in this manner.

d. The text and ro data section can also be added separately as mentioned in 1.

3. How to place a particular function in RAM?

a. Sometimes it would be required to keep a function in a particular region. The steps are similar to 1 as well.

b. Follow the steps a to c in 1.

c. Enter name as .text.<function name>.

d. The same can be done for ro-data as well. Need to keep name as .rodata.<rodata name>.

 

4. How to keep code and data in flash/RAM by default?

a. Open Sysconfig > Memory Configurator > Sections > Code and Data Regions.

b. Keep load and run region as flash. On making this change, the code and rodata would be in flash by default. Mark it as RAM if that is required.

5. Some points to note related to code and ro data placement.

a. If code is being kept in flash for XIP, make sure that the MPU configuration is correct. Code execution needs to be enabled for this region. This can be done from Sysconfig > TI Driver Porting Layer > MPU ARMv7

b. Make sure that regions are assigned enough memory. This can be done from Sysconfig > Memory Configurator > Memory Region

c. For XIP, The code and ro data must be aligned to 4K bytes (to be aligned to flash sector). This alignment can be done in Sysconfig > Memory Configurator > Section > Code and Read-Only Data > Output Section

d. Map file can be used to verify code and data placement.

e. Instruction prefetch aborts can occur due to issues related to code placement.