Skip to main content
sami
Associate III
June 13, 2013
Question

UPGRADING APPLICATION FIRMWARE BY USB STICK

  • June 13, 2013
  • 26 replies
  • 3651 views
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
    This topic has been closed for replies.

    26 replies

    John F.
    Associate III
    June 13, 2013
    Posted on June 13, 2013 at 17:26

    Intel HEX to BINARY File Converter Utility

    http://www.keil.com/download/docs/7.asp

    http://www.hex2bin.com/hex2bin/

    sami
    samiAuthor
    Associate III
    June 13, 2013
    Posted on June 13, 2013 at 18:02

    Thank you john ,

    but I use 64 bit system I does not work .

    Tesla DeLorean
    Guru
    June 13, 2013
    Posted on June 13, 2013 at 18:10

    My ELFARM tool should work from the command line, and takes AXF files and converts to hex and binary.

    [DEAD LINK /public/STe2ecommunities/mcu/Lists/cortex_mx_stm32/Flat.aspx?RootFolder=/public/STe2ecommunities/mcu/Lists/cortex_mx_stm32/converting%20.axf%20to%20.hax%20to%20flash%20on%20to%20STM3240G-EVAL%20Board&FolderCTID=0x01200200770978C69A1141439FE559EB459D7580009C4E14902C3CDE46A77F0FFD06506F5B&currentviews=594]https://my.st.com/public/STe2ecommunities/mcu/Lists/cortex_mx_stm32/Flat.aspx?RootFolder=%2Fpublic%2FSTe2ecommunities%2Fmcu%2FLists%2Fcortex_mx_stm32%2Fconverting%20.axf%20to%20.hax%20to%20flash%20on%20to%20STM3240G-EVAL%20Board&FolderCTID=0x01200200770978C69A1141439FE559EB459D7580009C4E14902C3CDE46A77F0FFD06506F5B¤tviews=594

    Tips, Buy me a coffee, or three.. PayPal Venmo (See Profile) Up vote any posts that you find helpful, it shows what's working..
    sami
    samiAuthor
    Associate III
    June 13, 2013
    Posted on June 13, 2013 at 18:24

    Thank you Clive   I could  not make it work , could you explain a little how to do that ?

    Tesla DeLorean
    Guru
    June 13, 2013
    Posted on June 13, 2013 at 18:32

    It runs from the command line, thus

    ELFARM C:\STM32Seminar\32L152CDISCOVERY\Firmware\STM32L_Discovery_FW\Projects\HelloWorld\MDK-ARM\STM32L-Discovery\STM32L-Discovery.axf

    This will generate a bunch of screen output, it's an ELF file dumping tool, when it finishes there will be the files ELFARM.BIN/.HEX/.MOT/.TEK in the directory from which you ran the tool.

    Tips, Buy me a coffee, or three.. PayPal Venmo (See Profile) Up vote any posts that you find helpful, it shows what's working..
    sami
    samiAuthor
    Associate III
    June 13, 2013
    Posted on June 13, 2013 at 18:46

    Thank you now I could generate the bin file , but after downloading the program did not work !

    Do I need to set something related to the address in myproject firware ?

    Tesla DeLorean
    Guru
    June 13, 2013
    Posted on June 13, 2013 at 19:38

    The base address for the data in the .BIN will be whatever you set up the compiler/linker to generate.

    You could examine the file with your preferred file viewer or hex editor.
    Tips, Buy me a coffee, or three.. PayPal Venmo (See Profile) Up vote any posts that you find helpful, it shows what's working..
    sami
    samiAuthor
    Associate III
    June 13, 2013
    Posted on June 13, 2013 at 19:46

    In keil .. options -linker I set R/O base to 0x08008000, but no way .. still not working .

    Any suggestion please ?

    Tesla DeLorean
    Guru
    June 13, 2013
    Posted on June 13, 2013 at 20:32

    Break out the debugger for your boot loader and step in. Follow the transition from the boot loader into the app code. Make a more clear determination of what is going wrong.

    Check what's stored at 0x08008000 and confirm it matches what you expect.

    Tips, Buy me a coffee, or three.. PayPal Venmo (See Profile) Up vote any posts that you find helpful, it shows what's working..
    sami
    samiAuthor
    Associate III
    June 14, 2013
    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