2024-02-14 02:19 AM
Hello,
I use Atollic True STUDIO as a development environment and usually use it to program the STM32L4.
As a test, I uploaded the generated project.hex file to an STM32L4 using the STM32CubeProgrammer. After reading the flash with the STM32CubeProgrammer, I noticed that the same code is not in the flash as by programming with the Atollic True STUDIO.
For example:
Is that normal?
What is extra added by Atollic True STUDIO?
Thank you in advance
Martin
Solved! Go to Solution.
2024-02-15 12:09 AM
Hello,
I don't know why that was wrong several times yesterday.
Sometimes you have to let some time pass and then it resolves itself :)
Apparently there were two different HEX files.
Thank you.
2024-02-14 06:28 AM - edited 2024-02-14 07:08 AM
Different compilers will produce different output. This is expected.
The translation from C code into cpu instructions is complicated, to say the least. You should not expect the same result for different compilers, or even different versions of the same compiler.
Think I misunderstood here. You probably aren't using the same hex file. But maybe not. The IDE should have some console output somewhere to show what file it used, exactly.
2024-02-14 06:41 AM
So you used the exact same .hex file? The only difference was using a different programmer?
2024-02-15 12:09 AM
Hello,
I don't know why that was wrong several times yesterday.
Sometimes you have to let some time pass and then it resolves itself :)
Apparently there were two different HEX files.
Thank you.
2024-02-26 03:25 AM
Hello,
the problem comes from code alignment applied by GCC compiler and linker making unexpectedly gaps between the code sections due to different alignment control what results at default filling of these gaps. This is done differently by GCC compiler and STM32CubeProgrammer used to calculate and make content (CRC results) of the Flash CRC descriptor field as a consequence. Different alignment usually happen when STL is combined with another code or FW (e.g. after implementation of floating point arithmetic). We strongly suggest to inspect the binary file by IDE build analyzer and verify and detect if any discontinuity appears at the code binary. If the binary file is not continuous, STL works only if it is downloaded by the STM32CubeProgrammer but not by e.g. STM32CubeIDE debugger applying the GCC ELF output file and so different default filling of the gaps between the not aligned code sections. Solution is to modify the linker scatter file and force unique alignment of all the sections eliminating these gaps.
We haven't observe such a problem at IAR or KEIL compilers and its occurrence is still under our investigation.
Best regards,
Petr
2024-02-26 04:01 AM
Hi,
thank you for your answer but I think I have used 2 different files.
Best regards,
Martin
2024-02-26 06:34 AM
I'm sorry, Martin, my reply was posted here by mistake. It concerns another thread.
Best regards,
Petr