cancel
Showing results for 
Search instead for 
Did you mean: 

STM32F427 CLASSB library V4.0.0 Flash test failed

melfice
Associate II

I have a Flash Full test failed issue with the STM32F427 ClassB library V4.0.0 code in Keil project.The project is generated from the STM32F446RE-Nucleo examples. Attached please find my scatter file and the post-build command batch file. (I have tested the official CubeIDE project and it can pass the Flash Full test and also the runtime partial flash test.)

 

Project.sct

LR_IROM1 0x08000000 0x00080000  {    ; load region size_region (512KB FLASH)
  ; Interrupt Vector Table and Program Code (FLASH)
  ; Full 512KB flash region
  ; Note: CRC area (0x0807FFFC-0x0807FFFF) should be excluded from flash test
  ER_IROM1 0x08000000 0x00080000  {  ; load address = execution address (full 512KB)
    *.o (RESET, +First)
    *(InRoot$$Sections)
    .ANY (+RO)
    .ANY (+XO)
  }
  
  ; RAM Memory Region (192KB)
  ; Backup buffer section (for STL) - 32 bytes (0x20), placed first in RAM, UNINIT (NOLOAD)
  backup_buffer_section 0x20000000 UNINIT 0x20 {
    * (backup_buffer_section)
  }
  
  ; Initialized data (loaded from FLASH) and uninitialized data
  ; Starts at 0x20000020 (after 32-byte backup buffer)
  RW_IRAM1 0x20000020 0x0002FFE0  {  ; RW data (192KB - 32 bytes RAM)
    .ANY (+RW +ZI)
  }
  
  ; CCMRAM Memory Region (64KB)
  ; CCMRAM initialized data (loaded from FLASH) and uninitialized data
  RW_IRAM2 0x10000000 0x00010000  {  ; CCMRAM (64KB)
    * (.ccmram)
    * (.ccmram*)
    .ANY (+RW +ZI)
  }
}

 

post-build.bat

C:\Keil_v5\ARM\Arm_Compiler_5.06u7\bin\fromelf.exe --bincombined --bincombined_padding=4,0xFFFFFFFF .\Out\Project.axf --output  .\Out\Project.bin
STM32_Programmer_CLI.exe -sl .\Out\Project.bin 0x08000000 0x08080000 0x400
.\bin\srec_cat.exe .\Out\Project.bin -binary -offset 0x0000 -o .\Out\Project_v2.hex -intel
.\bin\srec_cat.exe .\Out\Project_v2.hex -intel -crop 0x08000000 0x0807FFFF -fill 0xFF 0x08000000 0x0807FFFF -crc32-l-e 0x0807FFFC -o .\Out\Project_CRC.hex -intel

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
Petr Sladecek
ST Employee

Hello,

Note the Cube Programmer CLI performs CRC table but only upon the valid binary area. If you inspect the file after CLI command is applied, you will see the CRC area allocated at the end of the range specified at your CLI command starting from address 0x7F800. The defined range includes 512x 1KB sections so space for 512 words (~ 2KB) of CRC results for all these sections must be reserved for the CRC area at the end of the range there (note your comment at the linker scatter file is not correct). Then you should observe CRC words calculated for those sections occupied by the code exclusively, the other words stay unfilled (invalid) at the CRC area (the programmer doesn’t care about them). That is why you need to configure the Flash test at your flash configuration structure to fit exactly your binary area borders. Note the tested binary space must be continuous (all the included sections must be aligned) while its begin must aligned with 1KB boundary and end by 32-bit word (this means the last address to be tested must be at binary format Bxxx..xx11). I suggest inspecting your map file to verify your binary area end especially or you can overtake method implemented at the STL integration example where the last address is filled automatically from definition of dummy segment placed at the end of the binary while just the address preceding this last dummy segment start is overtaken as a valid binary end for the test.

Best regards,

Petr

View solution in original post

2 REPLIES 2
Petr Sladecek
ST Employee

Hello,

Note the Cube Programmer CLI performs CRC table but only upon the valid binary area. If you inspect the file after CLI command is applied, you will see the CRC area allocated at the end of the range specified at your CLI command starting from address 0x7F800. The defined range includes 512x 1KB sections so space for 512 words (~ 2KB) of CRC results for all these sections must be reserved for the CRC area at the end of the range there (note your comment at the linker scatter file is not correct). Then you should observe CRC words calculated for those sections occupied by the code exclusively, the other words stay unfilled (invalid) at the CRC area (the programmer doesn’t care about them). That is why you need to configure the Flash test at your flash configuration structure to fit exactly your binary area borders. Note the tested binary space must be continuous (all the included sections must be aligned) while its begin must aligned with 1KB boundary and end by 32-bit word (this means the last address to be tested must be at binary format Bxxx..xx11). I suggest inspecting your map file to verify your binary area end especially or you can overtake method implemented at the STL integration example where the last address is filled automatically from definition of dummy segment placed at the end of the binary while just the address preceding this last dummy segment start is overtaken as a valid binary end for the test.

Best regards,

Petr

Thank you, Petr.

 

I build the STM32F427 project again and re-arrange the post-build command as below:-

STM32_Programmer_CLI.exe -sl "Out/Project.axf" 0x08000000 0x08080000 0x400
C:\Keil_v5\ARM\Arm_Compiler_5.06u7\bin\fromelf.exe --bincombined --bincombined_padding=4,0xFFFFFFFF .\Out\Project.axf --output  .\Out\Project.bin

And the scatter file is same as the example, STM32F446. Then, the problem is solved.