Showing posts with label utility. Show all posts
Showing posts with label utility. Show all posts

Friday, February 25, 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.5In 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.4In 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"



Thursday, May 6, 2010

Micro Hex Bootloader for ATmega microcontrollers

New in 1.1 version:

The boot loader from microcontroller can report 5 different errors:
  1. LineDefError = One line is not have the defined destination.
  2. SecondHexCharNotFound = If first hex char is found but second hex char is not found or is not one hex char.
  3. CheckSum = If in one line is detected one check sum error.
  4. LineMismach = After conversion from hex to bin If total length line - 5 is not equal to data bytes contained by that line.
  5. NoMemorySelected = If user is trying to write in memory but the user is not sends the command to select Flash or EEProm memory.
Resources:
  • Flash = 852 Bytes For Atmega8( The fusible for jumping in boot loader is necessarily to set to 512 Words ).
  • Flash = 860 Bytes For Uart0 Atmega64-128( The fusible for jumping in boot loader is necessarily to set to 512 Words ).
  • Flash = 878 Bytes For Uart1 Atmega64-128( The fusible for jumping in boot loader is necessarily to set to 512 Words ).

From this moment the source code is ready to download for free.
To compile this boot loader is necessarily to use last ASM SDK.
This Bootloader has maximum 512Words(1KB) of flash and can work on controllers listened down:

ATmega48 Not Tested
ATmega48P Not Tested
Atmega8 Not Tested
Atmega8A Not Tested
ATmega88 Not Tested
ATmega88A Not Tested
ATmega88PA Not Tested
ATmega16 Not Tested
ATmega16A Not Tested
ATmega162 Not Tested
ATmega168 Not Tested
ATmega168A Not Tested
ATmega168PA Not Tested
ATmega32 Not Tested
ATmega32A Not Tested
ATmega64 OK
ATmega64A Not Tested
ATmega640 Not Tested
ATmega128 OK
ATmega128A Not Tested
ATmega1281 Not Tested
ATmega1280 Not Tested
ATmega2561 Not Tested
ATmega2560 Not Tested

Download Bootloader V1.1 ASM Source code and PC uploader C# source code.


First version V1.0

This is an utility that eliminate the ISP programmer for ATmega Microcontrollers and he work even on Windows Vista and Windows 7.

This boot loader is created to upload data in hex format no bin like others boot loaders, to convert from hex to bin is used an function integrated in boot loader not in up loader.

Version ( V1.0 ) is capable to write flash and eeprom (.hex and .eep) generated by AVR Studio and AVR GCC.

The .eep file is detected automatically by the program from the name of .hex file, for this reason is necessarily to select only .hex file.

When this boot loader is present on an ATmega microcontroller ,at reset is booting in boot loader and is programed to stay and wait for "BootInit" + Cr for entering in programed mode for 2 seconds, if "BootInit" + Cr is not received the boot loader jumps to address 0 in flash.

If communication is interrupted more than 2 seconds this boot loader jump to address 0 of flash.

The boot loader from microcontroller can report 4 different errors that can be appear:
  1. LineDefError = One line is not have the defined destination.
  2. SecondHexCharNotFound = If first hex char is found but second hex char is not found or is not one hex char.
  3. CheckSum = If in one line is detected one check sum error.
  4. LineMismach = After conversion from hex to bin If total length line - 5 is not equal to data bytes contained by that line.
Resources:
Flash = 952 Bytes For Uart1 ( The fusible for jumping in boot loader is necessarily to set to 512 Words ).

Down is ready to download 2 Hex demo files that contain the boot loader for ATmega64 at 16Mhz and 8Mhz at Baud rate 19200b/s for Uart1

Download PC uploader V1.0
Download BootLoader for ATmega64 8Mhz Uart1 19200b/s V1.0
Download BootLoader for ATmega64 16Mhz Uart1 19200b/s V1.0