Commit graph

34 commits

Author SHA1 Message Date
Álvaro Fernández Rojas b74af3b0d8 uart-bridge: restore clock speed
Apparently, some boards do not support setting a higher CPU clock:
https://github.com/Noltari/pico-uart-bridge/issues/11#issuecomment-2048104347

Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
2024-04-10 20:04:20 +02:00
Álvaro Fernández Rojas 2f05798e36 github: bump upload-artifact to v4
Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
2024-04-10 20:02:38 +02:00
Álvaro Fernández Rojas 2e3f10f756 github: bump checkout to v4
Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
2024-04-10 20:01:41 +02:00
Álvaro Fernández Rojas ca81e5c242
Merge pull request #15 from mgduda/use_memmove_fix
Switch from memcpy to memmove when copying within buffers
2023-01-31 19:25:12 +01:00
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
Álvaro Fernández Rojas 9d05ed4b1d uart-bridge: avoid CR/LF conversion
Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
2022-11-04 11:13:57 +01:00
Álvaro Fernández Rojas 3aa5d05fe3 Switch UART0 to GPIO 16 (TX) & GPIO 17 (RX)
Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
2022-11-04 11:08:49 +01:00
Álvaro Fernández Rojas 01e7831501 uart-bridge: add UART RX interrupts
Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
2022-11-04 11:00:31 +01:00
Álvaro Fernández Rojas 3e1672f2c9 Increase buffers and improve USB descriptors
Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
2022-11-04 10:59:54 +01:00
Álvaro Fernández Rojas 8db03b41ac Code cleanup
Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
2022-11-04 10:58:51 +01:00
Álvaro Fernández Rojas 71fd38df8a github: improve CI
Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
2022-11-04 09:19:25 +01:00
Álvaro Fernández Rojas d0925bfd33 pico-sdk: update to 1.4.0
Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
2022-11-04 09:19:25 +01:00
cxxcoder 6aa7cf2958 usb-descriptors: use flash ID as USB serial
Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
2022-11-04 09:19:03 +01:00
Álvaro Fernández Rojas 05e4815f6b uart-bridge: bump clock to 250 MHz
Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
2022-05-03 19:59:45 +02:00
Álvaro Fernández Rojas ebbc862b65 uart-bridge: increase BUFFER_SIZE
Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
2022-05-03 19:58:12 +02:00
Álvaro Fernández Rojas 71faf3097a build.sh: improve script
Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
2022-05-03 19:40:03 +02:00
Álvaro Fernández Rojas 982b071d6c github: update CI workflow
Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
2022-05-03 17:30:19 +02:00
Álvaro Fernández Rojas a7d61bb4c8 pico-sdk: update v1.3.0
Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
2022-05-03 14:42:23 +02:00
Álvaro Fernández Rojas 2460b10523 uart-bridge: usb_read_bytes: fix usb_buffer access
Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
2021-10-25 18:42:30 +02:00
Álvaro Fernández Rojas 7a8e3bf16c github: force Ubuntu 20.04
Apparently, ubuntu-latest still points to Ubuntu 18.04, which uses an older
and incompatible version of gcc-arm-none-eabi.

Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
2021-02-06 12:23:07 +01:00
Álvaro Fernández Rojas 206b612bae uart-bridge: improve usb_write_bytes
tud_cdc_n_write() may not be able to write the full buffer, so we need to
handle that by moving the remaining bytes in the buffer to the buffer start.

Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
2021-02-06 12:05:47 +01:00
Álvaro Fernández Rojas 7f8226a3a1 github: add CI
Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
2021-02-06 11:37:55 +01:00
Álvaro Fernández Rojas beb34da36d build: automatically checkout pico-sdk
Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
2021-02-06 11:27:34 +01:00
Álvaro Fernández Rojas 3f9c9fadde uart-bridge: add LC mutex
Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
2021-02-06 11:27:34 +01:00
Álvaro Fernández Rojas 8d9d952dde uart-bridge: remove unused variables
Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
2021-02-06 11:27:34 +01:00
Álvaro Fernández Rojas f2531be879 usb-descriptors: refactor code
Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
2021-02-06 11:27:34 +01:00
Álvaro Fernández Rojas b6c906e55e tusb_config: refactor code
Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
2021-02-06 11:27:34 +01:00
Álvaro Fernández Rojas a41adfcfdd Update README with multiple UARTs support
Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
2021-02-04 09:15:03 +01:00
Álvaro Fernández Rojas 410eef18ef uart-bridge: expose both HW UARTs
With these changes, both HW UARTs will be exposed as two independent USB-UART
bridge controllers.

Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
2021-02-04 09:08:41 +01:00
Álvaro Fernández Rojas 911bf03c80 uart-bridge: use DEF_BIT_RATE for CDC LC
Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
2021-02-04 09:03:46 +01:00
Álvaro Fernández Rojas 85383842d5 uart-bridge: code refactor
Avoid lines with more than 80 characters.
Fix indentation (tabs = 8 spaces).

Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
2021-02-03 15:45:04 +01:00
Álvaro Fernández Rojas f46d93bb54 uart-bridge: fix incorrect uart_parity_t usage
Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
2021-02-03 15:33:45 +01:00
Álvaro Fernández Rojas 7bac4bd99a uart-bridge: remove unneeded semicolon
Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
2021-02-03 15:29:50 +01:00
Álvaro Fernández Rojas 994eab59f5 Import project files
Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
2021-02-03 13:21:20 +01:00