EmbeddedRelated.com
Forums
The 2024 Embedded Online Conference

Programming dsPIC33FJ32GP302

Started by embcontrol September 10, 2010
I am trying to program a dsPIC33F chip with a programmer from microchip
(ICD3 debugger and programmer), and I am also using the explorer 16
development board also sold by microchip. So far, all I have is MPLAB as
the development environment but my back ground in assembly language is very
weak. 

I am looking for a C compiler that it's free or reasonable in price to be
able to program the dsPIC33F with the components mentioned. I looked at the
MPLAB C30 C compiler but the price is to high for my range. Is there
anything anybody can recommend for me to use? 

Thank you for your help!

	   
					
---------------------------------------		
Posted through http://www.EmbeddedRelated.com
On Sep 10, 9:15=A0pm, "embcontrol" <navasimoN@n_o_s_p_a_m.gmail.com>
wrote:

> I am looking for a C compiler that it's free or reasonable in price to be > able to program the dsPIC33F with the components mentioned. I looked at t=
he
> MPLAB C30 C compiler but the price is to high for my range. Is there
Microchip's compilers are free without optimization.
On 11 Sep, 15:09, larwe <zwsdot...@gmail.com> wrote:
> On Sep 10, 9:15=A0pm, "embcontrol" <navasimoN@n_o_s_p_a_m.gmail.com> > wrote: > > > I am looking for a C compiler that it's free or reasonable in price to =
be
> > able to program the dsPIC33F with the components mentioned. I looked at=
the
> > MPLAB C30 C compiler but the price is to high for my range. Is there > > Microchip's compilers are free without optimization.
And you can use the evaluation version of the full compiler free for 60 days. I don't think you are supposed to use it for commercial applications, though.
On Sep 11, 2:19=A0pm, Leon <leon...@btinternet.com> wrote:

> > Microchip's compilers are free without optimization. > > And you can use the evaluation version of the full compiler free for > 60 days. I don't think you are supposed to use it for commercial > applications, though.
I don't think you'd want to use a time-limited eval for a commercial application :) but (a) the OP doesn't make it clear (to me) that it is a commercial application, and (b) the lite version is OK for commercial use. Optimization is nice, but if I have a piece of code that won't work properly with optimization off, I'd call it a buggy/poorly written piece of code, or running too close to the micro's limits.
>On 11 Sep, 15:09, larwe <zwsdot...@gmail.com> wrote: >> On Sep 10, 9:15=A0pm, "embcontrol" <navasimoN@n_o_s_p_a_m.gmail.com> >> wrote: >> >> > I am looking for a C compiler that it's free or reasonable in price to
=
>be >> > able to program the dsPIC33F with the components mentioned. I looked
at=
> the >> > MPLAB C30 C compiler but the price is to high for my range. Is there >> >> Microchip's compilers are free without optimization. > >And you can use the evaluation version of the full compiler free for >60 days. I don't think you are supposed to use it for commercial >applications, though. >
Hi! thanks for your reply! It's not for commercial applications. I am aware that I can use the evaluation version, but I as we know, it's limited. Do you know of any other C compilers that would allow me to write the C code, and somehow that it can generate the assembly code so that I can then copy and paste it in MPLAB. I know it's not as simple as it sounds but this is just a basic description of what I am looking for. Any thoughts on this? Thanks again! --------------------------------------- Posted through http://www.EmbeddedRelated.com
embcontrol wrote:

> Hi! thanks for your reply! It's not for commercial applications. I am aware > that I can use the evaluation version, but I as we know, it's limited. Do > you know of any other C compilers that would allow me to write the C code, > and somehow that it can generate the assembly code so that I can then copy > and paste it in MPLAB. I know it's not as simple as it sounds but this is > just a basic description of what I am looking for.
Why do you want to do this? You don't have to program in assembler for the PIC microcontrollers, you can use just C. And it is not a commercial project, so if it is really too slow or too large, buy a bigger chip :-) There are some nice microcontrollers with ARM cores, for which the support is very good from GCC. And GCC can create optimized code. Depending on your application, the difference in size and speed between -O0 and -O2 for the ARM target can be a factor > 2. If you really want the assembler code: most C compilers provides a "listing" output (with some switches), with addresses and assembler code, and other intermediate files. -- Frank Buss, http://www.frank-buss.de piano and more: http://www.youtube.com/user/frankbuss
On Sep 12, 2:40=A0pm, "embcontrol" <navasimoN@n_o_s_p_a_m.gmail.com>
wrote:

> Hi! thanks for your reply! It's not for commercial applications. I am awa=
re
> that I can use the evaluation version, but I as we know, it's limited. Do > you know of any other C compilers that would allow me to write the C code=
,
> and somehow that it can generate the assembly code so that I can then cop=
y That is basically what a C compiler does. So what you are looking for is... tada... a C compiler. Just download the lite version and see if it works. I see no evidence that the limitations actually are known to be a problem for you.
On 12.09.2010 20:52, Frank Buss wrote:

> Why do you want to do this? You don't have to program in assembler for the > PIC microcontrollers, you can use just C.
Careful there. You may have fallen into Microchip's trap of mislabelling all kinds of CPUs as "PIC", whether they have any relation to the actual PIC or not. The OP's dsPIC is a prime example of that scheme of mischievous misdenomination.
On Sep 12, 4:01=A0pm, Hans-Bernhard Br=F6ker <HBBroe...@t-online.de>
wrote:
> On 12.09.2010 20:52, Frank Buss wrote: > > > Why do you want to do this? You don't have to program in assembler for =
the
> > PIC microcontrollers, you can use just C. > > Careful there. =A0You may have fallen into Microchip's trap of > mislabelling all kinds of CPUs as "PIC", whether they have any relation > to the actual PIC or not. =A0The OP's dsPIC is a prime example of that > scheme of mischievous misdenomination.
Oh, he's still right though. You CAN program say a 12C509 in C. You just probably wouldn't want to :)
On 12/09/2010 13:29, larwe wrote:
> On Sep 11, 2:19 pm, Leon<leon...@btinternet.com> wrote: > >>> Microchip's compilers are free without optimization. >> >> And you can use the evaluation version of the full compiler free for >> 60 days. I don't think you are supposed to use it for commercial >> applications, though. > > I don't think you'd want to use a time-limited eval for a commercial > application :) but (a) the OP doesn't make it clear (to me) that it is > a commercial application, and (b) the lite version is OK for > commercial use. > > Optimization is nice, but if I have a piece of code that won't work > properly with optimization off, I'd call it a buggy/poorly written > piece of code, or running too close to the micro's limits.
Optimisations change several things - code size, and code speed are the main differences. They will also change stack usage and perhaps ram usage in general. If your code acts in a different way with different optimisation settings, other than in size and speed, then I agree your code is bad. Certainly code that fails when optimised is almost certainly buggy code. But the speed difference between optimised code and unoptimised code can be very large - depending on the code in question and the compiler, you could be talking about several times speed differences. That's well out of the range of "pushing the limits". If we were talking about squeezing the last 5% performance out of the device, I'd agree - but the difference between -O0 and -Os or -O2 optimisation on many compilers is very large. I don't know this particular compiler, but for many compilers -O0 will cause the compiler to generate every local variable on the stack, while with -O2 many will be in registers or eliminated altogether for /much/ better generated code. Additionally, people who don't use decent optimising compilers tend to write code that is full of "manual" optimisations (such as using pointers when they really mean array access, or "while (--i) loops" when a "for" loop is clearer and neater). With a decent compiler, you can write clearer code and let the compiler do the dirty work.

The 2024 Embedded Online Conference