Does someone know a pragma directive to align a C function?
Compiler: TI: 10.1.0.00010 / Compiler: v20.2.1.LTS
Thanks
Mathieu
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.
Does someone know a pragma directive to align a C function?
Compiler: TI: 10.1.0.00010 / Compiler: v20.2.1.LTS
Thanks
Mathieu
Hi Mathieu,
Yeah CODE_ALIGN didn't work for me as well.
You can try aligned attribute, i tested it worked for me.
Here is an example to align to 32byte
In above example it aligns start address of delay function to 32byte multiples.
--
Thanks & regards,
Jagadish.
Thanks so much Jagadish! It unfortunately does not work for me. I don't get any warning using aligned attribute. But the function is not aligned as specified. For info I use thumb instruction (--code_state=16).
__attribute__((aligned(256))) void function()
From MAP-File:
0005e241 function
Compiler: TI: 10.1.0.00010 / Compiler: v20.2.1.LTS
I had previously reported Compiler/TM4C129XNCZAD: TI ARM v20.2.3.LTS compiler doesn't seem to support code alignment, as a result of which the issue EXT_EP-10161 - ARM compiler manual incorrectly claims #pragma CODE_ALIGN is supported was raised.
Based upon the work-around described in EXT_EP-10161 as of compiler ARM 18.12.8.LTS and ARM 20.2.5.LTS attribute aligned should work. I haven't yet tested this.
Thanks, Chester for your information.
Mathieu, can you please try with the latest LTS compiler because i tested with TI v20.2.7 LTS and it did work for me..
Hi Jagadish,
I cannot unfortunately try this version. I have to stick to the version v20.2.1.LTS. In my industry it is very costly to change version.
Could you help me for version v20.2.1.LTS?
Thanks
Mathieu
Hi Mathieu,
We can do using linker script.
Do the following steps:
1. Create one "my_section" in linker script with required alignment.
2. Now use CODE_SECTION pragma to allocate required function to the "my_section".
Please refer attached example if necessary.
Function_align_compiler_20_2_1_LTS.zip
--
Thanks & regards,
Jagadish.