Compare commits

..

No commits in common. "main" and "sdk130" have entirely different histories.
main ... sdk130

8 changed files with 24 additions and 99 deletions

View File

@ -21,17 +21,23 @@ if(FAMILY STREQUAL "rp2040")
option(PICO_NO_FLASH "Disable writing the compiled program to flash, and only load it to RAM. Useful for testing, but not much else (OFF by default)." OFF) option(PICO_NO_FLASH "Disable writing the compiled program to flash, and only load it to RAM. Useful for testing, but not much else (OFF by default)." OFF)
option(PICO_COPY_TO_RAM "Run all code in RAM, while the program is also stored on flash. On bootup, everything will be copied to RAM (OFF by default)." OFF) option(PICO_COPY_TO_RAM "Run all code in RAM, while the program is also stored on flash. On bootup, everything will be copied to RAM (OFF by default)." OFF)
include(pico_sdk_import.cmake) if (USE_SYSTEMWIDE_PICOSDK)
set(TOP "${PICO_SDK_PATH}/lib/tinyusb") set(TOP "$ENV{PICO_SDK_PATH}/lib/tinyusb")
get_filename_component(TOP "${TOP}" REALPATH) get_filename_component(TOP "${TOP}" REALPATH)
include(cmake/pico_sdk_import.cmake)
else()
set(PICO_SDK_PATH ${TOP}/hw/mcu/raspberrypi/pico-sdk)
include(${PICO_SDK_PATH}/pico_sdk_init.cmake)
endif()
include(${TOP}/hw/bsp/${FAMILY}/family.cmake) # tinyusb stuff include(${TOP}/hw/bsp/${FAMILY}/family.cmake) # tinyusb stuff
include(${TOP}/hw/bsp/family_support.cmake) # tinyusb stuff include(${TOP}/hw/bsp/family_support.cmake) # tinyusb stuff
family_get_project_name(PROJECT ${CMAKE_CURRENT_LIST_DIR}) family_get_project_name(PROJECT ${CMAKE_CURRENT_LIST_DIR})
#set(PROJECT DragonProbe) #set(PROJECT DragonProbe)
project(${PROJECT} C CXX ASM) project(${PROJECT})
#family_initialize_project(PROJECT ${CMAKE_CURRENT_LIST_DIR}) # calls pico_sdk_init() #family_initialize_project(PROJECT ${CMAKE_CURRENT_LIST_DIR}) # calls pico_sdk_init()
enable_language(C CXX ASM)
pico_sdk_init() pico_sdk_init()
#pico_set_program_name(${PROJECT} "${PROJECT}") #pico_set_program_name(${PROJECT} "${PROJECT}")

View File

@ -48,10 +48,8 @@ void cdc_uart_init(void) {
gpio_set_function(PINOUT_UART_TX, GPIO_FUNC_UART); gpio_set_function(PINOUT_UART_TX, GPIO_FUNC_UART);
gpio_set_function(PINOUT_UART_RX, GPIO_FUNC_UART); gpio_set_function(PINOUT_UART_RX, GPIO_FUNC_UART);
gpio_set_function(PINOUT_UART_CTS, GPIO_FUNC_SIO);
gpio_set_function(PINOUT_UART_RTS, GPIO_FUNC_SIO);
uart_init(PINOUT_UART_INTERFACE, lc_brate/*PINOUT_UART_BAUDRATE*/); uart_init(PINOUT_UART_INTERFACE, lc_brate/*PINOUT_UART_BAUDRATE*/);
//uart_set_hw_flow(PINOUT_UART_INTERFACE, hwflow, hwflow); uart_set_hw_flow(PINOUT_UART_INTERFACE, hwflow, hwflow);
uart_set_format(PINOUT_UART_INTERFACE, lc_data, lc_stop, lc_parity); uart_set_format(PINOUT_UART_INTERFACE, lc_data, lc_stop, lc_parity);
bi_decl(bi_2pins_with_func(PINOUT_UART_TX, PINOUT_UART_RX, GPIO_FUNC_UART)); bi_decl(bi_2pins_with_func(PINOUT_UART_TX, PINOUT_UART_RX, GPIO_FUNC_UART));
@ -60,8 +58,6 @@ void cdc_uart_deinit(void) {
uart_deinit(PINOUT_UART_INTERFACE); uart_deinit(PINOUT_UART_INTERFACE);
gpio_set_function(PINOUT_UART_TX, GPIO_FUNC_NULL); gpio_set_function(PINOUT_UART_TX, GPIO_FUNC_NULL);
gpio_set_function(PINOUT_UART_RX, GPIO_FUNC_NULL); gpio_set_function(PINOUT_UART_RX, GPIO_FUNC_NULL);
gpio_set_function(PINOUT_UART_CTS, GPIO_FUNC_NULL);
gpio_set_function(PINOUT_UART_RTS, GPIO_FUNC_NULL);
} }
void cdc_uart_task(void) { void cdc_uart_task(void) {
@ -94,8 +90,6 @@ bool cdc_uart_get_hwflow(void) {
bool cdc_uart_set_hwflow(bool enable) { bool cdc_uart_set_hwflow(bool enable) {
hwflow = enable; hwflow = enable;
//uart_set_hw_flow(PINOUT_UART_INTERFACE, enable, enable); //uart_set_hw_flow(PINOUT_UART_INTERFACE, enable, enable);
// TODO: CTS
gpio_put(PINOUT_UART_RTS, enable);
return true; return true;
} }

View File

@ -15,7 +15,7 @@
#define PINOUT_JTAG_TCK 2 // == SWCLK #define PINOUT_JTAG_TCK 2 // == SWCLK
#define PINOUT_JTAG_TMS 3 // == SWDIO #define PINOUT_JTAG_TMS 3 // == SWDIO
#define PINOUT_JTAG_TDI 4 #define PINOUT_JTAG_TDI 4
#define PINOUT_JTAG_TDO 5 // == SWO #define PINOUT_JTAG_TDO 5
#define PINOUT_JTAG_nTRST 6 #define PINOUT_JTAG_nTRST 6
#define PINOUT_JTAG_nRESET 7 #define PINOUT_JTAG_nRESET 7
#define PINOUT_JTAG_PIO_DEV pio0 #define PINOUT_JTAG_PIO_DEV pio0

View File

@ -86,18 +86,18 @@ PUBLIC sbw_tms_seq:
; alternatively, one could set the "load-bearing instruction" to a ; alternatively, one could set the "load-bearing instruction" to a
; "set pins, 0/1 side 1 [12]" for a fixed value useful for single sets/clears ; "set pins, 0/1 side 1 [12]" for a fixed value useful for single sets/clears
PUBLIC sbw_tclk_burst: PUBLIC sbw_tclk_burst:
set pindirs, 1 side 1 ; SBWTDIO is now output set pindirs, 1 side 1 ; SBWTDIO is now output
; tms slot: ; tms slot:
set pins, 0 side 1 ; stay in run-test/idle TAP state set pins, 0 side 1 ; stay in run-test/idle TAP state
nop side 0 ; target reads TMS at falling edge nop side 0 ; target reads TMS at falling edge
mov pins, y side 0 ; during low phase, prepare TCLK mov pins, y side 0 ; during low phase, prepare TCLK
; tdi slot: ; tdi slot:
nop side 1 [6] ; wait a bit nop side 1 [12] ; wait a bit
burst_loop: burst_loop:
;PUBLIC sbw_tclk_burst_loadbearing_insn: ;PUBLIC sbw_tclk_burst_loadbearing_insn:
out pins, 1 side 1 [6] ; in the middle of TDI hiphase: do TCLK out pins, 1 side 1 [12] ; in the middle of TDI hiphase: do TCLK
jmp x--, burst_loop side 1 [6] jmp x--, burst_loop side 1 [12]
nop side 0 [1] ; need a low clock edge for TDO nop side 0 [1] ; need a low clock edge for TDO
; tdo slot: ; tdo slot:
set pindirs, 0 side 1 [1] set pindirs, 0 side 1 [1]
nop side 0 [1] nop side 0 [1]

View File

@ -300,7 +300,7 @@ void sbw_clrset_tclk(bool value) {
void sbw_tclk_burst(uint32_t ncyc) { void sbw_tclk_burst(uint32_t ncyc) {
//sbw_pio_loadbearing_set_outpins(PINOUT_SBW_PIO); //sbw_pio_loadbearing_set_outpins(PINOUT_SBW_PIO);
uint32_t txremain = ((ncyc + 7) >> 3) * 2 - 1; uint32_t txremain = ((ncyc + 7) >> 3) * 2;
// MSB-first // MSB-first
uint8_t pattern = last_tclk ? 0x55 : 0xaa; uint8_t pattern = last_tclk ? 0x55 : 0xaa;

View File

@ -1,62 +0,0 @@
# This is a copy of <PICO_SDK_PATH>/external/pico_sdk_import.cmake
# This can be dropped into an external project to help locate this SDK
# It should be include()ed prior to project()
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}')")
endif ()
if (DEFINED ENV{PICO_SDK_FETCH_FROM_GIT} AND (NOT PICO_SDK_FETCH_FROM_GIT))
set(PICO_SDK_FETCH_FROM_GIT $ENV{PICO_SDK_FETCH_FROM_GIT})
message("Using PICO_SDK_FETCH_FROM_GIT from environment ('${PICO_SDK_FETCH_FROM_GIT}')")
endif ()
if (DEFINED ENV{PICO_SDK_FETCH_FROM_GIT_PATH} AND (NOT PICO_SDK_FETCH_FROM_GIT_PATH))
set(PICO_SDK_FETCH_FROM_GIT_PATH $ENV{PICO_SDK_FETCH_FROM_GIT_PATH})
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 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)
if (PICO_SDK_FETCH_FROM_GIT)
include(FetchContent)
set(FETCHCONTENT_BASE_DIR_SAVE ${FETCHCONTENT_BASE_DIR})
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
)
if (NOT 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
"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 ()
get_filename_component(PICO_SDK_PATH "${PICO_SDK_PATH}" REALPATH BASE_DIR "${CMAKE_BINARY_DIR}")
if (NOT EXISTS ${PICO_SDK_PATH})
message(FATAL_ERROR "Directory '${PICO_SDK_PATH}' not found")
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 Raspberry Pi Pico SDK")
endif ()
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

@ -469,16 +469,3 @@ struct mode m_01_default = {
}; };
// clang-format on // clang-format on
#if defined(DBOARD_HAS_UART)
// FIXME: use mode-specific callback here?
void tud_cdc_line_state_cb(uint8_t itf, bool dtr, bool rts) {
(void)dtr;
if (mode_current != &m_01_default) return;
if (itf == CDC_N_UART) {
cdc_uart_set_hwflow(rts);
}
}
#endif

View File

@ -51,14 +51,14 @@ extern "C" {
// Default to Highspeed for MCU with internal HighSpeed PHY (can be port specific), otherwise // Default to Highspeed for MCU with internal HighSpeed PHY (can be port specific), otherwise
// FullSpeed // FullSpeed
#ifndef BOARD_DEVICE_RHPORT_SPEED #ifndef BOARD_DEVICE_RHPORT_SPEED
/*#if (CFG_TUSB_MCU == OPT_MCU_LPC18XX || CFG_TUSB_MCU == OPT_MCU_LPC43XX || \ #if (CFG_TUSB_MCU == OPT_MCU_LPC18XX || CFG_TUSB_MCU == OPT_MCU_LPC43XX || \
CFG_TUSB_MCU == OPT_MCU_MIMXRT10XX || CFG_TUSB_MCU == OPT_MCU_NUC505 || \ CFG_TUSB_MCU == OPT_MCU_MIMXRT10XX || CFG_TUSB_MCU == OPT_MCU_NUC505 || \
CFG_TUSB_MCU == OPT_MCU_CXD56) \ CFG_TUSB_MCU == OPT_MCU_CXD56) \
#define BOARD_DEVICE_RHPORT_SPEED OPT_MODE_HIGH_SPEED #define BOARD_DEVICE_RHPORT_SPEED OPT_MODE_HIGH_SPEED
#else*/ #else
#define BOARD_DEVICE_RHPORT_SPEED OPT_MODE_FULL_SPEED #define BOARD_DEVICE_RHPORT_SPEED OPT_MODE_FULL_SPEED
//#endif #endif
#endif #endif
// Device mode with rhport and speed defined by board.mk // Device mode with rhport and speed defined by board.mk