Anyone here using eclipse?

Programming, for all ages and all languages.
Post Reply
Awe2K
Member
Member
Posts: 49
Joined: Sat Oct 24, 2015 3:14 am
Libera.chat IRC: awe2k

Anyone here using eclipse?

Post by Awe2K »

Hi, I was always wondering: does anyone here use eclipse for OS development?

For example, I use it just like this:
* Eclipse (Always loved it)
* Makefile (I like it, Ctrl-B (in eclipse) and your kernel/(whatever you coding) is compiling and emulator appears)
* Qemu emulator (I have redirected serial output to both log.txt and stdout, as I use serial i/o for logging in my kernel)

Are there any ways of debugging your kernel in eclipse?
Attachments
eclipse.png
User avatar
max
Member
Member
Posts: 616
Joined: Mon Mar 05, 2012 11:23 am
Libera.chat IRC: maxdev
Location: Germany
Contact:

Re: Anyone here using eclipse?

Post by max »

Hi Awe2K,

I'm using Eclipse for OS development. I have a set of shell scripts that do the entire build process. I'm using Mercurial (hg) as my main version control.

Yes, you can debug: build a GDB for your target platform and connect to QEMU. Configure it as a "C/C++ Remote Application". You can then launch QEMU in debug mode, and then start debugging in Eclipse and it will connect.

I'll try to collect some tips on how I set it up so that indexing/code completion/error checking work flawlessly, so maybe you and others can make use of it. It took quite some time to figure out how to get Eclipse to detect the custom toolchain properly, but I wouldn't want to use anything else. This is what mine looks like :P
  • In the project properties, at the point "C/C++ Build" is where I've included my shell scripts as the build scripts. For this you just have to untick "Use default build command" and enter "sh build.sh" in the "Build command" line. This is what Eclipse executes on Clean/Build.
  • I use external tools for launching the OS in a VM. This has the advantage that in the "Build" tab you can choose "Build before launch" for specific projects, and select that for example your kernel must be built before launching it.
  • To make code completion work properly it's important to set the correct "Providers". These are used by Eclipse to detect the settings of your compiler. So thats what we have to configure to make Eclipse detect the settings of our cross compiler. You can find them in the project properties at "C/C++ General -> Preprocessor Include Paths, Macros etc. -> Providers".

    Here you must configure one of the "Built-in Compiler Settings" entries so that they use your cross compiler instead of the default compiler (see this example configuration). For example I use the "CDT GCC Built-In Compiler Settings Cygwin". Select it. In the bottom panel, untick the "Use global provider shared between projects". Then in "Command to get compiler specs" you replace the "${COMMAND}" part with the name of your cross compiler, for me the line then looks for example like:

    Code: Select all

    i686-ghost-g++ ${FLAGS} -E -P -v -dD "${INPUTS}"
  • Tip: Configure the indexer under "Preferences -> C/C++ -> Indexer". Important is setting a slightly bigger heap size than default because otherwise there will be problems because it otherwise doesn't have enough memory to store the info. Also set the ticks on the top.
  • Tip: Install Java Tools in Eclipse and use Java working sets. They are way more comfortable than the C++ ones.
I think there were some more things that I don't remember right now, but these are the most important I think. I'll add them once they come back to my mind :P

Greets,
Max
Awe2K
Member
Member
Posts: 49
Joined: Sat Oct 24, 2015 3:14 am
Libera.chat IRC: awe2k

Re: Anyone here using eclipse?

Post by Awe2K »

Hi, Max.
As I've said, I'm currently using make (I don't trust CDT much), and it's very useful. Maybe I wound make some shell scripts, but I don't know shell lang :| , and make file, like a shell script, may be configured (but my make still doesn't see my cross-compiler).

Also, is there any way in eclipse to use make with gdb? As far as I know, both qemu and gdb "lock" execution until they stop. Can they somehow be run parallel?
User avatar
max
Member
Member
Posts: 616
Joined: Mon Mar 05, 2012 11:23 am
Libera.chat IRC: maxdev
Location: Germany
Contact:

Re: Anyone here using eclipse?

Post by max »

Makefiles are fine. I just decided for shell scripts myself because I find them easier comprehensible.

For GDB: Alas I can't try it out at the moment, but doesn't it work as described above? Running QEMU in debug mode makes it block until GDB connects. Running the debug mode in Eclipse with a "C/C++ Remote Application" should then make it connect to QEMU.
Awe2K
Member
Member
Posts: 49
Joined: Sat Oct 24, 2015 3:14 am
Libera.chat IRC: awe2k

Re: Anyone here using eclipse?

Post by Awe2K »

max wrote:Makefiles are fine. I just decided for shell scripts myself because I find them easier comprehensible.

For GDB: Alas I can't try it out at the moment, but doesn't it work as described above? Running QEMU in debug mode makes it block until GDB connects. Running the debug mode in Eclipse with a "C/C++ Remote Application" should then make it connect to QEMU.
Okay, thanks, I'll definitely try that way. :)
User avatar
DeezRamChips
Member
Member
Posts: 132
Joined: Fri Apr 08, 2016 5:03 am
Location: atapio.cpp - why won't you work :(
Contact:

Re: Anyone here using eclipse?

Post by DeezRamChips »

Hi max, I was wondering why you were using scripts and makefiles ? I managed to get it working only using a linker file xD and how you can see, it works well !
I've even added a lauch prophile that creates a bootable iso with grub-mkrecue and that lauches it into QEMU
Image
User avatar
max
Member
Member
Posts: 616
Joined: Mon Mar 05, 2012 11:23 am
Libera.chat IRC: maxdev
Location: Germany
Contact:

Re: Anyone here using eclipse?

Post by max »

DeezRamChips wrote:Hi max, I was wondering why you were using scripts and makefiles ? I managed to get it working only using a linker file xD and how you can see, it works well !
I've even added a lauch prophile that creates a bootable iso with grub-mkrecue and that lauches it into QEMU
Hey DeezRamChips,

sure that will work when you put all your stuff in a structure so that the Eclipse builder can make sense of it. But you will not always want to build with Eclipse, what if you want to build on a system where you don't have Eclipse? Like, maybe your own OS later on, when you want to get self-hosting? :P

I don't use Make btw, I just use plain shell scripts.

Greets
User avatar
matt11235
Member
Member
Posts: 286
Joined: Tue Aug 02, 2016 1:52 pm
Location: East Riding of Yorkshire, UK

Re: Anyone here using eclipse?

Post by matt11235 »

max wrote:I don't use Make btw, I just use plain shell scripts.
What happened to your custom build tool?
com.sun.java.swing.plaf.nimbus.InternalFrameInternalFrameTitlePaneInternalFrameTitlePaneMaximizeButtonWindowNotFocusedState
Compiler Development Forum
User avatar
max
Member
Member
Posts: 616
Joined: Mon Mar 05, 2012 11:23 am
Libera.chat IRC: maxdev
Location: Germany
Contact:

Re: Anyone here using eclipse?

Post by max »

matt11235 wrote:What happened to your custom build tool?
Both projects would take too much time, bash is available out of the box wherever I build it. ;-)

I might up it to GitHub though so maybe anyone else can make use of it.
stevewoods1986
Member
Member
Posts: 80
Joined: Wed Aug 09, 2017 7:37 am

Re: Anyone here using eclipse?

Post by stevewoods1986 »

I use Eclipse but not for OS development. It is great for Java. I use a normal text editor and my Terminal 8)
Post Reply