STMicroelectronics / stm32-external-loader

Provides drivers, examples, loader files and testing routines for external loaders for STM32 series of microcontrollers.
Other
127 stars 71 forks source link

Can not erase #6

Closed decelect-gchauvelin closed 3 years ago

decelect-gchauvelin commented 3 years ago

Hi,

I have tried this project with STM32H7B3I-DK which use MX25LM51245G_STM32H7B3I-DISCO.stldr external loader with STM32CubeProgrammer. If I build this project and replace MX25LM51245G_STM32H7B3I-DISCO.stldr into C:\Program Files\STMicroelectronics\STM32Cube\STM32CubeProgrammer\bin\ExternalLoader it does not work? Did you test on this board please?

Please see bellow log into STM32CubeProgrammer 10:19:26 : Memory Programming ... 10:19:26 : Opening and parsing file: extflash.bin 10:19:26 : File : extflash.bin 10:19:26 : Size : 5525216 Bytes 10:19:26 : Address : 0x90000000 10:19:26 : Erasing memory corresponding to segment 0: 10:19:26 : Erasing external memory sectors [0 84] 10:19:31 : Error: failed to erase memory 10:19:31 : Error: failed to erase memory 10:19:31 : RUNNING Program ... 10:19:31 : Address: : 0x90000000 10:19:31 : Application is running 10:19:31 : Start operation achieved successfully

By advanced, thanks for your help,

BR,

Grégory

FBOSTM commented 3 years ago

Hi Grégory, I tested the flasher and it works well. Could you provide me with more information: The CubeProgrammer version, Mode, Reset Mode. Also, Let me know if there is an application running in the internal memory.

Best Regards, Fedi Bouzazi.

decelect-gchauvelin commented 3 years ago

Hi Fedi,

Thanks for your reply. CubeProgrammer version is V2.4.0. It is mode normal and software reset. This configuration works fine with original external loader MX25LM51245G_STM32H7B3I-DISCO.stldr for STM32H7B3I-DK downloaded when CubeProgrammer is installed. There is no application into internal flash when I try to flash it. Is my configuration not ok according to you?

Best regards

Grégory Chauvelin

FBOSTM commented 3 years ago

Hi Grégory, Open Loader_Src.c and repalce the Init() function with the following one:

pragma section=".bss"

int Init() { disable_irq(); int32_t result=0; / Init structs to Zero/ char * startadd = section_begin(".bss"); uint32_t size = __section_size(".bss"); memset(startadd,0,size); / init system/ SystemInit(); HAL_Init(); / Configure the system clock / SystemClock_Config(); HAL_RCC_MCOConfig(RCC_MCO1, RCC_MCO1SOURCE_HSE, RCC_MCODIV_1);
/Initialaize OSPI/ if(BSP_OSPI_NOR_Init(0,&Flash) !=0) return 0; /Configure the OSPI in memory-mapped mode/ result=BSP_OSPI_NOR_EnableMemoryMappedMode(0);
if(result!=0) return result; return 1; }

Best Regards, Fedi Bouzazi.

decelect-gchauvelin commented 3 years ago

Hi Fedi,

Thanks for your help. Now it works. An issue is that the project has been made for IAR EW and a patch is necessary for STM32H7, unfortunately the patch is only available for version 8.50.6 of IAR and not for version 9.10. ST can not say when the patch will be available for latest version of IAR. Moreover I have a solution which works fine but not using SWD inteface, it is necessary to use JTAG interface. SWD inteface works for little binary size, but for 3MB size and more I had "Error : Unable to get core ID" on STM32Programmer. Using the same external loader with JTAG interface works fine.

Best regards Grégory Chauvelin