Compare commits
1 Commits
fix_debug
...
pipeline-p
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
1c36b52049 |
@@ -62,7 +62,6 @@ This information includes:
|
||||
/// a Cortex-M0+ processor with high-speed peripheral I/O only 1 processor cycle might be
|
||||
/// required.
|
||||
#define IO_PORT_WRITE_CYCLES 1U ///< I/O Cycles: 2=default, 1=Cortex-M0+ fast I/0.
|
||||
#define DELAY_SLOW_CYCLES 1U // We don't differentiate between fast/slow, we've got a 16-bit divisor for that
|
||||
|
||||
/// Indicate that Serial Wire Debug (SWD) communication mode is available at the Debug Access Port.
|
||||
/// This information is returned by the command \ref DAP_Info as part of <b>Capabilities</b>.
|
||||
@@ -95,7 +94,7 @@ This information includes:
|
||||
/// This configuration settings is used to optimize the communication performance with the
|
||||
/// debugger and depends on the USB peripheral. For devices with limited RAM or USB buffer the
|
||||
/// setting can be reduced (valid range is 1 .. 255).
|
||||
#define DAP_PACKET_COUNT 2U ///< Specifies number of packets buffered.
|
||||
#define DAP_PACKET_COUNT 3U ///< Specifies number of packets buffered.
|
||||
|
||||
/// Indicate that UART Serial Wire Output (SWO) trace is available.
|
||||
/// This information is returned by the command \ref DAP_Info as part of <b>Capabilities</b>.
|
||||
|
||||
39
src/main.c
39
src/main.c
@@ -32,20 +32,20 @@
|
||||
#include <string.h>
|
||||
|
||||
#include "bsp/board.h"
|
||||
#include "tusb.h"
|
||||
|
||||
#include "picoprobe_config.h"
|
||||
#include "probe.h"
|
||||
#include "tusb.h"
|
||||
#include "time.h"
|
||||
#include "cdc_uart.h"
|
||||
#include "get_serial.h"
|
||||
#include "led.h"
|
||||
#include "DAP.h"
|
||||
#include "DAP_config.h"
|
||||
|
||||
// UART0 for Picoprobe debug
|
||||
// UART1 for picoprobe to target device
|
||||
|
||||
static uint8_t TxDataBuffer[CFG_TUD_HID_EP_BUFSIZE];
|
||||
static uint8_t RxDataBuffer[CFG_TUD_HID_EP_BUFSIZE];
|
||||
static uint8_t TxDataBuffer[CFG_TUD_HID_EP_BUFSIZE * DAP_PACKET_COUNT];
|
||||
static uint8_t RxDataBuffer[CFG_TUD_HID_EP_BUFSIZE * DAP_PACKET_COUNT];
|
||||
|
||||
#define THREADED 1
|
||||
|
||||
@@ -66,16 +66,29 @@ void usb_thread(void *ptr)
|
||||
|
||||
void dap_thread(void *ptr)
|
||||
{
|
||||
uint32_t resp_len;
|
||||
uint32_t ret;
|
||||
int32_t packet_len;
|
||||
uint16_t req_len, resp_len;
|
||||
uint8_t *rx_ptr;
|
||||
|
||||
do {
|
||||
if (tud_vendor_available()) {
|
||||
tud_vendor_read(RxDataBuffer, sizeof(RxDataBuffer));
|
||||
resp_len = DAP_ProcessCommand(RxDataBuffer, TxDataBuffer);
|
||||
tud_vendor_write(TxDataBuffer, resp_len);
|
||||
} else {
|
||||
// Trivial delay to save power
|
||||
vTaskDelay(2);
|
||||
while (tud_vendor_available()) {
|
||||
rx_ptr = &RxDataBuffer[0];
|
||||
packet_len = tud_vendor_read(rx_ptr, sizeof(RxDataBuffer));
|
||||
picoprobe_debug("Got chunk %u\n", packet_len);
|
||||
do {
|
||||
ret = DAP_ProcessCommand(rx_ptr, TxDataBuffer);
|
||||
resp_len = ret & 0xffff;
|
||||
req_len = ret >> 16;
|
||||
tud_vendor_write(TxDataBuffer, resp_len);
|
||||
rx_ptr += req_len;
|
||||
packet_len -= req_len;
|
||||
picoprobe_debug("Packet decode remaining %u req %u resp %u\n",
|
||||
packet_len, req_len, resp_len);
|
||||
} while (packet_len > 0);
|
||||
}
|
||||
// Trivial delay to save power
|
||||
vTaskDelay(1);
|
||||
} while (1);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user