Przeglądaj źródła

Squashed 'swd_probe/' changes from 9518ae480..0c316d855

0c316d855 fix catalog versions
9c56e2cf8 combine 1
8eff6b8ff move base pack here
REVERT: 9518ae480 Removed ancient DOLPHIN_DEED
REVERT: 4535c961e Fixes to application.fam
REVERT: c32144a52 Merge pull request #3 from Feriixu/master
REVERT: 59565a37c Change apptype to EXTENSION
REVERT: 3940116fc Comment out DOLPHIN_DEED line, because it was causing the build to fail
REVERT: 9aec1bb17 Update README.md
REVERT: 840636ebb Update README.md
REVERT: 3a890e8d3 trying to debug USB hang issues when sending lot of data via second VCP
REVERT: 2a13f6172 small typo
REVERT: bb4b204de added single step commands
REVERT: 18784804d added source link
REVERT: df6dc6a63 added ADI CoreSight parsing
REVERT: 96fe7f42d increase max fps to 50 again, seems to be stable
REVERT: db49648aa rework to not use a timer, reducing complexity
REVERT: 56e1a8ea1 rework code a bit for better debugging split search and found view into two separate pages
REVERT: 1e10929f5 added commandline on second uart, renamed ap_select, added dp/ap read/write
REVERT: 751177cc5 use dialog style message - does not disappear
REVERT: bb71d4167 add a rotating chip when scanning fix memory dumping
REVERT: 540ec91b5 more code cleanups stability updates added function calls which execute other scripts smaller UI updates
REVERT: 77a81541c code cleanup, fixing compile errors with -Werror
REVERT: e1d53b818 add scripts into subfolder
REVERT: 138105f16 add goto and labels to script change memory access modes
REVERT: 431978bdd execute scripts from menu add message dialogs add swd_idle_bits parameter
REVERT: 29192ea74 added scripting support
REVERT: b33102caa small code restructuring and mode page updates
REVERT: ce774262f show BASE register of AP fix memory reading, skipping words
REVERT: 548b3bc6e fix leaving io selection in undefined state when changing page
REVERT: e9c6b4e5c added user interface buttons
REVERT: f428610f6 access AP to have memory dump support show more registers some basic navigation, without any UI hints yet
REVERT: 9c5f822e3 don't beep within mutex, show countdown
REVERT: ac7d351bb initial checkin

git-subtree-dir: swd_probe
git-subtree-split: 0c316d85586678a264aa155b81c8075c80da7ae2
Willy-JL 2 lat temu
rodzic
commit
ba39020af9

+ 17 - 17
README.md

@@ -1,17 +1,17 @@
-# ARM SWD (Single Wire Debug) Probe
-
-Modern microcontrollers have support for the two wire debug interface SWD, which makes wiring a lot simpler.
-When reverse engineering, finding these two pins is a los easier than with JTAG, where you had to wire up twice or more pins. However, finding  the two pins is still a bit of work, which gets simplified even more with this application.
-
-This application tries to detect a valid SWD response on the wires you have picked and beeps when you have found the correct pins, showing the detected ID register and, more important, the SWD pinout. It doesn't matter which two pins you choose, just pick any two from the GPIOs on the breakout header. 
-
-To achieve this, the application sends packets and scans the response on all pins and elaborates the pins within a few retries. Using some kind of bisect pattern reduces this number to a hand full of tries, yielding in a seemingly instant detection. 
-
-For the user it is as simple as a continuity tester - wire up your two test needles (or accupuncture needles), connect the obvious GND pin and probe all test pads.
-Now it depends on your bisect capabilities finding all pad combinations, how long it will take this time.
-
-https://cdn.discordapp.com/attachments/954430078882816021/1071603366741938176/20230205_022641.mp4
-
-https://cdn.discordapp.com/attachments/1071712925171056690/1072306469057347594/qFlipper_2023-02-07_01-01-24.mp4 
-
-Discussion thread: https://discord.com/channels/740930220399525928/1071712925171056690
+# ARM SWD (Single Wire Debug) Probe
+
+Modern microcontrollers have support for the two wire debug interface SWD, which makes wiring a lot simpler.
+When reverse engineering, finding these two pins is a los easier than with JTAG, where you had to wire up twice or more pins. However, finding  the two pins is still a bit of work, which gets simplified even more with this application.
+
+This application tries to detect a valid SWD response on the wires you have picked and beeps when you have found the correct pins, showing the detected ID register and, more important, the SWD pinout. It doesn't matter which two pins you choose, just pick any two from the GPIOs on the breakout header. 
+
+To achieve this, the application sends packets and scans the response on all pins and elaborates the pins within a few retries. Using some kind of bisect pattern reduces this number to a hand full of tries, yielding in a seemingly instant detection. 
+
+For the user it is as simple as a continuity tester - wire up your two test needles (or accupuncture needles), connect the obvious GND pin and probe all test pads.
+Now it depends on your bisect capabilities finding all pad combinations, how long it will take this time.
+
+https://cdn.discordapp.com/attachments/954430078882816021/1071603366741938176/20230205_022641.mp4
+
+https://cdn.discordapp.com/attachments/1071712925171056690/1072306469057347594/qFlipper_2023-02-07_01-01-24.mp4 
+
+Discussion thread: https://discord.com/channels/740930220399525928/1071712925171056690

+ 0 - 1
adi.c

@@ -789,7 +789,6 @@ static const struct dap_part_nums {
         "Denver PMU",
         "(Performance Monitor Unit)",
     },
-    /* https://github.com/stlink-org/stlink/blob/develop/doc/devices_boards.md */
     {0x20, 0x410, "STM32F10 (med)", "(ROM Table)"},
     {0x20, 0x411, "STM32F2", "(ROM Table)"},
     {0x20, 0x412, "STM32F10 (low)", "(ROM Table)"},

+ 5 - 7
application.fam

@@ -1,17 +1,15 @@
 App(
-    fap_author="g3gg0",
-    fap_weburl="https://github.com/g3gg0/flipper-swd_probe",
-    fap_version=(1, 0),
-    fap_description="ARM SWD (Single Wire Debug) Probe",
     appid="swd_probe",
     name="SWD Probe",
     apptype=FlipperAppType.EXTERNAL,
     entry_point="swd_probe_app_main",
-    cdefines=["APP_SWD_PROBE"],
     requires=["notification", "gui", "storage", "dialogs", "cli"],
     stack_size=2 * 1024,
     order=10,
     fap_icon="icons/app.png",
-    fap_category="Tools",
-    fap_icon_assets="icons"
+    fap_category="GPIO",
+    fap_icon_assets="icons",
+    fap_author="@g3gg0 & (fixes by @xMasterX)",
+    fap_version="1.1",
+    fap_description="ARM SWD (Single Wire Debug) Probe",
 )

BIN
img/1.png


+ 105 - 417
model/model_chip.h

@@ -1,420 +1,108 @@
 #define NUM_VERTICES 136
 float vertexCoords[NUM_VERTICES][3] = {
-  {1.000000, 1.000000, 0.152153},
-  {-1.000000, 1.000000, 0.152153},
-  {-1.000000, -1.000000, 0.152153},
-  {1.000000, -1.000000, 0.152153},
-  {1.000000, -1.000000, -0.185787},
-  {-1.000000, -1.000000, -0.185787},
-  {-1.000000, 1.000000, -0.185787},
-  {1.000000, 1.000000, -0.185787},
-  {-1.000043, -0.785071, -0.015780},
-  {-1.155724, -0.785071, -0.015780},
-  {-1.155724, -0.918718, -0.015780},
-  {-1.000043, -0.918718, -0.015780},
-  {-1.155724, -0.785071, 0.127052},
-  {-1.000043, -0.785071, 0.127052},
-  {-1.000043, -0.918718, 0.127052},
-  {-1.155724, -0.918718, 0.127052},
-  {-1.234192, -0.918846, -0.087021},
-  {-1.234397, -0.785201, -0.086336},
-  {-1.235319, -0.784943, -0.229143},
-  {-1.235114, -0.918588, -0.229828},
-  {-1.388133, -0.919573, -0.078673},
-  {-1.389056, -0.919314, -0.221479},
-  {-1.389261, -0.785669, -0.220795},
-  {-1.388338, -0.785927, -0.077988},
-  {-1.000043, -0.219627, -0.015780},
-  {-1.155724, -0.219627, -0.015780},
-  {-1.155724, -0.353273, -0.015780},
-  {-1.000043, -0.353273, -0.015780},
-  {-1.155724, -0.219627, 0.127052},
-  {-1.000043, -0.219627, 0.127052},
-  {-1.000043, -0.353273, 0.127052},
-  {-1.155724, -0.353273, 0.127052},
-  {-1.234192, -0.353402, -0.087021},
-  {-1.234397, -0.219756, -0.086336},
-  {-1.235319, -0.219498, -0.229143},
-  {-1.235114, -0.353143, -0.229828},
-  {-1.388133, -0.354128, -0.078673},
-  {-1.389056, -0.353870, -0.221479},
-  {-1.389261, -0.220224, -0.220795},
-  {-1.388338, -0.220482, -0.077988},
-  {-1.000043, 0.345818, -0.015780},
-  {-1.155724, 0.345818, -0.015780},
-  {-1.155724, 0.212172, -0.015780},
-  {-1.000043, 0.212172, -0.015780},
-  {-1.155724, 0.345818, 0.127052},
-  {-1.000043, 0.345818, 0.127052},
-  {-1.000043, 0.212172, 0.127052},
-  {-1.155724, 0.212172, 0.127052},
-  {-1.234192, 0.212043, -0.087021},
-  {-1.234397, 0.345689, -0.086336},
-  {-1.235319, 0.345947, -0.229143},
-  {-1.235114, 0.212301, -0.229828},
-  {-1.388133, 0.211317, -0.078673},
-  {-1.389056, 0.211575, -0.221479},
-  {-1.389261, 0.345221, -0.220795},
-  {-1.388338, 0.344962, -0.077988},
-  {-1.000043, 0.911263, -0.015780},
-  {-1.155724, 0.911263, -0.015780},
-  {-1.155724, 0.777617, -0.015780},
-  {-1.000043, 0.777617, -0.015780},
-  {-1.155724, 0.911263, 0.127052},
-  {-1.000043, 0.911263, 0.127052},
-  {-1.000043, 0.777617, 0.127052},
-  {-1.155724, 0.777617, 0.127052},
-  {-1.234192, 0.777488, -0.087021},
-  {-1.234397, 0.911133, -0.086336},
-  {-1.235319, 0.911392, -0.229143},
-  {-1.235114, 0.777746, -0.229828},
-  {-1.388133, 0.776762, -0.078673},
-  {-1.389056, 0.777020, -0.221479},
-  {-1.389261, 0.910665, -0.220795},
-  {-1.388338, 0.910407, -0.077988},
-  {1.000043, -0.785071, -0.015780},
-  {1.000043, -0.918718, -0.015780},
-  {1.155723, -0.918718, -0.015780},
-  {1.155723, -0.785071, -0.015780},
-  {1.155723, -0.785071, 0.127052},
-  {1.155723, -0.918718, 0.127052},
-  {1.000043, -0.918718, 0.127052},
-  {1.000043, -0.785071, 0.127052},
-  {1.234397, -0.785201, -0.086336},
-  {1.234192, -0.918846, -0.087021},
-  {1.235114, -0.918588, -0.229828},
-  {1.235319, -0.784943, -0.229143},
-  {1.388133, -0.919573, -0.078673},
-  {1.388338, -0.785927, -0.077988},
-  {1.389260, -0.785669, -0.220795},
-  {1.389056, -0.919314, -0.221479},
-  {1.000043, -0.219627, -0.015780},
-  {1.000043, -0.353273, -0.015780},
-  {1.155723, -0.353273, -0.015780},
-  {1.155723, -0.219627, -0.015780},
-  {1.155723, -0.219627, 0.127052},
-  {1.155723, -0.353273, 0.127052},
-  {1.000043, -0.353273, 0.127052},
-  {1.000043, -0.219627, 0.127052},
-  {1.234397, -0.219756, -0.086336},
-  {1.234192, -0.353402, -0.087021},
-  {1.235114, -0.353143, -0.229828},
-  {1.235319, -0.219498, -0.229143},
-  {1.388133, -0.354128, -0.078673},
-  {1.388338, -0.220482, -0.077988},
-  {1.389260, -0.220224, -0.220795},
-  {1.389056, -0.353870, -0.221479},
-  {1.000043, 0.345818, -0.015780},
-  {1.000043, 0.212172, -0.015780},
-  {1.155723, 0.212172, -0.015780},
-  {1.155723, 0.345818, -0.015780},
-  {1.155723, 0.345818, 0.127052},
-  {1.155723, 0.212172, 0.127052},
-  {1.000043, 0.212172, 0.127052},
-  {1.000043, 0.345818, 0.127052},
-  {1.234397, 0.345689, -0.086336},
-  {1.234192, 0.212043, -0.087021},
-  {1.235114, 0.212301, -0.229828},
-  {1.235319, 0.345947, -0.229143},
-  {1.388133, 0.211317, -0.078673},
-  {1.388338, 0.344962, -0.077988},
-  {1.389260, 0.345221, -0.220795},
-  {1.389056, 0.211575, -0.221479},
-  {1.000043, 0.911263, -0.015780},
-  {1.000043, 0.777616, -0.015780},
-  {1.155723, 0.777616, -0.015780},
-  {1.155723, 0.911263, -0.015780},
-  {1.155723, 0.911263, 0.127052},
-  {1.155723, 0.777616, 0.127052},
-  {1.000043, 0.777616, 0.127052},
-  {1.000043, 0.911263, 0.127052},
-  {1.234397, 0.911133, -0.086336},
-  {1.234192, 0.777488, -0.087021},
-  {1.235114, 0.777746, -0.229828},
-  {1.235319, 0.911392, -0.229143},
-  {1.388133, 0.776762, -0.078673},
-  {1.388338, 0.910407, -0.077988},
-  {1.389260, 0.910665, -0.220795},
-  {1.389056, 0.777020, -0.221479},
-};int edgeIndices[][3] = {
-  {0, 1},
-  {1, 2},
-  {2, 3},
-  {3, 0},
-  {4, 3},
-  {3, 2},
-  {2, 5},
-  {5, 4},
-  {5, 2},
-  {2, 1},
-  {1, 6},
-  {6, 5},
-  {6, 7},
-  {7, 4},
-  {4, 5},
-  {5, 6},
-  {7, 0},
-  {0, 3},
-  {3, 4},
-  {4, 7},
-  {6, 1},
-  {1, 0},
-  {0, 7},
-  {7, 6},
-  {8, 9},
-  {9, 10},
-  {10, 11},
-  {11, 8},
-  {12, 13},
-  {13, 14},
-  {14, 15},
-  {15, 12},
-  {13, 8},
-  {8, 11},
-  {11, 14},
-  {14, 13},
-  {12, 15},
-  {15, 16},
-  {16, 17},
-  {17, 12},
-  {10, 9},
-  {9, 18},
-  {18, 19},
-  {19, 10},
-  {20, 21},
-  {21, 22},
-  {22, 23},
-  {23, 20},
-  {17, 16},
-  {16, 20},
-  {20, 23},
-  {23, 17},
-  {19, 18},
-  {18, 22},
-  {22, 21},
-  {21, 19},
-  {24, 25},
-  {25, 26},
-  {26, 27},
-  {27, 24},
-  {28, 29},
-  {29, 30},
-  {30, 31},
-  {31, 28},
-  {29, 24},
-  {24, 27},
-  {27, 30},
-  {30, 29},
-  {28, 31},
-  {31, 32},
-  {32, 33},
-  {33, 28},
-  {26, 25},
-  {25, 34},
-  {34, 35},
-  {35, 26},
-  {36, 37},
-  {37, 38},
-  {38, 39},
-  {39, 36},
-  {33, 32},
-  {32, 36},
-  {36, 39},
-  {39, 33},
-  {35, 34},
-  {34, 38},
-  {38, 37},
-  {37, 35},
-  {40, 41},
-  {41, 42},
-  {42, 43},
-  {43, 40},
-  {44, 45},
-  {45, 46},
-  {46, 47},
-  {47, 44},
-  {45, 40},
-  {40, 43},
-  {43, 46},
-  {46, 45},
-  {44, 47},
-  {47, 48},
-  {48, 49},
-  {49, 44},
-  {42, 41},
-  {41, 50},
-  {50, 51},
-  {51, 42},
-  {52, 53},
-  {53, 54},
-  {54, 55},
-  {55, 52},
-  {49, 48},
-  {48, 52},
-  {52, 55},
-  {55, 49},
-  {51, 50},
-  {50, 54},
-  {54, 53},
-  {53, 51},
-  {56, 57},
-  {57, 58},
-  {58, 59},
-  {59, 56},
-  {60, 61},
-  {61, 62},
-  {62, 63},
-  {63, 60},
-  {61, 56},
-  {56, 59},
-  {59, 62},
-  {62, 61},
-  {60, 63},
-  {63, 64},
-  {64, 65},
-  {65, 60},
-  {58, 57},
-  {57, 66},
-  {66, 67},
-  {67, 58},
-  {68, 69},
-  {69, 70},
-  {70, 71},
-  {71, 68},
-  {65, 64},
-  {64, 68},
-  {68, 71},
-  {71, 65},
-  {67, 66},
-  {66, 70},
-  {70, 69},
-  {69, 67},
-  {72, 73},
-  {73, 74},
-  {74, 75},
-  {75, 72},
-  {76, 77},
-  {77, 78},
-  {78, 79},
-  {79, 76},
-  {79, 78},
-  {78, 73},
-  {73, 72},
-  {72, 79},
-  {76, 80},
-  {80, 81},
-  {81, 77},
-  {77, 76},
-  {74, 82},
-  {82, 83},
-  {83, 75},
-  {75, 74},
-  {84, 85},
-  {85, 86},
-  {86, 87},
-  {87, 84},
-  {80, 85},
-  {85, 84},
-  {84, 81},
-  {81, 80},
-  {82, 87},
-  {87, 86},
-  {86, 83},
-  {83, 82},
-  {88, 89},
-  {89, 90},
-  {90, 91},
-  {91, 88},
-  {92, 93},
-  {93, 94},
-  {94, 95},
-  {95, 92},
-  {95, 94},
-  {94, 89},
-  {89, 88},
-  {88, 95},
-  {92, 96},
-  {96, 97},
-  {97, 93},
-  {93, 92},
-  {90, 98},
-  {98, 99},
-  {99, 91},
-  {91, 90},
-  {100, 101},
-  {101, 102},
-  {102, 103},
-  {103, 100},
-  {96, 101},
-  {101, 100},
-  {100, 97},
-  {97, 96},
-  {98, 103},
-  {103, 102},
-  {102, 99},
-  {99, 98},
-  {104, 105},
-  {105, 106},
-  {106, 107},
-  {107, 104},
-  {108, 109},
-  {109, 110},
-  {110, 111},
-  {111, 108},
-  {111, 110},
-  {110, 105},
-  {105, 104},
-  {104, 111},
-  {108, 112},
-  {112, 113},
-  {113, 109},
-  {109, 108},
-  {106, 114},
-  {114, 115},
-  {115, 107},
-  {107, 106},
-  {116, 117},
-  {117, 118},
-  {118, 119},
-  {119, 116},
-  {112, 117},
-  {117, 116},
-  {116, 113},
-  {113, 112},
-  {114, 119},
-  {119, 118},
-  {118, 115},
-  {115, 114},
-  {120, 121},
-  {121, 122},
-  {122, 123},
-  {123, 120},
-  {124, 125},
-  {125, 126},
-  {126, 127},
-  {127, 124},
-  {127, 126},
-  {126, 121},
-  {121, 120},
-  {120, 127},
-  {124, 128},
-  {128, 129},
-  {129, 125},
-  {125, 124},
-  {122, 130},
-  {130, 131},
-  {131, 123},
-  {123, 122},
-  {132, 133},
-  {133, 134},
-  {134, 135},
-  {135, 132},
-  {128, 133},
-  {133, 132},
-  {132, 129},
-  {129, 128},
-  {130, 135},
-  {135, 134},
-  {134, 131},
-  {131, 130},
+    {1.000000, 1.000000, 0.152153},    {-1.000000, 1.000000, 0.152153},
+    {-1.000000, -1.000000, 0.152153},  {1.000000, -1.000000, 0.152153},
+    {1.000000, -1.000000, -0.185787},  {-1.000000, -1.000000, -0.185787},
+    {-1.000000, 1.000000, -0.185787},  {1.000000, 1.000000, -0.185787},
+    {-1.000043, -0.785071, -0.015780}, {-1.155724, -0.785071, -0.015780},
+    {-1.155724, -0.918718, -0.015780}, {-1.000043, -0.918718, -0.015780},
+    {-1.155724, -0.785071, 0.127052},  {-1.000043, -0.785071, 0.127052},
+    {-1.000043, -0.918718, 0.127052},  {-1.155724, -0.918718, 0.127052},
+    {-1.234192, -0.918846, -0.087021}, {-1.234397, -0.785201, -0.086336},
+    {-1.235319, -0.784943, -0.229143}, {-1.235114, -0.918588, -0.229828},
+    {-1.388133, -0.919573, -0.078673}, {-1.389056, -0.919314, -0.221479},
+    {-1.389261, -0.785669, -0.220795}, {-1.388338, -0.785927, -0.077988},
+    {-1.000043, -0.219627, -0.015780}, {-1.155724, -0.219627, -0.015780},
+    {-1.155724, -0.353273, -0.015780}, {-1.000043, -0.353273, -0.015780},
+    {-1.155724, -0.219627, 0.127052},  {-1.000043, -0.219627, 0.127052},
+    {-1.000043, -0.353273, 0.127052},  {-1.155724, -0.353273, 0.127052},
+    {-1.234192, -0.353402, -0.087021}, {-1.234397, -0.219756, -0.086336},
+    {-1.235319, -0.219498, -0.229143}, {-1.235114, -0.353143, -0.229828},
+    {-1.388133, -0.354128, -0.078673}, {-1.389056, -0.353870, -0.221479},
+    {-1.389261, -0.220224, -0.220795}, {-1.388338, -0.220482, -0.077988},
+    {-1.000043, 0.345818, -0.015780},  {-1.155724, 0.345818, -0.015780},
+    {-1.155724, 0.212172, -0.015780},  {-1.000043, 0.212172, -0.015780},
+    {-1.155724, 0.345818, 0.127052},   {-1.000043, 0.345818, 0.127052},
+    {-1.000043, 0.212172, 0.127052},   {-1.155724, 0.212172, 0.127052},
+    {-1.234192, 0.212043, -0.087021},  {-1.234397, 0.345689, -0.086336},
+    {-1.235319, 0.345947, -0.229143},  {-1.235114, 0.212301, -0.229828},
+    {-1.388133, 0.211317, -0.078673},  {-1.389056, 0.211575, -0.221479},
+    {-1.389261, 0.345221, -0.220795},  {-1.388338, 0.344962, -0.077988},
+    {-1.000043, 0.911263, -0.015780},  {-1.155724, 0.911263, -0.015780},
+    {-1.155724, 0.777617, -0.015780},  {-1.000043, 0.777617, -0.015780},
+    {-1.155724, 0.911263, 0.127052},   {-1.000043, 0.911263, 0.127052},
+    {-1.000043, 0.777617, 0.127052},   {-1.155724, 0.777617, 0.127052},
+    {-1.234192, 0.777488, -0.087021},  {-1.234397, 0.911133, -0.086336},
+    {-1.235319, 0.911392, -0.229143},  {-1.235114, 0.777746, -0.229828},
+    {-1.388133, 0.776762, -0.078673},  {-1.389056, 0.777020, -0.221479},
+    {-1.389261, 0.910665, -0.220795},  {-1.388338, 0.910407, -0.077988},
+    {1.000043, -0.785071, -0.015780},  {1.000043, -0.918718, -0.015780},
+    {1.155723, -0.918718, -0.015780},  {1.155723, -0.785071, -0.015780},
+    {1.155723, -0.785071, 0.127052},   {1.155723, -0.918718, 0.127052},
+    {1.000043, -0.918718, 0.127052},   {1.000043, -0.785071, 0.127052},
+    {1.234397, -0.785201, -0.086336},  {1.234192, -0.918846, -0.087021},
+    {1.235114, -0.918588, -0.229828},  {1.235319, -0.784943, -0.229143},
+    {1.388133, -0.919573, -0.078673},  {1.388338, -0.785927, -0.077988},
+    {1.389260, -0.785669, -0.220795},  {1.389056, -0.919314, -0.221479},
+    {1.000043, -0.219627, -0.015780},  {1.000043, -0.353273, -0.015780},
+    {1.155723, -0.353273, -0.015780},  {1.155723, -0.219627, -0.015780},
+    {1.155723, -0.219627, 0.127052},   {1.155723, -0.353273, 0.127052},
+    {1.000043, -0.353273, 0.127052},   {1.000043, -0.219627, 0.127052},
+    {1.234397, -0.219756, -0.086336},  {1.234192, -0.353402, -0.087021},
+    {1.235114, -0.353143, -0.229828},  {1.235319, -0.219498, -0.229143},
+    {1.388133, -0.354128, -0.078673},  {1.388338, -0.220482, -0.077988},
+    {1.389260, -0.220224, -0.220795},  {1.389056, -0.353870, -0.221479},
+    {1.000043, 0.345818, -0.015780},   {1.000043, 0.212172, -0.015780},
+    {1.155723, 0.212172, -0.015780},   {1.155723, 0.345818, -0.015780},
+    {1.155723, 0.345818, 0.127052},    {1.155723, 0.212172, 0.127052},
+    {1.000043, 0.212172, 0.127052},    {1.000043, 0.345818, 0.127052},
+    {1.234397, 0.345689, -0.086336},   {1.234192, 0.212043, -0.087021},
+    {1.235114, 0.212301, -0.229828},   {1.235319, 0.345947, -0.229143},
+    {1.388133, 0.211317, -0.078673},   {1.388338, 0.344962, -0.077988},
+    {1.389260, 0.345221, -0.220795},   {1.389056, 0.211575, -0.221479},
+    {1.000043, 0.911263, -0.015780},   {1.000043, 0.777616, -0.015780},
+    {1.155723, 0.777616, -0.015780},   {1.155723, 0.911263, -0.015780},
+    {1.155723, 0.911263, 0.127052},    {1.155723, 0.777616, 0.127052},
+    {1.000043, 0.777616, 0.127052},    {1.000043, 0.911263, 0.127052},
+    {1.234397, 0.911133, -0.086336},   {1.234192, 0.777488, -0.087021},
+    {1.235114, 0.777746, -0.229828},   {1.235319, 0.911392, -0.229143},
+    {1.388133, 0.776762, -0.078673},   {1.388338, 0.910407, -0.077988},
+    {1.389260, 0.910665, -0.220795},   {1.389056, 0.777020, -0.221479},
+};
+int edgeIndices[][3] = {
+    {0, 1},     {1, 2},     {2, 3},     {3, 0},     {4, 3},     {3, 2},     {2, 5},     {5, 4},
+    {5, 2},     {2, 1},     {1, 6},     {6, 5},     {6, 7},     {7, 4},     {4, 5},     {5, 6},
+    {7, 0},     {0, 3},     {3, 4},     {4, 7},     {6, 1},     {1, 0},     {0, 7},     {7, 6},
+    {8, 9},     {9, 10},    {10, 11},   {11, 8},    {12, 13},   {13, 14},   {14, 15},   {15, 12},
+    {13, 8},    {8, 11},    {11, 14},   {14, 13},   {12, 15},   {15, 16},   {16, 17},   {17, 12},
+    {10, 9},    {9, 18},    {18, 19},   {19, 10},   {20, 21},   {21, 22},   {22, 23},   {23, 20},
+    {17, 16},   {16, 20},   {20, 23},   {23, 17},   {19, 18},   {18, 22},   {22, 21},   {21, 19},
+    {24, 25},   {25, 26},   {26, 27},   {27, 24},   {28, 29},   {29, 30},   {30, 31},   {31, 28},
+    {29, 24},   {24, 27},   {27, 30},   {30, 29},   {28, 31},   {31, 32},   {32, 33},   {33, 28},
+    {26, 25},   {25, 34},   {34, 35},   {35, 26},   {36, 37},   {37, 38},   {38, 39},   {39, 36},
+    {33, 32},   {32, 36},   {36, 39},   {39, 33},   {35, 34},   {34, 38},   {38, 37},   {37, 35},
+    {40, 41},   {41, 42},   {42, 43},   {43, 40},   {44, 45},   {45, 46},   {46, 47},   {47, 44},
+    {45, 40},   {40, 43},   {43, 46},   {46, 45},   {44, 47},   {47, 48},   {48, 49},   {49, 44},
+    {42, 41},   {41, 50},   {50, 51},   {51, 42},   {52, 53},   {53, 54},   {54, 55},   {55, 52},
+    {49, 48},   {48, 52},   {52, 55},   {55, 49},   {51, 50},   {50, 54},   {54, 53},   {53, 51},
+    {56, 57},   {57, 58},   {58, 59},   {59, 56},   {60, 61},   {61, 62},   {62, 63},   {63, 60},
+    {61, 56},   {56, 59},   {59, 62},   {62, 61},   {60, 63},   {63, 64},   {64, 65},   {65, 60},
+    {58, 57},   {57, 66},   {66, 67},   {67, 58},   {68, 69},   {69, 70},   {70, 71},   {71, 68},
+    {65, 64},   {64, 68},   {68, 71},   {71, 65},   {67, 66},   {66, 70},   {70, 69},   {69, 67},
+    {72, 73},   {73, 74},   {74, 75},   {75, 72},   {76, 77},   {77, 78},   {78, 79},   {79, 76},
+    {79, 78},   {78, 73},   {73, 72},   {72, 79},   {76, 80},   {80, 81},   {81, 77},   {77, 76},
+    {74, 82},   {82, 83},   {83, 75},   {75, 74},   {84, 85},   {85, 86},   {86, 87},   {87, 84},
+    {80, 85},   {85, 84},   {84, 81},   {81, 80},   {82, 87},   {87, 86},   {86, 83},   {83, 82},
+    {88, 89},   {89, 90},   {90, 91},   {91, 88},   {92, 93},   {93, 94},   {94, 95},   {95, 92},
+    {95, 94},   {94, 89},   {89, 88},   {88, 95},   {92, 96},   {96, 97},   {97, 93},   {93, 92},
+    {90, 98},   {98, 99},   {99, 91},   {91, 90},   {100, 101}, {101, 102}, {102, 103}, {103, 100},
+    {96, 101},  {101, 100}, {100, 97},  {97, 96},   {98, 103},  {103, 102}, {102, 99},  {99, 98},
+    {104, 105}, {105, 106}, {106, 107}, {107, 104}, {108, 109}, {109, 110}, {110, 111}, {111, 108},
+    {111, 110}, {110, 105}, {105, 104}, {104, 111}, {108, 112}, {112, 113}, {113, 109}, {109, 108},
+    {106, 114}, {114, 115}, {115, 107}, {107, 106}, {116, 117}, {117, 118}, {118, 119}, {119, 116},
+    {112, 117}, {117, 116}, {116, 113}, {113, 112}, {114, 119}, {119, 118}, {118, 115}, {115, 114},
+    {120, 121}, {121, 122}, {122, 123}, {123, 120}, {124, 125}, {125, 126}, {126, 127}, {127, 124},
+    {127, 126}, {126, 121}, {121, 120}, {120, 127}, {124, 128}, {128, 129}, {129, 125}, {125, 124},
+    {122, 130}, {130, 131}, {131, 123}, {123, 122}, {132, 133}, {133, 134}, {134, 135}, {135, 132},
+    {128, 133}, {133, 132}, {132, 129}, {129, 128}, {130, 135}, {135, 134}, {134, 131}, {131, 130},
 };

+ 47 - 35
swd_probe_app.c

@@ -679,7 +679,7 @@ static bool swd_apscan_test(AppFSM* const ctx, uint32_t ap) {
 static void swd_script_log(ScriptContext* ctx, FuriLogLevel level, const char* format, ...) {
     bool commandline = false;
     ScriptContext* cur = ctx;
-    char buffer[256];
+    FuriString* buffer = furi_string_alloc();
     va_list argp;
     va_start(argp, format);
 
@@ -704,17 +704,19 @@ static void swd_script_log(ScriptContext* ctx, FuriLogLevel level, const char* f
             break;
         }
 
-        strcpy(buffer, prefix);
-        size_t pos = strlen(buffer);
-        vsnprintf(&buffer[pos], sizeof(buffer) - pos - 2, format, argp);
-        strcat(buffer, "\n");
-        if(!usb_uart_tx_data(ctx->app->uart, (uint8_t*)buffer, strlen(buffer))) {
+        furi_string_cat_str(buffer, prefix);
+        furi_string_cat_printf(buffer, format, argp);
+        furi_string_cat_str(buffer, "\n");
+
+        if(!usb_uart_tx_data(
+               ctx->app->uart, (uint8_t*)furi_string_get_cstr(buffer), furi_string_size(buffer))) {
             DBGS("Sending via USB failed");
         }
     } else {
-        LOG(buffer);
+        LOG(furi_string_get_cstr(buffer));
     }
     va_end(argp);
+    furi_string_free(buffer);
 }
 
 /* read characters until newline was read */
@@ -939,41 +941,44 @@ static bool swd_scriptfunc_goto(ScriptContext* ctx) {
     return true;
 }
 
+#include <toolbox/path.h>
+
 static bool swd_scriptfunc_call(ScriptContext* ctx) {
     DBGS("call");
 
     swd_script_skip_whitespace(ctx);
 
     /* fetch previous file directory */
-    char filename[MAX_FILE_LENGTH];
-    strncpy(filename, ctx->filename, sizeof(filename));
-    char* path = strrchr(filename, '/');
-    path[1] = '\000';
-
-    /* append filename */
-    if(!swd_script_get_string(ctx, &path[1], sizeof(filename) - strlen(path))) {
-        swd_script_log(ctx, FuriLogLevelError, "failed to parse filename");
-        return false;
-    }
+    FuriString* filepath = furi_string_alloc();
+    path_extract_dirname(ctx->filename, filepath);
+    // strncpy(filename, ctx->filename, sizeof(filename));
 
-    swd_script_seek_newline(ctx);
+    char filename[MAX_FILE_LENGTH] = {};
+    bool success = false;
+    do {
+        /* append filename */
+        if(!swd_script_get_string(ctx, filename, sizeof(filename))) {
+            swd_script_log(ctx, FuriLogLevelError, "failed to parse filename");
+            break;
+        }
 
-    /* append extension */
-    if(strlen(filename) + 5 >= sizeof(filename)) {
-        swd_script_log(ctx, FuriLogLevelError, "name too long");
-        return false;
-    }
+        swd_script_seek_newline(ctx);
+        /* append extension */
+        furi_string_cat_str(filepath, ".swd");
 
-    strcat(filename, ".swd");
+        bool ret = swd_execute_script(ctx->app, furi_string_get_cstr(filepath));
 
-    bool ret = swd_execute_script(ctx->app, filename);
+        if(!ret) {
+            swd_script_log(
+                ctx, FuriLogLevelError, "failed to exec '%s'", furi_string_get_cstr(filepath));
+            break;
+        }
 
-    if(!ret) {
-        swd_script_log(ctx, FuriLogLevelError, "failed to exec '%s'", filename);
-        return false;
-    }
+        success = true;
+    } while(false);
+    furi_string_free(filepath);
 
-    return true;
+    return success;
 }
 
 static bool swd_scriptfunc_status(ScriptContext* ctx) {
@@ -2926,10 +2931,10 @@ static bool swd_message_process(AppFSM* ctx) {
                     break;
 
                 case ModePageScan: {
-                    FuriString* result_path = furi_string_alloc_printf(ANY_PATH("swd"));
+                    FuriString* result_path = furi_string_alloc_printf(ANY_PATH("swd_scripts"));
                     FuriString* preselected = furi_string_alloc_printf(
                         (strlen(ctx->script_detected) > 0) ? ctx->script_detected :
-                                                             ANY_PATH("swd"));
+                                                             ANY_PATH("swd_scripts"));
                     DialogsFileBrowserOptions options;
 
                     dialog_file_browser_set_basic_options(&options, "swd", &I_swd);
@@ -2999,10 +3004,10 @@ static bool swd_message_process(AppFSM* ctx) {
                     }
                 } else if((ctx->mode_page == ModePageScan) || (ctx->mode_page == ModePageFound)) {
                     uint32_t mode_page = ctx->mode_page;
-                    FuriString* result_path = furi_string_alloc_printf(ANY_PATH("swd"));
+                    FuriString* result_path = furi_string_alloc_printf(ANY_PATH("swd_scripts"));
                     FuriString* preselected = furi_string_alloc_printf(
                         (strlen(ctx->script_detected) > 0) ? ctx->script_detected :
-                                                             ANY_PATH("swd"));
+                                                             ANY_PATH("swd_scripts"));
                     DialogsFileBrowserOptions options;
 
                     dialog_file_browser_set_basic_options(&options, "swd", &I_swd);
@@ -3128,7 +3133,9 @@ int32_t swd_probe_app_main(void* p) {
     notification_message(app->notification, &sequence_display_backlight_enforce_on);
 
     DBGS("swd_execute_script");
-    swd_execute_script(app, ANY_PATH("swd/startup.swd"));
+    swd_execute_script(app, ANY_PATH("swd_scripts/startup.swd"));
+
+    dolphin_deed(DolphinDeedPluginGameStart);
 
     DBGS("processing");
     for(bool processing = true; processing;) {
@@ -3164,6 +3171,11 @@ int32_t swd_probe_app_main(void* p) {
     furi_message_queue_free(app->event_queue);
     furi_mutex_free(app->gui_mutex);
     furi_mutex_free(app->swd_mutex);
+
+    // Reset GPIO pins to default state
+    for(int io = 0; io < 8; io++) {
+        furi_hal_gpio_init(gpios[io], GpioModeAnalog, GpioPullNo, GpioSpeedLow);
+    }
     free(app);
 
     furi_record_close(RECORD_GUI);

+ 2 - 6
swd_probe_app.h

@@ -1,5 +1,5 @@
-#ifndef __ARHA_FLIPPERAPP_DEMO
-#define __ARHA_FLIPPERAPP_DEMO
+#ifndef __SWD_PROBE_APP_H
+#define __SWD_PROBE_APP_H
 
 #include <stdint.h>
 #include <stdbool.h>
@@ -18,10 +18,6 @@
 #include <dolphin/dolphin.h>
 #include <notification/notification.h>
 #include <notification/notification_messages.h>
-#include <lib/subghz/receiver.h>
-#include <lib/subghz/transmitter.h>
-#include <lib/subghz/subghz_file_encoder_worker.h>
-#include <notification/notification.h>
 
 #include "usb_uart.h"
 

+ 0 - 1
swd_scripts/100us.swd

@@ -1 +0,0 @@
-swd_clock_delay 100

+ 0 - 6
swd_scripts/call_test_1.swd

@@ -1,6 +0,0 @@
-
-message 0 "gonna call call_test_2" dialog
-
-call call_test_2
-
-message 0 "back now" dialog

+ 0 - 7
swd_scripts/call_test_2.swd

@@ -1,7 +0,0 @@
-
-# first do a beeeeeep
-beep 1
-
-message 0 "Seems to work" dialog
-
-beep 0

+ 0 - 6
swd_scripts/dump_0x00000000_1k.swd

@@ -1,6 +0,0 @@
-ap_select 0
-max_tries 50
-block_size 4
-mem_dump /ext/swd/flash.bin 0x00000000 0x100000 2
-beep 1
-message 5 "Reading sucessful"

+ 0 - 6
swd_scripts/dump_0x00000000_4b.swd

@@ -1,6 +0,0 @@
-ap_select 0
-max_tries 50
-block_size 4
-mem_dump /ext/swd/flash.bin 0x00000000 0x100000 2
-beep 1
-message 5 "Reading sucessful"

+ 0 - 6
swd_scripts/dump_STM32.swd

@@ -1,6 +0,0 @@
-ap_select 0
-max_tries 50
-block_size 1024
-mem_dump /ext/swd/flash.bin 0x08000000 0x100000 2
-beep 1
-message 0 "Reading finished" dialog

+ 0 - 7
swd_scripts/goto_test.swd

@@ -1,7 +0,0 @@
-beep 1
-goto l2
-.label l1
-beep 0
-.label l2
-beep 1
-goto l1

+ 0 - 11
swd_scripts/halt.swd

@@ -1,11 +0,0 @@
-
-# make sure errors do not cause a script abort
-errors ignore
-
-message 0 "HAMMER TIME! Trying to halt CPU"
-ap_select 0
-
-# loop writing the halt bits
-.label l1
-mem_write 0xE000EDF0 0xA05F0003
-goto l1

+ 0 - 8
swd_scripts/reset.swd

@@ -1,8 +0,0 @@
-errors ignore
-status 0
-message 0 "HAMMER TIME! Try to halt the CPU"
-.label l1
-ap_select 0
-mem_write 0xE000EDF0 0xA05F0001
-mem_write 0xE000ED0C 0x05FA0004
-goto l1

+ 0 - 3
swd_scripts/test_write.swd

@@ -1,3 +0,0 @@
-mem_write 0x20002000 0xdeadbeef
-mem_write 0xE000EDF0 0xA05F0001
-mem_write 0xE000EDF0 0xA05F0007