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.
Hello,
I read in the compiler manual that #pragma LOCATION only works for EABI.
Is there an equally simple way to locate a symbol at a specific address in a COFF project please? For example, a CRC in the last two words of a flash sector.
The only solution I can currently think of is to define a MEMORY directive with the target address and length 2:
FLASHM : origin = 0x0BC000, length = 0x001FFE /* on-chip Flash */
FLASHM_CRC : origin = 0x0BDFFE, length = 0x000002 /* on-chip Flash */
Then a SECTION directive to direct the variable to FLASHM_CRC. Is that my only option?
Thank you.
Kier,
Your approach should work. Our expert on this is out today and can comment on if there is a better way to do this tomorrow.
Regards,
John
For example, a CRC in the last two words of a flash sector.
Another option could be to place the CRC in its own section, and use the HIGH Location Specifier for the section.
See section 8.5.5.2.4 Controlling Placement Using The HIGH Location Specifier in TMS320C28x Assembly Language Tools v20.12.0.STS User’s Guide
The method you propose is reasonable. I'll suggest another way that is a little easier to implement and understand.
In the C code where you create the symbol, use #pragma DATA_SECTION in a manner similar to ...
#pragma DATA_SECTION(special_global_variable, "odd_section_name") int special_global_variable;
In the SECTIONS directive part of the linker command file, write something similar to ...
odd_section_name > 0x0BDFFE
This code creates an output section named odd_section_name. It is made up of all the input sections named odd_section_name. In this case, there is only one such input section. It is allocated to the hard-coded address 0x0BDFFE. For more background on the terms used in this paragraph, please see the first part of the article Linker Command File Primer.
Thanks and regards,
-George