Using MCC18 in a custom program

I am would like to create a hybrid between EasyC and MPLab. I would like to make it be able to import and export to MPLab. Is it possible to write a program in VB.net or C#.net that can use Microchips C18 complier? i know there are a number of .Exes in the mcc18/bin/ folder. I think i would somehow need to run the compiler, linker, and mabe other programs, but i don’t know how to run or get a response from the .EXEs.

Any help would be appreciated

I had considered this before as I was getting some very erratic behavior out of MPLAB. My guess would be to either consult the MCC18 manual for what EXE needs what parameters (the long way), or watch what gets passed to which EXE in the compiler output in MPLAB and hard-code it (the short way). During off-season, us programmers need to unite and create FIRST-IDE, still using the MCC18 compiler, but blowing away MPLAB’s little ability to keep code good-looking, along with nicer features. Since I have to contend with that hideous IDE for another 2 years, it would definitely be worth coding something up to replace it.

Notice: This is not meant in any way to cut on Microchip. Thank you for all that you do, and all the time and money you have put into FIRST. Things would be very hard without the compiler and IDE you donated. Thanks again.

Yeah, eventually I think I’ll start a sourceforge for this once I get some off time to start. I’ll create a new thread once I get something working.

JBotAlan

PS - keep me posted on what you come up with. I have been very interested in replacing this IDE, and what you want to do sounds cool.

Its fairly easy to use the C18 compiler. First you should check out this thread that gives an example of how to construct and use a makefile. The makefile will allow you to manage the compilation of all the files in your project. You can have your program autogenerate this makefile which would save you time and effort.
When you want to compile and link you just need to run make with your desired parameters such as “clean all -f FILENAME” (where FILENAME is the filename of your makefile).

For more information on makefiles, take a look at this.

Why re-invent the wheel? From what I understand*, the MCC18 compiler can be used very easily independent of MPLab. I bet in a couple hours of googling, one can figure out how to integrate it with any IDE that supports multiple compilers (such as Eclipse, Programmers Notepad, etc.)

  • I’ve yet to actually try to integrate MCC18 with any other program, but I know it has been done with Eclipse.

MPlab just needs to be tamed, that is all. I have actually so far preferred it to all other IDE’s that are available on Windows. None of them shake a stick at Xcode yet, and for a standalone editor, SubEthaEdit is still the best all around, with all the features it offers, especially when it comes to making code look nice, and the ease of use to how people want their “tabing” done.

I want an IDE that allows you to collapse regions… like Microsoft Visual Studio… anyone know of any?

For AVR development I use the WinAVR project, which uses Programmers Notepad as the IDE. I think it is really good. Collapsible regions, decent syntax highlighting, good project management, tabbed browsing and overall good simplicity.

http://www.pnotepad.org/

I still haven’t been able to find how to get the errors from the EXEs. If anyone can point me in the right direction i wound appreciate it.

Capturing data from a console application is a real pain. Fortunately others have already traveled that path and you can see what they have done by looking at the code of just about any open source IDE. I’d advise you to download the source for the Dev C++ IDE and find the RunAndGetOutput function in Utils.pas. The source code is in Delphi but it should be easily convertable to C# or Visual Basic.

I am not familiar with Delphi and can’t find any vb or c# code to handle the text capturing. If anyone knows where i can find a sample in vb or C#?

If anyone wants to try and use MCC18 with Code::Blocks Studio, here’s the registry keys and project templates to use MCC18 with Code::Blocks.

It should work if MCC18 is installed at C:\mcc18, if not you’ll have to edit the registry keys.

Move all but the registry key to wherever you installed codeblocks\share\CodeBlocks emplates

If anyone needs any information on the way to call mcc18 from the command line it’s

For all .C Files
mcc18.exe FILENAME.C -fo=FILENAME.O /i “C:\mcc18\h” -p=18F8722 -D_FRC_BOARD

Then Once
mplink.exe /l “C:\mcc18\lib” ALL_.O_FILES “PATH_WHERE_ITS_LOCATED\18f8722.lkr” “PATH_WHERE_ITS_LOCATED\FRC_library_8722.lib” /m “PATH_WHERE_ITS_LOCATED\FrcCode.map” /o “PATH\FrcCode.cof”

P.S. The Error’s are not displayed in the Build Messages but they are in the Build Log

mcc18.zip (2.9 KB)


mcc18.zip (2.9 KB)

I have submitted a project to Source Forge and i will put a link here if it is acepted.

i know that this thread is over a month old, but i was interested in using code::blocks. but the zip file that was attached was corrupted. i was wondering if somebody could repost an uncorrupted version, if one exists.

I was able to open the file with 7-zip, and then rezipped it with winzip.

mcc18.zip (2.74 KB)


mcc18.zip (2.74 KB)

thanks, i only tired with winrar initally.

If you are interested in using the Snapshot versions of Code::Blocks (They are portable and are much more advanced) I have the appropiate XML File for the compiler aswell, PM if you are interested in it