Go to Post An extra week of driving practice and shakedown outweighs a lot of ooo-shiny. - Billfred [more]
Home
Go Back   Chief Delphi > Technical > Programming
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Closed Thread
Thread Tools Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 30-12-2006, 02:16
Cjmovie's Avatar
Cjmovie Cjmovie is offline
1293 Resident Hacker
AKA: Christopher Corsi
FRC #1293 (D5 Robotics)
Team Role: Programmer
 
Join Date: Jan 2006
Rookie Year: 2006
Location: SC
Posts: 73
Cjmovie is a name known to allCjmovie is a name known to allCjmovie is a name known to allCjmovie is a name known to allCjmovie is a name known to allCjmovie is a name known to all
Code::Blocks IDE interface (Tutorial/Makefile)

Hello,

After having a lot of problems with the interface in MPLAB, I decided to find a way to use my choice IDE of Code::Blocks to program the RC. After many searches and problems, I've managed to create a very nice interface for programming it.
Code::Blocks is a lightweight, opensource editor written in C++ with the wxWidgets toolkit. It's available for any operating system wxWidgets supports, although you're still tied to windows for the MPLAB C18 Compiler. It can be found at http://codeblocks.org/
My setup uses a custom makefile based on one I've had from long ago, originally written for Eclipse. I'm not sure of the author, but I cannot take full credit for it. However, I have customized it for use with Code::Blocks to take advantage of a really cool feature: Using the drop-down box in the IDE, you can change code between the 18F8722 and 18F8520 processor. It automatically switches out all libraries and build options. You can, in fact, compile it for one and then the other, without running a clean or anything. It will also keep the HEX output files named according to processor. Probably handy for when you need to run something on both models.

To use this setup, the MPLAB C18 compiler must be installed with the PATH environment variable pointing to the compiler's directory. Also, Code::Blocks must be installed, of course. I've only tested this with the 1.0rc2 on the main website.
The instructions for using this interface are as follows:

1. Download the makefile on my website and save it in the same directory as your code. After you've put the makefile in there, create two new folders: "obj.8722" and "obj.8520". Also, rename the libraries for the 8722 PIC to FRC_Library_8722.lib, and the library for the 8520 to FRC_Library_8520.lib.
2. Create a new Code::Blocks project, add all of your *.c and *.h files to it, and save the project in the same place as your code
3. In your project, add the 2 build targets PIC18F8722 and PIC18F8520. You can do this by clicking Project->Properties on the menu bar and clicking the "Targets" tab.
4. Now, leaving that dialog open, click the "Project" tab. Check the box that says "This is a custom Makefile" and make sure the makefile name matches the name of the makefile ("Makefile")
5. Click OK to close the window
6. Click Build->Options on the menu bar. Go to the "Other" tab, and click the drop-down box labeled "Build Method". Select "Work with Makefiles (GNU make is required)".
7. Click OK to close the window
8. On the drop-down box on the toolbar of the editor, labeled "Build target", select your processor of choice
9. Click "Build" either via the "Build" menu or the shortcut button on the toolbar.
10. Done! Just use the IFI_Loader applicatoin to download either PIC18F8722.hex or PIC18F8520.hex to your robot controller.

(Note: The makefile also defaults to having the MPLAB C18 compiler include directory and library directory in "c:\mcc18\h" and "c:\mcc18\lib". If this isn't what you want, open the makefile with notepad and look at the top 5-ish lines, and change what you need. MPDRIVE changes the hard drive/partition you have it installed on, which is default to C)

If you've got any questions, comments, etc. let me know. If this has been discussed already, I apologize, as a quick forum search didn't come up with it for me when I needed it.

*edit*
I've tested this only with the "make" utility included with Code::Blocks. If you run into errors, make sure that A) you installed Code::Blocks with the compiler it comes with, and B) You have that compiler selected as default. That way it will use the version of GNU make included with Code::Blocks.
__________________
D5 Robotics, Team 1293: Programmer, CAD'er, Mechanical, Electrical... I've made my rounds.
Events: 2006-2009 Palmetto Regional
Website: http://d5robotics.org/

Last edited by Cjmovie : 30-12-2006 at 16:34. Reason: Update instructions
  #2   Spotlight this post!  
Unread 30-12-2006, 12:33
JBotAlan's Avatar
JBotAlan JBotAlan is offline
Forever chasing the 'bot around
AKA: Jacob Rau
FRC #5263
Team Role: Mentor
 
Join Date: Sep 2004
Rookie Year: 2004
Location: Riverview, MI
Posts: 723
JBotAlan has a reputation beyond reputeJBotAlan has a reputation beyond reputeJBotAlan has a reputation beyond reputeJBotAlan has a reputation beyond reputeJBotAlan has a reputation beyond reputeJBotAlan has a reputation beyond reputeJBotAlan has a reputation beyond reputeJBotAlan has a reputation beyond reputeJBotAlan has a reputation beyond reputeJBotAlan has a reputation beyond reputeJBotAlan has a reputation beyond repute
Send a message via AIM to JBotAlan Send a message via Yahoo to JBotAlan
Re: Code::Blocks IDE interface (Tutorial/Makefile)

I take it I have to have gcc installed?

It auto-detected the gcc install that came with Bloodshed Dev-C++ and was using the mingw32-make.exe from there, but I still kept getting the error:
Code:
mingw32-make.exe: *** No rule to make target `obj.8722\cal.o', needed by `PIC18F8722.hex'.  Stop.
Process terminated with status 1 (0 minutes, 0 seconds)
0 errors, 0 warnings
I'm not sure what this means. I'm going to check everything over again, but I doubt I am going to get it myself because I'm a n00b...

JBot

EDIT: It seems to be looking for the compiler chosen in the dropdown box. I can't find a way to override this and it seems that...HOLD on a SEC! I think I just answered my own question...

EDIT AGAIN: What do I set for the Make: path for the compiler settings? It doesn't look like C18 even has make packaged with it...

EDIT AGAIN AGAIN: Now I got it to run mcc18 at least, but now it gave me something like 30 errors...I'm starting to give up...
__________________
Aren't signatures a bit outdated?

Last edited by JBotAlan : 30-12-2006 at 12:54.
  #3   Spotlight this post!  
Unread 30-12-2006, 12:49
CmptrGk's Avatar
CmptrGk CmptrGk is offline
Programming Mentor
AKA: Dillon
FRC #0716 (Who'sCTEKS)
Team Role: College Student
 
Join Date: Jan 2004
Rookie Year: 2004
Location: Kent,CT
Posts: 212
CmptrGk has much to be proud ofCmptrGk has much to be proud ofCmptrGk has much to be proud ofCmptrGk has much to be proud ofCmptrGk has much to be proud ofCmptrGk has much to be proud ofCmptrGk has much to be proud ofCmptrGk has much to be proud of
Re: Code::Blocks IDE interface (Tutorial/Makefile)

I think I was able to get it to work. I tried copying all of the *.o files into the obj.8722 folder. Then renamed FRC_Library.lib to FRC_Library_8722.lib. There were no error messages, and it created the hex file.

I left the complier settings to its gcc defaults.
__________________
#14


"Great autonomous mode Dillon."," It hasn't been written yet"
after an Archimedes match


  #4   Spotlight this post!  
Unread 30-12-2006, 16:27
Cjmovie's Avatar
Cjmovie Cjmovie is offline
1293 Resident Hacker
AKA: Christopher Corsi
FRC #1293 (D5 Robotics)
Team Role: Programmer
 
Join Date: Jan 2006
Rookie Year: 2006
Location: SC
Posts: 73
Cjmovie is a name known to allCjmovie is a name known to allCjmovie is a name known to allCjmovie is a name known to allCjmovie is a name known to allCjmovie is a name known to all
Re: Code::Blocks IDE interface (Tutorial/Makefile)

Quote:
Originally Posted by JBotAlan View Post
I take it I have to have gcc installed?

It auto-detected the gcc install that came with Bloodshed Dev-C++ and was using the mingw32-make.exe from there, but I still kept getting the error:
Code:
mingw32-make.exe: *** No rule to make target `obj.8722\cal.o', needed by `PIC18F8722.hex'.  Stop.
Process terminated with status 1 (0 minutes, 0 seconds)
0 errors, 0 warnings
I'm not sure what this means. I'm going to check everything over again, but I doubt I am going to get it myself because I'm a n00b...

JBot

EDIT: It seems to be looking for the compiler chosen in the dropdown box. I can't find a way to override this and it seems that...HOLD on a SEC! I think I just answered my own question...

EDIT AGAIN: What do I set for the Make: path for the compiler settings? It doesn't look like C18 even has make packaged with it...

EDIT AGAIN AGAIN: Now I got it to run mcc18 at least, but now it gave me something like 30 errors...I'm starting to give up...
If you could post the errors, I'd be glad to help out. Also, CmptrGk, thanks, I'll add the name change into the directions above.
__________________
D5 Robotics, Team 1293: Programmer, CAD'er, Mechanical, Electrical... I've made my rounds.
Events: 2006-2009 Palmetto Regional
Website: http://d5robotics.org/
  #5   Spotlight this post!  
Unread 30-12-2006, 22:38
JBotAlan's Avatar
JBotAlan JBotAlan is offline
Forever chasing the 'bot around
AKA: Jacob Rau
FRC #5263
Team Role: Mentor
 
Join Date: Sep 2004
Rookie Year: 2004
Location: Riverview, MI
Posts: 723
JBotAlan has a reputation beyond reputeJBotAlan has a reputation beyond reputeJBotAlan has a reputation beyond reputeJBotAlan has a reputation beyond reputeJBotAlan has a reputation beyond reputeJBotAlan has a reputation beyond reputeJBotAlan has a reputation beyond reputeJBotAlan has a reputation beyond reputeJBotAlan has a reputation beyond reputeJBotAlan has a reputation beyond reputeJBotAlan has a reputation beyond repute
Send a message via AIM to JBotAlan Send a message via Yahoo to JBotAlan
Re: Code::Blocks IDE interface (Tutorial/Makefile)

Quote:
Originally Posted by Cjmovie View Post
If you could post the errors, I'd be glad to help out.
Yeah, being the nerd I am I should know better than to say "an error popped up" but not specify what error...

I attached a screenshot because I couldn't copy/paste them and I'm not about to re-type them. My guess is that for some reason it is using the mingw gcc that I have installed somewhere else. I need to uninstall it and try again, but at the moment I'm too lazy...

Thanks
JBot
Attached Thumbnails
Click image for larger version

Name:	codeblockserrors.JPG
Views:	85
Size:	94.6 KB
ID:	4796  
__________________
Aren't signatures a bit outdated?
  #6   Spotlight this post!  
Unread 30-12-2006, 22:39
Cjmovie's Avatar
Cjmovie Cjmovie is offline
1293 Resident Hacker
AKA: Christopher Corsi
FRC #1293 (D5 Robotics)
Team Role: Programmer
 
Join Date: Jan 2006
Rookie Year: 2006
Location: SC
Posts: 73
Cjmovie is a name known to allCjmovie is a name known to allCjmovie is a name known to allCjmovie is a name known to allCjmovie is a name known to allCjmovie is a name known to all
Re: Code::Blocks IDE interface (Tutorial/Makefile)

Give me until the end of the weekend and I'll put the default code and a Code::Blocks project in a zip file for easy access, if anyone's interested. I personally find the interface much easier to use. Also, on the laptop we use, it produces no errors on opening :-).

@JBotAlan: To me it looks like a different version of the compiler or something. If it gets to the point of compiling and then does that, I'm not sure what's going on. v2.4?
__________________
D5 Robotics, Team 1293: Programmer, CAD'er, Mechanical, Electrical... I've made my rounds.
Events: 2006-2009 Palmetto Regional
Website: http://d5robotics.org/

Last edited by Cjmovie : 30-12-2006 at 22:44.
  #7   Spotlight this post!  
Unread 06-01-2007, 12:40
JonathanLKS JonathanLKS is offline
Code::Blocks
FRC #0610 (The Coyotes)
Team Role: Leadership
 
Join Date: Feb 2006
Rookie Year: 2005
Location: Toronto
Posts: 36
JonathanLKS will become famous soon enough
Send a message via MSN to JonathanLKS
Re: Code::Blocks IDE interface (Tutorial/Makefile)

I see someone else is using Code::Blocks
A few months ago I put up Code::Blocks project that didn't rely on make.exe and didn't use makefiles, it was for RC2 but I'm currently using one that works with the snapshot versions and it works very well, I used it during last seasons.
I attached the file here
http://www.chiefdelphi.com/forums/sh...ad.php?t=45814
But the zip file didn't work in winrar, someone else posted a fixed version of the zip file I believe

I also put how to call the mcc18.exe and mplink.exe which might help with some problems
  #8   Spotlight this post!  
Unread 23-01-2008, 22:51
Tom Bottiglieri Tom Bottiglieri is offline
Registered User
FRC #0254 (The Cheesy Poofs)
Team Role: Engineer
 
Join Date: Jan 2004
Rookie Year: 2003
Location: San Francisco, CA
Posts: 3,187
Tom Bottiglieri has a reputation beyond reputeTom Bottiglieri has a reputation beyond reputeTom Bottiglieri has a reputation beyond reputeTom Bottiglieri has a reputation beyond reputeTom Bottiglieri has a reputation beyond reputeTom Bottiglieri has a reputation beyond reputeTom Bottiglieri has a reputation beyond reputeTom Bottiglieri has a reputation beyond reputeTom Bottiglieri has a reputation beyond reputeTom Bottiglieri has a reputation beyond reputeTom Bottiglieri has a reputation beyond repute
Re: Code::Blocks IDE interface (Tutorial/Makefile)

I have searched all over the web, this site, and everywhere.

Does anyone have the makefile that will work with Code Blocks? I'm not exactly sure how the IDE passes targets and I can't get it to work.
  #9   Spotlight this post!  
Unread 25-01-2008, 02:18
Abrakadabra Abrakadabra is offline
Here We Go !!!
AKA: Scott Kukshtel, Mr. K
FRC #3467 (The Windham Windup!)
Team Role: Mentor
 
Join Date: Jan 2007
Rookie Year: 2002
Location: Windham, New Hampshire
Posts: 160
Abrakadabra has a brilliant futureAbrakadabra has a brilliant futureAbrakadabra has a brilliant futureAbrakadabra has a brilliant futureAbrakadabra has a brilliant futureAbrakadabra has a brilliant futureAbrakadabra has a brilliant futureAbrakadabra has a brilliant futureAbrakadabra has a brilliant futureAbrakadabra has a brilliant futureAbrakadabra has a brilliant future
Re: Code::Blocks IDE interface (Tutorial/Makefile)

Tom,

You may want to check out JonathanLKS' latest post over here:

http://www.chiefdelphi.com/forums/sh...ad.php?t=62212
Closed Thread


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Using Eclipse IDE & makefile as MPLAB replacement RoboPhantom Programming 0 27-02-2005 19:05
2005 code and IDE compatability? Phil Roth Programming 4 08-01-2005 22:30
Operator Interface code RiotingNerd Programming 5 07-02-2004 21:13
Autonomous code tutorial miketwalker Programming 2 23-02-2003 12:28


All times are GMT -5. The time now is 22:13.

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi