Searching \ for '[PIC] CCS C compiler' in subject line. ()
Make payments with PayPal - it's fast, free and secure! Help us get a faster server
FAQ page: www.piclist.com/techref/microchip/languages.htm?key=c
Search entire site for: 'CCS C compiler'.

Exact match. Not showing close matches.
PICList Thread
'[PIC] CCS C compiler'
2011\03\25@222607 by Isaac Marino Bavaresco

flavicon
face
Dear All,


I have a client that uses CCS C for a PIC24 project.

Now I need to interface it to my boot-loader (yes, that one) but I can't
find documentation for its function call convention. Besides I could not
find how to change the stack size.

I already searched the Internet, CCS's site and my client's docs, but
there is nothing. Does anybody know this information?

Experimentally I discovered that it passes parameters in temporary
variables (a-la PIC12 and PIC16) and returns bytes and words in W0.

It defines a very small stack (128 bytes), which it uses only for return
addresses (like small PICs). I need to enlarge the stack to at least 256
bytes, because my MPLAB C30 code uses local variables on stack.


Its generated code is also very poor, there is plenty of:

mov w4,w0
mov w0,w0
return

even at maximum optimization level.

It seems that CCS picked their compiler for small PICs and just
"adapted" it for PIC24 devices. I always had CCS as a high-grade
compiler by the words of others. Now I seriously doubt if I would ever
use it.


Isaac

2011\03\25@224305 by Xiaofan Chen

face picon face
On Sat, Mar 26, 2011 at 10:26 AM, Isaac Marino Bavaresco
<spam_OUTisaacbavarescoTakeThisOuTspamyahoo.com.br> wrote:
> I always had CCS as a high-grade
> compiler by the words of others. Now I seriously doubt if I would ever
> use it.

I do not have experiences of CCS myself. But based on an old
account (back in 2004...2005) from my colleague who had done
a comparison about the C compilers for PIC18, the CCS compiler
was quite easy to use but rather buggy and had different bugs across
different versions. At that time he concluded that HiTech PICC 18 was
the best. He thought MPLAB C18 was not too bad but the libraries
came with it was quite bad.

Maybe the above opinions are still valid now, at least partially.

For me I only use MPLAB C18 now for PIC18 since the Microchip
codes are more for C18.

-- Xiaofa

2011\03\26@122537 by Andre Abelian

picon face


Hi Isaac,

I use CCS compiler every day. I can tell CCS is my favorite compiler and has excellent tech support and they always help. I personally believe they are one of the best.
call 262-522-6500 #32 is Mark very nice guy, #85 is Richard very very knowledgeable guy
and ask Darien for USB questions. now back to your question.
as far as boot loader you may end up using their own boot loader see ccs examples folder.
Why do you want to change the stack size? compiler manages by itself.
how do you get W0? what temp registers?.
what do you mean by generated code is poor? how did you check it?
AA





________________________________
From: Isaac Marino Bavaresco <.....isaacbavarescoKILLspamspam@spam@yahoo.com.br>
To: Microcontroller discussion list - Public. <piclistspamKILLspammit.edu>
Sent: Fri, March 25, 2011 7:26:06 PM
Subject: [PIC] CCS C compiler

Dear All,


I have a client that uses CCS C for a PIC24 project.

Now I need to interface it to my boot-loader (yes, that one) but I can't
find documentation for its function call convention. Besides I could not
find how to change the stack size.

I already searched the Internet, CCS's site and my client's docs, but
there is nothing. Does anybody know this information?

Experimentally I discovered that it passes parameters in temporary
variables (a-la PIC12 and PIC16) and returns bytes and words in W0.

It defines a very small stack (128 bytes), which it uses only for return
addresses (like small PICs). I need to enlarge the stack to at least 256
bytes, because my MPLAB C30 code uses local variables on stack.


Its generated code is also very poor, there is plenty of:

mov w4,w0
mov w0,w0
return

even at maximum optimization level.

It seems that CCS picked their compiler for small PICs and just
"adapted" it for PIC24 devices. I always had CCS as a high-grade
compiler by the words of others. Now I seriously doubt if I would ever
use it.


Isaac

2011\03\26@133547 by Isaac Marino Bavaresco

flavicon
face
Em 26/3/2011 13:25, Andre Abelian escreveu:
>
> Hi Isaac,
>
> I use CCS compiler every day. I can tell CCS is my favorite compiler and has
> excellent
> tech support and they always help. I personally believe they are one of the
> best.
> call 262-522-6500 #32 is Mark very nice guy, #85 is Richard very very
> knowledgeable guy
> and ask Darien for USB questions. now back to your question.


Yes, my client could request support.


> as far as boot loader you may end up using their own boot loader see ccs
> examples folder.


This boot-loader is for a very special application, I don't think any
existing boot-loader will work.


> Why do you want to change the stack size?


Because the application will call an external function that uses more stack..


>  compiler manages by itself.


The compiler cannot know how much memory an external function will use.
MPLAB C30 allows me to choose how much stack I want and even where it
will be located.


> how do you get W0?


It is in the assembly code.


>  what temp registers?.


The parameters are passed in fixed locations in RAM memory (File
Registers), like in the smaller PICs without a data stack.
The PIC24 and dsPIC devices are a completely different beast compared to
the smaller PICs (PIC12 and PIC16).
Restricting the programming model to the same model necessary for the
smaller PICs is too wasteful, preventing the use of the full potential
of the devices.

With 16kbyte of RAM, those devices can make use of truly recursive
functions, which the CCS C model prevents, besides other useful constructs.


>  what do you mean by generated code is poor?


Because it generates lots of unnecessary instructions and inefficient
sequences that other compilers optimize better.


>  how did you check it?

By analyzing the generated assembly code in the "Program Memory" window.


Best regards,

Isaac

2011\03\26@144142 by arocholl

picon face
Hi Isaac,

Use the following sentence to increase stack to 512bytes

#build(stack=512)

You are right; they just adapted the baseline C compiler for PIC24. Actually
their current versions doesn't implement any optimization control, even if
the GUI apparently allows you to. The compiler has some basic optimization
embedded but will not allow you to switch it on or off. Their 8 bits
compiler is better in that regard.

HTH
Ariel Rocholl

{Original Message removed}

2011\03\26@170806 by Isaac Marino Bavaresco

flavicon
face
Em 26/3/2011 15:41, .....arochollKILLspamspam.....gmail.com escreveu:
> Hi Isaac,
>
> Use the following sentence to increase stack to 512bytes
>
> #build(stack=512)


Thank you! That's exactly what I need.

It is only a pity that this sentence is not standard C, so it is not
portable. If it were at least a "#pragma"...
There are also other non-standard constructs, like the "#device".


> You are right; they just adapted the baseline C compiler for PIC24. Actually
> their current versions doesn't implement any optimization control, even if
> the GUI apparently allows you to. The compiler has some basic optimization
> embedded but will not allow you to switch it on or off. Their 8 bits
> compiler is better in that regard.


Perhaps their compilers for smaller PICs may score better comparatively
with Hi-Tech and others, but definitely their PIC24 compiler is
sub-standard. Even the free MPLAB C30 is better than it.


Best regards,

Isaac

2011\03\26@181041 by Andre Abelian

picon face
Isaac,

if you know assembly well then go with assembly why bother with c.
I know assembly but I only check functionality of generated code. I have seen assembly coders that can take existing asm code and optimize it to make it lot smaller adn does the same job. This is good if you
do not have enough program memory "well in general is good" but if you have lots of program memory left
what's the point.

AA



________________________________
From: Isaac Marino Bavaresco <EraseMEisaacbavarescospam_OUTspamTakeThisOuTyahoo.com.br>
To: Microcontroller discussion list - Public. <piclistspamspam_OUTmit.edu>
Sent: Sat, March 26, 2011 10:35:45 AM
Subject: Re: [PIC] CCS C compiler

Em 26/3/2011 13:25, Andre Abelian escreveu:
{Quote hidden}

Yes, my client could request support.


> as far as boot loader you may end up using their own boot loader see ccs
> examples folder.


This boot-loader is for a very special application, I don't think any
existing boot-loader will work.


> Why do you want to change the stack size?


Because the application will call an external function that uses more stack..


>  compiler manages by itself.


The compiler cannot know how much memory an external function will use.
MPLAB C30 allows me to choose how much stack I want and even where it
will be located.


> how do you get W0?


It is in the assembly code.


>  what temp registers?.


The parameters are passed in fixed locations in RAM memory (File
Registers), like in the smaller PICs without a data stack.
The PIC24 and dsPIC devices are a completely different beast compared to
the smaller PICs (PIC12 and PIC16).
Restricting the programming model to the same model necessary for the
smaller PICs is too wasteful, preventing the use of the full potential
of the devices.

With 16kbyte of RAM, those devices can make use of truly recursive
functions, which the CCS C model prevents, besides other useful constructs.


>  what do you mean by generated code is poor?


Because it generates lots of unnecessary instructions and inefficient
sequences that other compilers optimize better.


>  how did you check it?

By analyzing the generated assembly code in the "Program Memory" window.


Best regards,

Isaac

2011\03\26@183642 by Isaac Marino Bavaresco

flavicon
face
Em 26/3/2011 19:10, Andre Abelian escreveu:
> Isaac,
>
> if you know assembly well then go with assembly why bother with c.


The points here are *portability* and development *time*. With C I have
gains in both.


> I know assembly but I only check functionality of generated code.


In the past I used to write entire applications in assembly, but back
then we didn't have good C compilers for small MCUs and the MCUs
themselves were too resource-restricted.

Presently I only write assembly code if it's the only option, or if I
need to extract the last bit of performance or if the code must be
isochronous.


> I have seen assembly coders that can take existing asm code and optimize it to make it lot smaller adn does the same job.


Seldom the performance gains pay for the extra development time.


> This is good if you do not have enough program memory "well in general is good" but if you have lots
> of program memory left what's the point.


Nowadays it is rare the program memory size being the limiting factor.


Best regards,

Isaac

More... (looser matching)
- Last day of these posts
- In 2011 , 2012 only
- Today
- New search...