mirror of
https://github.com/m24h/DAPLINK_C6T6.git
synced 2026-09-26 22:16:11 +00:00
modified by me, to support STM32F103C6T6
This commit is contained in:
@@ -0,0 +1,4 @@
|
||||
Use a serial tool like "putty" to connect OCD telnet port, and use file-logging function.
|
||||
Type "mdb 0x08000000 0x8000" to dump firmware bytes in ROM.
|
||||
Use a text editor to clean unrelated contents in log file.
|
||||
Use "mdb-hex.pl" to convert log file to a ".hex" file.
|
||||
@@ -0,0 +1,32 @@
|
||||
my $base='0000';
|
||||
my $cksum;
|
||||
my $num;
|
||||
my $off;
|
||||
my $s;
|
||||
|
||||
sub b($) {
|
||||
my $b=shift;
|
||||
$cksum+=hex($b);
|
||||
$num++;
|
||||
return uc($b);
|
||||
}
|
||||
|
||||
while(<>) {
|
||||
next unless m/^\s*0x([0-9A-Fa-f]{4})([0-9A-Fa-f]{4})\s*:([ 0-9A-Fa-f]+)$/;
|
||||
if ($1 ne $base) {
|
||||
$base=$1;
|
||||
$cksum=0x02+0x04+hex(substr($base,0,2))+hex(substr($base,2,2));
|
||||
$cksum=(0x100-$cksum&0xFF)&0xFF;
|
||||
printf (":02000004${1}%02X\n", $cksum);
|
||||
}
|
||||
$off=$2;
|
||||
$s=$3;
|
||||
$cksum=hex(substr($off,0,2))+hex(substr($off,2,2));
|
||||
$num=0;
|
||||
$s=~s/\s*([0-9A-Fa-f]{2})\s*/b($1)/ge;
|
||||
$cksum+=$num;
|
||||
$cksum=(0x100-$cksum&0xFF)&0xFF;
|
||||
printf (":%02X${off}00${s}%02X\n", $num, $cksum);
|
||||
}
|
||||
|
||||
print ":00000001FF\n";
|
||||
Reference in New Issue
Block a user