cancel
Showing results for 
Search instead for 
Did you mean: 

stm32f407 discovery FW_update and dev app

dandantas88
Associate II
Posted on September 09, 2015 at 19:29

good afternoon!

i'm trying to prepare my system for realise updates to the user, and him can download it to the usb flash (used in my process all time) and as FW_update says rset-> press botton 4s-> wait until green -> press botton and its running the new update

i get the point of change all the vectores in my app but after creat the .bin file and try the update doesnt run ( if code upload via SW works)

what i have done in MDK keil 5.14 on my project:

1)file system_stm32f4xx.c change to this ''#define VECT_TAB_SRAM

#define VECT_TAB_OFFSET  0x8000''

2)options for target - target tab

IROM1 0x8008000

3) options for target - user tab

check Run#1 comand: $K\ARM\ARMCC\bin\fromelf.exe --bin --output=@L.bin !L

4) options for target - linker tab

uncheck ''use memory layout...''

and define R/O base: 0x08008000

build and place generated .bin file in usb flash...doesnt start

i kept the FW_Update example as it is so my code should be pointed to start at 0x08008000

i bet, for the beaviour that is doing update and try to start something but not my code begin at all...

because if i rset the board as appnote says it should go direct to my code is nothing done, and nothing starts =(

what i'm missing? in keil configs??

thanks for the help

PS: during my research i found that discovery has a bootload, could it be also a option for my objective of firmware update on client?

4 REPLIES 4
Posted on September 09, 2015 at 21:28

Pretty sure you don't want it looking for the vectors in SRAM. The value in SCB->VTOR needs to be 0x08008000

Would suggest you instrument your code and use USART6 (PC6/PC7) to provide more diagnostic information so you can understand what's going on internally.

You could also use a debugger, break-point the control transfer code and step into the application code to understand where it was going wrong.

Tips, buy me a coffee, or three.. PayPal Venmo Up vote any posts that you find helpful, it shows what's working..
dandantas88
Associate II
Posted on September 10, 2015 at 12:39

good moorning Clive1 et all

today i did a memory compare using st-link utility

i start the comparation on 0x0800800 and my bin file, after a run fw_update, and its equal, so my applications is load into memory correctelly.

as far as i know the problem should be in start vector as clive1 says.

in my apllication code, file system_stm32f4xx.c  i have

#define VECT_TAB_SRAM

#define VECT_TAB_OFFSET  0x8000

and in the void SystemInit(void) i have

#ifdef VECT_TAB_SRAM

  SCB->VTOR = SRAM_BASE | VECT_TAB_OFFSET; /* Vector Table Relocation in Internal SRAM */

#else

  SCB->VTOR = FLASH_BASE | VECT_TAB_OFFSET; /* Vector Table Relocation in Internal FLASH */

#endif

map file:

Load Region LR_IROM1 (Base: 0x08008000, Size: 0x0000e124, Max: 0x00100000, ABSOLUTE, COMPRESSED[0x0000df4c])

    0x08008000   0x00000188   Data   RO            3    RESET               startup_stm32f407xx.o

at this point i have a new debout

SCB-VTOR result is 0x20008000 (RAM) but, the fw_update says the application should be at 0x0808000 (Sram), could it be related?

i 'll try to get some infor about program beaveour from RAM vs SRAM vs ROM

debug is not easy to set as the code to be debuged is FW_update and after the runing it should jump to my apllication.

if my application starts i can know it because of led flashing.

Program counter after finish FW_update doesnt go on 0x080800, so i'm lost around.

but any option 'll help!

Thanks

Posted on September 10, 2015 at 15:56

#define VECT_TAB_SRAM  // Look it's not in SRAM, don't define this

Tips, buy me a coffee, or three.. PayPal Venmo Up vote any posts that you find helpful, it shows what's working..
dandantas88
Associate II
Posted on September 10, 2015 at 16:24

and its working =)

thanks a lot

for information:

on Fw_update, i didnt change anything, or you can change in comand.c the DOWNLOAD_FILENAME to your desired name, output of your app

on my app i went on target option:

1)target tab

IROM1: start at the 0x8008000

2)user tab

run#1 $K\ARM\ARMCC\bin\fromelf.exe --bin --output=@L.bin !L

them copy the output file from your project folder in mdk-arm xxx.bin (same name DOWNLOAD_FILENAME or change to it) to your usb

plug usb, rset while pressing user button, wait until bootup and blue blink, realise user button, blue on, orange on, green on, press user button to start your app, ITS RUNNING

thanks Clive1 for the helping around