2016-12-08 05:07 AM
Hello Everyone,
I need DFU application which can load the new firmware at run time.
I want to implement DFU in stm32l476G-Eval board, tried with DFU bootloader method (Connecting Boot0 to VCC) it is working fine.
Compiled the DFU standalone example application and ran it but it is not showing as a DFU device when i connected the eval board to PC.
Can any body explain or point me to the links which can explain how to implement the DFU standalone method. How the run time DFU will work? how much space it will take for the DFU code?
#stm32l4 #usb #stm32l476g-eval #stm32l4-dfu-runtime #dfu Note: this post was migrated and contained many threaded conversations, some content may be missing.2017-08-23 01:10 AM
How can i write DFU file ? (means own Boot loader at 0x08000000) , I have new image but i have no idea about how to write own DFU file so pls guide me
2017-08-23 04:43 AM
Hi ,
When my program start it enter into internal bootloader and i can able to flash using USB communication . Now my problem is , I want to enter into application program (0x08004000) after flash get complete.
My plan is when STM32 reset ,my STM32F207ZG controller goes to DFU mode and flash the firmware into application memory and After finish flashing, it jump into application memory.
2017-08-23 08:10 AM
I think you're going to need to manage that in your boot loader, because the processor resets into 0x08000000, you should determine if the image at 0x08004000 is valid, and transfer control.
2017-08-23 08:25 AM
Yes my bootloader in 0x08000000 and image file in 0x08004000 , but my doubt is how to write bootloader to change the device into DFU mode . If i use internal bootloader means then how i can able to jump into application image .
2017-08-23 08:30 AM
Transfer control means?
setting main stack pointer or something else
---------------------------------------------------------------------------
If i Jump into DFU mode then how can i come out from that
Thanks
Manikandan
2017-08-23 09:53 AM
To exit wouldn't you click 'Leave DFU Mode' in DFuSe Demo? I would expect it to reset the part, there's no 'jump to this code' option.
Think about how the processor works, when you transfer control to the application code from your boot loader code what conditions/state does the entry point of the application expect? If it is a Reset_Handler in the Vector Table, then assume, at a minimum, that there are expectations about SP and PC registers, and that interrupts aren't masked, etc.
2017-08-23 11:10 AM
SysMemBootJump = (void (*)(void)) (*((uint32_t *) 0x1fff0004));
HAL_RCC_DeInit();
SysTick->CTRL = 0; SysTick->LOAD = 0; SysTick->VAL = 0;__set_MSP(0x20004000);
SysMemBootJump();
while (1)
;This is my bootloader main code, my doubt is instead of setting MSP as 0x20004000(
__set_MSP(0x20004000);) to 0x080004000 right or wrong ?, Means i set MSP to my application code and in command I give leave dfu this also I dono right or wrong . If anything wrong pls give me some example code because I get confusing more
2017-08-23 12:38 PM
You want the stack in RAM, so pointing it at 0x08004000 in FLASH will be a disaster.
The 32-bit data value at 0x08004000 is the value the processor wants for the stack, ie
SP = *((uint32_t *)0x08004000); // The content of the address, not the address itself
// Your Loader Code transferring control to Application Code
AppJump = (void (*)(void)) (*((uint32_t *)0x08004004)); // Initial PC [+4]
__set_MSP(*((uint32_t *)0x08004000)); // Initial SP [+0]
AppJump();
The micro-controller has a very simple view of the world, understand how it executes code and starts and you'll be far less confused.