Keil Logo

How to burn a large volume of bytes (>40k) into the eprom?

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

Details Message
Read-Only
Author
Kan Deng
Posted
25-Oct-2003 09:07 GMT
Toolset
C51
New! How to burn a large volume of bytes (>40k) into the eprom?
How to burn a large volume of bytes (>40k) into the eprom?

I read the previous discussion on creating data-only hex file, http://www.keil.com/support/docs/2070.htm. The problem is that I cannot hard-code the bytes in an array, like,
   const code my_bytes[] =  { _byte1, _byte2, _byte3 };

The reason is that the number of byte is too big (>40k), thus I have to read them from a file.

As matter of fact, this set of bytes is a Java bytecode. First, I load a set of C codes which runs as the Java VM. Second, The VM reads the Java bytecode from a fixed address. In other words, my question is how to load the Java bytecode to a specified location.

Many thanks beforehand,
Kan
Read-Only
Author
Andy Neil
Posted
25-Oct-2003 11:22 GMT
Toolset
C51
New! RE: How to burn a large volume of bytes (>40k) into the eprom?
Just convert the bytes directly to Intel Hex format?
There are plenty of tools around for dealing with Intel Hex - use your favourite internet search engine.
Or write your own - the Hex format spec is in the downloads area.

Or write yourself a little utility to create the 'C' array for your data...
Read-Only
Author
Dan Henry
Posted
25-Oct-2003 16:41 GMT
Toolset
C51
New! RE: How to burn a large volume of bytes (>40k) into the eprom?
There are a number of hex editors available that could accommodate your needs. I recently had occasion to research the currently available editors, since the one I had been using lacked some of the more advanced that I now require. The result of this research for a product that best suited my requirements was 010 Editor available here:

http://www.sweetscape.com/010editor/

To test how it might handle your requirements, I loaded an arbitrary binary file and then exported it to an Intel HEX file and was able to specify the start address. Well that task itself is probably easily performed by a number of hex editors, but where 010 Editor may shine, is its ability to automate tasks using C language scripts. For example, if you wanted to load your program's HEX file, then "merge/append a binary file at a specific address, then save the new larger program-with-bytecodes image to HEX file, you could automate all of this using a script.
Read-Only
Author
Kan Deng
Posted
26-Oct-2003 05:33 GMT
Toolset
C51
New! RE: How to burn a large volume of bytes (>40k) into the eprom?
Thanks a lot Andy and Dan. I will try the 010 Editor, and let you know the result later on.

many thanks again.
Kan
Read-Only
Author
Kan Deng
Posted
26-Oct-2003 07:44 GMT
Toolset
C51
New! RE: How to burn a large volume of bytes (>40k) into the eprom?
Hi, there,

I tried Keil's BINARY to Intel HEX Converter Utility, it gave me following error.

$ bin2hex act.class

BIN2HEX Version 1.06
Copyright (c) 1993-1995 BITWARE.
All rights reserved.

ERROR: Could not open BIN file act.class.
Status: BIN to HEX conversion was not successful.

However, I tried a jpg file, it worked.
$ bin2hex /O0000 foot.jpg

BIN2HEX Version 1.06
Copyright (c) 1993-1995 BITWARE.
All rights reserved.
Status: Creating Intel HEX file.
Status: Address 0x00000000 exceeds 64K.
Status: Writing 15 bytes at address 0x00003E80.
Status: Writing EOF record.
Status: BIN to HEX conversion was successful.

- Notice that Status: Address 0x00000000 exceeds 64K.. What does this mean?

- Why does a jpg file work, while a Java bytecode doesn't?

Also, I tried 010 Hex Editor, it worked for both files.

many thanks again,
Kan
Read-Only
Author
Richard Collett
Posted
26-Oct-2003 07:50 GMT
Toolset
C51
New! RE: How to burn a large volume of bytes (>40k) into the eprom?
>Why does a jpg file work, while a Java bytecode doesn't?

This is only a guess, but have a look when that utility was written! It probably does not know how to handle long filenames, and anything with ".class" as the file extension is definitely a long filename!

Try renaming "act.class" to "act.bin", and try again using this filename.
Read-Only
Author
Kan Deng
Posted
26-Oct-2003 08:12 GMT
Toolset
C51
New! RE: How to burn a large volume of bytes (>40k) into the eprom?
Very good guess! After I changed .class to .bin, it works.

Another question, how to specify the output file type to be "Intel 8-Bit Hex Code" instead of "16-bit", if using bin2hex ? 010 Hex Editor allows us to specify these different output file types.

thanks,
Kan
Read-Only
Author
Kan Deng
Posted
26-Oct-2003 08:38 GMT
Toolset
C51
New! RE: How to burn a large volume of bytes (>40k) into the eprom?
One more question.

For the starting address, can someone clarify the the /O starting offset, and the address field of the first record of the output?

$ bin2hex /O0010 Act.bin Action.hex
Action.hex start with :20000800

$ bin2hex /O0030 Act.bin Action.hex
Action.hex start with :20001800

$ bin2hex /O0050 Act.bin Action.hex
Action.hex start with :20002800

$ bin2hex /O0009 Act.bin Action.hex
Action.hex start with :20000000
Read-Only
Author
Drew Davis
Posted
26-Oct-2003 23:33 GMT
Toolset
C51
New! RE: How to burn a large volume of bytes (>40k) into the eprom?
At at guess, risky because I haven't bothered to check the manual:

I'd say the /O option accepts C-format integers, in which case a leading 0 indicates octal format. The number in the .HEX file is in, well, hex.

0010 == 0x0008 (one eight equals eight ones)
0030 == 0x0018 (three eights equals one sixteen and eight ones)
0050 == 0x0028 (five eights equals two sixteens and eight ones)
0009 == 0x0000 (the digit '9' does not exist in base eight)
Read-Only
Author
Kan Deng
Posted
27-Oct-2003 00:48 GMT
Toolset
C51
New! RE: How to burn a large volume of bytes (>40k) into the eprom?
Yes, /O leads an octal address, not hex, not decimal.

Only one problem remained,

$ bin2hex /O0000 foot.jpg

BIN2HEX Version 1.06
Copyright (c) 1993-1995 BITWARE.
All rights reserved.
Status: Creating Intel HEX file.
Status: Address 0x00000000 exceeds 64K.
Status: Writing 15 bytes at address 0x00003E80.
Status: Writing EOF record.
Status: BIN to HEX conversion was successful.


Notice that Status: Address 0x00000000 exceeds 64K.. What does this mean?

cheers,
Kan
Read-Only
Author
Andrew Neil
Posted
27-Oct-2003 10:27 GMT
Toolset
C51
New! RE: How to burn a large volume of bytes (>40k) into the eprom?
"Notice that Status: Address 0x00000000 exceeds 64K.. What does this mean?"

What size is the JPEG file?
Read-Only
Author
Kan Deng
Posted
27-Oct-2003 16:44 GMT
Toolset
C51
New! RE: How to burn a large volume of bytes (>40k) into the eprom?
It always happens. Even for a Java class generated on this code, it still gives this warning.

class Act {
    public static void doMathForever() {
        int i = 0;
        while (true) {
            i += 1;
            i *= 2;
        }
    }
}

But it seems to me this warning doesn't hurt any thing, hence can be safely ignored.

thanks,
Kan
Read-Only
Author
Hans-Bernhard Broeker
Posted
28-Oct-2003 11:53 GMT
Toolset
C51
New! RE: How to burn a large volume of bytes (>40k) into the eprom?
I think it may work out better if you take up the hints provided and avoid writing your number in octal format. Did you try writing /O0 or /O0x00 instead of /O0000?
Read-Only
Author
Kan Deng
Posted
28-Oct-2003 21:06 GMT
Toolset
C51
New! RE: How to burn a large volume of bytes (>40k) into the eprom?
It always gives this warning, no matter what address is assigned to /0.

Following is an example.

Many thanks anyway.

Kan


$ bin2hex /O0x00 Act.bin Act_3.hex

BIN2HEX Version 1.06
Copyright (c) 1993-1995 BITWARE.
All rights reserved.
Status: Creating Intel HEX file.
Status: Address 0x00000000 exceeds 64K.
Status: Writing 9 bytes at address 0x00000100.
Status: Writing EOF record.
Status: BIN to HEX conversion was successful.
Read-Only
Author
Drew Davis
Posted
29-Oct-2003 18:47 GMT
Toolset
C51
New! RE: How to burn a large volume of bytes (>40k) into the eprom?
For what it's worth, here's a link to a program that can handle a wide variety of record formats for memory image files, as well as manipulate the files.

http://srecord.sourceforge.net/srecord.html
Read-Only
Author
Kan Deng
Posted
29-Oct-2003 18:58 GMT
Toolset
C51
New! RE: How to burn a large volume of bytes (>40k) into the eprom?
Thanks for the information.

cheers,
Kan

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

  Arm logo
Important information

This site uses cookies to store information on your computer. By continuing to use our site, you consent to our cookies.

Change Settings

Privacy Policy Update

Arm’s Privacy Policy has been updated. By continuing to use our site, you consent to Arm’s Privacy Policy. Please review our Privacy Policy to learn more about our collection, use and transfers
of your data.