mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2025-08-14 10:37:23 -07:00
commit
1aeb37e1b1
15 changed files with 464 additions and 165 deletions
5
.gitignore
vendored
5
.gitignore
vendored
|
@ -109,3 +109,8 @@ fpga_version_info.c
|
|||
|
||||
# .tmp files are created during compilation
|
||||
*.tmp
|
||||
|
||||
#VSCode files
|
||||
!.vscode/templates/*.json
|
||||
!.vscode/extensions.json
|
||||
!.vscode/tasks.json
|
10
.vscode/extensions.json
vendored
Normal file
10
.vscode/extensions.json
vendored
Normal file
|
@ -0,0 +1,10 @@
|
|||
{
|
||||
// See https://go.microsoft.com/fwlink/?LinkId=827846
|
||||
// for the documentation about the extensions.json format
|
||||
"recommendations": [
|
||||
"ms-vscode.cpptools",
|
||||
"austin.code-gnu-global",
|
||||
"marus25.cortex-debug",
|
||||
"augustocdias.tasks-shell-input"
|
||||
]
|
||||
}
|
145
.vscode/setup.sh
vendored
Executable file
145
.vscode/setup.sh
vendored
Executable file
|
@ -0,0 +1,145 @@
|
|||
#!/bin/bash
|
||||
###############################
|
||||
# Linux #
|
||||
# Uncomment to override #
|
||||
###############################
|
||||
#export SerialPort="/dev/ttyACM0"
|
||||
#export DebuggerPath="/usr/bin/gdb"
|
||||
#export JLinkServerPath="/opt/SEGGER/JLink/JLinkGDBServerCLExe"
|
||||
|
||||
###############################
|
||||
# WSL #
|
||||
# Uncomment to override #
|
||||
###############################
|
||||
#export SerialPort="/dev/ttyS4"
|
||||
#export DebuggerPath="/usr/bin/gdb"
|
||||
#export JLinkServerPath="/mnt/c/Program Files (x86)/SEGGER/JLink/JLinkGDBServerCL.exe"
|
||||
|
||||
###############################
|
||||
# ProxSpace #
|
||||
# Uncomment to override #
|
||||
###############################
|
||||
#export SerialPort="COM5"
|
||||
#export JLinkServerPath="C:/Program Files (x86)/SEGGER/JLink/JLinkGDBServerCL.exe"
|
||||
|
||||
#Debugging on 256KB systems is not recommended
|
||||
#This option does not override PLATFORM_SIZE
|
||||
export DeviceMem="512"
|
||||
|
||||
|
||||
VSCODEPATH=$(dirname "$0")
|
||||
|
||||
function print_config {
|
||||
echo "Updating with following configuration:"
|
||||
echo "SerialPort: $SerialPort"
|
||||
echo "DebuggerPath: $DebuggerPath"
|
||||
echo "JLinkServerPath: $JLinkServerPath"
|
||||
}
|
||||
|
||||
function setup_serial_port {
|
||||
if [ -z "$SerialPort" ]; then
|
||||
pm3list=$($VSCODEPATH/../pm3 --list 2>/dev/null)
|
||||
#Use first port listed
|
||||
export SerialPort=$(echo $pm3list | head -n 1 | cut -c 4-)
|
||||
if [ -z "$SerialPort" ]; then
|
||||
echo >&2 "[!!] No serial port found, please set SerialPort manually"
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
function setup_gdb_linux {
|
||||
if [ -z "$DebuggerPath" ]; then
|
||||
export DebuggerPath="/usr/bin/gdb"
|
||||
fi
|
||||
if [ ! -x "$DebuggerPath" ]; then
|
||||
echo >&2 "[!!] gdb not found, please set DebuggerPath manually"
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
function setup_jlink_linux {
|
||||
if [ -z "$JLinkServerPath" ]; then
|
||||
export JLinkServerPath="/opt/SEGGER/JLink/JLinkGDBServerCLExe"
|
||||
fi
|
||||
if [ ! -x "$JLinkServerPath" ]; then
|
||||
echo >&2 "[!!] JLinkGDBServerCLExe not found, please set JLinkServerPath manually"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
}
|
||||
|
||||
function setup_jlink_wsl {
|
||||
if [ -z "$JLinkServerPath" ]; then
|
||||
export JLinkServerPath="/mnt/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
|
||||
}
|
||||
|
||||
function setup_jlink_ps {
|
||||
if [ -z "$JLinkServerPath" ]; then
|
||||
export JLinkServerPath="c:/Program Files (x86)/SEGGER/JLink/JLinkGDBServerCL.exe"
|
||||
fi
|
||||
jlinkpath=$(cygpath "$JLinkServerPath")
|
||||
if [ ! -x "$jlinkpath" ]; then
|
||||
echo >&2 "[!!] JLinkGDBServerCL.exe not found, please set JLinkServerPath manually"
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
function setup_wsl {
|
||||
setup_serial_port
|
||||
setup_gdb_linux
|
||||
setup_jlink_wsl
|
||||
print_config
|
||||
envsubst '${SerialPort} ${DebuggerPath} ${JLinkServerPath} ${DeviceMem}' <"$VSCODEPATH/templates/launch_wsl.json" > "$VSCODEPATH/launch.json"
|
||||
}
|
||||
|
||||
function setup_linux {
|
||||
setup_serial_port
|
||||
setup_gdb_linux
|
||||
setup_jlink_linux
|
||||
print_config
|
||||
envsubst '${SerialPort} ${DebuggerPath} ${JLinkServerPath} ${DeviceMem}' <"$VSCODEPATH/templates/launch_linux.json" > "$VSCODEPATH/launch.json"
|
||||
}
|
||||
|
||||
function setup_ps {
|
||||
setup_serial_port
|
||||
setup_jlink_ps
|
||||
export DebuggerPath="Using ProxSpace gbd"
|
||||
print_config
|
||||
envsubst '${SerialPort} ${JLinkServerPath} ${DeviceMem}' <"$VSCODEPATH/templates/launch_ps.json" > "$VSCODEPATH/launch.json"
|
||||
}
|
||||
|
||||
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
|
||||
mv "$VSCODEPATH/launch.json" "$VSCODEPATH/launch.json.bak" 2> /dev/null
|
||||
else
|
||||
echo >&2 "[!!] user abort"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
fi
|
||||
|
||||
HOSTOS=$(uname | awk '{print toupper($0)}')
|
||||
if [ "$HOSTOS" = "LINUX" ]; then
|
||||
if uname -a|grep -q Microsoft; then
|
||||
setup_wsl
|
||||
else
|
||||
setup_linux
|
||||
fi
|
||||
elif [ "$HOSTOS" = "DARWIN" ]; then
|
||||
echo >&2 "[!!] MacOS not supported, sorry!"
|
||||
exit 1
|
||||
elif [[ "$HOSTOS" =~ MINGW(32|64)_NT* ]]; then
|
||||
setup_ps
|
||||
else
|
||||
echo >&2 "[!!] Host OS not recognized, abort: $HOSTOS"
|
||||
exit 1
|
||||
fi
|
101
.vscode/tasks.json
vendored
101
.vscode/tasks.json
vendored
|
@ -2,23 +2,20 @@
|
|||
// 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",
|
||||
"windows": {
|
||||
"options": {
|
||||
"cwd": "${workspaceFolder}/../..",
|
||||
"shell": {
|
||||
"executable": "${workspaceFolder}/../../runme64.bat",
|
||||
"args": [
|
||||
"-c \"cd ${workspaceFolderBasename} &&"
|
||||
],
|
||||
|
||||
}
|
||||
}
|
||||
},
|
||||
"problemMatcher": [
|
||||
"$gcc"
|
||||
],
|
||||
|
@ -31,18 +28,6 @@
|
|||
"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"
|
||||
],
|
||||
|
@ -52,18 +37,6 @@
|
|||
"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"
|
||||
],
|
||||
|
@ -73,18 +46,6 @@
|
|||
"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"
|
||||
],
|
||||
|
@ -94,55 +55,27 @@
|
|||
"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 debug",
|
||||
"type": "shell",
|
||||
"command": "make armsrc/clean && make armsrc/all DEBUG_ARM=1",
|
||||
"problemMatcher": [
|
||||
"$gcc"
|
||||
],
|
||||
"group": "build",
|
||||
}
|
||||
],
|
||||
"inputs": [
|
||||
|
|
|
@ -5,34 +5,11 @@
|
|||
"version": "0.2.0",
|
||||
"configurations": [
|
||||
{
|
||||
"name": "(gdb) Attach",
|
||||
"type": "cppdbg",
|
||||
"request": "attach",
|
||||
"program": "${cwd}/client/proxmark3",
|
||||
//"processId": "${command:pickProcess}",
|
||||
"processId": "${input:ProcessID}",
|
||||
"MIMode": "gdb",
|
||||
"setupCommands": [
|
||||
{
|
||||
"description": "Enable pretty-printing for gdb",
|
||||
"text": "-enable-pretty-printing",
|
||||
"ignoreFailures": true
|
||||
}
|
||||
],
|
||||
"windows": {
|
||||
"processId": "${input:ProcessIDWindows}",
|
||||
"miDebuggerPath": "${workspaceFolder}/../../msys2/mingw64/bin/gdb.exe",
|
||||
"externalConsole": true,//for ProxSpace externalConsole=true is required, because the internal cosole stops updating after a while
|
||||
"environment": [{
|
||||
"name": "PATH","value": "${workspaceFolder}/../../msys2/mingw64/bin;${workspaceFolder}/../../msys2/usr/local/bin;${workspaceFolder}/../../msys2/usr/bin;${workspaceFolder}/../../msys2/bin"
|
||||
}]
|
||||
}
|
||||
},{
|
||||
"name": "(gdb) Build & Launch",
|
||||
"name": "Client: (gdb) Build & Launch",
|
||||
"type": "cppdbg",
|
||||
"request": "launch",
|
||||
"program": "${cwd}/client/proxmark3",
|
||||
"args": ["/dev/ttyACM0"],
|
||||
"args": ["${SerialPort}"],
|
||||
"stopAtEntry": false,
|
||||
"cwd": "${workspaceFolder}",
|
||||
"environment": [],
|
||||
|
@ -46,15 +23,36 @@
|
|||
}
|
||||
],
|
||||
"preLaunchTask": "client: Debug: clean & make",
|
||||
"miDebuggerPath": "/usr/bin/gdb",
|
||||
"windows": {
|
||||
"args": ["COM5"],
|
||||
"miDebuggerPath": "${workspaceFolder}/../../msys2/mingw64/bin/gdb.exe",
|
||||
"externalConsole": true,//for ProxSpace externalConsole=true is required, because the internal cosole stops updating after a while
|
||||
"environment": [{
|
||||
"name": "PATH","value": "${workspaceFolder}/../../msys2/mingw64/bin;${workspaceFolder}/../../msys2/usr/local/bin;${workspaceFolder}/../../msys2/usr/bin;${workspaceFolder}/../../msys2/bin"
|
||||
}]
|
||||
}
|
||||
"miDebuggerPath": "${DebuggerPath}"
|
||||
},{
|
||||
"name": "Client: (gdb) Attach",
|
||||
"type": "cppdbg",
|
||||
"request": "attach",
|
||||
"program": "${cwd}/client/proxmark3",
|
||||
//"processId": "${command:pickProcess}",
|
||||
"processId": "${input:ProcessID}",
|
||||
"MIMode": "gdb",
|
||||
"setupCommands": [
|
||||
{
|
||||
"description": "Enable pretty-printing for gdb",
|
||||
"text": "-enable-pretty-printing",
|
||||
"ignoreFailures": true
|
||||
}
|
||||
]
|
||||
},{
|
||||
"name": "Firmware: (J-Link) Build & Launch",
|
||||
"type": "cortex-debug",
|
||||
"request": "launch",
|
||||
"cwd": "${workspaceRoot}",
|
||||
"preLaunchTask": "fullimage: clean & make debug",
|
||||
"executable": "${workspaceRoot}/armsrc/obj/fullimage.elf",
|
||||
"serverpath": "${JLinkServerPath}",
|
||||
"servertype": "jlink",
|
||||
"device": "AT91SAM7S${DeviceMem}",
|
||||
"interface": "jtag",
|
||||
"serialNumber": "", //If you have more than one J-Link probe, add the serial number here.
|
||||
"runToMain": false,
|
||||
"armToolchainPath": "/usr/bin/"
|
||||
}
|
||||
],
|
||||
"inputs": [
|
||||
|
@ -67,14 +65,6 @@
|
|||
"command": "pgrep -n proxmark3",
|
||||
}
|
||||
|
||||
},{
|
||||
"id": "ProcessIDWindows",
|
||||
"type": "command",
|
||||
"command": "shellCommand.execute",
|
||||
"args": {
|
||||
"command": "${workspaceFolder}/../../runme64.bat -c \"cat /proc/$(pgrep -n proxmark3)/winpid\"",
|
||||
}
|
||||
|
||||
}
|
||||
]
|
||||
}
|
49
.vscode/templates/launch_ps.json
vendored
Normal file
49
.vscode/templates/launch_ps.json
vendored
Normal file
|
@ -0,0 +1,49 @@
|
|||
{
|
||||
// Use IntelliSense to learn about possible attributes.
|
||||
// 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",
|
||||
"type": "cppdbg",
|
||||
"request": "launch",
|
||||
"cwd": "${workspaceFolder}",
|
||||
"program": "${cwd}/client/proxmark3",
|
||||
"args": ["${SerialPort}"],
|
||||
"stopAtEntry": false,
|
||||
"externalConsole": true,//for ProxSpace externalConsole=true is required, because the internal cosole stops updating after a while
|
||||
"MIMode": "gdb",
|
||||
"setupCommands": [
|
||||
{
|
||||
"description": "Enable pretty-printing for gdb",
|
||||
"text": "-enable-pretty-printing",
|
||||
"ignoreFailures": true
|
||||
}
|
||||
],
|
||||
"preLaunchTask": "client: Debug: clean & make",
|
||||
"miDebuggerPath": "${workspaceFolder}/../../msys2/mingw64/bin/gdb.exe"
|
||||
},{
|
||||
"name": "Firmware: (J-Link) Build & Launch",
|
||||
"type": "cortex-debug",
|
||||
"request": "launch",
|
||||
"cwd": "${workspaceRoot}",
|
||||
"preLaunchTask": "fullimage: clean & make debug",
|
||||
"executable": "${workspaceRoot}/armsrc/obj/fullimage.elf",
|
||||
"serverpath": "${JLinkServerPath}",
|
||||
"servertype": "jlink",
|
||||
"device": "AT91SAM7S${DeviceMem}",
|
||||
"interface": "jtag",
|
||||
"serialNumber": "", //If you have more than one J-Link probe, add the serial number here.
|
||||
"runToMain": false,
|
||||
"armToolchainPath": "${workspaceFolder}/../../msys2/mingw64/bin"
|
||||
}
|
||||
]
|
||||
}
|
70
.vscode/templates/launch_wsl.json
vendored
Normal file
70
.vscode/templates/launch_wsl.json
vendored
Normal file
|
@ -0,0 +1,70 @@
|
|||
{
|
||||
// Use IntelliSense to learn about possible attributes.
|
||||
// Hover to view descriptions of existing attributes.
|
||||
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
|
||||
"version": "0.2.0",
|
||||
"configurations": [
|
||||
{
|
||||
"name": "Client: (gdb) Build & Launch",
|
||||
"type": "cppdbg",
|
||||
"request": "launch",
|
||||
"program": "${cwd}/client/proxmark3",
|
||||
"args": ["${SerialPort}"],
|
||||
"stopAtEntry": false,
|
||||
"cwd": "${workspaceFolder}",
|
||||
"environment": [],
|
||||
"externalConsole": false,
|
||||
"MIMode": "gdb",
|
||||
"setupCommands": [
|
||||
{
|
||||
"description": "Enable pretty-printing for gdb",
|
||||
"text": "-enable-pretty-printing",
|
||||
"ignoreFailures": true
|
||||
}
|
||||
],
|
||||
"preLaunchTask": "client: Debug: clean & make",
|
||||
"miDebuggerPath": "${DebuggerPath}"
|
||||
},{
|
||||
"name": "Client: (gdb) Attach",
|
||||
"type": "cppdbg",
|
||||
"request": "attach",
|
||||
"program": "${cwd}/client/proxmark3",
|
||||
//"processId": "${command:pickProcess}",
|
||||
"processId": "${input:ProcessID}",
|
||||
"MIMode": "gdb",
|
||||
"setupCommands": [
|
||||
{
|
||||
"description": "Enable pretty-printing for gdb",
|
||||
"text": "-enable-pretty-printing",
|
||||
"ignoreFailures": true
|
||||
}
|
||||
]
|
||||
},{
|
||||
"name": "Firmware: (J-Link) Build & Launch",
|
||||
"type": "cortex-debug",
|
||||
"request": "launch",
|
||||
"cwd": "${workspaceRoot}",
|
||||
"preLaunchTask": "fullimage: clean & make debug",
|
||||
"executable": "${workspaceRoot}/armsrc/obj/fullimage.elf",
|
||||
"serverpath": "${JLinkServerPath}",
|
||||
"servertype": "jlink",
|
||||
"device": "AT91SAM7S${DeviceMem}",
|
||||
"interface": "jtag",
|
||||
"serialNumber": "", //If you have more than one J-Link probe, add the serial number here.
|
||||
"runToMain": false,
|
||||
"armToolchainPath": "/usr/bin/"
|
||||
}
|
||||
],
|
||||
"inputs": [
|
||||
{
|
||||
// Using Extension "Tasks Shell Input" https://marketplace.visualstudio.com/items?itemName=augustocdias.tasks-shell-input
|
||||
"id": "ProcessID",
|
||||
"type": "command",
|
||||
"command": "shellCommand.execute",
|
||||
"args": {
|
||||
"command": "pgrep -n proxmark3",
|
||||
}
|
||||
|
||||
}
|
||||
]
|
||||
}
|
|
@ -66,6 +66,11 @@ else
|
|||
DEFCFLAGS = -Wall -Werror -O3 -fstrict-aliasing -pipe
|
||||
DEFLDFLAGS =
|
||||
endif
|
||||
|
||||
ifeq ($(DEBUG_ARM),1)
|
||||
APP_CFLAGS += -g
|
||||
SKIP_COMPRESSION=1
|
||||
endif
|
||||
# Next ones are activated only if SANITIZE=1
|
||||
ifeq ($(SANITIZE),1)
|
||||
DEFCFLAGS += -g -fsanitize=address -fno-omit-frame-pointer
|
||||
|
|
|
@ -217,8 +217,12 @@ $(OBJDIR)/fullimage.data.o: $(OBJDIR)/fullimage.data.bin.z
|
|||
$(Q)$(OBJCOPY) -O elf32-littlearm -I binary -B arm --rename-section .data=compressed_data $^ $@
|
||||
|
||||
$(OBJDIR)/fullimage.elf: $(OBJDIR)/fullimage.nodata.o $(OBJDIR)/fullimage.data.o
|
||||
ifeq (,$(findstring WITH_NO_COMPRESSION,$(APP_CFLAGS)))
|
||||
$(info [=] LD $@)
|
||||
$(Q)$(CC) $(CROSS_LDFLAGS) -Wl,-T,ldscript,-e,_osimage_entry,-Map,$(patsubst %.elf,%.map,$@) -o $@ $^
|
||||
else
|
||||
$(Q)$(CP) $(OBJDIR)/fullimage.stage1.elf $@
|
||||
endif
|
||||
|
||||
tarbin: $(OBJS)
|
||||
$(info TAR $@)
|
||||
|
|
|
@ -257,6 +257,9 @@ void ReadMem(int addr) {
|
|||
/* osimage version information is linked in, cf commonutil.h */
|
||||
/* bootrom version information is pointed to from _bootphase1_version_pointer */
|
||||
extern char *_bootphase1_version_pointer, _flash_start, _flash_end, __data_src_start__;
|
||||
#ifdef WITH_NO_COMPRESSION
|
||||
extern char *_bootrom_end, _bootrom_start, __os_size__;
|
||||
#endif
|
||||
static void SendVersion(void) {
|
||||
char temp[PM3_CMD_DATA_SIZE - 12]; /* Limited data payload in USB packets */
|
||||
char VersionString[PM3_CMD_DATA_SIZE - 12] = { '\0' };
|
||||
|
@ -295,9 +298,11 @@ static void SendVersion(void) {
|
|||
strncat(VersionString, "\n ", sizeof(VersionString) - strlen(VersionString) - 1);
|
||||
}
|
||||
}
|
||||
#ifndef WITH_NO_COMPRESSION
|
||||
// Send Chip ID and used flash memory
|
||||
uint32_t text_and_rodata_section_size = (uint32_t)&__data_src_start__ - (uint32_t)&_flash_start;
|
||||
uint32_t compressed_data_section_size = common_area.arg1;
|
||||
#endif
|
||||
|
||||
struct p {
|
||||
uint32_t id;
|
||||
|
@ -308,7 +313,11 @@ static void SendVersion(void) {
|
|||
|
||||
struct p payload;
|
||||
payload.id = *(AT91C_DBGU_CIDR);
|
||||
payload.section_size = text_and_rodata_section_size + compressed_data_section_size;
|
||||
#ifdef WITH_NO_COMPRESSION
|
||||
payload.section_size = (uint32_t)&_bootrom_end - (uint32_t)&_bootrom_start + (uint32_t)&__os_size__;
|
||||
#else
|
||||
payload.section_size = text_and_rodata_section_size + compressed_data_section_size;
|
||||
#endif
|
||||
payload.versionstr_len = strlen(VersionString) + 1;
|
||||
memcpy(payload.versionstr, VersionString, payload.versionstr_len);
|
||||
|
||||
|
|
|
@ -14,14 +14,16 @@
|
|||
|
||||
#include "proxmark3_arm.h"
|
||||
#include "appmain.h"
|
||||
#ifndef WITH_NO_COMPRESSION
|
||||
#include "lz4.h"
|
||||
#endif
|
||||
#include "BigBuf.h"
|
||||
#include "string.h"
|
||||
|
||||
extern struct common_area common_area;
|
||||
extern char __data_src_start__, __data_start__, __data_end__, __bss_start__, __bss_end__;
|
||||
|
||||
|
||||
#ifndef WITH_NO_COMPRESSION
|
||||
static void uncompress_data_section(void) {
|
||||
int avail_in;
|
||||
memcpy(&avail_in, &__data_src_start__, sizeof(int));
|
||||
|
@ -35,6 +37,7 @@ static void uncompress_data_section(void) {
|
|||
// save the size of the compressed data section
|
||||
common_area.arg1 = avail_in;
|
||||
}
|
||||
#endif
|
||||
|
||||
void __attribute__((section(".startos"))) Vector(void);
|
||||
void Vector(void) {
|
||||
|
@ -47,12 +50,23 @@ void Vector(void) {
|
|||
common_area.version = 1;
|
||||
}
|
||||
common_area.flags.osimage_present = 1;
|
||||
|
||||
uncompress_data_section();
|
||||
|
||||
#ifdef WITH_NO_COMPRESSION
|
||||
/* Set up data segment: Copy from flash to ram */
|
||||
char *src = &__data_src_start__;
|
||||
char *dst = &__data_start__;
|
||||
char *end = &__data_end__;
|
||||
while(dst < end) *dst++ = *src++;
|
||||
dst = &__bss_start__;
|
||||
end = &__bss_end__;
|
||||
#else
|
||||
uncompress_data_section();
|
||||
|
||||
/* Set up (that is: clear) BSS. */
|
||||
char *dst = &__bss_start__;
|
||||
char *end = &__bss_end__;
|
||||
#endif
|
||||
|
||||
while (dst < end) *dst++ = 0;
|
||||
|
||||
AppMain();
|
||||
|
|
|
@ -137,6 +137,9 @@ endif
|
|||
ifneq ($(SKIP_HFPLOT),1)
|
||||
PLATFORM_DEFS += -DWITH_HFPLOT
|
||||
endif
|
||||
ifeq ($(SKIP_COMPRESSION),1)
|
||||
PLATFORM_DEFS += -DWITH_NO_COMPRESSION
|
||||
endif
|
||||
|
||||
# Standalone mode
|
||||
ifneq ($(strip $(filter $(PLATFORM_DEFS),$(STANDALONE_REQ_DEFS))),$(strip $(STANDALONE_REQ_DEFS)))
|
||||
|
|
|
@ -0,0 +1,72 @@
|
|||
# Visual Studio Code for debugging
|
||||
|
||||
Download and install [Visual Studio Code](https://code.visualstudio.com/)
|
||||
|
||||
Download and install [J-Link Software and Documentation pack](https://www.segger.com/downloads/jlink)
|
||||
|
||||
|
||||
## Debian / Ubuntu / Kali / ParrotOS / Raspbian
|
||||
|
||||
Install dependencies
|
||||
|
||||
```sh
|
||||
sudo apt-get install --no-install-recommends binutils-arm-none-eabi gdb openocd gdb-multiarch
|
||||
```
|
||||
|
||||
On some systems `arm-none-eabi-gdb` was replaced with `gdb-multiarch`. In order to use the J-Link debugger you need to link `arm-none-eabi-gdb` to `gdb-multiarch`:
|
||||
```sh
|
||||
ln -s /usr/bin/gdb-multiarch /usr/bin/arm-none-eabi-gdb
|
||||
```
|
||||
|
||||
Setup the Visual Studio Code configuration, by going into your project folder and run:
|
||||
```sh
|
||||
./.vscode/setup.sh
|
||||
```
|
||||
|
||||
now launch Visual Studio Code and open your project folder
|
||||
|
||||
|
||||
## Windows: WSL
|
||||
|
||||
Enter WSL prompt (`wsl` or `start windows terminal`)
|
||||
|
||||
Install dependencies
|
||||
```sh
|
||||
sudo apt-get install --no-install-recommends binutils-arm-none-eabi gdb openocd gdb-multiarch
|
||||
```
|
||||
|
||||
The J-Link debugger requires `arm-none-eabi-gdb` which was replaced with `gdb-multiarch`. In order to use the J-Link debugger link `arm-none-eabi-gdb` to `gdb-multiarch`:
|
||||
```sh
|
||||
sudo ln -s /usr/bin/gdb-multiarch /usr/bin/arm-none-eabi-gdb
|
||||
```
|
||||
|
||||
Setup the Visual Studio Code configuration, by going into your project folder and run:
|
||||
```sh
|
||||
./.vscode/setup.sh
|
||||
```
|
||||
|
||||
and launch Visual Studio Code
|
||||
```sh
|
||||
code .
|
||||
```
|
||||
|
||||
|
||||
## Windows: ProxSpace
|
||||
|
||||
Download and install [Visual Studio Code](https://code.visualstudio.com/)
|
||||
|
||||
Download and install [J-Link Software and Documentation pack for Windows](https://www.segger.com/downloads/jlink/JLink_Windows.exe)
|
||||
|
||||
Enter PorxSpace (`runme64.bat`) and enter your project folder.
|
||||
|
||||
Setup the Visual Studio Code configuration, by running:
|
||||
```sh
|
||||
./.vscode/setup.sh
|
||||
```
|
||||
|
||||
now launch Visual Studio Code and open your project folder
|
||||
|
||||
|
||||
|
||||
_note_
|
||||
Please install the recommended Visual Studio Code extensions in order for debugging to work.
|
|
@ -149,18 +149,3 @@ Note that it may take a quite long time for a freshly plugged Proxmark3 to be vi
|
|||
|
||||
Now you're ready to follow the [compilation instructions](/doc/md/Use_of_Proxmark/0_Compilation-Instructions.md).
|
||||
|
||||
## Color text on windows 10
|
||||
In later versions of windows 10 you may be able to get color to work by setting this registry key
|
||||
```
|
||||
[HKEY_CURRENT_USER\Console]
|
||||
"VirtualTerminalLevel"=dword:00000001
|
||||
```
|
||||
You also need to disable "use legacy console" in the cmd.exe properties, or set the following registry key
|
||||
```
|
||||
[HKEY_CURRENT_USER\Console]
|
||||
"ForceV2"=dword:00000001
|
||||
```
|
||||
After making these changes, you will need to start a new command prompt (cmd.exe) to ensure its using the new settings.
|
||||
|
||||
If after making these changes (and restarting proxmark3.exe) you get extra characters and no color text, set either key to 0 or enable legacy mode again (and restart the command prompt).
|
||||
|
||||
|
|
45
pm3
45
pm3
|
@ -14,27 +14,32 @@ PM3PATH=$(dirname "$0")
|
|||
EVALENV=""
|
||||
FULLIMAGE="fullimage.elf"
|
||||
BOOTIMAGE="bootrom.elf"
|
||||
# try pm3 dirs in current repo workdir
|
||||
if [ -d "$PM3PATH/client/" ]; then
|
||||
if [ -x "$PM3PATH/client/proxmark3" ]; then
|
||||
CLIENT="$PM3PATH/client/proxmark3"
|
||||
elif [ -x "$PM3PATH/client/build/proxmark3" ]; then
|
||||
CLIENT="$PM3PATH/client/build/proxmark3"
|
||||
else
|
||||
echo >&2 "[!!] In devel workdir but no executable found, did you compile it?"
|
||||
exit 1
|
||||
fi
|
||||
# Devel mode: point to workdir pm3.py module
|
||||
EVALENV+=" PYTHONPATH=$PM3PATH/client/src"
|
||||
# try install dir
|
||||
elif [ -x "$PM3PATH/proxmark3" ]; then
|
||||
CLIENT="$PM3PATH/proxmark3"
|
||||
EVALENV+=" PYTHONPATH=$PM3PATH/../share/proxmark3/pyscripts/"
|
||||
# or /usr/[local/]lib/python3/dist-packages/pm3.py ?
|
||||
else
|
||||
# hope it's installed somehow, still not sure where fw images and pm3.py are...
|
||||
CLIENT="proxmark3"
|
||||
|
||||
#Skip check if --list is used
|
||||
if [ ! "$1" == "--list" ]; then
|
||||
# try pm3 dirs in current repo workdir
|
||||
if [ -d "$PM3PATH/client/" ]; then
|
||||
if [ -x "$PM3PATH/client/proxmark3" ]; then
|
||||
CLIENT="$PM3PATH/client/proxmark3"
|
||||
elif [ -x "$PM3PATH/client/build/proxmark3" ]; then
|
||||
CLIENT="$PM3PATH/client/build/proxmark3"
|
||||
else
|
||||
echo >&2 "[!!] In devel workdir but no executable found, did you compile it?"
|
||||
exit 1
|
||||
fi
|
||||
# Devel mode: point to workdir pm3.py module
|
||||
EVALENV+=" PYTHONPATH=$PM3PATH/client/src"
|
||||
# try install dir
|
||||
elif [ -x "$PM3PATH/proxmark3" ]; then
|
||||
CLIENT="$PM3PATH/proxmark3"
|
||||
EVALENV+=" PYTHONPATH=$PM3PATH/../share/proxmark3/pyscripts/"
|
||||
# or /usr/[local/]lib/python3/dist-packages/pm3.py ?
|
||||
else
|
||||
# hope it's installed somehow, still not sure where fw images and pm3.py are...
|
||||
CLIENT="proxmark3"
|
||||
fi
|
||||
fi
|
||||
|
||||
# LeakSanitizer suppressions
|
||||
if [ -e .lsan_suppressions ]; then
|
||||
EVALENV+=" LSAN_OPTIONS=suppressions=.lsan_suppressions"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue