Modify a abs file before programming uP

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Modify a abs file before programming uP

Jump to solution
2,990 Views
Giox79
Contributor I

Hello everybody,

I have a problem I think quite simple but that I don't know how to solve.

I would like to perform the following task:

starting from a .abs file generated for the platform HCS08QE, I would like to modify 2 different item at well know offset, using a C/C++/C# source code.

 

The items should be defined during the production phase (something like a serial number, but a bit different, it's too long to explain :-D).

 

So I would like to know if there is some SW library by which, invoking a command similar to:

 

set -o memoryOffset -v valueToBeSet -i absFile

 

will allow me to generate the desired file.

I think this is a quite common task, I know that there is some bin programmer able to write a serial number in bin image, but I need to set different kind of item, so a SW is required.

 

Is there someone able to provide me some link/idea about this topic? I think that quite anyone that used uP faced similar problem, but I'm quite a newbye

Thanks Gio

Labels (1)
0 Kudos
1 Solution
629 Views
bigmac
Specialist III

Hello Gio,

 

I am not sure which tool you refer to.  At Sourceforge I could find only a converter from S19 to binary format, but I don't think this is what you need.  I see your problem as requiring a means to manipulate and add lines within an ASCII text file (the S19 file).

 

The memory start address of each line within the file is defined, and each line will typically contain data for a maximum of 16 or 32 bytes of data.  The address ranges for your special data would simply be omitted when the project is compiled and linked.  It is then a matter of appending further lines to the S19 file, for the additional data.  The final line with the S9 record would need to be repositioned, to follow the new data.

 

The attached file should explain the S-record format.

 

Regards,

Mac

 

View solution in original post

0 Kudos
5 Replies
629 Views
CompilerGuru
NXP Employee
NXP Employee

The abs files are using the ELF format, the same format as used in Linux. So there are many tools out which work on elf files, and libraries supporting to read and write them.

 

http://en.wikipedia.org/wiki/Executable_and_Linkable_Format

 

As alternative, often such tasks are done using the target content only, so not modifying the ELF file, which contains a more

information (and structure to parse).

The target content is contained in the SRecord files (*.s1,*.s2, *.sx) or even a binary image file (which can be produced with the burner.exe tool).

 

Daniel

0 Kudos
629 Views
JimDon
Senior Contributor III

You might be surprised just how few ELF tools are out there.

The only ones I know of that are actually supported are readelf and elfedit from Code Sourcery. But elfedit only lets you change things like the version. While ELF is a standard, different build systems handle things, well, differently. 

 

elfedit [‘--input-mach=’machine][‘--input-type=’type]‘--output-mach=’machine‘--output-type=’type[‘-v’|‘--version’][‘-h’|‘--help’]elffile...elfedit updates the ELF header of ELF files which have the matching ELF machine and file types. The options control how and which fields in the ELF header should be updated.

 

However, as compilerguru says, you really need to edit the S19 file, which is oddly named project_name.abs.s19. This is what gets burned.

I don't know of any utilities that would do that, but you can find out the  S19 format details and write one, as it is all ASCII.

The format has a check sum for each "record", so you have to actaully read it in, modify it, and re-write it with a new check sum.

 

0 Kudos
629 Views
Giox79
Contributor I

Many thanks for your help.

Well, since you told me the right file to watch at is the s19 tool, wht do you think about srecord tool from sourceforge?

Is it a good tool?

Thanks again

Gio

0 Kudos
630 Views
bigmac
Specialist III

Hello Gio,

 

I am not sure which tool you refer to.  At Sourceforge I could find only a converter from S19 to binary format, but I don't think this is what you need.  I see your problem as requiring a means to manipulate and add lines within an ASCII text file (the S19 file).

 

The memory start address of each line within the file is defined, and each line will typically contain data for a maximum of 16 or 32 bytes of data.  The address ranges for your special data would simply be omitted when the project is compiled and linked.  It is then a matter of appending further lines to the S19 file, for the additional data.  The final line with the S9 record would need to be repositioned, to follow the new data.

 

The attached file should explain the S-record format.

 

Regards,

Mac

 

0 Kudos
629 Views
Giox79
Contributor I

Hi, many thanks for your help

I was referring to this tool

 

http://sourceforge.net/projects/srecord/

 

However I like much better your file since it explain hoiw to manipulate the different things

I will read it carefully

Many many thanks, have a nice day

Giovanni

0 Kudos