I am creating a OS kernel in C, C++ and assembly. I am developing on a installed Eclipse CDT IDE on my Ubuntu 16.04 LTS machine. I am searching about run configurations in eclipse, but it seems to be that it is used for executing application binaries. My OS kernel is not a normal binary that can be executed under Linux. It must be emulated using software like QEMU and Bochs.
My Makefile uses the command q to run the kernel inside QEMU after building its components:
make q
Using the build configuration, I can make Eclipse build the kernel by executing the following command in a bash shell:
make Build
How can I create a run configuration in Eclipse so that it can run the kernel after building it? Currently, I have to type in the terminal window to run the kernel, or create an alterative build configuration to run the kernel, even if I click the build button.
After a long time, I have found the solution to this problem. The thing is that your kernel is not a normal C++ application. Eclipse can only execute the app in the context of the already running operating system. You need to make a launcher program that executes things on your behave or runs a script to run the kernel.
Well, since you use a makefile, you could just run the make program directly. Its binary may be stored in usr/bin/make.
In your run configuration, pass the location of your makeprogram as the C++ application's path. In addition to this, add the arguments given to the C++ application, including -
RunCommand - The command in the makefile that runs your kernel.
-f/path/to/makefile - The make program needs to know where your Makefile is because it is being executed by a absolute path (usr/bin/make).
-I/path/to/project-dir - The make program must also switch the current working directory to your project directory so that the commands work.
Related
I setup CMake Tools extension for vscode for building a project for an embedded system.
My executable is *.elf
Every time I hit the run button, the code builds successfully and then cmake tries to run my_executable.elf which obviously cannot run on my machine.
Instead, I want to specify the extension to call a custom script I've written that uses my programming tool to flash the produced file into my chip.
How can I change the action of the run button and run a custom script/program?
I am having trouble running mono CLI commands inside the msysgit console. It works fine in the windows command prompt added by the Mono installer. I have paid attention to the path env variable in the mono command prompt and added C:\Program Files (x86)\Mono\bin\; to the beginning of my system path (and restarted msysgit).
I am getting the following error when trying to run xbuild:
/c/Program Files (x86)/Mono/bin/xbuild: line 2: cygpath: command not found Cannot open assembly 'xbuild.exe': No such file or directory.
What am I missing from msysgit to help mono's CLI tools work better?
Mono for windows is built with cygwin + mingw (see Mono compile guide).
I'm not sure whether it's fully compatible with msys or not. From the error, I guess there is a problem of path. You may need cygpath.exe in your path from the following link. You should probably invoke mono either from Cygwin or cmd (through the bat provided files).
Even if mono for windows is compiled with mingw (and thus should not depend on cygwin), from your error, we can see there are still cygwin dependencies.
I have installed swig on my mac and it works in the console just fine. If I type swig -verison in terminal it spits out the version. Eclipse keeps telling me that it can't find swig. I am using the liquidfun library http://google.github.io/liquidfun/SWIG/html/index.html and it told me to put this export SWIG_BIN=$("which" swig) in .bashrc, which I did. This enviroment variable registers through terminal as well. Eclipse STILL won't grab swig properly. What the hell?
Bash reads .bash_profile, .bash_login or .profile. I don't expect the Eclipse process to load such a file (although I could be wrong) nor the SWIG_BIN variable to augment its search path for executables, but if you launch Eclipse from the shell, it should inherit the shell's environment variables.
Try running swig from eclipse using a full absolute path (the one that "which" returns).
The eclipse.ini file can set some startup parameters but perhaps not the path. There might be other eclipse startup files.
Another possibility is to add swig's directory to the path in a login script. (To test that, log out and back in, then start eclipse.)
Before each debugging cycle I have to run gdbserver on remote target (Linux). So I was thinking to make script that would call python program that would connect over ssh and would run gdbserver.
I cant find any options to run command before debug and I also try to change .gdbinit file but I am unable tu run python script whit that. Since I am using crosscompiler I cant to get other gdb whit such support.
You don't need to run Python to invoke an external command from GDB. This (in .gdbinit) should work:
shell ssh remote-host gdbserver :12345 /path/to/binary/on/remote &
target remote remote-host:12345
If you do need more complicated ssh setup and need Python for that, you can certainly get it with
shell python your_script.py
If you can't get any external program called from your gdbinit, I see one way of doing it within Eclipse that might work (I didn't tested) but it is not really straightforward...
Create an External Tool configuration that launches your gdbserver program (Python or whatever command line script)
Create a C/C++ application launcher that launch your application to debug
Create a launch group that will call the two previously configured configurations.
Launch the group in debug mode
Eclipse 4.7.0 can connect to SSH and launch gdbserver automatically with the automatic launcher set when creating a new debug connection, without the need for any custom scripts.
I have explained the setup in great detail at: Remote debugging C++ applications with Eclipse CDT/RSE/RDT
I have created an application in linux with GTK2 as GUI. It uses some linux-specific headers (e.g. arpa/inet.h) so to run under Windows I have to compile it with Cygwin. I downloaded the latest installer and choose to install GTK2 and its dependencies. My program compiled fine. But it needs X server to be running! I has old-style, ugly graphics and it doesn't open in a different window, like all Windows' applications do, but inside X server's window. Because of this it can't be portable. I found that guide, which is exactly what I need, but I get an error when I run "make" for GTK2 (undefined reference for _IID_IFilePersist, although I have uuid installed - also tried it with gtk2.20). Can you suggest what to do to build my application with cygwin? Or what do I need to install for the "_IID_IFilePersist" error? Thanks in advance!
There's prebuilt packages for windows that doesn't rely on X. http://gtk-win.sourceforge.net/home/index.php/Downloads
If you don't want X server to be running, then you're going to have to port the linux-specific parts of your code and compile with MinGW rather than Cygwin.