Raspberry Pi Pico UART-USB bridge
Find a file
Michael Duda 67ce07178f Switch from memcpy to memmove when copying within buffers
In the usb_write_bytes and uart_write_bytes routines, a memcpy was previously
used to copy untransmitted bytes to the beginning of the buffer (ud->uart_buffer
and ud->usb_buffer, respectively). Since the source and destination regions of
memory may potentially overlap, the use of memcpy may lead to undefined results.

From the draft C89 standard:

    4.11.2.1 The memcpy function

    Synopsis

             #include <string.h>
             void *memcpy(void *s1, const void *s2, size_t n);

    Description

       The memcpy function copies n characters from the object pointed to
    by s2 into the object pointed to by s1 .  If copying takes place
    between objects that overlap, the behavior is undefined.

    Returns

       The memcpy function returns the value of s1 .

By using memmove rather than memcpy in the usb_write_bytes and uart_write_bytes
routines, the potential for undefined behavior can be avoided.
2023-01-29 11:49:11 -07:00
.github/workflows github: improve CI 2022-11-04 09:19:25 +01:00
pico-sdk@2e6142b15b pico-sdk: update to 1.4.0 2022-11-04 09:19:25 +01:00
.gitignore Import project files 2021-02-03 13:21:20 +01:00
.gitmodules github: add CI 2021-02-06 11:37:55 +01:00
build.sh build.sh: improve script 2022-05-03 19:40:03 +02:00
CMakeLists.txt Code cleanup 2022-11-04 10:58:51 +01:00
LICENSE.md Import project files 2021-02-03 13:21:20 +01:00
README.md Switch UART0 to GPIO 16 (TX) & GPIO 17 (RX) 2022-11-04 11:08:49 +01:00
tusb_config.h Increase buffers and improve USB descriptors 2022-11-04 10:59:54 +01:00
uart-bridge.c Switch from memcpy to memmove when copying within buffers 2023-01-29 11:49:11 -07:00
usb-descriptors.c Increase buffers and improve USB descriptors 2022-11-04 10:59:54 +01:00

Raspberry Pi Pico USB-UART Bridge

This program bridges the Raspberry Pi Pico HW UARTs to two independent USB CDC serial devices in order to behave like any other USB-to-UART Bridge controllers.

Disclaimer

This software is provided without warranty, according to the MIT License, and should therefore not be used where it may endanger life, financial stakes, or cause discomfort and inconvenience to others.

Raspberry Pi Pico Pinout

Raspberry Pi Pico GPIO Function
GPIO16 (Pin 21) UART0 TX
GPIO17 (Pin 22) UART0 RX
GPIO4 (Pin 6) UART1 TX
GPIO5 (Pin 7) UART1 RX