Øyvind,
Here is the current help on load_image (from the openocd website).
>>Command: load_image filename address [bin|ihex|elf]
Load image from file filename to target memory at address. The
file format may optionally be specified (bin, ihex, or elf)
And here are some of my comments from reading the source code.
--> address is the relocation address.
Currently load_image also supports optional arguments
--> min_addr - ignore data below min_addr (this is w.r.t. address within
the file but it also applies to the target address space).
--> max_length - maximum number of bytes to load.
So:
Command: load_image filename address [bin|ihex|elf] [min_addr
[max_length]]
Effectively min_addr and max_length provide [partial] ability to load
part of a file. You would simply make min_addr > base_address to get an
offset.
Originally, I thought that this will not allow me to load data offset
from the start of a file but then I realized that I can manipulate the
relocation address while keeping min_addr and max_addr constant.
Here is example.
Suppose you have a file (file.bin) size=0x5000 and you want to load the
data between file offset 0x3000 and 0x4000 at address 0x4000_0000 in
RAM.
'load_image file.bin [expr 0x4000_0000-0x3000] 0x4000_0000 0x1000'
This is not very intuitive but it works. The same principle will work
for elf files but here it gets complicated as all sections will be
relocated.
Perhaps adding this to openocd docs will help others.
I would think that adding a command
'load_image_bin filename address length file_offset' would be helpful.
Michal
On Mon, 2010-04-12 at 21:01 +0200, Øyvind Harboe wrote:
> After some further thought, I think your approach is fine.
>
> Before I would merge it, I would ask a few things:
>
> - write openocd.texi documentation including example. Unless
> other users than you can make effective use of this, then there
> is no point in merging this patch with OpenOCD.
>
> - try to clean up the implementation so it works across file format
> types. I think the "offset" should operate on addresses rather than
> byte offset in file across chunks. Try to stick with OpenOCD whitespace
> conventions.
>
> Along with the patch, please post the results of a few tests run.
>
> At least one test on binary, at least one test on a non .bin file (e.g. elf)
> and show it works across elf sections w/gaps.
>
_______________________________________________
Openocd-development mailing list
[email protected]
https://lists.berlios.de/mailman/listinfo/openocd-development