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
sami
Associate II
Posted on June 14, 2013 at 15:52

Thank you clive .. but still not solved .

let me explain what i am doing . I have two codes the first is firmware upgrade from usb stick it is the same as the discovery board i just changed the entery to the boot mode.

int main(void) 
{ 
/* STM32 evalboard user initialization */ 
BSP_Init(); 
/* Flash unlock */ 
FLASH_If_FlashUnlock(); 
/* Test if User button on the Discovery kit is pressed */ 
//if (STM_EVAL_PBGetState(BUTTON_USER) == Bit_RESET) 
if(GPIO_ReadInputDataBit(GPIOE, GPIO_Pin_0)==1)// 
{ 
/* Check Vector Table: Test if user code is programmed starting from address 
''APPLICATION_ADDRESS'' */ 
if (((*(__IO uint32_t*)APPLICATION_ADDRESS) & 0x2FFE0000 ) == 0x20000000) 
{ 
/* Jump to user application */ 
JumpAddress = *(__IO uint32_t*) (APPLICATION_ADDRESS + 4); 
Jump_To_Application = (pFunction) JumpAddress; 
/* Initialize user application's Stack Pointer */ 
__set_MSP(*(__IO uint32_t*) APPLICATION_ADDRESS); 
Jump_To_Application(); 
} 
} 
/* Init Host Library */ 
USBH_Init(&USB_OTG_Core, USB_OTG_FS_CORE_ID, &USB_Host, &USBH_MSC_cb, &USR_Callbacks); 
while (1) 
{ 
/* Host Task handler */ 
USBH_Process(&USB_OTG_Core, &USB_Host); 
} 
}

the second code is my Project code but in the linker option of keil I checked the option '' USE MEMORYLAYOUT FROM TARGET DIALOG'' in the target option of keil under read/only memory area i checked the option IROM1 start 0x8008000 size 0xf8000 and set #define VECT_TAB_OFFSET 0x8000 after i generate the bin file of my Project i see that the binary code set the address to 0x800819D NOT 0x8008000! but when i debug the bootloader program i can see that the program jumps to 0x800819D, but my application program does not run ! What is wrong here ? Could you please guide me to fix this headache? Regards Esat
sami
Associate II
Posted on June 15, 2013 at 10:37

Any help here ?

Posted on June 15, 2013 at 13:41

Any help here ?

Don't poke me, I don't like it.
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 15, 2013 at 14:58

0x0800819D is likely the address of ResetHandler, not the base of the vector table that points to it. It should be the 32-bit value at 0x08008004

So, does the data at 0x08008000 reflect that of your file?

When you step your debugger across the JumpToApplication() is the code it is executing correct? It should look like the code in startup_stm32fxxx.s. Does the call to SystemInit() cause failure, or a fault?
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 20, 2013 at 11:29

Sorry Clive for poke I dont mean that .

sami
Associate II
Posted on June 20, 2013 at 14:05

I still could not solve ,

While debugging Jump_To_Application(), the program jumps to the 0x8000819c then

it stucks in the address  0x80001B6 defualt  handler

any idea for this problem ?

Thank you

Posted on June 20, 2013 at 14:33

You're re-describing the problem again, I need to see different details.

I'd need to see the data at/around 0x08008000 thru 0x080081FF

I'd need to see the disassembly code at the point you jump to the application, and the code it lands on.

You cut-n-paste, or provide screen shots.
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 20, 2013 at 16:27

The original post was too long to process during our migration. Please click on the provided URL to read the original post. https://st--c.eu10.content.force.com/sfc/dist/version/download/?oid=00Db0000000YtG6&ids=0680X000006I6cV&d=%2Fa%2F0X0000000bru%2FxCYZgfQBz6kKps24MpeHV7JV5c.lRbd5a3cIaCdwk_8&asPdf=false
Posted on June 20, 2013 at 18:10

Ok, that's a good start. I was interested in the Boot Loader code where you jump to the Application code.

Do you have some interrupts enabled in the Boot Loader? Which ones? Are these handled in the App? or do the dump into DefaultHandler?

Can you step across the transition?

Can you step into ResetHandler 0x0800818D?

How about SystemInit() 0x0800B761, or _main 0x08008189

Are there interrupts being enabled in the App?

Does the relocation of the Vector Table (SCB->VTOR) that occurs in SystemInit() point to the right location?
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 09:44

yes I have interrupt enabled in the bootloader , but those interrupts enabled incase if button is pressed and go to bootloader incase not pressed it goes directly to the application and does not enable those inturrepts ,

void TIM2_IRQHandler(void)

void OTG_FS_IRQHandler(void)

void EXTI0_IRQHandler(void)

void EXTI_IRQHandler(void)

void SysTick_Handler(void)

also i use those interupts in my application too .

after debugging,   I can reach the to  SystemInit() 0x0800B761  after i set break point there.

also I can debug arround SystemInit() 0x0800B761 after i set a break point too .

but after that i can debug because it stucks.