cherry-pick some stuff from 9aaa7ff on haskal/mechanical-fixes
This commit is contained in:
parent
414c0dfdee
commit
a1c9327174
|
@ -1,2 +1,4 @@
|
||||||
cmake-build/
|
cmake-build/
|
||||||
|
build/
|
||||||
ex/
|
ex/
|
||||||
|
compile_commands.json
|
||||||
|
|
|
@ -84,8 +84,11 @@ target_include_directories(${PROJECT} PUBLIC
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/bsp/default/
|
${CMAKE_CURRENT_SOURCE_DIR}/bsp/default/
|
||||||
)
|
)
|
||||||
|
|
||||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall")
|
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra")
|
||||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall")
|
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")
|
if(FAMILY STREQUAL "rp2040")
|
||||||
target_link_libraries(${PROJECT} pico_stdlib pico_unique_id hardware_spi
|
target_link_libraries(${PROJECT} pico_stdlib pico_unique_id hardware_spi
|
||||||
|
|
|
@ -33,7 +33,7 @@ Compilation is done using CMake:
|
||||||
|
|
||||||
```
|
```
|
||||||
mkdir cmake-build && cd cmake-build
|
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,
|
`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:
|
Other options are:
|
||||||
* `-DPICO_NO_FLASH=[On|Off]`: store the binary in RAM only, useful for development.
|
* `-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
|
* `-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
|
## Usage
|
||||||
|
|
||||||
|
@ -231,8 +231,9 @@ libco is licensed under the [ISC license](https://opensource.org/licenses/ISC)
|
||||||
|
|
||||||
- [x] CMSIS-DAP JTAG implementation
|
- [x] CMSIS-DAP JTAG implementation
|
||||||
- [x] Flashrom/SPI support using Serprog
|
- [x] Flashrom/SPI support using Serprog
|
||||||
- [ ] Parallel ROM flashing support, too, by having the device switch into a
|
- Parallel ROM flashing support, too, by having the device switch into a
|
||||||
separate mode that temporarily disables all other IO protocols
|
separate mode that temporarily disables all other IO protocols
|
||||||
|
- Not enough IO, rip.
|
||||||
- [x] UART with CTS/RTS flow control
|
- [x] UART with CTS/RTS flow control
|
||||||
- [x] Needs configurable stuff as well, as some UART interfaces won't use this.
|
- [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
|
- [x] Debug interface to send printf stuff directly to USB, instead of having
|
||||||
|
|
2
dmctl.py
2
dmctl.py
|
@ -7,7 +7,7 @@ def auto_int(x):
|
||||||
return int(x, 0)
|
return int(x, 0)
|
||||||
|
|
||||||
class RTOpt(NamedTuple):
|
class RTOpt(NamedTuple):
|
||||||
type: bool
|
type: Callable[[Any], Any]
|
||||||
optid: int
|
optid: int
|
||||||
desc: str
|
desc: str
|
||||||
|
|
||||||
|
|
|
@ -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"
|
|
@ -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)
|
Loading…
Reference in New Issue