2013-06-13 08:16 AM
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 you2013-06-14 06:52 AM
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
2013-06-15 01:37 AM
2013-06-15 04:41 AM
Any help here ?
Don't poke me, I don't like it.2013-06-15 05:58 AM
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?2013-06-20 02:29 AM
2013-06-20 05:05 AM
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 you2013-06-20 05:33 AM
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.2013-06-20 07:27 AM
2013-06-20 09:10 AM
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?2013-06-21 12:44 AM
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.