This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Problem with generating a single hex file for code banked application

Hi

My µC is C8051F122.

In µVision2 (version V2.40a and C51 V7.50) i create 2 Lib files. One for code bank 1 and one for the common bank.

These .lib files are linked into a project in Silicon Laboratories IDE. During to the .M51 file the code is located correct in the selected code bank.

I use BL51 linker and with OC51+OH51 i generate .H1, .H2 and .H3 files. Is there any way to create a single hex file instead? According to the Keil homepage it can be done by using HEX2BIN + BIN2HEX. Here i get an error (unable to open hexfile).
The file name is 1 character in length.

Then i tried to use the LX51 linker instead, but then i get the following error: L204 invalid keyword, POS 606 in one of the .lib files. When the error message appear a character in path is missing (please note that the path is identical to the one used when BL51 linker is used)

Any one with any ideas to creat either a single hex file from the 3 hex files, or how to get rid of the L204 error message when using LX51 linker?

  • > Is there any way to create a single hex file instead?

    You can make a single HEX file all in one, but SiLabs FLASH utility doesn't accept it.

    > One for code bank 1 and one for the common bank.

    Then, you don't need to split it into code banks :-)
    Monolithic 64 Kbytes code space serves for the entire code, without any overhead to access to banked code.

    Tsuneo

  • Actually the i manged to create a single Hex file. Data is located in bank 2 and 3 as well. Common and bank 1 holds the LIB files only.

    My hex file contains the common area multiple times, but this will be no problem since I just ignore these except from one of course.

  • What is the purpose for you to make the HEX file?
    Isn't it burning it to SiLabs 'F122 ?

    I once posted a related topic on SiLabs forum,
    www.cygnal.org/.../000735.html

    Here is updated version (for USB debug adapter)

    0) Apply BL51 linker - SiLabs IDE doesn't fully recognize object generated by LX51

    1) OC51 - Convert original banked omf file into separated object files of each bank

    > OC51 mycode.omf

    mycode.B01, mycode.B02, mycode.B03 are generated.

    2) OH51 - Convert each separated object file to HEX file

    > OH51 mycode.B01 HEX (mycode_B01.hex)
    > OH51 mycode.B02 HEX (mycode_B02.hex)
    > OH51 mycode.B03 HEX (mycode_B03.hex)

    3) SRecord - Split banked code area from common code

    For Bank 2 and 3
    > srec_cat mycode_B02.hex -intel -crop 0x8000 0x0000 -o mycode_B02_b.hex -intel
    > srec_cat mycode_B03.hex -intel -crop 0x8000 0x0000 -o mycode_B03_b.hex -intel

    4) FlashUtilCl - Write them to the FLASH

    > FLASHUtilCL downloadusb -E mycode_B01.hex "" 0 0
    > FLASHUtilCL downloadusb -B2 mycode_B02_b.hex "" 0 0
    > FLASHUtilCL downloadusb -B3 mycode_B03_b.hex "" 0 0

    SRecord
    srecord.sourceforge.net/

    Tsuneo

  • Hey

    I need the hex file for the bootloader.

    By using HEX2BIN and BIN2HEX i have my hex file organised as:

    0x00000-0x07FFF Common
    0x08000-0x0FFFF Bank 1
    0x10000-0x17FFF Common
    0x18000-0x1FFFF Bank 2
    0x20000-0x27FFF Common
    0x28000-0x2FFFF Bank 3

    I just will skip the 2nd and 3rd common area in the hex file