Compare commits

...

7 Commits

Author SHA1 Message Date
marble
cfbf3b2d93 cdc_uart: add RTS and DTR pins 2023-04-03 16:15:17 +02:00
Jonathan Bell
156a33fa01 freeRTOS: shrink heap by half
A 128K reservation on a device with 256K of RAM is a bit demanding.
Shrink to fix a link error in a DebugRel build.
2023-02-27 14:06:22 +00:00
P33M
3bd58697e6 Merge pull request #69 from raspberrypi/enable_e15_fix
Default TUD_OPT_RP2040_USB_DEVICE_UFRAME_FIX=1
2023-02-22 15:52:36 +00:00
graham sanderson
599ee88582 Default TUD_OPT_RP2040_USB_DEVICE_UFRAME_FIX=1 2023-02-21 16:44:15 -06:00
Jonathan Bell
42d1ff28c8 Fix vendor interface semantics for tinyUSB >= 0.13
Explicit flushing of writes is now required.
2023-01-06 11:48:55 +00:00
P33M
fd445fd8c1 Merge pull request #13 from lurch/patch-1
Use latest upstream version of pico_sdk_import.cmake
2022-11-24 13:34:13 +00:00
Andrew Scheller
3e367acf66 Use latest upstream version of pico_sdk_import.cmake 2022-11-24 12:01:57 +00:00
6 changed files with 45 additions and 14 deletions

View File

@@ -3,8 +3,6 @@
# This can be dropped into an external project to help locate this SDK
# It should be include()ed prior to project()
# todo document
if (DEFINED ENV{PICO_SDK_PATH} AND (NOT PICO_SDK_PATH))
set(PICO_SDK_PATH $ENV{PICO_SDK_PATH})
message("Using PICO_SDK_PATH from environment ('${PICO_SDK_PATH}')")
@@ -20,8 +18,8 @@ if (DEFINED ENV{PICO_SDK_FETCH_FROM_GIT_PATH} AND (NOT PICO_SDK_FETCH_FROM_GIT_P
message("Using PICO_SDK_FETCH_FROM_GIT_PATH from environment ('${PICO_SDK_FETCH_FROM_GIT_PATH}')")
endif ()
set(PICO_SDK_PATH "${PICO_SDK_PATH}" CACHE PATH "Path to the PICO SDK")
set(PICO_SDK_FETCH_FROM_GIT "${PICO_SDK_FETCH_FROM_GIT}" CACHE BOOL "Set to ON to fetch copy of PICO SDK from git if not otherwise locatable")
set(PICO_SDK_PATH "${PICO_SDK_PATH}" CACHE PATH "Path to the Raspberry Pi Pico SDK")
set(PICO_SDK_FETCH_FROM_GIT "${PICO_SDK_FETCH_FROM_GIT}" CACHE BOOL "Set to ON to fetch copy of SDK from git if not otherwise locatable")
set(PICO_SDK_FETCH_FROM_GIT_PATH "${PICO_SDK_FETCH_FROM_GIT_PATH}" CACHE FILEPATH "location to download SDK")
if (NOT PICO_SDK_PATH)
@@ -31,20 +29,31 @@ if (NOT PICO_SDK_PATH)
if (PICO_SDK_FETCH_FROM_GIT_PATH)
get_filename_component(FETCHCONTENT_BASE_DIR "${PICO_SDK_FETCH_FROM_GIT_PATH}" REALPATH BASE_DIR "${CMAKE_SOURCE_DIR}")
endif ()
FetchContent_Declare(
pico_sdk
GIT_REPOSITORY https://github.com/raspberrypi/pico-sdk
GIT_TAG master
)
# GIT_SUBMODULES_RECURSE was added in 3.17
if (${CMAKE_VERSION} VERSION_GREATER_EQUAL "3.17.0")
FetchContent_Declare(
pico_sdk
GIT_REPOSITORY https://github.com/raspberrypi/pico-sdk
GIT_TAG master
GIT_SUBMODULES_RECURSE FALSE
)
else ()
FetchContent_Declare(
pico_sdk
GIT_REPOSITORY https://github.com/raspberrypi/pico-sdk
GIT_TAG master
)
endif ()
if (NOT pico_sdk)
message("Downloading PICO SDK")
message("Downloading Raspberry Pi Pico SDK")
FetchContent_Populate(pico_sdk)
set(PICO_SDK_PATH ${pico_sdk_SOURCE_DIR})
endif ()
set(FETCHCONTENT_BASE_DIR ${FETCHCONTENT_BASE_DIR_SAVE})
else ()
message(FATAL_ERROR
"PICO SDK location was not specified. Please set PICO_SDK_PATH or set PICO_SDK_FETCH_FROM_GIT to on to fetch from git."
"SDK location was not specified. Please set PICO_SDK_PATH or set PICO_SDK_FETCH_FROM_GIT to on to fetch from git."
)
endif ()
endif ()
@@ -56,9 +65,9 @@ endif ()
set(PICO_SDK_INIT_CMAKE_FILE ${PICO_SDK_PATH}/pico_sdk_init.cmake)
if (NOT EXISTS ${PICO_SDK_INIT_CMAKE_FILE})
message(FATAL_ERROR "Directory '${PICO_SDK_PATH}' does not appear to contain the PICO SDK")
message(FATAL_ERROR "Directory '${PICO_SDK_PATH}' does not appear to contain the Raspberry Pi Pico SDK")
endif ()
set(PICO_SDK_PATH ${PICO_SDK_PATH} CACHE PATH "Path to the PICO SDK" FORCE)
set(PICO_SDK_PATH ${PICO_SDK_PATH} CACHE PATH "Path to the Raspberry Pi Pico SDK" FORCE)
include(${PICO_SDK_INIT_CMAKE_FILE})

View File

@@ -71,7 +71,7 @@
/* Memory allocation related definitions. */
#define configSUPPORT_STATIC_ALLOCATION 0
#define configSUPPORT_DYNAMIC_ALLOCATION 1
#define configTOTAL_HEAP_SIZE (128*1024)
#define configTOTAL_HEAP_SIZE (64*1024)
#define configAPPLICATION_ALLOCATED_HEAP 0
/* Hook function related definitions. */

View File

@@ -43,6 +43,13 @@ void cdc_uart_init(void) {
gpio_set_pulls(PICOPROBE_UART_TX, 1, 0);
gpio_set_pulls(PICOPROBE_UART_RX, 1, 0);
uart_init(PICOPROBE_UART_INTERFACE, PICOPROBE_UART_BAUDRATE);
gpio_init(PICOPROBE_UART_DTR);
gpio_init(PICOPROBE_UART_RTS);
gpio_set_dir(PICOPROBE_UART_DTR, GPIO_OUT);
gpio_set_dir(PICOPROBE_UART_RTS, GPIO_OUT);
gpio_put(PICOPROBE_UART_DTR, 1);
gpio_put(PICOPROBE_UART_RTS, 1);
}
void cdc_task(void)
@@ -117,6 +124,9 @@ void tud_cdc_line_coding_cb(uint8_t itf, cdc_line_coding_t const* line_coding)
void tud_cdc_line_state_cb(uint8_t itf, bool dtr, bool rts)
{
gpio_put(PICOPROBE_UART_DTR, !dtr);
gpio_put(PICOPROBE_UART_RTS, !rts);
/* CDC drivers use linestate as a bodge to activate/deactivate the interface.
* Resume our UART polling on activate, stop on deactivate */
if (!dtr && !rts)

View File

@@ -64,6 +64,11 @@ void usb_thread(void *ptr)
} while (1);
}
// Workaround API change in 0.13
#if (TUSB_VERSION_MAJOR == 0) && (TUSB_VERSION_MINOR <= 12)
#define tud_vendor_flush(x) ((void)0)
#endif
void dap_thread(void *ptr)
{
uint32_t resp_len;
@@ -72,6 +77,7 @@ void dap_thread(void *ptr)
tud_vendor_read(RxDataBuffer, sizeof(RxDataBuffer));
resp_len = DAP_ProcessCommand(RxDataBuffer, TxDataBuffer);
tud_vendor_write(TxDataBuffer, resp_len);
tud_vendor_flush();
} else {
// Trivial delay to save power
vTaskDelay(2);

View File

@@ -58,6 +58,8 @@
// UART config
#define PICOPROBE_UART_TX 4
#define PICOPROBE_UART_RX 5
#define PICOPROBE_UART_RTS 7
#define PICOPROBE_UART_DTR 8
#define PICOPROBE_UART_INTERFACE uart1
#define PICOPROBE_UART_BAUDRATE 115200

View File

@@ -74,6 +74,10 @@
#define CFG_TUD_VENDOR_RX_BUFSIZE 8192
#define CFG_TUD_VENDOR_TX_BUFSIZE 8192
#ifndef TUD_OPT_RP2040_USB_DEVICE_UFRAME_FIX
#define TUD_OPT_RP2040_USB_DEVICE_UFRAME_FIX 1
#endif
#ifdef __cplusplus
}
#endif