Jump to content


Photo

C Compiler "chameleon" In Mplabx


7 replies to this topic

#1 L de vries

L de vries

    Regular

  • EstablishedMember
  • Pip
  • 22 posts
  • Gender:Male
  • Location:Holland

Posted 16 July 2017 - 08:16 PM

After some time, a lot of upgrades in Sourceboost V7.40, thanks for that.


When I build a project with MplabX, i get messages in the Output window of MPlabX:


C:\Program_Files\SourceBoost\include\system.h(40): WARNING: Try our new Chameleon C compiler. It's fast, free and 95% backward compatible with BoostC.


I would like to try this, I see in the Sourceboost IDE "Active Tollsuite Selection" where I can choose "Chameleon"

"normal" use of the MPlabx plugin works fine, with BoostC version 7.40.
Also I removed and installed the MPlabX plug-in (in Sourceboost 7.40 the version seems the same as in 7.3 (plug-in version 1.0)
The document "MplabX_Plugin.pdf" in the Sourceboost 7.40 directory does not describe the use of "Chameleon" either.


So how do I manage to use Chameleon in MplabX ?

Edited by L de vries, 16 July 2017 - 09:54 PM.


#2 Pavel

Pavel

    Super Maniac

  • Administrators
  • PipPipPipPipPip
  • 1,451 posts
  • Gender:Male
  • Location:Melbourne, Australia

Posted 16 July 2017 - 11:56 PM

Currently the Chameleon compiler is in beta stage and does not have a corresponding MplabX plugin yet. The only way I can think of how to work around this is to save the BoostC compiler executable in a safe place, rename the Chameleon executable into BoostC and use MplabX with BoostC plugin. The command lines between these 2 is mostly compatible and this makes it possible for this approach to work.

 

Pavel



#3 L de vries

L de vries

    Regular

  • EstablishedMember
  • Pip
  • 22 posts
  • Gender:Male
  • Location:Holland

Posted 17 July 2017 - 06:27 PM

It works. " BoostC compiler executable in a safe place, rename the Chameleon executable into BoostC "
That will be boostc_pic16. exe / boostc_pic18.exe VS c_pic16.exe / c_pic18.exe.

Compiling works, it looks like Chameleon is more restrictive on the same code, i get errors, while i do not see those with BoostC.
Errors were the result of " extern volatile char eedata ; " in the code, of course there was already a declaration in the header file (include map in source boost installation).

 " ..\EEprom16F87XA.c(30):  error: failed to add variable 'eedata', variable with this name already declared on C:\Program_Files\SourceBoost\include\PIC16F877A.h:399 "
 


Edited by L de vries, 17 July 2017 - 06:36 PM.


#4 L de vries

L de vries

    Regular

  • EstablishedMember
  • Pip
  • 22 posts
  • Gender:Male
  • Location:Holland

Posted 17 July 2017 - 06:40 PM

Just curious about "Chameleon"

The fact that there is c_pic16.exe (2064Kb), boostc++_pic16.exe (2124Kb) and that c_pic16.exe (4156Kb), in combination with the name "Chameleon",
does this mean that the new compiler is a C and C++ combined ?
Microchip does have / borrows this, for their 8 bits Atmel parts (avr8-gnu-toolchain), but does not have it for their 8 bits (PIC16 and PIC18) parts.

Nice move, Pavel !

 

 

The compiler message: "WARNING: Try our new Chameleon C compiler. It's fast, free and 95% backward compatible with BoostC."

What is the 5% that is not?, what are the differences?



#5 Pavel

Pavel

    Super Maniac

  • Administrators
  • PipPipPipPipPip
  • 1,451 posts
  • Gender:Male
  • Location:Melbourne, Australia

Posted 18 July 2017 - 01:17 AM

...Errors were the result of " extern volatile char eedata ; " in the code...

That's sounds like a compiler bug. We'll look into this.

 

...does this mean that the new compiler is a C and C++ combined ?...

Chameleon does not support C++ classes but has a very good support of data and function templates up to the point when template based meta programming can be done. In fact its code generation logic is based on this. For an example check very bottom of include\sys\sys_assign.h file where meta programming is used to generate code for assigning structs. It also supports auto data type and explicit enum types (like in the latest C++ standard).
 

...What is the 5% that is not?, what are the differences?...

From the top of my head:
- rom type specifier is ignored
- dynamic memory allocation is not supported (new/delete)
- complex array and struct initialisation works a bit differently
- system header system.h does not have to be included (it's included behind the scene)
- Chameleon does support bit fields
- Chameleon does support floating point data types natively

Pavel



#6 L de vries

L de vries

    Regular

  • EstablishedMember
  • Pip
  • 22 posts
  • Gender:Male
  • Location:Holland

Posted 06 August 2017 - 04:11 PM

Installed V7.41 with new souceboost MPLABX - plugin. into MPLABX v3.65

 

When I open a project in MPLABX , I can get to File>Project Properties.

It would be nice that i can switch between compiler Toolchains:

 

 

(screenshot print screen copy paste not allowed in this forum,)

"You are not allowed to use that image extension on this community."

 

 

The XC8 compiler in this example is selectable v1.42 or v1.43.

The Sourceboost compiler has just one taste.

It would be nice to have the option in this screen to switch between C, C++ and Chameleon.

 

A way that works is:

 

Go to Tools>Options>Embedded>Build Tools.

 

Default the C Compiler is : C:\Program Files (x86)\SourceBoost\xlaunch.exe

 

Click on the .... box after the line C:\Program Files (x86)\SourceBoost\xlaunch.exe ,

 

so you can chance this to :

 

C:\Program Files (x86)\SourceBoost\c_pic16.exe

 

 

and Apply

 

Now this project, and al other sourceboost projects,  compiles with Chameleon, without altering file names.

To switch back, just select C:\Program Files (x86)\SourceBoost\xlaunch.exe again.

 

Lieuwe



#7 Pavel

Pavel

    Super Maniac

  • Administrators
  • PipPipPipPipPip
  • 1,451 posts
  • Gender:Male
  • Location:Melbourne, Australia

Posted 06 August 2017 - 11:57 PM

...It would be nice to have the option in this screen to switch between C, C++ and Chameleon....

The reason we use xlaunch.exe instead of the actual compiler in the MplabX plugin is to allow different programming languages to be used in the same project. Xlaunch analyses the command line and based on the extension of the input source file launched a relevant compiler

 

For example a project can consist of .c, .c++ and .bas files an when compiling xlaunch.exe will use C, C++ and Basic compilers to compile these files.



#8 L de vries

L de vries

    Regular

  • EstablishedMember
  • Pip
  • 22 posts
  • Gender:Male
  • Location:Holland

Posted 10 August 2017 - 09:16 PM

I see that the document " MplabX_Plugin.pdf " in the source boost install is chanced.

 

On page 9 is an explanation how to force the compiler:

 

To force BoostC or BoostC++ use command line argument -force_c or -force_cpp.
To force Chameleon use command line argument -force_chameleon
To add command line argument right click on the project inside MPLAB-X and open
project properties dialog.

 

this is a far better method , so forget about chancing "build tools" file names

 

Lieuwe


Edited by L de vries, 10 August 2017 - 09:19 PM.




Reply to this topic



  


0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users