cancel
Showing results for 
Search instead for 
Did you mean: 

CRC injection calculation failure

JTres.2
Associate II

Hi,

I'm implementing the X-CUBE-STL flash test in a project on a STM32F0 device and using STM32_Programmer_CLI.exe to inject CRCs after compilations to the binary. Compilation runs without any errors/warnings. Running the flash test on the device causes a flash test failure if the last section of  application is included in the testing. Investigating the CRC computed for all section of the applications showed that all CRCs are correct except for the last. Has anyone here encountered the same problem and/or solved the issue?

Thanks in advance!

8 REPLIES 8
Bruno_ST
ST Employee

Hello @JTres.2​ 

Which STM32CubeProgrammer version and IDE are you using ?

They have been an issue in the CRC tools does not take into account all binaries information available in the out file.

The problem has been seen with the filled binary. In such case, there could be overlap between 32 bits alignment feature of CRC tool and binary.

Could it be your issue ?

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.

JTres.2
Associate II

Tnx @Bruno_ST​ I'm using Visual Code (1.57.1), arme-eabi-none-gcc 9.2.1 20191025 (release) with and STM Prog CLI (2.5.0.0). How can I check and hopefully solve this issue?

JTres.2
Associate II

Am I suppose to use the fill cmd in the linker script to fill the section with data?

Bruno_ST
ST Employee

@JTres.2​ Can you have a try with STM Prog CLI v2.8.0 please ?

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.

JTres.2
Associate II

I tried with 2.8.0, but same output, not successful.

JTres.2
Associate II

@Bruno_ST​ reading to the documentation of both X-CUBE-STL and the STM_Programmer_CLI and manually calc the CRCs; It seems that the CLI only calculates the CRC of the occupied memory of the last section while STL calculates the the entire section.

Can you please advice on recommendations to solve this issue?

Hi @JTres.2​ ,

You will find an explanation for the difference of behavior between X-CUBE-STL and STM32CubeProgrammer in this discussion.

As suggested there, the solution is to assure 32-bit alignment of the code prior calling the ST CRC calculation tool to avoid automatic padding done by STM32CubeProgrammer.

-Amel

PS: Once your question is answered, please click on "Select as Best" for the comment containing the answer to your initial question.

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.

JTres.2
Associate II

@Amel NASRI​ thanks for your reply.

I'm attempting to enforce 32-bit alignment on the flash section through the linker script. Could you please advice on proper syntax?

Attaching the section related to flash:

 /* The program code and other data goes into FLASH */

 .text ALIGN(4):

 {

  . = ALIGN(4);

  *(.text)      /* .text sections (code) */

  *(.text*)     /* .text* sections (code) */

  *(.glue_7)     /* glue arm to thumb code */

  *(.glue_7t)    /* glue thumb to arm code */

  *(.eh_frame)

  KEEP (*(.init))

  KEEP (*(.fini))

  . = ALIGN(4);

  _etext = .;    /* define a global symbols at end of code */

 } >FLASH

 /* Constant data goes into FLASH */

 .rodata ALIGN(4):

 {

  . = ALIGN(4);

  *(.rodata)     /* .rodata sections (constants, strings, etc.) */

  *(.rodata*)    /* .rodata* sections (constants, strings, etc.) */

  . = ALIGN(4);

 } >FLASH

Thanks in advance!