cancel
Showing results for 
Search instead for 
Did you mean: 

UPGRADING APPLICATION FIRMWARE BY USB STICK

sami
Associate II
Posted on June 13, 2013 at 17:16

HELLO

I  want to upgrade the fırware of my design by usb stick , I am using the example given with the discovery board where I need a binary image of my Project  myproject.BIN,

I am using keil so I can generate hex file of my Project , how can I convert hex file to binary file inorder to use it?

Thank you
26 REPLIES 26
alexandr
Associate II
Posted on June 21, 2013 at 10:30

>Do you have some interrupts enabled in the Boot Loader? ?

Clive, if bootloader uses interrupts, that are not used in the main application - do we need to disable it before JumpToApplication ?

In my current project I use USB in  bootloader, but Main Application does not use USB.

sami
Associate II
Posted on June 21, 2013 at 13:49

Have you succees to make the application work ?

Posted on June 21, 2013 at 14:08

Clive, if bootloader uses interrupts, that are not used in the main application - do we need to disable it before JumpToApplication? In my current project I use USB in  bootloader, but Main Application does not use USB.

Well if the boot loader was considerate it would tear down the resources that were no longer in use. The problem with interrupts is whether the app has code to handle them, if the vectors are not specified they will weakly link to a default handler, where spurious interrupt will get dumped. If that handler is an infinite loop your product will seize up. Best not to leave unused/unhandled interrupts enabled.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
Posted on June 21, 2013 at 14:24

You should be single stepping rather than using breakpoints once you get to the area of failure.

If you have already set up the clocks and PLLs, you wouldn't need to do that again in SystemInit(), just change SCB->VTOR

That it calls the LOWER Boot Loader Handler suggests it either hasn't got to the end of SystemInit(), or the vector table address hasn't been set properly (yet).

None of this stuff however is magic, it just needs some rigor in the debugging and analysis of the code being executed.
Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
sami
Associate II
Posted on June 21, 2013 at 16:35

where should I set the vector table ?

in the bootloader code before it jump to the application code ?

or in the application code ?

or in both ?

what should be its value? 0x8000?

Posted on June 21, 2013 at 18:00

where should I set the vector table ? in the bootloader code before it jump to the application code ? or in the application code ?  or in both ? what should be its value? 0x8000?

 

Well in my Boot Loader / App designs I set the appropriate vector table in SystemInit() based on a linker generated address for the table being used.

I also don't dump into the App with assorted interrupts configured. That would cause all manner of problems with initialization of RAM structures or other things which can't get handed off cleanly or safely. The goal is to reduce the dependencies each has on the other, and let the linker build free standing and independent code. Ideally the hand off should be done with near reset conditions, and minimally the App should know exactly what state it is inheriting from the Boot Loader.

The Boot Loader would effectively set SCB->VTOR = 0x08000000; and the App would effectively set SCB->VTOR = 0x08008000;

The linker generates the address for __Vectors and I don't have to think about it.
Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
sami
Associate II
Posted on July 04, 2013 at 16:20

Thank you alot Clive , after very long debugg it was really easy .. in the application code in the usb code somewhere the application vector was setting to the wrong place . now it is ok .

Really thank you all and clive .

Do you suggest a simple code to add it to the application code to protect it from being read ?