Results 1 to 4 of 4

Thread: How to Generate the INTEL HEX File?

  1. #1
    shidlingayya
    Guest

    How to Generate the INTEL HEX File?

    Dear Sir,
    I am Shidlingayya..presently i am working for Siemens from past one year
    i am facing some problem in generating the INTEL HEX File

    Problem-> How to Convert EEPROM Data into INTEL HEX File format
    i am using following tool for my compilation...
    -VC++ compiler(Editor)
    -IAR Compiler
    -NEC microcontroller
    -PERL(Linux Envirnoment)
    Is there any way to generate the Intel Hex file from Any of these tools..if some procedure is there please tell me where i can get some more details about my requirement....
    Thanks & Regards
    Shidlingayya
    I promise that I have read the FAQ and tried to use the Search to answer my question.

  2. #2
    Try 010 Editor
    The only reason for time is so that everything doesn't happen at once. [A. Einstein]

  3. #3
    Super Moderator
    Join Date
    Dec 2004
    Posts
    1,486
    Blog Entries
    15
    what is your question ? you want the compilers to output hex format directly ??
    i dont think it is feasible at least not with vc

    what is eeprom data
    do you have an executable that you compiled ??

    if you have an exe as output from these compilers then you can check out a few exetohex convertors

    Code:
    EXEHEX - A Microsoft EXE to Intel HEX file converter
    This program converts Microsoft .EXE files to Intel HEX files 
    suitable for burning into EPROM. Like the loader in MSDOS, 
    exehex performs any necessary relocation of segments in the 
    .EXE file.
    google gave me this in one search

    http://www.programmersheaven.com/download/3177/download.aspx

    Code:
    				EXEHEX
    
    This program is used to convert Microsoft .EXE files to Intel HEX files that  are suitable for burning into EPROM.
    
    You CANNOT simply take your favorite program such as Microsoft WORD, and expect
    the exehex program make it work in EPROM.  You must write the programs to be
    used with this utility carefully, and with the full intent of running them on
    an embedded 80x86 microprocessor system.
    
    Some things that must be done to be successful:
    
    1) Write a simple jump vector program in MASM that will reside in EPROM at
       address FFFF:0000.  This program should consist of something like this for
       an 8086/8088:
    
    PwrInit	segment para public 'Code'
    	Public	Power_Start
    Power_Start	proc	far
    	org	0
    ;	jmp	far ptr 0F000:0000H		;MASM won't allow this, so...
    	db	0EAH				;fake a far jump to EPROM start
    	dd	0F0000000H			;(segment)(offset)
    
    Power_Start	endp
    PwrInit	ends
    	end
    
    
       Then after linking with Microsoft linker, you pass the file thru
       exehex like this:
    
    	exehex -SFFFF -O0000 powerini.exe powerini.hex
    
       This startup vector is setup to reside at FFFF:0000 in EPROM, and to jump
       to the first location in EPROM where your program will begin.
    
    2) Write a short chunk of code that will reside at the first location in your
       EPROM (in this case F000:0000).  This code will setup the segment registers,
       stack, interrupt vectors, copy initialized data to ram, and then when done,
       will branch to your application program.
    
    EPROMST	segment para public 'Code'
    	Public	EPROM_Begin
    EPROM_Begin	proc	near
    	org	0
    	xor	ax,ax			;this example assumes 64K of RAM
    	mov	ds,ax
    	mov	es,ax
    	mov	ss,ax
    	mov	sp,STACK_TOP
    
    	xor	si,si			;int vectors start at offset 0
    	mov	cx,256			;number of possible interrupt vectors
    
    	mov	ax,0000H		;set all vectors to power restart
    	mov	dx,0FFFFH		;they should really go to default handler.
    IV_Loop:
    	mov	[si],ax
    	add	si,2
    	mov	[si],dx
    	add	si,2
    	loop	IV_Loop
    	.
    	.
    	jmp	Your_Code_Begin
    
    EPROM_Begin	endp
    EPROMST	ends
    	end
    
       Then link your code, and pass it thru exehex like this:
    
    	exehex -SF000 -O0000 -N yourcode.exe yourcode.hex
    
    3) Cat your power start vector to your linked code:
    
    	copy yourcode.hex + powerini.hex EPROM.HEX
    
    4) Burn EPROM.HEX using your favorite method of burning intel hex files, and
       watch your project come to life.
    
    5) Be sure to include a file that defines the segment ordering with every
       assembly language file in the program.  For example:
    
    	.seg				;say you want segments in order shown
    EPROMST	segment para public 'Code'
    EPROMST ends
    
    Code	segment para public 'Code'
    Code	ends
    
    PwrInit	segment para public 'Code'
    PwrInit	ends
    
    6) Be sure and present the Code segment files to the the linker in the same
       order that you want them to appear in EPROM. (eg. it would be handy to
       have your startup code appear first in the EPROM. ;-) )
    
    7) Initialized data segments must not appear in the assembled output.  If you
       want to initialize data, you must put that data into the EPROM in the code
       segment.  If you want to be able to change the value of the initialized
       data, you must make your program copy the data into the proper location in
       RAM, and use it there (eg, the data must have the same offset it had in
       EPROM, but just be in the RAM segment).
    
    I have examples of startup code for 80186/80188 processors too, If you really
    need them, something can be arranged.  Bear in mind that I do this embedded
    processor stuff as my sole means of support and livelyhood, not just for fun.
    
    Good Luck, If you have any questions, comments, or bug reports, I can be
    reached by email at: chuck@eng.umd.edu or:
    
    
    		Chuck Harris
    
    		C.F. Harris - Consulting
    		9308 Canterbury Riding
    		Laurel, Maryland 20723
    		(301)490-7443

  4. #4
    reknihT esreveR SiGiNT's Avatar
    Join Date
    Sep 2004
    Location
    Wherever I am
    Posts
    750
    Most of the Eprom CPLD, and PLD firmware I've seen is not Hex, but binary, in ascii format, usually the chip manufacturer or the programing hardware comes with simple Basic type editor and a compiler - however nothing is stopping you if you really want dig deep and and do it by hand - our firmware guys at work seem to like UltraEdit as an all purpose tool.

    SiGiNT
    Unemployed old fart Geek - Self Employed Annoyance
    Team: Noobisco Crackers
    If someone can't do it for you, you'll never learn!

Similar Threads

  1. IDA Pro - Generate TIL for directX headers
    By majin in forum Tools of Our Trade (TOT) Messageboard
    Replies: 0
    Last Post: October 2nd, 2013, 09:26
  2. Generate Your Own MD5 Collisions In Under a Minute
    By LLXX in forum RCE Cryptographics
    Replies: 12
    Last Post: June 2nd, 2009, 16:40
  3. Understand the "Generate License Code" Mechanism
    By Nixkap in forum The Newbie Forum
    Replies: 4
    Last Post: September 6th, 2008, 16:43
  4. File Handle
    By ReVeR in forum The Newbie Forum
    Replies: 10
    Last Post: September 21st, 2004, 07:45
  5. File time
    By crUsAdEr in forum The Newbie Forum
    Replies: 19
    Last Post: May 22nd, 2004, 08:14

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •