cancel
Showing results for 
Search instead for 
Did you mean: 

How to make an own dfu application on STM32F746G-DISCO board?

David Kim
Associate II

I'm trying to make own dfu application on STM32F746G-DISCO board.

I've already tested dfu function by using ST's DFU_Standalone demo example which is worked under USB device mode.

Demo example is also provided upgradable sample application which is named as STM32746G_DISCOVERY_SysTick_0x08008000.dfu.

I can upgrade this application by using DfuSeDemo.exe on windows 10 PC and It works well.

But if i made a simple led toggle dfu application, It cannot run.

In this case, i have used the same DFU bootloader. Just changed application.

Below is what i modified for dfu application

--------------------------------------------------------------------------------

1. Changed app's flash location to 0x08008000 in STM32F746NGHX_FLASH.ld

2. Changed VECT_TAB_OFFSET to 0x8000 in system_stm32f7xx.c.

the board is always running in DFU mode even if there is no error by using DfuFileMgr.exe and DfuSeDemo.exe

So i checked flash's USBD_DFU_APP_DEFAULT_ADD(0x08008000) location by using STM32CubeProgrammer.

It shows 0x20050000. Obviously, this value cannot meet in DFU bootloader's application jump condition.

/* Test if user code is programmed starting from USBD_DFU_APP_DEFAULT_ADD address */

if(((*(__IO uint32_t*)USBD_DFU_APP_DEFAULT_ADD) & 0x2FFE0000 ) == 0x20000000)

{

  /* Jump to user application */

  JumpAddress = *(__IO uint32_t*) (USBD_DFU_APP_DEFAULT_ADD + 4);

  JumpToApplication = (pFunction) JumpAddress;

   

  /* Initialize user application's Stack Pointer */

  __set_MSP(*(__IO uint32_t*) USBD_DFU_APP_DEFAULT_ADD);

  JumpToApplication();

}

Could you let me know what i missed something?

Thanks in advance,

1 ACCEPTED SOLUTION

Accepted Solutions

The RAM stack test can be changed/broadened, one can also report one value in Initial SP, and then load a higher value within the Reset Handler.

The DFU file contains address/size location, so the the ROM based loader can replace the App or the User Loader, or any combinations thereof.

Watch generally that you don't have any active IRQs with different memory/structure expectations that won't handle the transfer of control

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

6 REPLIES 6
Uwe Bonnes
Principal III

Why do you want to write your own DFU application. For USB1, a DFU application is in the system bootloader. Have some switch early in your startup code to run DFU with some marker, e.g. some magic in RAM or some reset event. When the application should switch to DFU, set this marker and reset, Only if you want DFU for USB2, you need your own DFU code.

What i said of DFU application means upgradable binary. Not bootloader.

If i fixed some bug or problem, I want to update to latest binary by using DfuSeDemo.exe.

I used DFU bootloader of ST's DFU_Standalone demo example.

The RAM stack test can be changed/broadened, one can also report one value in Initial SP, and then load a higher value within the Reset Handler.

The DFU file contains address/size location, so the the ROM based loader can replace the App or the User Loader, or any combinations thereof.

Watch generally that you don't have any active IRQs with different memory/structure expectations that won't handle the transfer of control

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

You miss idea about SYSTEM and CUSTOM DFU bootloaders.

CUSTOM is placed in normal start 0x8000000 and size may vary , but application then is loaded after this size rounded to sector. Sometimes 0x8008000

SYSTEM DFU works other way. In simple mode you can connect BOOT pin over resistors to gnd and VBUS. Then if connect USB and reset - system DFU is started and you can load new binary with DFUSE (obsolete) or  STM32CubeProgrammer normaly to 0x8000000 and overwrite old code.

I think that you talked about the system bootloader.

I'm just beginner of embedded system. so i want to study about the embedded bootloader.

My testing is based on the STM32Cube_FW_F7_V1.16.1\Projects\STM32746G-Discovery\Applications\USB_Device\DFU_Standalone.

If you have any other tips, Could you let me know?

Ggvfd.2
Associate II

Why do you need to write your personal DFU utility. For USB1, a DFU utility is inside the device bootloader click on button. Have a few switch early to your startup code to run DFU with a few marker Some magic in RAM or a few reset occasion.