#include <windows.h>
#include <stdio.h>
#include <io.h>
#include "Common.h"
Data Structures | |
struct | FlashImage |
Struct used to contain information about the files converted. More... | |
Defines | |
#define | ICPFlashStart (0xFC00) |
Start of Protected Flash memory Values at this address or above are ignored. | |
Functions | |
unsigned int | hex1ToDecimal (char **ptr) |
Convert a single character ('0'-'9', 'a'-'f' or 'A'-'F') into a hex value. | |
unsigned int | hex2ToDecimal (char **ptr) |
Convert two characters ('0'-'9', 'a'-'f' or 'A'-'F') into a hex value. | |
unsigned int | hex4ToDecimal (char **ptr) |
Convert four characters ('0'-'9', 'a'-'f' or 'A'-'F') into a hex value. | |
int | loadSRecordFile (char *filename) |
Load a Freescale S-record file into the buffer. | |
void | writeCSourceFile (FILE *fp) |
Write buffer to C source file. | |
void | convertFiles (char *outputFilename, char *inputFilenameMask) |
Converts multiple S-record files into a C source file. | |
int | main (int argc, char *argv[]) |
Variables | |
U8 | flashImage [0x10000] |
FlashImage | flashImages [20] |
Array used to contain information about the files converted. | |
int | flashImageNumber |
Number of the last loaded file. |
Note: ignores values at or above ICPFlashStart
Usage: HexToC outputFilename inputFilenameMask
Created on: 27/07/2008 Author: PODonoghue
#define ICPFlashStart (0xFC00) |
Start of Protected Flash memory
Values at this address or above are ignored.
void convertFiles | ( | char * | outputFilename, | |
char * | inputFilenameMask | |||
) |
Converts multiple S-record files into a C source file.
outputFilename | - name of output file to create | |
inputFilenameMask | - mask for input files. This may contain a path. |
unsigned int hex1ToDecimal | ( | char ** | ptr | ) |
Convert a single character ('0'-'9', 'a'-'f' or 'A'-'F') into a hex value.
ptr | - Ptr to the ptr to the character to convert. *ptr is advanced |
unsigned int hex2ToDecimal | ( | char ** | ptr | ) |
Convert two characters ('0'-'9', 'a'-'f' or 'A'-'F') into a hex value.
ptr | - Ptr to the ptr to the character to convert. *ptr is advanced |
unsigned int hex4ToDecimal | ( | char ** | ptr | ) |
Convert four characters ('0'-'9', 'a'-'f' or 'A'-'F') into a hex value.
ptr | - Ptr to the ptr to the character to convert. *ptr is advanced |
int loadSRecordFile | ( | char * | filename | ) |
Load a Freescale S-record file into the buffer.
Minimal error checking (file open etc, no S-record validity checks).
A global buffer flashImage[] is used. The buffer is cleared to 0xFF before loading
flashImages[] is updated appropriately
filename | - name (path) to the file to load |
int main | ( | int | argc, | |
char * | argv[] | |||
) |
void writeCSourceFile | ( | FILE * | fp | ) |
Write buffer to C source file.
fp | - file pointer of open output file |
U8 flashImage[0x10000] |
int flashImageNumber |
Number of the last loaded file.
Array used to contain information about the files converted.