Skip to main content
SGasp.1
Associate III
October 21, 2021
Question

Flashing a HEX file in STM32F4

  • October 21, 2021
  • 2 replies
  • 3162 views

Hi forum..

I developed a bootloader for flashing a hex file present in usb key.

The text from the usb key is transferred via UART to another micro..

The bytes are then flashedin the flash area..

You can find the HEX file in the usb key here ..

When I flash the bytes witj HAL inside the flash memory region I start from the second file of the txt file...

When I finish to write all the file except first line and last line I compare with stm32cube programmer the hex file and the memory region and they are the same..

But when I reboot the application doesnt' start ..

Which is the issue ??

Thanks a lot

Simone

This topic has been closed for replies.

2 replies

TDK
Super User
October 21, 2021

If you flash it with STM32CubeProgrammer instead, does it start?

"If you feel a post has answered your question, please click ""Accept as Solution""."
SGasp.1
SGasp.1Author
Associate III
October 22, 2021

Hi TDK...

Usually i flash a file which is made with bootloader + FE2040 HEX file..

If i flash this file it is working and from the bootloader I am able to jump in the application FE2040..

But now that I try only flashing the FE2040 file it is not working... it is strange because it is coming from the stm32cudeide enviroment..

TDK
Super User
October 22, 2021

I am not sure how to interpret that.

I am trying to determine if your flasher is working correctly. If STM32CubeProgrammer produces the same result as your flasher, you can be confident it is working correctly. And if the flash memory is the same in both cases, the program behavior will be the same in both cases, provided you are not running things differently.

> If I try to flash the hex file with the stm32cubeprogrammer it is not working

Then the program is with your program, not the flasher.

"If you feel a post has answered your question, please click ""Accept as Solution""."
Tesla DeLorean
Guru
October 21, 2021

>>Which is the issue ??

Stops in a debugger and looks..

It a guess, stuff like the BOOT0 pin was wrong, the SCB->VTOR was wrong, random interrupts, some hard fault, or disabled all interrupts in the processor.

Perhaps instrument things like HardFault_Handler() and Error_Handler() to output actionable information, use GPIO or USART to identify where in your code it did manage to get to, or get stuck in.

#HowManyWentToStIves

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