Updated PicoSDK template. Using compile commands instead of manual directory enumeration and macro definitions.
This commit is contained in:
parent
f3dba05939
commit
e58ff49233
|
|
@ -1,2 +1 @@
|
||||||
build
|
build
|
||||||
.vscode/ccls-cache
|
|
||||||
|
|
@ -0,0 +1,16 @@
|
||||||
|
{
|
||||||
|
"configurations": [
|
||||||
|
{
|
||||||
|
"name": "Linux",
|
||||||
|
"intelliSenseMode": "linux-gcc-arm",
|
||||||
|
"browse": {
|
||||||
|
"path": [
|
||||||
|
"${workspaceFolder}"
|
||||||
|
],
|
||||||
|
"limitSymbolsToIncludedHeaders": true
|
||||||
|
},
|
||||||
|
"compileCommands": "build/compile_commands.json"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"version": 4
|
||||||
|
}
|
||||||
|
|
@ -1,12 +1,62 @@
|
||||||
{
|
{
|
||||||
"version": "2.0.0",
|
"version": "2.0.0",
|
||||||
"tasks": [
|
"tasks": [
|
||||||
|
{
|
||||||
|
"label": "Configure",
|
||||||
|
"detail": "configure project",
|
||||||
|
"type": "shell",
|
||||||
|
"command": "cmake",
|
||||||
|
"args": [
|
||||||
|
"-H.",
|
||||||
|
"-Bbuild",
|
||||||
|
"-DCMAKE_EXPORT_COMPILE_COMMANDS=1"
|
||||||
|
],
|
||||||
|
"group": "build",
|
||||||
|
"presentation": {
|
||||||
|
"echo": true,
|
||||||
|
"reveal": "always",
|
||||||
|
"focus": true,
|
||||||
|
"panel": "shared",
|
||||||
|
"showReuseMessage": true,
|
||||||
|
"clear": true
|
||||||
|
}
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"label": "Build",
|
"label": "Build",
|
||||||
"detail": "Build project",
|
"detail": "Build project",
|
||||||
|
"dependsOn": [
|
||||||
|
"Configure"
|
||||||
|
],
|
||||||
"type": "shell",
|
"type": "shell",
|
||||||
"command": "cmake -H. -Bbuild -DCMAKE_EXPORT_COMPILE_COMMANDS=YES && make -j$(nproc) -C build",
|
"command": "make",
|
||||||
"args": [
|
"args": [
|
||||||
|
"-C",
|
||||||
|
"build",
|
||||||
|
"-j$(nproc)"
|
||||||
|
],
|
||||||
|
"group": "build",
|
||||||
|
"presentation": {
|
||||||
|
"echo": true,
|
||||||
|
"reveal": "always",
|
||||||
|
"focus": true,
|
||||||
|
"panel": "shared",
|
||||||
|
"showReuseMessage": true,
|
||||||
|
"clear": true
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"label": "Flash",
|
||||||
|
"detail": "Build and flash",
|
||||||
|
"type": "shell",
|
||||||
|
"dependsOn": [
|
||||||
|
"Configure"
|
||||||
|
],
|
||||||
|
"command": "make",
|
||||||
|
"args": [
|
||||||
|
"-C",
|
||||||
|
"build",
|
||||||
|
"-j$(nproc)",
|
||||||
|
"Flash"
|
||||||
],
|
],
|
||||||
"group": "build",
|
"group": "build",
|
||||||
"presentation": {
|
"presentation": {
|
||||||
|
|
@ -22,8 +72,10 @@
|
||||||
"label": "Clean",
|
"label": "Clean",
|
||||||
"detail": "Clean build directory and executable",
|
"detail": "Clean build directory and executable",
|
||||||
"type": "shell",
|
"type": "shell",
|
||||||
"command": "rm -rf build",
|
"command": "rm",
|
||||||
"args": [
|
"args": [
|
||||||
|
"-rf",
|
||||||
|
"build"
|
||||||
],
|
],
|
||||||
"group": "build",
|
"group": "build",
|
||||||
"presentation": {
|
"presentation": {
|
||||||
|
|
@ -34,24 +86,6 @@
|
||||||
"showReuseMessage": false,
|
"showReuseMessage": false,
|
||||||
"clear": true
|
"clear": true
|
||||||
}
|
}
|
||||||
},
|
|
||||||
{
|
|
||||||
"label": "Flash",
|
|
||||||
"detail": "Flash executable",
|
|
||||||
"type": "shell",
|
|
||||||
"dependsOn": "Build",
|
|
||||||
"command": "cd build && make Flash",
|
|
||||||
"args": [
|
|
||||||
],
|
|
||||||
"group": "build",
|
|
||||||
"presentation": {
|
|
||||||
"echo": true,
|
|
||||||
"reveal": "always",
|
|
||||||
"focus": true,
|
|
||||||
"panel": "shared",
|
|
||||||
"showReuseMessage": true,
|
|
||||||
"clear": true
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
@ -15,21 +15,22 @@ set(CMAKE_CXX_STANDARD 17)
|
||||||
|
|
||||||
pico_sdk_init()
|
pico_sdk_init()
|
||||||
|
|
||||||
add_executable(PicoSDKProject
|
add_executable(PicoSDKExec)
|
||||||
|
target_sources(PicoSDKExec PUBLIC
|
||||||
src/main.c
|
src/main.c
|
||||||
)
|
)
|
||||||
|
|
||||||
target_link_libraries(PicoSDKProject
|
target_link_libraries(PicoSDKExec
|
||||||
pico_stdlib
|
pico_stdlib
|
||||||
)
|
)
|
||||||
|
|
||||||
# Stdio configuration
|
# Stdio configuration
|
||||||
pico_enable_stdio_usb(PicoSDKProject 1)
|
pico_enable_stdio_usb(PicoSDKExec 1)
|
||||||
pico_enable_stdio_uart(PicoSDKProject 1)
|
pico_enable_stdio_uart(PicoSDKExec 1)
|
||||||
|
|
||||||
pico_add_extra_outputs(PicoSDKProject)
|
pico_add_extra_outputs(PicoSDKExec)
|
||||||
|
|
||||||
add_custom_target(Flash
|
add_custom_target(Flash
|
||||||
DEPENDS PicoSDKProject
|
DEPENDS PicoSDKExec
|
||||||
COMMAND picotool load -f ${PROJECT_BINARY_DIR}/PicoSDKProject.uf2
|
COMMAND picotool load -f ${PROJECT_BINARY_DIR}/PicoSDKExec.uf2
|
||||||
)
|
)
|
||||||
|
|
|
||||||
|
|
@ -1 +0,0 @@
|
||||||
build/compile_commands.json
|
|
||||||
Loading…
Reference in New Issue