diff --git a/.gitignore b/.gitignore index 125dc536e..e1f694327 100644 --- a/.gitignore +++ b/.gitignore @@ -111,4 +111,5 @@ fpga_version_info.c #VSCode files !.vscode/templates/*.json -!.vscode/extensions.json \ No newline at end of file +!.vscode/extensions.json +!.vscode/tasks.json \ No newline at end of file diff --git a/.vscode/setup.sh b/.vscode/setup.sh index 1cfd3b9b6..1dc3b5237 100755 --- a/.vscode/setup.sh +++ b/.vscode/setup.sh @@ -21,7 +21,7 @@ ############################### #export SerialPort="COM5" #export DebuggerPath="${workspaceFolder}/../../msys2/mingw64/bin/gdb.exe" -#export JLinkServerPath="c/Program Files (x86)/SEGGER/JLink/JLinkGDBServerCL.exe" +#export JLinkServerPath="/c/Program Files (x86)/SEGGER/JLink/JLinkGDBServerCL.exe" #Debugging on 256KB systems is not recommended #This option does not override PLATFORM_SIZE @@ -59,6 +59,12 @@ function setup_gdb_linux { fi } +function setup_gdb_ps { + if [ -z "$DebuggerPath" ]; then + export DebuggerPath="${workspaceFolder}/../../msys2/mingw64/bin/gdb.exe" + fi +} + function setup_jlink_linux { if [ -z "$JLinkServerPath" ]; then export JLinkServerPath="/opt/SEGGER/JLink/JLinkGDBServerCLExe" @@ -75,7 +81,17 @@ function setup_jlink_wsl { export JLinkServerPath="/mnt/c/Program Files (x86)/SEGGER/JLink/JLinkGDBServerCL.exe" fi if [ ! -x "$JLinkServerPath" ]; then - echo >&2 "[!!] JLinkGDBServerCLExe not found, please set JLinkServerPath manually" + echo >&2 "[!!] JLinkGDBServerCL.exe not found, please set JLinkServerPath manually" + exit 1 + fi +} + +function setup_jlink_ps { + if [ -z "$JLinkServerPath" ]; then + export JLinkServerPath="/c/Program Files (x86)/SEGGER/JLink/JLinkGDBServerCL.exe" + fi + if [ ! -x "$JLinkServerPath" ]; then + echo >&2 "[!!] JLinkGDBServerCL.exe not found, please set JLinkServerPath manually" exit 1 fi } @@ -85,7 +101,6 @@ function setup_wsl { setup_gdb_linux setup_jlink_wsl print_config - cp "$VSCODEPATH/templates/tasks_wsl.json" "$VSCODEPATH/tasks.json" envsubst '${SerialPort} ${DebuggerPath} ${JLinkServerPath} ${DeviceMem}' <"$VSCODEPATH/templates/launch_wsl.json" > "$VSCODEPATH/launch.json" } @@ -94,26 +109,23 @@ function setup_linux { setup_gdb_linux setup_jlink_linux print_config - cp "$VSCODEPATH/templates/tasks_linux.json" "$VSCODEPATH/tasks.json" envsubst '${SerialPort} ${DebuggerPath} ${JLinkServerPath} ${DeviceMem}' <"$VSCODEPATH/templates/launch_linux.json" > "$VSCODEPATH/launch.json" } function setup_ps { setup_serial_port - if [ -z "$JLinkServerPath" ]; then - export JLinkServerPath="c/Program Files (x86)/SEGGER/JLink/JLinkGDBServerCL.exe" - fi + setup_gdb_ps + setup_jlink_ps print_config + envsubst '${SerialPort} ${DebuggerPath} ${JLinkServerPath} ${DeviceMem}' <"$VSCODEPATH/templates/launch_ps.json" > "$VSCODEPATH/launch.json" } -if [ -f "$VSCODEPATH/launch.json" ] || [ -f "$VSCODEPATH/tasks.json" ]; then +if [ -f "$VSCODEPATH/launch.json" ]; then read -p "Existing configuration found, do you want to override it? " -n 1 -r if [[ $REPLY =~ ^[Yy]$ ]] then rm "$VSCODEPATH/launch.json.bak" 2> /dev/null - rm "$VSCODEPATH/tasks.json.bak" 2> /dev/null mv "$VSCODEPATH/launch.json" "$VSCODEPATH/launch.json.bak" 2> /dev/null - mv "$VSCODEPATH/tasks.json" "$VSCODEPATH/tasks.json.bak" 2> /dev/null else echo >&2 "[!!] user abort" exit 1 diff --git a/.vscode/tasks.json b/.vscode/tasks.json new file mode 100644 index 000000000..463377982 --- /dev/null +++ b/.vscode/tasks.json @@ -0,0 +1,102 @@ +{ + // See https://go.microsoft.com/fwlink/?LinkId=733558 + // for the documentation about the tasks.json format + "version": "2.0.0", + "windows": { + "options": { + "cwd": "${workspaceFolder}", + "env": { + "PATH": "${workspaceFolder}/../../msys2/mingw64/bin;${workspaceFolder}/../../msys2/usr/local/bin;${workspaceFolder}/../../msys2/usr/bin;${workspaceFolder}/../../msys2/bin", + "MSYSTEM": "MINGW64" + } + } + }, + "tasks": [ + { + "label": "all: Make & run", + "type": "shell", + "command": "make -j && ./pm3", + "problemMatcher": [ + "$gcc" + ], + "group": { + "kind": "build", + "isDefault": true + } + }, + { + "label": "choose: Make", + "type": "shell", + "command": "make ${input:componentType} -j", + "problemMatcher": [ + "$gcc" + ], + "group": "build", + }, + { + "label": "client: Debug: make", + "type": "shell", + "command": "make client -j DEBUG=1", + "problemMatcher": [ + "$gcc" + ], + "group": "build", + }, + { + "label": "client: Debug: clean & make", + "type": "shell", + "command": "make client/clean && make client -j DEBUG=1", + "problemMatcher": [ + "$gcc" + ], + "group": "build", + }, + { + "label": "fullimage: Make & Flash", + "type": "shell", + "command": "make fullimage && ./pm3-flash-fullimage", + "problemMatcher": [] + }, + { + "label": "BOOTROM: Make & Flash", + "type": "shell", + "command": "make bootrom && ./pm3-flash-bootrom", + "problemMatcher": [] + }, + { + "label": "Run client", + "type": "shell", + "command": "./pm3", + "problemMatcher": [] + },{ + "label": "fullimage: clean & make debug", + "type": "shell", + "command": "make armsrc/clean && make armsrc/all SKIP_COMPRESSION=1 DEBUG=1", + "problemMatcher": [ + "$gcc" + ], + "group": "build", + } + ], + "inputs": [ + { + "type": "pickString", + "id": "componentType", + "description": "What Makefile target do you want to execute?", + "options": [ + "all", + "client", + "bootrom", + "fullimage", + "recovery", + "clean", + "install", + "uninstall", + "style", + "miscchecks", + "check", + ], + "default": "all" + } + ] +} \ No newline at end of file diff --git a/.vscode/templates/launch_linux.json b/.vscode/templates/launch_linux.json index 0f60495a6..5239c6bda 100644 --- a/.vscode/templates/launch_linux.json +++ b/.vscode/templates/launch_linux.json @@ -44,7 +44,7 @@ "type": "cortex-debug", "request": "launch", "cwd": "${workspaceRoot}", - "preLaunchTask": "fullimage: clean & make", + "preLaunchTask": "fullimage: clean & make debug", "executable": "${workspaceRoot}/armsrc/obj/fullimage.elf", "serverpath": "${JLinkServerPath}", "servertype": "jlink", diff --git a/.vscode/templates/launch_ps.json b/.vscode/templates/launch_ps.json index 8794ef76e..28b724f7b 100644 --- a/.vscode/templates/launch_ps.json +++ b/.vscode/templates/launch_ps.json @@ -3,6 +3,13 @@ // Hover to view descriptions of existing attributes. // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 "version": "0.2.0", + "options": { + "cwd": "${workspaceFolder}", + "env": { + "PATH": "${workspaceFolder}/../../msys2/mingw64/bin;${workspaceFolder}/../../msys2/usr/local/bin;${workspaceFolder}/../../msys2/usr/bin;${workspaceFolder}/../../msys2/bin", + "MSYSTEM": "MINGW64" + } + }, "configurations": [ { "name": "Client: (gdb) Build & Launch", @@ -11,10 +18,6 @@ "program": "${cwd}/client/proxmark3", "args": ["${SerialPort}"], "stopAtEntry": false, - "cwd": "${workspaceFolder}", - "environment": [ - "name": "PATH","value": "${workspaceFolder}/../../msys2/mingw64/bin;${workspaceFolder}/../../msys2/usr/local/bin;${workspaceFolder}/../../msys2/usr/bin;${workspaceFolder}/../../msys2/bin" - ], "externalConsole": true,//for ProxSpace externalConsole=true is required, because the internal cosole stops updating after a while "MIMode": "gdb", "setupCommands": [ diff --git a/.vscode/templates/launch_wsl.json b/.vscode/templates/launch_wsl.json index 0f60495a6..5239c6bda 100644 --- a/.vscode/templates/launch_wsl.json +++ b/.vscode/templates/launch_wsl.json @@ -44,7 +44,7 @@ "type": "cortex-debug", "request": "launch", "cwd": "${workspaceRoot}", - "preLaunchTask": "fullimage: clean & make", + "preLaunchTask": "fullimage: clean & make debug", "executable": "${workspaceRoot}/armsrc/obj/fullimage.elf", "serverpath": "${JLinkServerPath}", "servertype": "jlink", diff --git a/.vscode/templates/tasks_linux.json b/.vscode/templates/tasks_linux.json deleted file mode 100644 index 4cc21841d..000000000 --- a/.vscode/templates/tasks_linux.json +++ /dev/null @@ -1,177 +0,0 @@ -{ - // See https://go.microsoft.com/fwlink/?LinkId=733558 - // for the documentation about the tasks.json format - "version": "2.0.0", - "tasks": [ - { - "label": "all: Make & run", - "type": "shell", - "command": "make -j && ./pm3", - "windows": { - "options": { - "cwd": "${workspaceFolder}/../..", - "shell": { - "executable": "${workspaceFolder}/../../runme64.bat", - "args": [ - "-c \"cd ${workspaceFolderBasename} &&" - ], - - } - } - }, - "problemMatcher": [ - "$gcc" - ], - "group": { - "kind": "build", - "isDefault": true - } - }, - { - "label": "choose: Make", - "type": "shell", - "command": "make ${input:componentType} -j", - "windows": { - "options": { - "cwd": "${workspaceFolder}/../..", - "shell": { - "executable": "${workspaceFolder}/../../runme64.bat", - "args": [ - "-c \"cd ${workspaceFolderBasename} &&" - ], - - } - } - }, - "problemMatcher": [ - "$gcc" - ], - "group": "build", - }, - { - "label": "client: Debug: make", - "type": "shell", - "command": "make client -j DEBUG=1", - "windows": { - "options": { - "cwd": "${workspaceFolder}/../..", - "shell": { - "executable": "${workspaceFolder}/../../runme64.bat", - "args": [ - "-c \"cd ${workspaceFolderBasename} &&" - ], - - } - } - }, - "problemMatcher": [ - "$gcc" - ], - "group": "build", - }, - { - "label": "client: Debug: clean & make", - "type": "shell", - "command": "make client/clean && make client -j DEBUG=1", - "windows": { - "options": { - "cwd": "${workspaceFolder}/../..", - "shell": { - "executable": "${workspaceFolder}/../../runme64.bat", - "args": [ - "-c \"cd ${workspaceFolderBasename} &&" - ], - - } - } - }, - "problemMatcher": [ - "$gcc" - ], - "group": "build", - }, - { - "label": "fullimage: Make & Flash", - "type": "shell", - "command": "make fullimage && ./pm3-flash-fullimage", - "windows": { - "options": { - "cwd": "${workspaceFolder}/../..", - "shell": { - "executable": "${workspaceFolder}/../../runme64.bat", - "args": [ - "-c \"cd ${workspaceFolderBasename} &&" - ], - - } - } - }, - "problemMatcher": [] - }, - { - "label": "BOOTROM: Make & Flash", - "type": "shell", - "command": "make bootrom && ./pm3-flash-bootrom", - "windows": { - "options": { - "cwd": "${workspaceFolder}/../..", - "shell": { - "executable": "${workspaceFolder}/../../runme64.bat", - "args": [ - "-c \"cd ${workspaceFolderBasename} &&" - ], - - } - } - }, - "problemMatcher": [] - }, - { - "label": "Run client", - "type": "shell", - "command": "./pm3", - "windows": { - "options": { - "cwd": "${workspaceFolder}/../..", - "shell": { - "executable": "${workspaceFolder}/../../runme64.bat", - "args": [ - "-c \"cd ${workspaceFolderBasename} &&" - ], - - } - } - }, - "problemMatcher": [] - },{ - "label": "fullimage: clean & make", - "type": "shell", - "command": "make armsrc/clean && make armsrc/all SKIP_COMPRESSION=1 DEBUG=1", - "problemMatcher": [ - "$gcc" - ], - "group": "build", - } - ], - "inputs": [ - { - "type": "pickString", - "id": "componentType", - "description": "What Makefile target do you want to execute?", - "options": [ - "all", - "client", - "bootrom", - "fullimage", - "recovery", - "clean", - "install", - "uninstall", - "style", - "miscchecks", - "check", - ], - "default": "all" - } - ] -} \ No newline at end of file diff --git a/.vscode/templates/tasks_ps.json b/.vscode/templates/tasks_ps.json deleted file mode 100644 index 4cc21841d..000000000 --- a/.vscode/templates/tasks_ps.json +++ /dev/null @@ -1,177 +0,0 @@ -{ - // See https://go.microsoft.com/fwlink/?LinkId=733558 - // for the documentation about the tasks.json format - "version": "2.0.0", - "tasks": [ - { - "label": "all: Make & run", - "type": "shell", - "command": "make -j && ./pm3", - "windows": { - "options": { - "cwd": "${workspaceFolder}/../..", - "shell": { - "executable": "${workspaceFolder}/../../runme64.bat", - "args": [ - "-c \"cd ${workspaceFolderBasename} &&" - ], - - } - } - }, - "problemMatcher": [ - "$gcc" - ], - "group": { - "kind": "build", - "isDefault": true - } - }, - { - "label": "choose: Make", - "type": "shell", - "command": "make ${input:componentType} -j", - "windows": { - "options": { - "cwd": "${workspaceFolder}/../..", - "shell": { - "executable": "${workspaceFolder}/../../runme64.bat", - "args": [ - "-c \"cd ${workspaceFolderBasename} &&" - ], - - } - } - }, - "problemMatcher": [ - "$gcc" - ], - "group": "build", - }, - { - "label": "client: Debug: make", - "type": "shell", - "command": "make client -j DEBUG=1", - "windows": { - "options": { - "cwd": "${workspaceFolder}/../..", - "shell": { - "executable": "${workspaceFolder}/../../runme64.bat", - "args": [ - "-c \"cd ${workspaceFolderBasename} &&" - ], - - } - } - }, - "problemMatcher": [ - "$gcc" - ], - "group": "build", - }, - { - "label": "client: Debug: clean & make", - "type": "shell", - "command": "make client/clean && make client -j DEBUG=1", - "windows": { - "options": { - "cwd": "${workspaceFolder}/../..", - "shell": { - "executable": "${workspaceFolder}/../../runme64.bat", - "args": [ - "-c \"cd ${workspaceFolderBasename} &&" - ], - - } - } - }, - "problemMatcher": [ - "$gcc" - ], - "group": "build", - }, - { - "label": "fullimage: Make & Flash", - "type": "shell", - "command": "make fullimage && ./pm3-flash-fullimage", - "windows": { - "options": { - "cwd": "${workspaceFolder}/../..", - "shell": { - "executable": "${workspaceFolder}/../../runme64.bat", - "args": [ - "-c \"cd ${workspaceFolderBasename} &&" - ], - - } - } - }, - "problemMatcher": [] - }, - { - "label": "BOOTROM: Make & Flash", - "type": "shell", - "command": "make bootrom && ./pm3-flash-bootrom", - "windows": { - "options": { - "cwd": "${workspaceFolder}/../..", - "shell": { - "executable": "${workspaceFolder}/../../runme64.bat", - "args": [ - "-c \"cd ${workspaceFolderBasename} &&" - ], - - } - } - }, - "problemMatcher": [] - }, - { - "label": "Run client", - "type": "shell", - "command": "./pm3", - "windows": { - "options": { - "cwd": "${workspaceFolder}/../..", - "shell": { - "executable": "${workspaceFolder}/../../runme64.bat", - "args": [ - "-c \"cd ${workspaceFolderBasename} &&" - ], - - } - } - }, - "problemMatcher": [] - },{ - "label": "fullimage: clean & make", - "type": "shell", - "command": "make armsrc/clean && make armsrc/all SKIP_COMPRESSION=1 DEBUG=1", - "problemMatcher": [ - "$gcc" - ], - "group": "build", - } - ], - "inputs": [ - { - "type": "pickString", - "id": "componentType", - "description": "What Makefile target do you want to execute?", - "options": [ - "all", - "client", - "bootrom", - "fullimage", - "recovery", - "clean", - "install", - "uninstall", - "style", - "miscchecks", - "check", - ], - "default": "all" - } - ] -} \ No newline at end of file diff --git a/.vscode/templates/tasks_wsl.json b/.vscode/templates/tasks_wsl.json deleted file mode 100644 index 4cc21841d..000000000 --- a/.vscode/templates/tasks_wsl.json +++ /dev/null @@ -1,177 +0,0 @@ -{ - // See https://go.microsoft.com/fwlink/?LinkId=733558 - // for the documentation about the tasks.json format - "version": "2.0.0", - "tasks": [ - { - "label": "all: Make & run", - "type": "shell", - "command": "make -j && ./pm3", - "windows": { - "options": { - "cwd": "${workspaceFolder}/../..", - "shell": { - "executable": "${workspaceFolder}/../../runme64.bat", - "args": [ - "-c \"cd ${workspaceFolderBasename} &&" - ], - - } - } - }, - "problemMatcher": [ - "$gcc" - ], - "group": { - "kind": "build", - "isDefault": true - } - }, - { - "label": "choose: Make", - "type": "shell", - "command": "make ${input:componentType} -j", - "windows": { - "options": { - "cwd": "${workspaceFolder}/../..", - "shell": { - "executable": "${workspaceFolder}/../../runme64.bat", - "args": [ - "-c \"cd ${workspaceFolderBasename} &&" - ], - - } - } - }, - "problemMatcher": [ - "$gcc" - ], - "group": "build", - }, - { - "label": "client: Debug: make", - "type": "shell", - "command": "make client -j DEBUG=1", - "windows": { - "options": { - "cwd": "${workspaceFolder}/../..", - "shell": { - "executable": "${workspaceFolder}/../../runme64.bat", - "args": [ - "-c \"cd ${workspaceFolderBasename} &&" - ], - - } - } - }, - "problemMatcher": [ - "$gcc" - ], - "group": "build", - }, - { - "label": "client: Debug: clean & make", - "type": "shell", - "command": "make client/clean && make client -j DEBUG=1", - "windows": { - "options": { - "cwd": "${workspaceFolder}/../..", - "shell": { - "executable": "${workspaceFolder}/../../runme64.bat", - "args": [ - "-c \"cd ${workspaceFolderBasename} &&" - ], - - } - } - }, - "problemMatcher": [ - "$gcc" - ], - "group": "build", - }, - { - "label": "fullimage: Make & Flash", - "type": "shell", - "command": "make fullimage && ./pm3-flash-fullimage", - "windows": { - "options": { - "cwd": "${workspaceFolder}/../..", - "shell": { - "executable": "${workspaceFolder}/../../runme64.bat", - "args": [ - "-c \"cd ${workspaceFolderBasename} &&" - ], - - } - } - }, - "problemMatcher": [] - }, - { - "label": "BOOTROM: Make & Flash", - "type": "shell", - "command": "make bootrom && ./pm3-flash-bootrom", - "windows": { - "options": { - "cwd": "${workspaceFolder}/../..", - "shell": { - "executable": "${workspaceFolder}/../../runme64.bat", - "args": [ - "-c \"cd ${workspaceFolderBasename} &&" - ], - - } - } - }, - "problemMatcher": [] - }, - { - "label": "Run client", - "type": "shell", - "command": "./pm3", - "windows": { - "options": { - "cwd": "${workspaceFolder}/../..", - "shell": { - "executable": "${workspaceFolder}/../../runme64.bat", - "args": [ - "-c \"cd ${workspaceFolderBasename} &&" - ], - - } - } - }, - "problemMatcher": [] - },{ - "label": "fullimage: clean & make", - "type": "shell", - "command": "make armsrc/clean && make armsrc/all SKIP_COMPRESSION=1 DEBUG=1", - "problemMatcher": [ - "$gcc" - ], - "group": "build", - } - ], - "inputs": [ - { - "type": "pickString", - "id": "componentType", - "description": "What Makefile target do you want to execute?", - "options": [ - "all", - "client", - "bootrom", - "fullimage", - "recovery", - "clean", - "install", - "uninstall", - "style", - "miscchecks", - "check", - ], - "default": "all" - } - ] -} \ No newline at end of file