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.

TMS320F280037: CCS Check for 8-word alignment (required for Flash API)

Part Number: TMS320F280037


Tool/software:

I was recently having trouble with using serial flash programming due to a memory map being generated with a code section that wasn't aligned to 8 words. It was one of two sections included in a group that used ALIGN(8). I found other posts that suggested splitting these sections into separate allocations in the cmd file instead of being grouped together. This fixed the problem.

My question is - is there a check I can enable in CCS that will generate a warning/error when sections aren't aligned like this? In case this mistake is inadvertently made in the future (since it's a subtle memory mapping trick this seems likely) it would be good to detect this when building code instead of having to find the problem later downstream when in-system reprogramming using FlashAPI fails.

Thanks, Ben

  • is there a check I can enable in CCS that will generate a warning/error when sections aren't aligned like this?

    Unfortunately, no.

    Here is a suggestion to consider.  Create an XML file that has information about each section with a command similar to ...

    ofd2000 --obj_display=none,sections -x -o section_info.xml final_executable.out

    Note ofd2000 is a utility that is in the same directory as the compiler cl2000.  It is documented in the C28x assembly tools manual. Next, write a script in your favorite scripting language which processes that XML, then checks all the sections in a certain memory range to be sure their starting address is aligned as required.

    Thanks and regards,

    -George

  • Thanks for the advice. That is a klunkier solution than I had hoped for but better than nothing I guess.

  • I was able to run the ofd2000 tool but the xml file only seems to include run addresses, not load addresses. Am I missing something? The manual is not very helpful.

  • The run address of a section is an explicit field in the section header.  Unfortunately, the same is not true of the load address.  You have to compute it.  It is not super hard.  But there are multiple steps to it.  I'll give you a rough introduction, just to give you an idea of what is involved.

    Learn about segments by searching the C28x assembly tools manual for the sub-chapter titled Introduction to Sections.  You need information about the segments in the XML, so the ofd2000 command changes to ...

    ofd2000 --obj_display=none,segments,sections -x -o section_info.xml final_executable.out

    Based on the run address for the section, find the segment which contains it.  Here is pseudocode to compute the load address:

    load_address = segment->load_address + (section->run_address - segment->run_address)

    Thanks and regards,

    -George