cancel
Showing results for 
Search instead for 
Did you mean: 

External Loader Parsing Error (V2.12.0)

Dario BUSONI
ST Employee

Hi,

I have updated STM32CubeProgrammer to version 2.12.0 and our custom External Loader is not load properly anymore. In the EL section I can read "Error: Flash loader error parsing fail" and in the log I can read "Error: Flash loader 'C:\*****/MyExternalLoader.stldr" cannot be loaded."

In 2.11.0 it worked just fine.

Do I have to change anything in my EL project (Dev_Inf.c, Loader_Src.c, linker.ld...) to work in the new version?

Thanks in advance.

Dario

1 ACCEPTED SOLUTION

Accepted Solutions

Thank you very much Tesla, good advice, it was the structure size, all along. Since I have only 2 types of sectors in my SPI FLASH, my StorageInfo structure was only 136 bytes long instead of 200. I solved by adding 64 padding bytes. After replacing the .stldr file with the fixed one, the error is gone.

typedef struct DeviceSectors
{
  unsigned long		SectorNum;     // Number of Sectors
  unsigned long		SectorSize;    // Sector Size in Bytes
} device_sector_t;
 
struct StorageInfo
{
   char				DeviceName[100];		// Device Name and Description
   unsigned short	DeviceType;				// Device Type: ONCHIP, EXT8BIT, EXT16BIT, ...
   unsigned long	DeviceStartAddress;		// Default Device Start Address
   unsigned long	DeviceSize;				// Total Size of Device
   unsigned long	PageSize;				// Programming Page Size
   unsigned char	EraseValue;				// Content of Erased Memory
   device_sector_t	sectors[SECTOR_NUM];	// Flash sector types
   unsigned long	padding[16];			// Total size of struct StorageInfo must be 200 bytes
};

View solution in original post

10 REPLIES 10
Sara BEN HADJ YAHYA
ST Employee

Hello @Dario BUSONI​ ,

Thanks for your feedback,

Could you please specify the MCU and share the used EL for further check?

Thanks,

Sara.

Dario BUSONI
ST Employee

Thank you for the answer, the MCU is a STM32G070RBTx.

I'll send the EL project in a private message.

Could you PM me the .STLDR, don't need the project, issues with the ELF should be more apparent. Thanks.

Perhaps with the symbols it exports, the linker script sections, or the format/content of the StorageInfo structure.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
Sara BEN HADJ YAHYA
ST Employee

Hello @Dario BUSONI​ ,

Thanks for raising this issue to our attention,

I submitted an internal Ticket for further check, I'll keep you posted with updates.

Internal ticket number: 141953 (This is an internal tracking number and is not accessible or usable by customers).

  

Sara.

Hi,

Thank you for answering. In the V2.11.0 version the same .elf/.stldr file works fine, so those files should still be correct.

I'll PM you the .STLDR, thanks.

Sara BEN HADJ YAHYA
ST Employee

Hello @Dario BUSONI​ ,

After further investigation, it turns out that the parsing error is caused by a wrong StorageInfo value, it is expected to be 000000c8 and not 00000088

In previous STM32CubeProgrammer versions, corrupted external loaders were accepted, but starting from v2.12.0 a check is made to display an error when loading a faulty .stldr file.

Let me know if this solves your issue!

Sara.

Dario BUSONI
ST Employee

Hello,

thanks for the update. I've looked for the value you mentioned but I'm having a hard time finding it.

Here is my storage info definition, could you help me find out where is the wrong value?

#define 	SPI_FLASH   7
#define SECTOR_NUM 		2			// Max Number of Sector types
#define MAPPED_ADDRESS				0x90000000 // STM32CubeProgrammer shall see the memory at this address
 
/* This structure contains information used by ST-LINK Utility to program and erase the device */
#if defined (__ICCARM__)
__root struct StorageInfo const StorageInfo  =  {
#else
struct StorageInfo const StorageInfo = {
#endif
		"M25P16_EVLKST8500GHxxx", 	 	 	// Device Name + version number
		SPI_FLASH,                  		// Device Type
		MAPPED_ADDRESS,                		// Device Start Address
		0x00200000,                 		// Device Size in Bytes (2MBytes/16Mbits)
		0x00000100,                 		// Programming Page Size 256Bytes
		0xFF,                       		// Initial Content of Erased Memory
		// Specify Size and Address of Sectors (view example below)
		{
				{ 0x00000020, 0x00010000 }, 		// Sector Num : 32 ,Sector Size: 64KBytes
				{ 0x00000000, 0x00000000 }			// end
		}
};

Would be sizeof() StorageInfo structure as it gets into the .ELF (STLDR) file.

Could double check size reported in .MAP file, or reported by objcopy or fromelf dumping tools.

From .MAP of one of mine

...
 
.info           0x00000000       0xc8
 *(.rodata.StorageInfo)
 .rodata.StorageInfo
                0x00000000       0xc8 out/Dev_Inf.o
                0x00000000                StorageInfo
 
.prog           0x24000004     0x1b5c
                0x24000004                . = ALIGN (0x4)
 *(.text)
 .text          0x24000004      0x21c c:/ct/tools/gcc49_2014q4/bin/../lib/gcc/arm-none-eabi/4.9.3/armv7e-m\libgcc.a(_arm_addsubsf3.o)
...

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..

Thank you very much Tesla, good advice, it was the structure size, all along. Since I have only 2 types of sectors in my SPI FLASH, my StorageInfo structure was only 136 bytes long instead of 200. I solved by adding 64 padding bytes. After replacing the .stldr file with the fixed one, the error is gone.

typedef struct DeviceSectors
{
  unsigned long		SectorNum;     // Number of Sectors
  unsigned long		SectorSize;    // Sector Size in Bytes
} device_sector_t;
 
struct StorageInfo
{
   char				DeviceName[100];		// Device Name and Description
   unsigned short	DeviceType;				// Device Type: ONCHIP, EXT8BIT, EXT16BIT, ...
   unsigned long	DeviceStartAddress;		// Default Device Start Address
   unsigned long	DeviceSize;				// Total Size of Device
   unsigned long	PageSize;				// Programming Page Size
   unsigned char	EraseValue;				// Content of Erased Memory
   device_sector_t	sectors[SECTOR_NUM];	// Flash sector types
   unsigned long	padding[16];			// Total size of struct StorageInfo must be 200 bytes
};