Add option to not reset board on connect
[fw/stlink] / src / test_sg.c
index 899efc3a9dd3a25ac068554a32c6b0806be0aaf6..bc16a1c7c8815be48adf48d7107cff6d9c1f783c 100644 (file)
@@ -33,6 +33,8 @@ static void __attribute__((unused)) mark_buf(stlink_t *sl) {
 
 
 int main(int argc, char *argv[]) {
+       /* Avoid unused parameter warning */
+       (void)argv;
        // set scpi lib debug level: 0 for no debug info, 10 for lots
 
        switch (argc) {
@@ -50,7 +52,7 @@ int main(int argc, char *argv[]) {
         break;
        }
 
-       stlink_t *sl = stlink_v1_open(99);
+       stlink_t *sl = stlink_v1_open(99, 1);
        if (sl == NULL)
                return EXIT_FAILURE;
     
@@ -78,7 +80,7 @@ int main(int argc, char *argv[]) {
        stlink_read_mem32(sl, 0x4001100c, 4);
        DD(sl, "GPIOC_ODR = 0x%08x", read_uint32(sl->q_buf, 0));
 #endif
-#if 1
+#if 0
        // happy new year 2011: let blink all the leds
        // see "RM0041 Reference manual - STM32F100xx advanced ARM-based 32-bit MCUs"
 
@@ -169,13 +171,14 @@ int main(int argc, char *argv[]) {
        stlink_read_mem32(sl, 0x20000000, 1024 * 6);
        stlink_read_mem32(sl, 0x20000000 + 1024 * 6, 1024 * 2);
 #endif
-#if 0
-       stlink_read_all_regs(sl);
+#if 1
+    reg regs;
+       stlink_read_all_regs(sl, &regs);
        stlink_step(sl);
        fputs("++++++++++ write r0 = 0x12345678\n", stderr);
        stlink_write_reg(sl, 0x12345678, 0);
-       stlink_read_reg(sl, 0);
-       stlink_read_all_regs(sl);
+       stlink_read_reg(sl, 0, &regs);
+       stlink_read_all_regs(sl, &regs);
 #endif
 #if 0
        stlink_run(sl);