Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

How to embedded a hex file into a exe file with Visual C++?

Status
Not open for further replies.

funnynypd

Banned
Advanced Member level 1
Joined
May 9, 2007
Messages
436
Helped
48
Reputation
100
Reaction score
25
Trophy points
1,308
Location
USA & Canada
Activity points
0
With Visual C++ 6.0, There must be a quick way to embed a small hex file into a project and generate a exe file which includes all hex file data. And the exe file can manipulate this embedded hex file, at least read the embedded hex data.

Anyone happen to know and please give a hint.
 

Re: How to embedded a hex file into a exe file with Visual C

I dont know if this helps, but hex files are quite easy to parse. Here is the format

Intel Hex 32 Format

The extended 32-bit address hex format is similar to the hex 8 format,
except that the extended linear address record is output also to establish
the upper 16 bits of the data address. This is mainly used for 16-bit core
devices since their addressable program memory exceeds 64 kbytes.

Each data record begins with a 9-character prefix and ends with a
2-character checksum. Each record has the following format:

:BBAAAATTHHHH....HHHCC
where:

BB A two digit hexadecimal byte count representing the number of data bytes
that will appear on the line.

AAAA A four digit hexadecimal address representing the starting address of
the data record.

TT A two digit record type:

00 - Data record
01 - End of File record
02 - Segment address record
04 - Linear address record

HH A two digit hexadecimal data byte, presented in low byte/high byte
combinations.

CC A two digit hexadecimal checksum that is the two's complement of
the sum of all preceding bytes in the record.
 

Re: How to embedded a hex file into a exe file with Visual C

Thanks for the reply. These are useful information.
Also I want to know if possible to embed a hex file into a exe file with Visual C++.
 

Re: How to embedded a hex file into a exe file with Visual C

This is a very old post, but this information could help someone.

There are two ways to do this.

1. Define the content of the hex file (decoded to binary or as it is) as a C array and use that array in the program.

2. Add the hex file as a resource in the project and use FindResource() and associated functions to extract it.
 

    funnynypd

    Points: 2
    Helpful Answer Positive Rating
include the hex file as a binary resource in the resource editor ( easiest way) and read it during run time and use it
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top