Sfoglia il codice sorgente

upd swd probe

fix by Willy-JL
MX 9 mesi fa
parent
commit
7ac35a162a
3 ha cambiato i file con 15 aggiunte e 12 eliminazioni
  1. 1 0
      adi.c
  2. 1 0
      swd_probe_app.c
  3. 13 12
      usb_uart.c

+ 1 - 0
adi.c

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

+ 1 - 0
swd_probe_app.c

@@ -961,6 +961,7 @@ static bool swd_scriptfunc_call(ScriptContext* ctx) {
             swd_script_log(ctx, FuriLogLevelError, "failed to parse filename");
             swd_script_log(ctx, FuriLogLevelError, "failed to parse filename");
             break;
             break;
         }
         }
+        furi_string_cat_printf(filepath, "/%s", filename);
 
 
         swd_script_seek_newline(ctx);
         swd_script_seek_newline(ctx);
         /* append extension */
         /* append extension */

+ 13 - 12
usb_uart.c

@@ -9,7 +9,7 @@
 #include <toolbox/api_lock.h>
 #include <toolbox/api_lock.h>
 #include "cli/cli.h"
 #include "cli/cli.h"
 
 
-#define USB_CDC_PKT_LEN CDC_DATA_SZ
+#define USB_CDC_PKT_LEN      CDC_DATA_SZ
 #define USB_UART_RX_BUF_SIZE (USB_CDC_PKT_LEN * 5)
 #define USB_UART_RX_BUF_SIZE (USB_CDC_PKT_LEN * 5)
 
 
 #define USB_CDC_BIT_DTR (1 << 0)
 #define USB_CDC_BIT_DTR (1 << 0)
@@ -48,21 +48,22 @@ static const CdcCallbacks cdc_cb = {
     .rx_ep_callback = &vcp_on_cdc_rx,
     .rx_ep_callback = &vcp_on_cdc_rx,
     .state_callback = &vcp_state_callback,
     .state_callback = &vcp_state_callback,
     .ctrl_line_callback = &vcp_on_cdc_control_line,
     .ctrl_line_callback = &vcp_on_cdc_control_line,
-    .config_callback = &vcp_on_line_config};
+    .config_callback = &vcp_on_line_config,
+};
 
 
 static void usb_uart_vcp_init(UsbUart* usb_uart, uint8_t vcp_ch) {
 static void usb_uart_vcp_init(UsbUart* usb_uart, uint8_t vcp_ch) {
     furi_hal_usb_unlock();
     furi_hal_usb_unlock();
 
 
-    Cli* cli = furi_record_open(RECORD_CLI);
-    cli_session_close(cli);
+    CliVcp* cli_vcp = furi_record_open(RECORD_CLI_VCP);
+    cli_vcp_disable(cli_vcp);
 
 
     if(vcp_ch == 0) {
     if(vcp_ch == 0) {
         furi_check(furi_hal_usb_set_config(&usb_cdc_single, NULL) == true);
         furi_check(furi_hal_usb_set_config(&usb_cdc_single, NULL) == true);
     } else {
     } else {
         furi_check(furi_hal_usb_set_config(&usb_cdc_dual, NULL) == true);
         furi_check(furi_hal_usb_set_config(&usb_cdc_dual, NULL) == true);
-        cli_session_open(cli, &cli_vcp);
+        cli_vcp_enable(cli_vcp);
     }
     }
-    furi_record_close(RECORD_CLI);
+    furi_record_close(RECORD_CLI_VCP);
     furi_hal_cdc_set_callbacks(vcp_ch, (CdcCallbacks*)&cdc_cb, usb_uart);
     furi_hal_cdc_set_callbacks(vcp_ch, (CdcCallbacks*)&cdc_cb, usb_uart);
 }
 }
 
 
@@ -70,9 +71,9 @@ static void usb_uart_vcp_deinit(UsbUart* usb_uart, uint8_t vcp_ch) {
     UNUSED(usb_uart);
     UNUSED(usb_uart);
     furi_hal_cdc_set_callbacks(vcp_ch, NULL, NULL);
     furi_hal_cdc_set_callbacks(vcp_ch, NULL, NULL);
     if(vcp_ch != 0) {
     if(vcp_ch != 0) {
-        Cli* cli = furi_record_open(RECORD_CLI);
-        cli_session_close(cli);
-        furi_record_close(RECORD_CLI);
+        CliVcp* cli_vcp = furi_record_open(RECORD_CLI_VCP);
+        cli_vcp_disable(cli_vcp);
+        furi_record_close(RECORD_CLI_VCP);
     }
     }
 }
 }
 
 
@@ -157,9 +158,9 @@ static int32_t usb_uart_worker(void* context) {
 
 
     furi_hal_usb_unlock();
     furi_hal_usb_unlock();
     furi_check(furi_hal_usb_set_config(&usb_cdc_single, NULL) == true);
     furi_check(furi_hal_usb_set_config(&usb_cdc_single, NULL) == true);
-    Cli* cli = furi_record_open(RECORD_CLI);
-    cli_session_open(cli, &cli_vcp);
-    furi_record_close(RECORD_CLI);
+    CliVcp* cli_vcp = furi_record_open(RECORD_CLI_VCP);
+    cli_vcp_enable(cli_vcp);
+    furi_record_close(RECORD_CLI_VCP);
 
 
     return 0;
     return 0;
 }
 }