diff --git a/.vscode/tasks.json b/.vscode/tasks.json index 86491abb4f89ee44b04a66ce5b067977ca36d809..580e8f8c308b006c74b0e1b59881045fd1d1634f 100755 --- a/.vscode/tasks.json +++ b/.vscode/tasks.json @@ -13,7 +13,7 @@ "label": "CLEAN", "type": "shell", "windows": { - "command": "sh sbs -c" + "command": "./sbs -c" }, "linux": { "command": "./sbs -c" @@ -32,13 +32,24 @@ "problemMatcher": "$gcc" }, { - "label": "BUILD current-entrypoint", + "label": "BUILD current-entrypoint DEBUG", "type": "shell", "windows": { - "command": "sh sbs -v -n -b ${fileBasenameNoExtension}" + "command": "./sbs -d -b ${fileBasenameNoExtension}" }, "linux": { - "command": "./sbs -v -b ${fileBasenameNoExtension}" + "command": "./sbs -d -b ${fileBasenameNoExtension}" + }, + "problemMatcher": "$gcc" + }, + { + "label": "BUILD current-entrypoint NO DEBUG", + "type": "shell", + "windows": { + "command": "./sbs -b ${fileBasenameNoExtension}" + }, + "linux": { + "command": "./sbs -b ${fileBasenameNoExtension}" }, "problemMatcher": "$gcc" }, @@ -46,7 +57,7 @@ "label": "RUN current-entrypoint", "type": "shell", "windows": { - "command": "ST-LINK_CLI.exe -P bin/${fileBasenameNoExtension}/${fileBasenameNoExtension}.bin 0x8000000 -V -Rst" + "command": "ST-LINK_CLI.exe -P build/${fileBasenameNoExtension}.bin 0x8000000 -V -Rst" }, "linux": { "command": "st-flash write bin/${fileBasenameNoExtension}/${fileBasenameNoExtension}.bin 0x8000000" @@ -54,18 +65,30 @@ "problemMatcher": [] }, { - "label": "BUILD+RUN current-entrypoint", + "label": "BUILD+RUN current-entrypoint DEBUG", "type": "shell", "windows": { - "command": "ST-LINK_CLI.exe -P bin/${fileBasenameNoExtension}/${fileBasenameNoExtension}.bin 0x8000000 -V -Rst" + "command": "./sbs -d -f ${fileBasenameNoExtension}" }, "linux": { - "command": "sleep 1;st-flash write bin/${fileBasenameNoExtension}/${fileBasenameNoExtension}.bin 0x8000000" + "command": "./sbs -d -f ${fileBasenameNoExtension}" + }, + "problemMatcher": [], + "group": { + "kind": "build", + "isDefault": true + } + }, + { + "label": "BUILD+RUN current-entrypoint NO DEBUG", + "type": "shell", + "windows": { + "command": "./sbs -f ${fileBasenameNoExtension}" + }, + "linux": { + "command": "./sbs -f ${fileBasenameNoExtension}" }, "problemMatcher": [], - "dependsOn": [ - "BUILD current-entrypoint" - ], "group": { "kind": "build", "isDefault": true @@ -106,6 +129,17 @@ "options": { "cwd": "/opt/arm-miosix-eabi/bin" } + }, + { + "label": "Open PuTTY 'skyward' session", + "type": "shell", + "windows": { + "command": "putty.exe -load skyward &" + }, + "linux": { + "command": "putty.exe -load skyward &" + }, + "problemMatcher": [] } ] } \ No newline at end of file diff --git a/sbs b/sbs index d23bb8720de90eee96e61191e89397ed78a0b3bf..ba00248e562ded47e757c3965004f43a18d3b84b 100755 --- a/sbs +++ b/sbs @@ -40,8 +40,10 @@ EOF } find_deps() { - command -v ccache &> /dev/null && config_ccache=true - command -v ninja &> /dev/null && config_ninja=true + command -v ccache &> /dev/null && config_ccache=true + command -v ninja &> /dev/null && config_ninja=true + command -v st-flash &> /dev/null && config_stflash=true + command -v ST-LINK_CLI.exe &> /dev/null && config_stlink=true } print_found_deps() { @@ -104,7 +106,16 @@ flash() { if build "$1"; then echo if [ -f "$build_dir/$1.bin" ]; then - st-flash --reset write "$build_dir/$1.bin" 0x08000000 + printf "Flashing software: "; + [ "$config_stflash" = true ] && echo "st-flash" || ([ "$config_stlink" = true ] && echo "st-link" || "no") + + if [ "$config_stflash" = true ]; then + st-flash --reset write "$build_dir/$1.bin" 0x08000000 + elif [ "$config_stlink" = true ]; then + ST-LINK_CLI.exe -P "$build_dir/$1.bin" 0x8000000 -V -Rst + else + echo "Error: No flashing software found!" + fi else echo "Error: target '$1' is not flashable" fi @@ -181,6 +192,8 @@ config_ccache=false config_debug=false config_verbose=false config_ninja=false +config_stflash=false +config_stlink=false build_jobs= find_deps