Friday, 25 February 2011

Intel HEX to binary HEX converter

This is an utility for programmers to convert Intel .hex files generated by AVR studio for example to binary hex data file, to create static or dynamic library like image of flash ROM and can be imported like data file to a project.

V1.0.5
In this version the files that is not modified ,is not recompiled, in this case if you work on memory stick not take the number of writings / deletions of memory stick for files that is not modified, or if you work with many files will not be useless to compile the files were not changed
This version can be downloaded from here.

V1.0.4
In this version I added to automatically put the "#ifndef FileName" to include only one time a library if is declared on multiple files.
This version can be downloaded from here.

V1.0.3


Added:
Now can include header file with definition constants in hex image file, in this case is no longer case to include hex image file and header file separately, you can include only hex image file, if the name of .hex file is "AA.hex" the name of header file is necessary to be "AA_Headers.inc".

When hi finish to compile all files, auto close the thread, this feature allow to include this compiler on Pre Assembling section of AVR Studio, in this case before the compilation of AVR studio, AVR Studio can launch this compiler to actualize the images of libraries, and after can compile the project with updated libraries.

Fix:
On start up auto load the path where is.

This version can be downloaded from here.

V1.0.2

Fix: no filter to .hex in 1.0.1 version.
The last version of this utility can be downloaded from here (Internet explorer only).

V1.0.1
New:
Added:
  1. On program open you can choose the base directory where is the source folder.
  2. You can always change the working directory.
  3. Automatic checking and downloading updates.


V1.0.0

This utility get all of the .hex files from directory that the utility has been opened /source and put converted files include directory structure to /bin.

For example the project is placed to C:/source/, and the utility in C:/

The directory structure is this:
C:/source/Math.hex
C:/source/IO_Port_Driver.hex
C:/source/IO_Uart_Driver.hex

After running of the utility all files is compiled on C:/bin/ and well see like that:

C:/bin/Math.asm
C:/bin/IO_Port_Driver.asm
C:/bin/IO_Uart_Driver.asm

The result is files .asm with data in hex format.

To create static or dynamic library's is necessary to put links to the integrated functions on top of the library, for example:

File: Math.asm

.Org 0
MathLibrary: // This is the base address of the links
Rjmp Add8x8_8
Rjmp Add16x16_16
Rjmp Add 32x32_32
Rjmp Sub 8x8_8
Rjmp Sub 16x16_16
Rjmp Sub 32x32_32
;--------------------------------//End of links
//Begin of routines
Add8x8_8:
Code......
Ret
;--------
Add16x16_16:
Code......
Ret
;--------
Add32x32_32:
Code......
Ret
;--------
Sub8x8_8:
Code......
Ret
;--------
Sub16x16_16:
Code......
Ret
;--------
Sub32x32_32:
Code......
Ret
;--------
//End of library

To define the offsets of links you can create another file with this, for example:

File: Math.inc

#define _MathLibrary (0) //Offset of base of links

#define _Add8x8_8 (0) //Link 1
#define _Add16x16_16 (1) //Link 2
#define _Add32x32_32 (2) //Link 3
#define _Sub8x8_8 (3) //Link 4
#define _Sub16x16_16 (4) //Link 5
#define _Sub32x32_32 (5) //Link 6

To import a library, on end of main file include "Math.asm" file from bin directory.

For example:

_MathLibrary_:
.Include "Math.asm"


All of the function from this library can be called like that:

Rcall _MathLibrary_ + _MathLibrary + _Sub8x8_8
Or if "_MathLibrary" base address of links is 0:
Rcall _MathLibrary_ + _Sub8x8_8

"_MathLibrary_" is address of the imported library assigned by the compiler when you build the project, and "_Sub8x8_8" is the offset of the link of the included routine in library defined in
"Math.inc"




Post a Comment