OSDev.org

The Place to Start for Operating System Developers
It is currently Thu Mar 28, 2024 8:51 am

All times are UTC - 6 hours




Post new topic Reply to topic  [ 10 posts ] 
Author Message
 Post subject: Anyone here using eclipse?
PostPosted: Wed Oct 28, 2015 10:18 am 
Offline
Member
Member

Joined: Sat Oct 24, 2015 3:14 am
Posts: 49
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
eclipse.png [ 101.83 KiB | Viewed 9864 times ]
Top
 Profile  
 
 Post subject: Re: Anyone here using eclipse?
PostPosted: Wed Oct 28, 2015 1:04 pm 
Offline
Member
Member
User avatar

Joined: Mon Mar 05, 2012 11:23 am
Posts: 616
Location: Germany
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:
    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

_________________
Ghost OS - GitHub


Top
 Profile  
 
 Post subject: Re: Anyone here using eclipse?
PostPosted: Wed Oct 28, 2015 1:58 pm 
Offline
Member
Member

Joined: Sat Oct 24, 2015 3:14 am
Posts: 49
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?


Top
 Profile  
 
 Post subject: Re: Anyone here using eclipse?
PostPosted: Wed Oct 28, 2015 2:17 pm 
Offline
Member
Member
User avatar

Joined: Mon Mar 05, 2012 11:23 am
Posts: 616
Location: Germany
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.

_________________
Ghost OS - GitHub


Top
 Profile  
 
 Post subject: Re: Anyone here using eclipse?
PostPosted: Thu Oct 29, 2015 1:23 am 
Offline
Member
Member

Joined: Sat Oct 24, 2015 3:14 am
Posts: 49
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. :)


Top
 Profile  
 
 Post subject: Re: Anyone here using eclipse?
PostPosted: Sat Apr 29, 2017 6:05 pm 
Offline
Member
Member
User avatar

Joined: Fri Apr 08, 2016 5:03 am
Posts: 132
Location: atapio.cpp - why won't you work :(
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

_________________
My github page: https://github.com/AlexandreRouma
Meme-deving since 420 Bc !
YouTube: https://www.youtube.com/channel/UCyJnOD ... C8Y7pccc6A
Twitter: https://twitter.com/WhatsTheGeekYT


Top
 Profile  
 
 Post subject: Re: Anyone here using eclipse?
PostPosted: Sun Apr 30, 2017 1:19 am 
Offline
Member
Member
User avatar

Joined: Mon Mar 05, 2012 11:23 am
Posts: 616
Location: Germany
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

_________________
Ghost OS - GitHub


Top
 Profile  
 
 Post subject: Re: Anyone here using eclipse?
PostPosted: Sun Apr 30, 2017 2:17 am 
Offline
Member
Member
User avatar

Joined: Tue Aug 02, 2016 1:52 pm
Posts: 286
Location: East Riding of Yorkshire, UK
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


Top
 Profile  
 
 Post subject: Re: Anyone here using eclipse?
PostPosted: Sun Apr 30, 2017 9:25 am 
Offline
Member
Member
User avatar

Joined: Mon Mar 05, 2012 11:23 am
Posts: 616
Location: Germany
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.

_________________
Ghost OS - GitHub


Top
 Profile  
 
 Post subject: Re: Anyone here using eclipse?
PostPosted: Wed Aug 09, 2017 12:51 pm 
Offline
Member
Member

Joined: Wed Aug 09, 2017 7:37 am
Posts: 80
I use Eclipse but not for OS development. It is great for Java. I use a normal text editor and my Terminal 8)


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 10 posts ] 

All times are UTC - 6 hours


Who is online

Users browsing this forum: No registered users and 37 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group