cancel
Showing results for 
Search instead for 
Did you mean: 

STM32CubeProgrammer vs Atollic True STUDIO different data in flash memory

Martin42
Associate III

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:

Martin42_0-1707905867703.png

Martin42_1-1707905884484.png

 

Is that normal?
What is extra added by Atollic True STUDIO?

 

Thank you in advance
Martin

 

1 ACCEPTED SOLUTION

Accepted Solutions
Martin42
Associate III

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.

View solution in original post

6 REPLIES 6
TDK
Guru

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.

If you feel a post has answered your question, please click "Accept as Solution".
Andrew Neil
Evangelist III

So you used the exact same .hex file? The only difference was using a different programmer?

Martin42
Associate III

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.

Petr Sladecek
ST Employee

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

Hi,

thank you for your answer but I think I have used 2 different files.

Best regards,

Martin

Petr Sladecek
ST Employee

I'm sorry, Martin, my reply was posted here by mistake. It concerns another thread.

Best regards,

Petr