kopia lustrzana https://github.com/stlink-org/stlink
Add documentation about the checksum
rodzic
6515e57b9e
commit
1047fdd440
|
@ -539,6 +539,11 @@ want to disassemble the code at 0x20000000, use:\
|
|||
(gdb) disassemble 0x20000001
|
||||
```
|
||||
|
||||
Checksum of binary file
|
||||
-----------------------
|
||||
|
||||
When flashing a file, the checksum of which is calculated, both in md5 and the sum algorithm used by ST's official tool. The detail of sum algorithm can be found in [https://www.st.com/resource/en/user_manual/cd00262073-stm32-stlink-utility-software-description-stmicroelectronics.pdf](https://www.st.com/resource/en/user_manual/cd00262073-stm32-stlink-utility-software-description-stmicroelectronics.pdf).
|
||||
|
||||
References
|
||||
==========
|
||||
|
||||
|
|
22
src/common.c
22
src/common.c
|
@ -1366,7 +1366,7 @@ static int check_file(stlink_t* sl, mapped_file_t* mf, stm32_addr_t addr) {
|
|||
return 0;
|
||||
}
|
||||
|
||||
static void md5_calculate(mapped_file_t *mf, const char *path) {
|
||||
static void md5_calculate(mapped_file_t *mf) {
|
||||
/* calculate md5 checksum of given binary file */
|
||||
Md5Context md5Context;
|
||||
MD5_HASH md5Hash;
|
||||
|
@ -1380,7 +1380,7 @@ static void md5_calculate(mapped_file_t *mf, const char *path) {
|
|||
printf(", ");
|
||||
}
|
||||
|
||||
static void stlink_checksum(mapped_file_t *mp, const char* path) {
|
||||
static void stlink_checksum(mapped_file_t *mp) {
|
||||
/* checksum that backward compatible with official ST tools */
|
||||
uint32_t sum = 0;
|
||||
uint8_t *mp_byte = (uint8_t *)mp->base;
|
||||
|
@ -1470,9 +1470,9 @@ int stlink_fwrite_sram(stlink_t * sl, const char* path, stm32_addr_t addr) {
|
|||
fprintf(stderr, "map_file() == -1\n");
|
||||
return -1;
|
||||
}
|
||||
printf("file %s ");
|
||||
md5_calculate(&mf, path);
|
||||
stlink_checksum(&mf, path);
|
||||
printf("file %s ", path);
|
||||
md5_calculate(&mf);
|
||||
stlink_checksum(&mf);
|
||||
|
||||
/* check addr range is inside the sram */
|
||||
if (addr < sl->sram_base) {
|
||||
|
@ -2698,9 +2698,9 @@ int stlink_fwrite_flash(stlink_t *sl, const char* path, stm32_addr_t addr) {
|
|||
return -1;
|
||||
}
|
||||
|
||||
printf("file %s ");
|
||||
md5_calculate(&mf, path);
|
||||
stlink_checksum(&mf, path);
|
||||
printf("file %s ", path);
|
||||
md5_calculate(&mf);
|
||||
stlink_checksum(&mf);
|
||||
|
||||
if (sl->opt) {
|
||||
idx = (unsigned int) mf.len;
|
||||
|
@ -3266,9 +3266,9 @@ int stlink_fwrite_option_bytes(stlink_t *sl, const char* path, stm32_addr_t addr
|
|||
return -1;
|
||||
}
|
||||
|
||||
printf("file %s ");
|
||||
md5_calculate(&mf, path);
|
||||
stlink_checksum(&mf, path);
|
||||
printf("file %s ", path);
|
||||
md5_calculate(&mf);
|
||||
stlink_checksum(&mf);
|
||||
|
||||
err = stlink_write_option_bytes(sl, addr, mf.base, (uint32_t) mf.len);
|
||||
stlink_fwrite_finalize(sl, addr);
|
||||
|
|
Ładowanie…
Reference in New Issue