Home
JAQForum Ver 24.01
Log In or Join  
Active Topics
Local Time 13:09 24 Nov 2024 Privacy Policy
Jump to

Notice. New forum software under development. It's going to miss a few functions and look a bit ugly for a while, but I'm working on it full time now as the old forum was too unstable. Couple days, all good. If you notice any issues, please contact me.

Forum Index : Microcontroller and PC projects : cpik, open-source C compiler for PIC18F

Author Message
vasi

Guru

Joined: 23/03/2007
Location: Romania
Posts: 1697
Posted: 08:44am 12 Oct 2011
Copy link to clipboard 
Print this post

Until now, we had only SDCC open-source C compiler for PIC18F microcntrollers but as anyone knows, SDCC was primarily made for Intel microprocessors (as 8051). Yes, is a retargettable (the word is not validated by check speller !?) but not "native" PIC18F.

cpik C compiler is made by Alain Gibaud for PIC18F microcontrollers and up to version 0.5.2 lacked some major features such as absence of:

-switch statement
-FP calculation
-bit variables

The project stalled a long period of time until recently when a new announcement was published on the home page of the compiler:

[quote="Alain Gibaud"]Josef Pavlik is a new contributor to the cpik project who has developed a lot of new features for version 0.5.3. Thanks to Josef, this version is a real improvement over the previous one.

-in version 0.5.3 (Marie Jeanne Gabrielle)

* Bug fixes in code and run-time library,
* Run-time library improvements,
* New pin.h header for easy manipulation of I/O ports thru symbolic names,
* Improved LCD library with pin configuration from C code,
* Dead code elimination in the case of loops or test with constant conditions,
* Optimisation of static data initialization, using the program sections concept,
* Post-compilation branch optimizer that generally reduces the code by 10%,
* Implementation of the enum declarator,
* Implementation of the switch instruction: this implementation is efficient and provides a near constant-time case selection,
* Support for data located in ROM, with different access mechanisms,
* And more..
[/quote]

Right now, the author is working at the 0.6 version which will come with support for IEEE-754 floating point numbers and Josef Pavlik is working at a way to implement "universal pointer" RAM / ROM. Also, the Pinguino team is testing the compiler in order to replace the SDCC for the 8bit version of Pinguino IDE.

Any help (joining as developer, contributing with libraries, reporting bugs, or just using it and providing examples) is highly appreciated.

VasiEdited by vasi 2011-10-13
Hobbit name: Togo Toadfoot of Frogmorton
Elvish name: Mablung Miriel
Beyound Arduino Lang
 
elproducts

Senior Member

Joined: 19/06/2011
Location: United States
Posts: 282
Posted: 12:52pm 12 Oct 2011
Copy link to clipboard 
Print this post

Vasi,
This is interesting but with Microchip now releasing all their compilers in essentially free mode (lite mode) what is the advantage to another open source compiler that needs work?

The only restriction in the Lite version is limited to 1 level of optimization. Other than that they are full compilers with support for all parts.
I don't like optimization anyway. It shifts the code around. I'd rather just use a larger memory PIC.



www.elproducts.com
 
vasi

Guru

Joined: 23/03/2007
Location: Romania
Posts: 1697
Posted: 01:04pm 12 Oct 2011
Copy link to clipboard 
Print this post

  elproducts said   Vasi,
This is interesting but with Microchip now releasing all their compilers in essentially free mode (lite mode) what is the advantage to another open source compiler that needs work?

The only restriction in the Lite version is limited to 1 level of optimization. Other than that they are full compilers with support for all parts.
I don't like optimization anyway. It shifts the code around. I'd rather just use a larger memory PIC.




Yes, I said that too in a discussion with another person (today C18 is the best free C compiler for PIC18F) but the point of Pinguino project is to use a totally open-sourced development chain. The only really weak part of 8bit Pinguino project was always the SDCC compiler, forcing the developers to make a lot of tricks regarding to USB bootloader. Now, we have cpik which can be a successful project if it will gain a lot of attention. And it have the chance to become better than C18 compiler of Microchip.

P.S. Arduino free and open-source movement forced Microchip to release a non-restricted, full optimized C32 compiler!!! We can force an analogy? Not yet but with help from volunteers it can be possible.
P.P.S. Of course, the Pinguino 8bit project can be forked and can use C18 instead of SDCC but needs also volunteers.
Hobbit name: Togo Toadfoot of Frogmorton
Elvish name: Mablung Miriel
Beyound Arduino Lang
 
vasi

Guru

Joined: 23/03/2007
Location: Romania
Posts: 1697
Posted: 01:07pm 12 Oct 2011
Copy link to clipboard 
Print this post

Regarding to Hitech C compiler for PIC18F, you must read Geoff's opinion (I share it):
http://geoffg.net/C_Compilers.html
Hobbit name: Togo Toadfoot of Frogmorton
Elvish name: Mablung Miriel
Beyound Arduino Lang
 
wizard

Newbie

Joined: 29/07/2011
Location: United States
Posts: 38
Posted: 02:01pm 13 Oct 2011
Copy link to clipboard 
Print this post


Hi all,

Has anyone looked at optimization for MIPS by the various
compilers?

For PIC32 I use
gcc - openwrt version
chipkit.org
Microchip.

Does the compiled code differ much among the compilers?
Speed of execution
Size

Does optimization really do anything useful?

Thanks
Wiz
 
vasi

Guru

Joined: 23/03/2007
Location: Romania
Posts: 1697
Posted: 02:21pm 13 Oct 2011
Copy link to clipboard 
Print this post

  wizard said  
Hi all,
.....................

Does the compiled code differ much among the compilers?
Speed of execution
Size
[/quote]
The optimization can be for speed or for size, as you know. In the real world, both are important.

Size matter if your boss don't want to spend money to change the entire line based on an old microcontroller but it ask you more features (you do it or you leave). Of course, that boss don't pay a cent also for the programming tools...

JALv2 compiler produce very good size optimized code for PIC12F/PIC16F microcontrollers. But the best for code size is the C compiler from "B Knudsen Data", CC5X but the disadvantage is that is not ANSI C and you have to take care of bank switching so, better use JALv2.

The size also matter when you need a small USB bootloader and that means more space for user applications - an advantage over the other boards from the market.

The size also matter for MMBasic project. We will see that on DuinoMite boards.

The smaller you microcontroller is, the bigger is the need for compact code.

Or speed matter if you have a similar product with the one made by your rivals.

  wizard said  
Does optimization really do anything useful?

Thanks
Wiz


Yes, I strongly believe that! Specially when you produce affordable educational tools.

Vasi
Hobbit name: Togo Toadfoot of Frogmorton
Elvish name: Mablung Miriel
Beyound Arduino Lang
 
vasi

Guru

Joined: 23/03/2007
Location: Romania
Posts: 1697
Posted: 02:30pm 13 Oct 2011
Copy link to clipboard 
Print this post

We can say now, that we have such a large PIC32, we don't need an optimized C compiler anymore. Until you start to use retroBSD... or other similar, bigger projects.

The needs are rising same time with the microcontroller upgrade. When you can't match them, then you move to another platform (but probably we prefer a highly optimized compiler instead of spending more money).



Edited by vasi 2011-10-15
Hobbit name: Togo Toadfoot of Frogmorton
Elvish name: Mablung Miriel
Beyound Arduino Lang
 
vasi

Guru

Joined: 23/03/2007
Location: Romania
Posts: 1697
Posted: 02:46pm 13 Oct 2011
Copy link to clipboard 
Print this post

Let say we have an 8bit Pinguino board (based on 18F4550). I can't have the same full featured JALv2 application (which occupy 100% the flash) written in Arduino language (using Pinguino IDE and SDCC C compiler) because there are huge differences mainly in the size of the code produced by the compilers. Also, from the start, Pinguino board come with much less user application space if I use the Pinguino USB bootloader against JAL USB bootloader. 6Kb difference in a total space of 32Kb.

Comparing them, we can say that the optimizations in SDCC compiler are a bad joke (of course, that is unfair for the developers of the PIC support for SDCC but I can say that now they have a very promising alternative ).

Now, I can't say again that the optimization does not matter.

Not even if I compare with PIC32 because there, I will use applications which occupy the same percent of flash for analysis (as I said before, MMBasic, retroBSD, etc...).

Vasi

P.S. BTW, the high optimization of JALv2 compiler helped me to fit inside PIC12F675 (1KB flash) one additional feature than using PICAXE8M as Windmill logger. I can't find PICAXE8M in my country and you can't get too easy a PIC12F683 (wasn't available at the project time)...

Another thing which helped me, was that I had the full sources of the libraries from the Jallib project (a team which develop JAL libraries for a large variety of peripherals and sensors) and a modification in the source helped me to fit the code.Edited by vasi 2011-10-15
Hobbit name: Togo Toadfoot of Frogmorton
Elvish name: Mablung Miriel
Beyound Arduino Lang
 
wizard

Newbie

Joined: 29/07/2011
Location: United States
Posts: 38
Posted: 07:03pm 13 Oct 2011
Copy link to clipboard 
Print this post

Hi Vasi and all,

It might be interesting to compile MMBasic with
the different compilers and compare the results to get some real numbers.

Maybe someone has done it already?

When next version comes out I'll have to byte
compare my compilation with 'official' one.

Wiz
 
elproducts

Senior Member

Joined: 19/06/2011
Location: United States
Posts: 282
Posted: 02:42am 14 Oct 2011
Copy link to clipboard 
Print this post

  vasi said   Regarding to Hitech C compiler for PIC18F, you must read Geoff's opinion (I share it):
http://geoffg.net/C_Compilers.html


Geoff does make some very good points.
And having an open source compiler can allow a team to optimize it for the hardware such as Pinquino.
And Pinquino is clearly targeting a complete open source platform so I understand your point.

www.elproducts.com
 
vasi

Guru

Joined: 23/03/2007
Location: Romania
Posts: 1697
Posted: 08:24am 14 Oct 2011
Copy link to clipboard 
Print this post

Hi elproducts,

I thought my set of characters are guilty, that I am on Linux... but then I wrote the two words together and yes, you are using q against g.
Pinguino - Pinquino.
Well, I think is your preference...

Vasi

P.S. Unless you are teaching Google Search something If yes, would be interesting to see that product Edited by vasi 2011-10-15
Hobbit name: Togo Toadfoot of Frogmorton
Elvish name: Mablung Miriel
Beyound Arduino Lang
 
elproducts

Senior Member

Joined: 19/06/2011
Location: United States
Posts: 282
Posted: 10:09am 14 Oct 2011
Copy link to clipboard 
Print this post

Sorry.
My mistake.
www.elproducts.com
 
vasi

Guru

Joined: 23/03/2007
Location: Romania
Posts: 1697
Posted: 01:15am 10 Nov 2011
Copy link to clipboard 
Print this post

cpik 0.6 ready!
Hobbit name: Togo Toadfoot of Frogmorton
Elvish name: Mablung Miriel
Beyound Arduino Lang
 
Print this page


To reply to this topic, you need to log in.

© JAQ Software 2024