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.

RTOS/AM4377: Code section rearranging with .xdt file

Part Number: AM4377
Other Parts Discussed in Thread: SYSBIOS

Tool/software: TI-RTOS

SYS/BIOS : 6.42.2.29

base application : EtherCAT full feature example + motor_control

my goal : running application in "L3 build"

Hi,

I have a question about linker setting.

I tried to run the application on L2(as SRAM).

With SPRAC45, I made platform setting, compiling works well.

When the application is small enough to fit in L2SRAM, it has no error.

But the size application code data exceeds the L2SRAM, I couldn't make ".out" file.

My application size is 362KB,(I checked it by XIP build) and OCMCRAM has 128KB + L2SRAM has 256KB.

So I have 384KB, I think it's possible to load application.

Then I need to rearrange application sections, how could I get it?

I tried *(EXCLUDE_FILE(objectfile.o) .text.objectfile) in .text section(in ~~~.xdt file), but the size exceeded is same as before.

Did I missed something? or I should try more objectfiles?

Thank you.

  • The RTOS team have been notified. They will respond here.
  • Hi

    When the 256 KB L2/L3 memory is configured as L2 cache there is the 64 KB ARM RAM and the 256 KB L3 RAM for a total of 320KB RAM.

    When the 256 KB L2/L3 memory is configured as L3 RAM, the total is 576 KB.

    Running with cache typically provides best performance.  See http://www.ti.com/lit/an/sprac45a/sprac45a.pdf

    Some optimizations that that reduce the memory size is to compile with -Os (optimize for size), specify -mfloat-abi=hard -mfpu=neon. Also -ffunction-sections and -fdata-sections can provide a good improvement.  Remove debugging -g and -gdwarf.  If you are developing a runtime package and do not require  UART communications then you may wish to exclude uart runtime components, print, and stdio.h. in the application and pdk_am437x...\packages\ti\board\... that are called by the application. To modify aboard library file, add the file (as a link) to the project (do not copy) and add the modification's. You may need to change some of the includes of these files  by ether by changing the include description to provide the full path or changing the library search path of the project. Some saving can also be gained by  checking the heap and stack usages . The sysbios user guide in C:\ti\bios_version\docs has some additional optimizations that can help .

    David

  • Hi, Thank you for your answer...

    I tried "-Os"option. It exceeds memory(.text exceeds L2SRAM), too.
    UART console is required...
    I want to move somethings in .text to .data(OCMCRAM).
    I've tried "EXCLUDE_FILE" command in '.xdt' file, but it doesn't seem to work.(exceeding size is same...)

    Can you help me to move some binary data from ".text" to ".data"?
    I think it help me to run my application..

    Thank you.
  • Hi

    The arm tool chain has a command that can be used to identify the sizes of your components and where they are placed . We use this command in a dos window and dump the results into a text document that can be imported into a spreadsheet and sorted.
    The command is arm-none-eabi-objdump.exe -x -w "the_program_to_be _checked.out" > the_program_to_be _checked.txt
    This program is in {CCS_installation_directory}\tools\compiler\gcc-arm-none-eabi-"arm_version"\arm-none-eabi\bin - for example -
    C:\ti\ccsv7\tools\compiler\gcc-arm-none-eabi-4_9-2015q3\arm-none-eabi\bin\arm-none-eabi-objdump.exe

    SYSBIOS provides tools to move program segments into specific potions of memory
    This is documented in the Bios_User_Guide in {bios_installation_directory}\docs\Bios_User_Guide.pdf
    CHapter 7 has some very relevant solutions for configuring and using memory .

    David
  • Hi, Thank you for your answer.
    I defined a new section ".text2", and assigned some object files in that section.
    ".text2" is in "Data memory(REGION_DATA)".
    When I move some objects related to SYS/BIOS to ".text2", binary file building is fine.
    But the binary file size over 2MB.
    I've found I assigned objects related to SYS/BIOS twice(in ".text2" & in ".data").
    Does this cause the huge binary?

    Thank you.
  • Hi

    Are you saying the that file produced by pdkAppImageCreate is large while the *.out file is an expected size?

    When functions are separated into separate sections there will be some increase in the total executable size because some of the references become far calls. You can see this if you sort the symbol table by sections. However this should be a % increase, not something large. In general, we get the most compact code with the best code execution speed when we move a group of functions that are closely related with primarily internal references. An example of this would be moving all of the board initialization code into a section or moving a group of functions which comprise a task into a section.

    We use the symbol table produced by arm-none-eabi-objdump.exe -x -w "the_program_to_be _checked.out" > the_program_to_be _checked.txt command . as a guide in developing the section definitions by sorting the table by section name in a spread sheet.

    David