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.
Tool/software: TI C/C++ Compiler
Hi,
I am using compiler TI v15.12.1.LTS for the F28377s, and CCS 7.0.x. I have a function containing a loop that I have hand optimized with NOPs to execute in exactly 250 clocks. So I would like to be able to modify the project's compiler optimizations while holding this function with no optimizations so my loop remains constant. However, whether I set the project to -O0 and the FUNCTION_OPTIONS pragma to
#pragma FUNCTION_OPTIONS (send_led_data, "--opt_level=3")
or vice-versa, it appears that the function send_led_data is still being compiled with the project's -Ox flag and the pragma is ignored. Perhaps I am missing some other setting to make FUNCTION_OPTIONS work?
Thanks, dave
db_woodall said:it appears that the function send_led_data is still being compiled with the project's -Ox flag and the pragma is ignored.
What do you see that makes you think this is the case? Exactly how do you see it?
Please follow the directions in the article How to Submit a Compiler Test Case to send in a test case for the source file which contains the function send_led_data.
Thanks and regards,
-George
Hi George,
This program drives a large panel of WS2812 RGB LEDs, so if the bit bang loop isn't right, the LEDs flash randomly. I can also tell by looking at CpuTimer1Regs.TIM, which is running at the CPU's 200Mhz rate.
Tests: Set a breakpoint on the first instruction in the bit bang loop, then hit it a second time and subtract the timer values:
So, it is doing something, but the function pragma does not produce equivalent code to the project properties setting. If I could count on it to produce the same code with the same function pragma regardless of what the project setting is, I could re-tune the loop for -O2 and leave it. I will look at the instructions for sending in the code.
Thanks, dave
Attached is the source. If you set a breakpoint on line 18457, hit it twice and compare the CPU1 timer values, you can easily see the loop time. This was built with -O2 for the project and also for the function pragma. The compiler tools version is v15.12.1.
Thanks! dave
Thank you for sending in the test case. I cannot run the code. So I don't know that I have reproduced exactly what you describe. However, I did see the compiler ignore this directive ...
#pragma FUNCTION_OPTIONS (send_led_data_13, "--opt_level=off")
That's not good. So I filed CODEGEN-3614 in the SDOWP system to have this case investigated. You are welcome to follow it with the SDOWP link below in my signature.
Thanks and regards,
-George
Thanks George and pf,
I can certainly compile the file with its own optimization settings. If the pragma isn't updated, it would be good to document the behavior in the compiler user guide.
Thanks, dave