Loading...
 

Zephyr project on STM32

   Zephyr Workbench, a VSCode extension to manage Zephyr on STM32.
It enables users to easily create, develop, and debug Zephyr applications.
Main features:
  • Install host dependencies.
  • Import toolchain and SDK.
  • Create, configure, build and manage apps.
  • Debug STM32.
You can directly download it from the VSCode marketplace
For more details, visit the Zephyr Workbench

System Workbench for STM32


STM32F103 - CubeMX DFU

Hi,





I couldn’t find online a working bootloader implementation of STM32f103C8 based on generated files from CubeMX, i’ve started porting the F4 DFU to F1, there are two applications:

0x08000000 - DFU Bootloader

0x08008000 - Application



Jump between the address works perfectly, CRC works well, at the init of DFU bootloader i check the CRC at certain address if it matches the application that starts from 0x08008000.



Correctly the main issue is with the implementation of “MEM_If_Write_FS”, this is the code:


uint16_t MEM_If_Write_FS(uint8_t *src, uint8_t *dest, uint32_t Len)

{

/* USER CODE BEGIN 3 */

uint32_t i = 0;



for(i = 0; i < Len; i+=4)

{

/* Device voltage range supposed to be 2.7V to 3.6V, the operation will

be done by byte */

if(HAL_FLASH_Program(FLASH_TYPEPROGRAM_WORD, (uint32_t)(dest+i), *(uint32_t*)(src+i)) == HAL_OK)

{

/* Check the written value */

if(*(uint32_t *)(src + i) != *(uint32_t*)(dest+i))

{

/* Flash content doesn’t match SRAM content */

return 2;

}

}

else

{

/* Error occurred while writing data in Flash memory */

return 1;

}

}



return (USBD_OK);

/* USER CODE END 3 */

}


When i try to load the app through dfu-util on linux the app freezes on:

Download from image offset 00000000 to memory 08008000-080083ff, size 1024

Poll timeout 50 ms

Poll timeout 0 ms

And on the debugger i get “Flash content doesn’t match SRAM content” on the “MEM_If_Write_FS”.





Is there any way to solve this issue?







Best,

Itamar

 

Newest Forum Posts

  1. SPI on Nucleo_STMH533RE by royjamil, 2025-05-04 20:13
  2. SPI on Nucleo_STMH533RE by higginsa1, 2025-03-25 07:37
  3. SPI on Nucleo_STMH533RE by royjamil, 2025-03-23 11:31
  4. SPI on Nucleo_STMH533RE by higginsa1, 2025-03-23 09:33
  5. Configuring DMA for ADC in SW? by sam.hodgson, 2025-03-04 12:58
  6. Build a project in "release" mode by info@creosrl.it, 2025-02-20 18:12
  7. Build a project in "release" mode by info@creosrl.it, 2025-02-20 17:05
  8. Build a project in "release" mode by tang, 2025-02-20 10:36
  9. Build a project in "release" mode by info@creosrl.it, 2025-02-19 17:35
  10. Fail to debug in Win 11 C/C++ by mortenlund, 2024-12-26 20:27

Last-Modified Blogs