diff --git a/.gitignore b/.gitignore index 42bfd6f..26578c7 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,4 @@ cmake-build/ +build/ ex/ +compile_commands.json diff --git a/CMakeLists.txt b/CMakeLists.txt index c2dc03e..e277c70 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -84,8 +84,11 @@ target_include_directories(${PROJECT} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/bsp/default/ ) -set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall") -set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall") +set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra") +set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra") + +add_custom_target(fix_db ALL WORKING_DIRECTORY ${OUTPUT_DIR} + COMMAND "${CMAKE_CURRENT_SOURCE_DIR}/scripts/fix_clang_db.py") if(FAMILY STREQUAL "rp2040") target_link_libraries(${PROJECT} pico_stdlib pico_unique_id hardware_spi diff --git a/README.md b/README.md index 9f4445a..1692f80 100644 --- a/README.md +++ b/README.md @@ -33,7 +33,7 @@ Compilation is done using CMake: ``` mkdir cmake-build && cd cmake-build -cmake -DBOARD=raspberry_pi_pico -DFAMILIY=rp2040 -DCMAKE_BUILD_TYPE=RelWithDebInfo .. +cmake -DBOARD=raspberry_pi_pico -DFAMILY=rp2040 -DCMAKE_BUILD_TYPE=RelWithDebInfo .. ``` `BOARD` and `FAMILY` should correspond to those used in the TinyUSB `hw` folder, @@ -54,7 +54,7 @@ the `-DUSE_SYSTEMWIDE_PICOSDK=On` flag to CMake, too. Other options are: * `-DPICO_NO_FLASH=[On|Off]`: store the binary in RAM only, useful for development. * `-DPICO_COPY_TO_RAM=[On|Off]`: write to flash, but always run from RAM -* `-DUSE_USBCDC_FOR_STDIO=[On|Off]`: export an extra USB-CDC interface for debuggin +* `-DUSE_USBCDC_FOR_STDIO=[On|Off]`: export an extra USB-CDC interface for debugging ## Usage @@ -231,8 +231,9 @@ libco is licensed under the [ISC license](https://opensource.org/licenses/ISC) - [x] CMSIS-DAP JTAG implementation - [x] Flashrom/SPI support using Serprog - - [ ] Parallel ROM flashing support, too, by having the device switch into a - separate mode that temporarily disables all other IO protocols + - Parallel ROM flashing support, too, by having the device switch into a + separate mode that temporarily disables all other IO protocols + - Not enough IO, rip. - [x] UART with CTS/RTS flow control - [x] Needs configurable stuff as well, as some UART interfaces won't use this. - [x] Debug interface to send printf stuff directly to USB, instead of having diff --git a/dmctl.py b/dmctl.py index 6f85ce2..c29cadb 100755 --- a/dmctl.py +++ b/dmctl.py @@ -7,7 +7,7 @@ def auto_int(x): return int(x, 0) class RTOpt(NamedTuple): - type: bool + type: Callable[[Any], Any] optid: int desc: str diff --git a/scripts/configure_dev.sh b/scripts/configure_dev.sh new file mode 100755 index 0000000..e814bd3 --- /dev/null +++ b/scripts/configure_dev.sh @@ -0,0 +1,14 @@ +#!/bin/bash + +set -eo pipefail + +SCRIPTPATH="$(cd -- "$(dirname "$0")" >/dev/null 2>&1; pwd -P)" +SRCPATH=$(readlink -e "$SCRIPTPATH/..") +cd "$SRCPATH" +[ -d "cmake-build" ] || mkdir cmake-build +cd cmake-build + +set -x +exec cmake -G Ninja -DBOARD=raspberry_pi_pico -DFAMILY=rp2040 -DCMAKE_BUILD_TYPE=RelWithDebInfo \ + -DPICO_NO_FLASH=On -DUSE_USBCDC_FOR_STDIO=On -DUSE_SYSTEMWIDE_PICOSDK=On \ + "$SRCPATH" diff --git a/scripts/fix_clang_db.py b/scripts/fix_clang_db.py new file mode 100755 index 0000000..fb130fe --- /dev/null +++ b/scripts/fix_clang_db.py @@ -0,0 +1,16 @@ +#!/usr/bin/env python3 + +import json +import sys + +with open("compile_commands.json", "r") as f: + data = json.load(f) + +include = " -I/usr/arm-none-eabi/include" + +for i in range(len(data)): + if include not in data[i]["command"]: + data[i]["command"] += include + +with open("compile_commands.json", "w") as f: + json.dump(data, f)