Keil™, An ARM® Company

Discussion Forum

Problem with generating a single hex file for code banked application

Next Thread | Thread List | Previous Thread Start a Thread | Settings

DetailsMessage
Author
Morten R
Posted
19-Jan-2010 09:28 GMT
Toolset
C51
New! 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?

Author
Tsuneo Chinzei
Posted
20-Jan-2010 17:56 GMT
Toolset
C51
New! RE: Problem with generating a single hex file for code banked application

> 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

Author
Morten R
Posted
21-Jan-2010 06:12 GMT
Toolset
C51
New! RE: Problem with generating a single hex file for code banked application

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.

Author
Tsuneo Chinzei
Posted
21-Jan-2010 13:47 GMT
Toolset
C51
New! RE: Problem with generating a single hex file for code banked application

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,
http://www.cygnal.org/ubb/Forum4/HTML/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
http://srecord.sourceforge.net/

Tsuneo

Author
Morten R
Posted
21-Jan-2010 13:52 GMT
Toolset
C51
New! RE: Problem with generating a single hex file for code banked application

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

Next Thread | Thread List | Previous Thread Start a Thread | Settings