Hello, project configured for ARM CM55, compiler optimization -Ofast, link time optimizations disabledHere is main functionint main() {
printf("!");
printf("hello!");
/* testAll_flatten();*/
return 0;
}
Debugger can step in main and output printf() in console but when i comment printf() and uncomment testAll_flatten module, that contains different tests, function calls etc i see next errors and warnings and cannot debug my project or just see printf() in console... and after pressing Continue i see only
waitcontinueNORMAL_TERMINATIONExecution stopped in Secure Privileged Thread mode at 0x000010E4 due to application reaching end of execution0x000010E4 BKPT #0xabHere I attach additional info about debug configuration and scatter file
https://drive.google.com/file/d/16Q9u_kfOA9pnwwTqkNLxrN0y0fKmiXom/view?usp=sharing (scatter file)
Similar problems are encountered in other larger projects configured in a similar way, I suspect that there may be something wrong with my scatter file, or that some functions, files, (if I understood correctly) are not in the execution range... How to fix that and how to debug without these problems?
HiMy name is Stephen and I work at Arm.Which Arm Compiler are you using? I assume it is Arm Compiler for Embedded 6, but let me know if not.As a first step, try compiling with a lower optimization level (e.g. -O1), and the printf's and testAll_flatten() both uncommented. Also add a printf after testAll_flatten().Re-compile, then run. After reaching main(), single step over the printf's Do the printf's work ok?Then open the Disassembly view to see the instructions generated. Do you see a BL call to testAll_flatten()? If so, single-step at instruction level (press F10 to toggle between single-stepping at instruction level and source-code level) to testAll_flatten() and then into it. If not, it may have been optimized away or otherwise removed. Try linking with the armlink option "--info unused" to check whether the linker is removing any code/data.If you need more help, please show us the disassembly of main().I couldn't access your scatter-file, but feel free to paste it directly here if you need more help.Stephen
Thanks for the reply!Yes, I am using Arm Compiler for Embedded 6. I changed the optimization to -O1 and added printf() before and after the test calls:
I did a rebuild and run. In disassembly, I did not see the BL call to testAll_flatten(): And nothing happens during the step, none of the printf() are output to the console... I tried linking with the "--info unused" option, but none of my functions are removed: As the problem is still not solved I will attach the disassembly and scatter file: Scatter.zipLet me know if you need any additional information
Hi againYour output of "--info unused" is showing symbols with names e.g. lto-llvm-xxxxxx.o. I suspect you accidentally still have link-time optimization enabled. Please try disabling that. You'll need to remove the -flto switch from the compile step and the --lto switch from the link step.Hope this helpsStephen
Hi again! Despite all these settings, the functions were still deleted and it is impossible to debug it, and only the one printf() before testAll_flatten is printed to the console (with -Ofast, with -O1 for exmp. even this printf doesn't printed to the console)
Only adding the following setting "*(*.text*) *(*.ARM.exidx*)" in the --keep argument section solved the problem of removing functions from the created image, but everything still "works" just as it did before Also, I can't understand why the linker / compiler considers the given functions "unused" if it's not so... and why it removes when --no_remove added and when --no_lto and -fno-lto flags enabled
'Building target: flatten.axf'
'Invoking: Arm Linker 6'
armlink.exe --entry=Reset_Handler --scatter="C:\Users\kyiv\Desktop\Visual_Studio\flatten\ARM_DS\RTE\Device\ARMCM55\ARMCM55_ac6.sct"
--no_lto --no_remove --keep="*(*.text*) *(*.ARM.exidx*)"--info=sizes
--info=unused --no_remove --no_lto -o "flatten.axf" ./flatten/flatten.o
./flatten/main.o ./flatten/test.o ./flatten/utils.o
./RTE/Device/ARMCM55/startup_ARMCM55.o
./RTE/Device/ARMCM55/system_ARMCM55.o
Hi againI've tried, but have not been able to reproduce what you see.My test case just works as expected - see screenshot below.I'm using Arm DS 2024.0. Are you?
Are you sure that you are loading the _Debug_ image to the FVP, and not the _Release_ image?Check your flatten.launch file. It should contain something like: <stringAttribute key="FILES.ICE_DEBUG.RESOURCES.0.VALUE" value="${workspace_loc:/flatten/Debug/flatten.axf}"/>If that still doesn't help, then we'll need to investigate further and maybe get a copy of your project. It would not be appropriate to post your project on this public forum, so instead you will need to raise an official support case by selecting Support > Arm Support Services from the top of this page, then "Open a Support Case". Please add a reference to this forum post.Stephen
Hi and thanks for the reply, I checked, Arm DS version is 2024.0 and the debug configuration is run from the debug image, not the release${workspace_loc:/flatten/Debug/flatten.axf} So I will create a separate support case, thanks again for your help! Oleksandr