View previous topic :: View next topic |
Author |
Message |
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
Installing PCM and PCH in separate directories |
Posted: Wed Feb 16, 2005 1:27 pm |
|
|
In this thread, most people say they can install PCW versions in
different directories. One person says he puts the command line
compilers in different directories and it works fine.
http://www.ccsinfo.com/forum/viewtopic.php?t=19614
But can this be done with MPLAB ? I installed PCM in the
default directory of c:\Program Files\PICC and I installed PCH
in separate directory of c:\Program Files\PICC-PCH.
But then how can this be setup in MPLAB 7.01 ? It seems that
MPLAB has a global setting (not a per-project setting) for the
compiler and the compiler location.
Also, in the Project/Select Language Toolsuite menu, it only has one
setting: "CCS C compiler for PIC 12/14/16/18"
It doesn't break it up into separate "CCS PCM" and "CCS PCH"
selections. Because of that, you can't specify separate Tool Locations
in the "Set Language Tool Locations" menu.
So maybe it's not possible to use PCM and PCH in separate
directories with MPLAB. Has anyone done this ?
(The reason for doing this is because different versions conflict with
each other). |
|
|
Mark
Joined: 07 Sep 2003 Posts: 2838 Location: Atlanta, GA
|
|
Posted: Wed Feb 16, 2005 4:03 pm |
|
|
Okay, this should work for you:
Use the other CCS compiler option. Set it up to use the other compiler. You will get an error in the build window that says it failed even though it actually compiled.
Now if you want to be slick and use lots of different versions try this out:
make this into a add.reg file
Quote: |
Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SOFTWARE\Microchip\MPLAB IDE\Legacy Language Suites\{489322ed-251d-4d29-bba5-5bb74dafd28b}]
@="TLPCMCCS.ini"
"DoNotLoad"=dword:00000000
[HKEY_LOCAL_MACHINE\SOFTWARE\Microchip\MPLAB IDE\Legacy Language Suites\{489322ed-251d-4d29-bba5-5bb74dafd28b}\Tools]
@=""
[HKEY_LOCAL_MACHINE\SOFTWARE\Microchip\MPLAB IDE\Legacy Language Suites\{489322ed-251d-4d29-bba5-5bb74dafd28b}\Tools\{BED0F566-62C2-4e1d-81DE-939BD7CD00F2}]
@="PCMccsc.mtc"
[HKEY_LOCAL_MACHINE\SOFTWARE\Microchip\MPLAB IDE\Legacy Language Suites\{489322ed-251d-4d29-bba5-5bb74dafd28b}\Tools\{BED0F566-62C2-4e1d-81DE-939BD7CD00F2}\{C8A22AE3-3335-4031-A6D5-386565A737DB}]
@=""
[HKEY_LOCAL_MACHINE\SOFTWARE\Microchip\MPLAB IDE\Legacy Language Suites\{489322ed-251d-4d29-bba5-5bb74dafd28b}\{AD07CB5B-44AA-4365-9AB6-86056022DA43}]
@=""
|
And this into tlpcmccs.ini
Quote: |
// Microchip Language Tools Configuration File
// CCS Language Suite
[Language_Suite]
LanguageSuite=CCS PCM C Compiler
DefaultFilename=default.ht
Object=OBJ
Target=HEX
Library=LIB
Source=C
Header=H
LkrScripts=
Output=LST;ERR;SYM;HEX;TRE
Debug=COD
MTC_Files=ccsc
|
And this as pcmccsc.mtc
Quote: |
// Microchip Language Tools Configuration File
// CCS PCM PIC C
[Tool]
Tool=PCM C-COMPILER
SourceExtension=c
HeaderExtension=h
MultipleNodes=0
[0]
Description=Compiler
OptionList=PCB;PCM;PCH
Default=PCM
PCB=+FB
PCM=+FM
PCH=+FH
Data=0
MultipleOptions=0
[1]
Description=Pause after compile
Switch=+p
Data=0
[2]
Description=Generate Call Tree
Switch=+t
Data=0
|
These files go in the MTC Suites directory. You can add additional options in the mtc file and even set defaults. For the GUID's, they need to be unique. I just simply added 1 to the ones for the CCS suite.
Another option would be to ask CCS for their plugin source code and create your own dll based on theirs.
PS: the reg file of course doesn't go in the MTC Suites directory. You just simply run it to import the data into the registry. |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Thu Feb 17, 2005 12:09 pm |
|
|
Thanks Mark. I will study this and then try it. |
|
|
Mark
Joined: 07 Sep 2003 Posts: 2838 Location: Atlanta, GA
|
|
Posted: Thu Feb 17, 2005 12:13 pm |
|
|
For those of you who get confused by the 2 CCS entries, you can delete the wrong one in the registry. |
|
|
Mark
Joined: 07 Sep 2003 Posts: 2838 Location: Atlanta, GA
|
|
Posted: Thu Feb 17, 2005 8:57 pm |
|
|
Okay, I played with this a bit more. As it stands, the IDE doesn't think everything was built correctly so it doesn't load the hex file. Here is the first problem in the tlccs.ini file.
Since the compiler doesn't generate obj files you get the error that it did compile sucessfully even though it did. So how do we overcome this. Easy:
Now the IDE sees the HEX file and thinks everything is okay. Now the next problem, No Linker! We can take care of this too. We will just fool the compiler.
Quote: |
Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SOFTWARE\Microchip\MPLAB IDE\Legacy Language Suites\{489322ed-251d-4d29-bba5-5bb74dafd28a}]
@="TLCCS.ini"
"DoNotLoad"=dword:00000000
[HKEY_LOCAL_MACHINE\SOFTWARE\Microchip\MPLAB IDE\Legacy Language Suites\{489322ed-251d-4d29-bba5-5bb74dafd28a}\Tools]
@=""
[HKEY_LOCAL_MACHINE\SOFTWARE\Microchip\MPLAB IDE\Legacy Language Suites\{489322ed-251d-4d29-bba5-5bb74dafd28a}\Tools\{BED0F566-62C2-4e1d-81DE-939BD7CD00F1}]
@="ccsc.mtc"
[HKEY_LOCAL_MACHINE\SOFTWARE\Microchip\MPLAB IDE\Legacy Language Suites\{489322ed-251d-4d29-bba5-5bb74dafd28a}\Tools\{BED0F566-62C2-4e1d-81DE-939BD7CD00F1}\{C8A22AE3-3335-4031-A6D5-386565A737DA}]
@=""
[HKEY_LOCAL_MACHINE\SOFTWARE\Microchip\MPLAB IDE\Legacy Language Suites\{489322ed-251d-4d29-bba5-5bb74dafd28a}\Tools\{eae4e6f3-501b-48f3-aaa3-4ee51a9204f5}]
@="MPLINK.MTC"
[HKEY_LOCAL_MACHINE\SOFTWARE\Microchip\MPLAB IDE\Legacy Language Suites\{489322ed-251d-4d29-bba5-5bb74dafd28a}\Tools\{eae4e6f3-501b-48f3-aaa3-4ee51a9204f5}\{42a20e31-236e-47fb-851a-fd464985044b}]
[HKEY_LOCAL_MACHINE\SOFTWARE\Microchip\MPLAB IDE\Legacy Language Suites\{489322ed-251d-4d29-bba5-5bb74dafd28a}\{AD07CB5B-44AA-4365-9AB6-86056022DA42}]
@=""
|
The above can be name add.reg This will add mplink as a tool that CCS uses
Now we fix the tlccs.ini file:
Quote: |
// Microchip Language Tools Configuration File
// CCS Language Suite
[Language_Suite]
LanguageSuite=CCS C Compiler
DefaultFilename=default.ht
Object=HEX
Target=HEX
Library=
Source=C
Header=H
Output=LST;ERR;SYM;HEX;TRE
Debug=COD;COFF
MTC_Files=ccsc;mplink
|
Under the Tools for the CCS you should see an entry for mplink. Now we don't actually want to invoke the linker so create a batch file named dummy.bat that has nothing in it. Now point the mplink to invoke that batch file and you will now get this when you compile:
Quote: | Clean: Deleting intermediary and output files.
Clean: Done.
Executing: "C:\Program Files\PICC\Ccsc.exe" test.c +FH +t
Executing: "C:\Program Files\PICC\dummy.bat" "C:\test.HEX" /o "test.HEX"
Loaded c:\test.COD
BUILD SUCCEEDED: Thu Feb 17 21:42:17 2005
|
You can edit the ccsc.mtc file to include other parameters or just specify some in the extra settings. You can use similar techniques and add a bunch of entries if you like. Heck, add one for every version of the compiler if you want. If someone doesn't understand any of this, just let me know and I will try and explain things a bit more. |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Fri Feb 18, 2005 1:07 am |
|
|
I'd like you to explain it.
I don't know much about the registry. Can you tell us what it's doing ? |
|
|
Mark
Joined: 07 Sep 2003 Posts: 2838 Location: Atlanta, GA
|
|
Posted: Fri Feb 18, 2005 8:08 am |
|
|
Some definitions
GUID
Short for Globally Unique Identifier, a unique 128-bit number that is produced by the Windows OS or by some Windows applications to identify a particular component, application, file, database entry, and/or user. GUIDs can be created in a number of ways, but usually they are a combination of a few unique settings based on specific point in time (e.g., an IP address, network MAC address, clock date/time, etc.).
Those are the funny long numbers that you see all throughout the registry.
MPLAB provides support for third parties. Nowadays you would write a custom DLL to hook into MPLAB. Microchip provides this to its Third Party vendors. Microchip also provided support for Legacy or older Third Party software which is what I am exploiting. When MPLAB loads, it looks for entries in the registry under Legacy Language Suites. Each entry or "Key" is just a GUID. The default value for this key is the name of an INI file for the Tool Suite. There is also an entry "DoNotLoad" that will prevent the item from being loaded if set to "1". Under this key there is another key whose name is also a GUID. Why its there, only Microchip knows it just needs to be there. There is another key named "Tools" (this is where each of the tools or MTC files will be listed). Under the "Tools" key we have another GUID for each tool (these are like a compiler, assembler, linker entries). The Default value for this key is the name of the MTC file. Under this key is another GUID. There is an entry for each tool. CCS only has 1 the compiler but my method creates 2. The second is a dummy one because MPLAB thinks that it must link the object files. I just copied the GUID's for MPLINK and put them under the CCS tools and then pointed the tool under CCS to a "dummy" batch file to make the IDE all .
The INI file:
The ini file controls how things are displayed and loaded. The LanguageSuite is the name that you see displayed when you select a tool suite in MPLAB. It also specifies file type extensions so that MPLAB knows how to load those files in the project window. The MTC entry lists all the MTC files for that suite.
The MTC file:
This file controls all the command line parameters that get passed to the compiler. The "Tool" entry is the name of the tool that you see when you open up a tool suite in mplab. If you study a few of the MTC files, you see how to add additional parameters and even how to add and hide them. |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Fri Feb 18, 2005 11:04 am |
|
|
Thanks for that explanation. If we try this, but then decide to
revert to the previous settings, is there any easy way to undo
your changes ? |
|
|
Mark
Joined: 07 Sep 2003 Posts: 2838 Location: Atlanta, GA
|
|
Posted: Fri Feb 18, 2005 11:17 am |
|
|
If you create new entries then you can just delete them. If you modify the CCS one then you can just delete the extra key that I am adding for the CCS. Keep in mind that you aren't using the CCS version that I am modifying. The other CCS entry is controlled by a DLL. Worst case you can delete the registry entry and do a MPLAB install to fix anything you might mess up. I wouldn't worry about it though. It is pretty simple once you look at it.
PS: If you want me to create a totally new entry for you, just let me know and I will post the files or send them. |
|
|
guest Guest
|
|
Posted: Mon Mar 07, 2005 5:20 am |
|
|
Thanks Mark for your detailed information on how to set up more than one CCS compiler with MPLAB.
I tried to set it up for two versions of PCH (my production V3.150 and latest 3.221), both installed in separate directories i.e. \PCH_3150 and \PCH_3221.
I use MPLAB 7.01 and run everything under XP Pro.
After playing with it for a while I figured most of it out up to the point where the linker cuts in... :-(
I get the following error message when compiling:
Clean: Deleting intermediary and output files.
Clean: Deleted file "main.HEX".
Clean: Deleted file "C:\...\main.mcs".
Clean: Done.
Executing: "C:\Program Files\PCH_3221\Ccsc.exe" main.c +FH +p +t
Executing: "C:\Program Files\PCH_3221\dummy.bat" "C:\...\main.HEX" /o "main.HEX"
Could not spawn langauge tool. Check command-line options. (193)
Link step failed.
BUILD FAILED: Mon Mar 07 11:05:39 2005
(source path edited for readability)
I created dummy.bat by saving an empty text file with that name.
Any idea anybody, what's wrong? |
|
|
Mark
Joined: 07 Sep 2003 Posts: 2838 Location: Atlanta, GA
|
|
Posted: Mon Mar 07, 2005 6:57 am |
|
|
Goto your Folder Options and make sure the Hide Extensions for known file types is turned OFF. Then right click on the dummy.bat file and make sure the file name is not dummy.bat.txt. This will happen if you create the batch file in Notepad and leave the file type as TXT. |
|
|
guest Guest
|
|
Posted: Mon Mar 07, 2005 7:33 am |
|
|
Thanks Mark for your quick reply.
Hide Extensions for known file types was already turned OFF in both the source code working directory and the CCS compiler directory.
I 'generated' dummy.bat using notepad and saved it as "dummy.bat" (WITH quotes) which saved it with the correct file name.
Any other ideas? |
|
|
Mark
Joined: 07 Sep 2003 Posts: 2838 Location: Atlanta, GA
|
|
Posted: Mon Mar 07, 2005 8:13 am |
|
|
Stick this in the batch file
Quote: |
@ECHO OFF
ECHO Skipping Link Step
|
Also make sure that you have the following in the ini file
Object=HEX
Target=HEX
The IDE will look for the file with the proper extension to know whether or not it succeeded. Post the output window after you change the batch file. |
|
|
guest Guest
|
|
Posted: Mon Mar 07, 2005 8:30 am |
|
|
Changed dummy.bat and now get:
Clean: Deleting intermediary and output files.
Clean: Deleted file "main.HEX".
Clean: Done.
Executing: "C:\Program Files\PCH_3221\Ccsc.exe" main.c +FH +p +t
Executing: "C:\Program Files\PCH_3221\dummy.bat" "C:\...\main.HEX" /o "main.HEX"
Skipping Link Step
Link step failed.
BUILD FAILED: Mon Mar 07 14:18:55 2005
Looks like the batch file runs o.k.
My TLPCH3221.ini file:
// Microchip Language Tools Configuration File
// CCS Language Suite
[Language_Suite]
LanguageSuite=PCH 3.221 C Compiler
DefaultFilename=default.ht
Object=HEX
Target=HEX
Library=LIB
Source=C
Header=H
LkrScripts=
Output=LST;ERR;SYM;HEX;TRE
Debug=COD
MTC_Files=PCH3221;mplink
My PCH3221.mtc file:
// Microchip Language Tools Configuration File
// CCS PIC C
[Tool]
Tool=PCH 3.221
SourceExtension=c
HeaderExtension=h
MultipleNodes=0
[0]
Description=CCS PCH 3.221
OptionList=PCH
Default=PCH
PCB=+FB
PCM=+FM
PCH=+FH
Data=0
MultipleOptions=0
[1]
Description=Pause after compile
Switch=+p
Data=0
[2]
Description=Generate Call Tree
Switch=+t
Data=0
hmmm... |
|
|
Mark
Joined: 07 Sep 2003 Posts: 2838 Location: Atlanta, GA
|
|
Posted: Mon Mar 07, 2005 9:06 am |
|
|
Change the INI file to
Debug=COD;COFF
and see what happens |
|
|
|