Proxmark3 community

Research, development and trades concerning the powerful Proxmark3 device.

Remember; sharing is caring. Bring something back to the community.


"Learn the tools of the trade the hard way." +Fravia

You are not logged in.

Announcement

Time changes and with it the technology
Proxmark3 @ discord

Users of this forum, please be aware that information stored on this site is not private.

#1 2019-01-15 03:50:52

Rhodds
Contributor
From: Sydney
Registered: 2019-01-11
Posts: 5

IDE and compilation

Hello All,

It has been a week that I'm trying to set up and IDE to compile, run (and maybe debug) the code.
I'm not really knowledgeable in C (I'm more into C# and Java).

So I tried with Eclipse and Visual Studio.
So far It doesn't compile tongue

What I have done so far,
Installed Proxspace, make the code compile within flash the proxmarks test the code.
Did some changes, compiled and flashed again. And magic  saw the changes. 
The above has been done with Sublime Text.  However I can't see myself working just with Sublime Text in 2019 smile.
I'm sure using an IDE could help tons to develop and understand the code faster. 


So I have used (I'm still trying to understand it) Proxspace project. I put into my PATH, the libraries downloaded by this project  and tried to compile outside of Proxspace (in cmd prompt and Eclipse)
And here I'm stuck, compilation starts but fails :

gcc -shared -o lua52.dll lapi.o lcode.o lctype.o ldebug.o ldo.o ldump.o lfunc.o lgc.o llex.o lmem.o lobject.o lopcodes.o lparser.o lstate.o lstring.o ltable.o ltm.o lundump.o lvm.o lzio.o lauxlib.o lbaselib.o lbitlib.o lcorolib.o ldblib.o liolib.o lmathlib.o loslib.o lstrlib.o ltablib.o loadlib.o linit.o 
strip --strip-unneeded lua52.dll
gcc -o lua.exe -s  lua.o lua52.dll -lm  
lua.o:lua.c:(.text+0x82): undefined reference to `__imp_lua_gettop'
...
lua.o:lua.c:(.text.startup+0x101): undefined reference to `__imp_lua_tolstring'
collect2.exe: error: ld returned 1 exit status
make[3]: *** [lua.exe] Error 1
make[3]: Leaving directory `/c/Users/Ayuda/Documents/GitHub/pm3Matt/liblua'

I suspect Qt5 (but not sure).

So I have 2 questions,
Does anyone use an IDE and could help me to configure mine ?
Does anyone is able to pin point the part of ProxSpace's code which start the download of all the dependencies ( I couldn't find it smile)

I mean this

Following tools will be automatically download:

gcc
Qt5
readline
git
perl
pkg-config

Thanks peeps

Offline

#2 2019-01-15 13:04:23

gator96100
Contributor
From: Austria
Registered: 2016-03-25
Posts: 177

Re: IDE and compilation

If you want to compile outside ProxSpace you would need to install everything just like ProxSpace does, there would be no gains. You can find the installation part of ProxSpace in " ProxSpace/msys2/etc/post-install/09-proxspace.post".

You need the mingw environment that msys2 provides in order to compile. Compiling in the Windows cmd does not work(Windows 10 has a ubuntu based bash shell that could work).

I use Visual Studio Code as IDE and have ProxSpace compile it for me.

Offline

#3 2019-01-18 06:06:34

Rhodds
Contributor
From: Sydney
Registered: 2019-01-11
Posts: 5

Re: IDE and compilation

Hi Thanks a lot for your help gator96100 smile.

You're right doing everything in windows is overkill (for nothing tongue).
So compiling through Proxspace and using VS code is pretty convenient smile. (just a small set up for the dependencies is needed)

However do you have achieved to use the debug mode ?
I have change the MakeFile (from client)
(I have tried to put -g DDEBUG)

CC = gcc -g -DDEBUG
CXX = g++ -g -DDEBUG
LD = g++ -g -DDEBUG

However it I cannot make it stop on a break point and it doesn't really start.
You might have gone through the process ?

Loaded 'C:\Windows\System32\advapi32.dll'. Cannot find or open the PDB file.
Loaded 'C:\Windows\System32\msvcrt.dll'. Cannot find or open the PDB file.
Loaded 'C:\Windows\System32\sechost.dll'. Cannot find or open the PDB file.
Loaded 'C:\Windows\System32\rpcrt4.dll'. Cannot find or open the PDB file.
Loaded 'C:\Windows\System32\user32.dll'. Cannot find or open the PDB file.
Loaded 'C:\Windows\System32\win32u.dll'. Cannot find or open the PDB file.
Loaded 'C:\Windows\System32\gdi32.dll'. Cannot find or open the PDB file.
Loaded 'C:\Windows\System32\gdi32full.dll'. Cannot find or open the PDB file.
Loaded 'C:\Windows\System32\msvcp_win.dll'. Cannot find or open the PDB file.
Loaded 'C:\Windows\System32\ucrtbase.dll'. Cannot find or open the PDB file.
The thread 23740 has exited with code -1073741515 (0xc0000135).
The thread 25040 has exited with code -1073741515 (0xc0000135).
The program '[16712] proxmark3.exe' has exited with code -1073741515 (0xc0000135).

Thanks a lot for your help

Offline

#4 2019-01-18 16:11:03

gator96100
Contributor
From: Austria
Registered: 2016-03-25
Posts: 177

Re: IDE and compilation

I have never tried debug mode. I am not sure how ProxSpace would behave with DDEBUG on. I am guessing you need to install some more dependencies in the ProxSpace environment => “pacman -S --needed base-devel msys2-devel mingw-w64-i686-toolchain mingw-w64-x86_64-toolchain” that should install all needed dependencies.

Offline

#5 2019-01-26 04:19:44

Rhodds
Contributor
From: Sydney
Registered: 2019-01-11
Posts: 5

Re: IDE and compilation

Hi again, I finally done it.

So first thanks Gator for his help.

Then because I spend a lot (too much ??) time to do it. Here the instruction which worked for me.

So as Gator said, I first install everything normally :
- Proxspace
- Vs Code

Then install the C/C++ plug-in.

For the include you can define the vscode c config file like this:
(I just added : "${workspaceFolder}/include")

{
    "configurations": [
        {
            "name": "Win32",
            "includePath": [
                "${workspaceFolder}/**",
                "${workspaceFolder}/include"
            ],
            "defines": [
                "_DEBUG",
                "UNICODE",
                "_UNICODE"
            ],
            "compilerPath": "C:\\cygwin64\\bin\\clang-5.0.exe",
            "cStandard": "c11",
            "cppStandard": "c++17",
            "intelliSenseMode": "clang-x64"
        }
    ],
    "version": 4
}

Once installed you'll need to install gdb (I struggled because you must not install the latest version):
pacman -S mingw-w64-x86_64-gdb  7.10-1 http://repo.msys2.org/mingw/x86_64/mingw-w64-x86_64-gdb-7.10-1-any.pkg.tar.xz   


And then you just need to create the launch.json (here mine).

{
    // 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": "(gdb) Launch",
            "type": "cppdbg",
            "request": "launch",
            "program": "${workspaceFolder}/client/proxmark3",
            "args": ["com 9"],
            "stopAtEntry": false,
            "cwd": "${workspaceFolder}",
            "environment": [],
            "externalConsole": true,
            "MIMode": "gdb",
            "miDebuggerPath": "PATH\\TO\\WHICH\\SHOULD\\FINISH\\WITH\\msys2\\mingw64\\bin\\gdb.exe",
            "setupCommands": [
                {
                    "description": "Enable pretty-printing for gdb",
                    "text": "-enable-pretty-printing",
                    "ignoreFailures": true
                }
            ]
        }
    ]
}

don't forget to change the Makefile (client one) (as I said above)

CC = gcc -g
CXX = g++ -g
LD = g++ -g

Put your breakpoints and let the magic begins tongue

Offline

#6 2019-01-26 07:53:35

iceman
Administrator
Registered: 2013-04-25
Posts: 9,536
Website

Re: IDE and compilation

Cool,  too good to not add on the Wiki.  https://github.com/Proxmark/proxmark3/w … ---Windows

See if I missed something from this writeup.

Offline

Board footer

Powered by FluxBB