Programming dsPIC33FJ32GP302

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

formatting link

Reply to
embcontrol
Loading thread data ...

he

Microchip's compilers are free without optimization.

Reply to
larwe

be

the

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.
Reply to
Leon

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.

Reply to
larwe

=

at=

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

formatting link

Reply to
embcontrol

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
Reply to
Frank Buss

re

,
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.

Reply to
larwe

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.

Reply to
Hans-Bernhard Bröker

the

Oh, he's still right though. You CAN program say a 12C509 in C. You just probably wouldn't want to :)

Reply to
larwe

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.

Reply to
David Brown

I have been cursing this also. I haven't found much competition with Microchip. I study PIC32s and only two compilers I have found are from Microchip, namely HI-Tech and PIC32-gcc. Both very expensive from student point of view. Does MicroChip have student pricing option?

There is a good GPL tools for Atmel stuff. Why there aren't such for PICs?

Have anyone hacked the Microchip compilers....:-)))

Best Regards Kari

--
PIC - ARM - Microcontrollers - I2C - SPI
Keypads - USB-RS232 - USB-I2C - Accessories
http://www.byvac.com
I am just a happy customer
Reply to
Kari Laine

?

There are options, just not good options. Low end PICs aren't meant to run C, and getting semi-usable code into them is specialized. dsPIC is a limited market product (ish, this is an oversimplification).

As for PIC32, it is really nothing to do with PIC, just MIPS... gcc supports the core just fine. And in fact Microchip's compiler is gcc, and you can obtain the sources and re-enable the optimizations if you wish.

Microchip does have student pricing - register at microchip.com with a .edu email address and you get 25% off dev tools (software and hardware), plus free (no shipping even) samples - two orders per month.

Most students, even EEs, are quite happy with the lite compiler.

Reply to
larwe

That's sort of correct. Microchip's PIC32 /compiler/ is gcc, since the core is MIPs. And gcc is under the GPL, and available from Microchip in source form, and can be re-compiled with optimisations enabled and licensing limitations disabled. It is also possible to use other MIPs compilers (such as gcc from other sources) with the devices.

But Microchip's /libraries/ for the PIC32 are not open in any sense of the word. They are specifically licensed for use with the PIC32-gcc binaries from Microchip, and may not be used with a re-compiled version with licensing restrictions disabled. This is designed as a way to force people to Microchip them for the gcc compiler tools that Microchip obtained freely and openly. Apparently this legal, but IMHO it is unethical and against the spirit of the gcc licensing.

I have no problem with tool vendors charging for their software, or for support or other services. I would have no problem with Microchip charging for their libraries. But I /do/ have a problem with companies taking other companies' and people's software and passing it off as their own software and charging people as though that were the case.

Reply to
David Brown

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.