mirror of
https://github.com/Noltari/pico-uart-bridge.git
synced 2024-12-28 18:26:05 +00:00
67ce07178f
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. |
||
---|---|---|
.github/workflows | ||
pico-sdk@2e6142b15b | ||
.gitignore | ||
.gitmodules | ||
build.sh | ||
CMakeLists.txt | ||
LICENSE.md | ||
README.md | ||
tusb_config.h | ||
uart-bridge.c | ||
usb-descriptors.c |
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 |