cancel
Showing results for 
Search instead for 
Did you mean: 

cubeprogrammer can not find masserase function

keanlee0721
Associate II

I created an external flash STLDR file for my board, with STM32H750VB chip and W25Q64 QSPI FLASH. After copying the STLDR file to the cubeprographer directory, it can perform normal external flash read/write and sector erase functions. However, when selecting full chip erase, the cubeprographer prompts me "please select external loader before performing external full chip erase". But I am sure that my code contains the correct int MassErase (void) function, and I used the readelf command in Ubuntu environment to read the STLDR file I created, which also includes the MassErase function. But it seems that this function cannot be correctly detected by the cubeprographer. How can I locate the cause and solve this problem?
Wishing you peace

1 ACCEPTED SOLUTION

Accepted Solutions

The .STLDR you attached looks reasonable enough

Not sure the linker script is entirely correct. It describes the FLASH at 0x08000000 and the StorageInfo structure is placed there.

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

View solution in original post

8 REPLIES 8

>>How can I locate the cause and solve this problem?

Hard to know with the detail presented, you look to be looking in the right places.

Perhaps attach the .ELF / .STLDR, or a structure dump via OBJDUMP, OBJCOPY, or whatever.

Perhaps the address or attributes of the function? The case?

Perhaps compare the structure of how your's dumps vis-a-v all the other examples in the ExternalLoader subdirectory.

Screen shots of error, showing loader that's loaded, the Log at Verbosity Level 3..

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

thank you for your replay!

this is my Screen shots and error message

keanlee0721_0-1740839208415.png

This stldr file can help me perform external flash read, write, and fast erase functions, but full chip erase cannot be used.

I saved the output of objdump and readelf commands in CMDobjdump.txt and CMDreadlef.txt files. It can be found that the masserase function exists in both files. However, when executing external full chip erase, the error shown in the figure above is always prompted. I put part of these two files here for easy display, as well as my cubeide project. By the way, the cubeide I use is the Linux version, and the development environment is ubuntu22.04.5LTS.
This problem has bothered me for a week
Thank you again for your reply

keanlee0721_1-1740840189367.png

keanlee0721_2-1740840215903.png

 this is source code screen shots

keanlee0721_3-1740840351250.png

about of the cubeprogrammer

keanlee0721_4-1740840853885.png

about of the cubeide

keanlee0721_5-1740840920803.png

keanlee0721_6-1740841405832.png

 

 

I'll take a look. Make sure the most current version of your loader is in the STM32 Cube Programmer External Loader directory

This is the one I built as a constrast

https://github.com/cturvey/stm32extldr/blob/main/h7_w25q64/CLIVEONE-W25Q64_STM32H7XX-PB2-PB6-PD11-PD12-PE2-PD13.stldr

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

I have used the stldr file you provided, It can perform left and right external flash operations normally in ubuntu environment without any errors, and I sent an email to ask if I could donate to get the source code, remember?^_^
Last night, I used the stldr file I made to do some other tests and found some new problems. The same stldr file can be used in cubeprogrammer under windows environment, all functions are normal, but in ubuntu, cubeprogrammer only reports an error for full external flash erase. However, in ubuntu command line, using the command "STM32_Programmer_CLI -c port=SWD freq=4000 -el /home/user/keanlee/stm32/hope/hope_h750_w25q64jv_stldr/hope_h750_w25q64jv_stldr/Debug/hope_h750_w25q64jv_stldr.stldr -e all", the mass erase function can be executed normally to complete the full chip erase. I don't know why this happens. I hope to get some supplements and solutions in this regard. Thank you again for your reply, which is very important to me.

In the Ubuntu CubeIDE environment, I set up the CubeIDE project as follows:

keanlee0721_0-1740918818329.pngkeanlee0721_1-1740918833751.pngkeanlee0721_2-1740918848559.png

keanlee0721_3-1740918997411.png

Is it possible that these settings may cause errors?


It has been a few days since we last discussed this issue. May I ask if there are any results yet?

Best wishes

The .STLDR you attached looks reasonable enough

Not sure the linker script is entirely correct. It describes the FLASH at 0x08000000 and the StorageInfo structure is placed there.

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 for your reply. I have modified the linker script and removed the 0x08000000 flash address. After recompiling, everything is working properly. I am really excited and thank you again for your help Because I have never used buymeacoffee before, I am researching how to use it. Please enjoy your coffee later, that is my agreement! Best wishes!

Oh my god, I made a *** mistake in the test just now. I erased the on-chip flash memory instead of the external flash memory, and the full chip erase of the external flash memory still reported an error: Please select external loader before performing external full chip erase, I made the following modifications in the linker script, but it still doesn't work. Do you have any suggestions? I'm laughing at my own foolishness!

/*

******************************************************************************

**

** File : LinkerScript.ld

**

** Author : STM32CubeIDE

**

** Abstract : Linker script for STM32H7 series

** 128Kbytes FLASH and 1056Kbytes RAM

**

** Set heap size, stack size and stack location according

** to application requirements.

**

** Set memory bank area and size if external memory is used.

**

** Target : STMicroelectronics STM32

**

** Distribution: The file is distributed as is, without any warranty

** of any kind.

**

*****************************************************************************

** @attention

**

** Copyright (c) 2024 STMicroelectronics.

** All rights reserved.

**

** This software is licensed under terms that can be found in the LICENSE file

** in the root directory of this software component.

** If no LICENSE file comes with this software, it is provided AS-IS.

**

****************************************************************************

*/

 

/* Entry Point */

ENTRY(Reset_Handler)

 

/* Highest address of the user mode stack */

_estack = ORIGIN(RAM_D1) + LENGTH(RAM_D1); /* end of RAM */

/* Generate a link error if heap and stack don't fit into RAM */

_Min_Heap_Size = 0x200; /* required amount of heap */

_Min_Stack_Size = 0x400; /* required amount of stack */

 

/* Generate 2 segment for loader code and device info */

PHDRS {Loader PT_LOAD; SgInfo PT_LOAD ; }

 

/* Specify the memory areas */

MEMORY

{

RAM_D1 (xrw) : ORIGIN = 0x24000004, LENGTH = 512K

}

 

/* Define output sections */

SECTIONS

{

/* The startup code goes first into FLASH */

.isr_vector :

{

. = ALIGN(4);

KEEP(*(.isr_vector)) /* Startup code */

. = ALIGN(4);

} >RAM_D1 :Loader

 

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

.text :

{

. = 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 */

} >RAM_D1 :Loader

 

.Dev_info :

{

KEEP(*Dev_Inf.o ( .rodata ))

} >RAM_D1 :SgInfo

 

/* Constant data goes into FLASH */

.rodata :

{

. = ALIGN(4);

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

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

. = ALIGN(4);

} >RAM_D1 :Loader

 

.ARM.extab (READONLY) : /* The READONLY keyword is only supported in GCC11 and later, remove it if using GCC10 or earlier. */

{

*(.ARM.extab* .gnu.linkonce.armextab.*)

} >RAM_D1 :Loader

.ARM (READONLY) : /* The READONLY keyword is only supported in GCC11 and later, remove it if using GCC10 or earlier. */

{

__exidx_start = .;

*(.ARM.exidx*)

__exidx_end = .;

} >RAM_D1 :Loader

 

.preinit_array (READONLY) : /* The READONLY keyword is only supported in GCC11 and later, remove it if using GCC10 or earlier. */

{

PROVIDE_HIDDEN (__preinit_array_start = .);

KEEP (*(.preinit_array*))

PROVIDE_HIDDEN (__preinit_array_end = .);

} >RAM_D1 :Loader

 

.init_array (READONLY) : /* The READONLY keyword is only supported in GCC11 and later, remove it if using GCC10 or earlier. */

{

PROVIDE_HIDDEN (__init_array_start = .);

KEEP (*(SORT(.init_array.*)))

KEEP (*(.init_array*))

PROVIDE_HIDDEN (__init_array_end = .);

} >RAM_D1 :Loader

 

.fini_array (READONLY) : /* The READONLY keyword is only supported in GCC11 and later, remove it if using GCC10 or earlier. */

{

PROVIDE_HIDDEN (__fini_array_start = .);

KEEP (*(SORT(.fini_array.*)))

KEEP (*(.fini_array*))

PROVIDE_HIDDEN (__fini_array_end = .);

} >RAM_D1 :Loader

 

/* used by the startup to initialize data */

_sidata = LOADADDR(.data);

 

/* Initialized data sections goes into RAM, load LMA copy after code */

.data :

{

. = ALIGN(4);

_sdata = .; /* create a global symbol at data start */

*(.data) /* .data sections */

*(.data*) /* .data* sections */

*(.RamFunc) /* .RamFunc sections */

*(.RamFunc*) /* .RamFunc* sections */

 

. = ALIGN(4);

_edata = .; /* define a global symbol at data end */

} >RAM_D1 :Loader

 

/* Uninitialized data section */

. = ALIGN(4);

.bss :

{

/* This is used by the startup in order to initialize the .bss section */

_sbss = .; /* define a global symbol at bss start */

__bss_start__ = _sbss;

*(.bss)

*(.bss*)

*(COMMON)

 

. = ALIGN(4);

_ebss = .; /* define a global symbol at bss end */

__bss_end__ = _ebss;

} >RAM_D1 :Loader

 

/* User_heap_stack section, used to check that there is enough RAM left */

._user_heap_stack :

{

. = ALIGN(8);

PROVIDE ( end = . );

PROVIDE ( _end = . );

. = . + _Min_Heap_Size;

. = . + _Min_Stack_Size;

. = ALIGN(8);

} >RAM_D1 :Loader

 

/* Remove information from the standard libraries */

/DISCARD/ :

{

libc.a ( * )

libm.a ( * )

libgcc.a ( * )

}

 

.ARM.attributes 0 : { *(.ARM.attributes) }

}