Here is a patch that adds file_offset to load_image command.
This allows loading 'bin' regions that do not start at 0x0 file offset.
I use this to create a simple flash driver in tcl. It load chunks of the
bin file to memory and burn them to flash. This is saved me a quite a
bit of time as I did not have to write a full flash driver in openocd.
--Michal
2424c2424
< uint32_t *min_address, uint32_t *max_address)
---
> uint32_t *min_address, uint32_t *max_address, uint32_t *offset)
2426c2426
< if (CMD_ARGC < 1 || CMD_ARGC > 5)
---
> if (CMD_ARGC < 1 || CMD_ARGC > 6)
2447c2447
< if (CMD_ARGC == 5)
---
> if (CMD_ARGC >= 5)
2452a2453,2457
> if (CMD_ARGC == 6)
> {
> /* This only makes sense for image->type == IMAGE_BINARY images */
> COMMAND_PARSE_NUMBER(u32, CMD_ARGV[5], *offset);
> }
2466a2472
> uint32_t file_offset =0;
2471c2477
< &image, &min_address, &max_address);
---
> &image, &min_address, &max_address, &file_offset);
2503a2510,2515
> if (file_offset >= buf_cnt)
> {
> free(buffer);
> break;
> }
>
2524c2536,2542
< if ((retval = target_write_buffer(target, image.sections[i].base_address + offset, length, buffer + offset)) != ERROR_OK)
---
> if (file_offset + length >= buf_cnt)
> {
> /* there is not enough data in the buffer. Only write out what's left */
> length = buf_cnt - file_offset;
> }
>
> if ((retval = target_write_buffer(target, image.sections[i].base_address + offset, length, buffer + offset + file_offset)) != ERROR_OK)
4858a4877
> uint32_t file_offset =0;
4864c4883
< &image, &min_address, &max_address);
---
> &image, &min_address, &max_address, &file_offset);
5039c5058
< "[min_address [max_length]]",
---
> "[min_address [max_length offset]]",
5196c5215
< "[min_address] [max_length]",
---
> "[min_address [max_length offset]",
_______________________________________________
Openocd-development mailing list
[email protected]
https://lists.berlios.de/mailman/listinfo/openocd-development