Swordfish Compiler for PIC24 and dsPIC30/33

Discuss PIC and electronic related things

Moderators: David Barker, Jerry Messina

Post Reply
rmteo
Posts: 237
Joined: Fri Feb 29, 2008 7:02 pm
Location: Colorado, USA

Swordfish Compiler for PIC24 and dsPIC30/33

Post by rmteo » Wed Mar 05, 2008 3:24 am

I have evaluated the SF compiler for PIC18 and have to say that I like it a lot. I have several other BASIC compilers and feel that SF is the best of them. Being able to get support from the developer himself (and several other very helpful testers) is a real bonus.

Now that many PIC24's and dsPIC's (in particular the dsPIC33's) with very capable performance and features are available - at prices that are competitive, sometimes even less than some PIC18's - a compiler with the features of SF is extremely appealing. Here is an example of such a device:
PIC24FJ256GA108

256kB Flash, 16384 bytes RAM, 69 I/O pins, 80-pin TQFP
16 x 16 Hardware Multiply
Single Cycle Execution -32-bit x 16-bit Hardware Divider
Flash Program Memory -10,000 erase/write cycles
Internal oscillator support - 31 kHz to 8 MHz, up to 32 MHz with 4X PLL
10-bit ADC, 16 channels, 500k samples per second
Three Analog comparators Peripherals
CTMU supports Capacitive Touch applications
Perpheral Pin Select allows independent I/O remapping of peripherals in real time
4xUART Modules with LIN and IrDA support, 4 Deep FIFO
3xSPI ™ Modules with 8 Deep FIFO
3xI2C™ Modules with Master and Slave Modes
Five 16/32-bit Timer Modules
Up to 9 Input Capture and 9 Output Compare/PWM
Hardware RTCC, Real-Time Clock Calendar with Alarms
PMP, Parallel Master Port, with 16 Address Lines, and 8/16-bit Data
This from a chip that is about US$5 in small quantities. David, if you decide to go ahead with your plans to come up with this software package, I will be the first in line to get it.

TimB
Posts: 262
Joined: Wed Oct 04, 2006 7:25 am
Location: London UK

Post by TimB » Wed Mar 05, 2008 7:54 am

Do you have any idea how much work it would be to develop a compiler for 18 the 24 and the 32 bit series?

I recommend you learn C then you can access all your desired devices.

BTW would expect to pay only £100 for all 3?

User avatar
David Barker
Swordfish Developer
Posts: 1214
Joined: Tue Oct 03, 2006 7:01 pm
Location: Saltburn by the Sea, UK
Contact:

Post by David Barker » Wed Mar 05, 2008 9:36 am

Ouch Tim, it's a fair question ;-)

Yes, they are very attractive devices. I always believed that Swordfish would lend itself better to this type of device, rather than say the 16 series. Swordfish is a multipass compiler that separates front end from back end code generation - so it is certainly possible. That said, it's a major task as the architecture is quite different.

Here is the situation : Yes, I would like to add Swordfish support for these devices - but - I cannot give any timescales at the moment. I would not want anyone to buy the compiler in the belief this will definitely happen - evaluate your purchase decision for 18F only.

User avatar
octal
Registered User
Registered User
Posts: 586
Joined: Thu Jan 11, 2007 12:49 pm
Location: Paris IDF
Contact:

Post by octal » Wed Mar 05, 2008 9:44 am

Ooooops ... David was quicker than me to answer :)
Hi,

I agree with rmteo. he is right in when he says:
1- SF is the BEST compiler ever developed for PIC :)
2- A version for PIC24 or PIC32 will be great.

In fact the modularity and structured way SF is done, makes it a very very adapted and good candidate for these chips.

However, I agree also with TIM when he says that it's a difficult task to port it.

In fact PIC24 architecture has nothing to do with PIC18 one. Idem for PIC32.

David choosed PIC18 architecture because it was a cleaner one than the ugly PIC12/16 (12 and 14 bits) architecture. see
http://www.sfcompiler.co.uk/wiki/pmwiki ... evelopment

As for the PIC24, the architecture is by far better than PIC18 one. maybe some of the most important aspects of this architecture are:
- 16 bit architecture (data bus)
- Interrupts vectorisation
- True software stack management
- Software remapping of hardware peripherals
...
these are the most notable differences ... (from compiler writer point of view).
This imply a lot of work from compiler writer side:

- First, data are not necessarily packed in the same manner in memory
- Some bit packing strategies (and passing as param) do not apply the same with larger data bus
- PIC24 introduce the VIEW WINDOW strategy (instead of banking and shared area introduced by PIC18)
- Stack management (and thus procedure activation record or frame stacks) has to be reviewed
- Interrupts handling (and thus EVENTS and INTERRUPT CONTEXT saving strategies) have to be reworked
- all internal code for calculations since there are a lot more registers available (instead of the single Working reg in PIC18) ... and there are dedicated operations like multiplication of big numbers ...
- Some instructions (and regs) specially dedicated for loops ... that can be (or MUST be) used to accelerate loops or indirect addr for arrays ...
....

you can see that this are the apparent and easily spoted out problems that can be encountred when porting a compiler from PIC18 to PIC24. Other more technical problems can arise ....

Idem for PIC32. The architecture is based on a fully different core, a MIPS core. Dont even try to compare ... everything is different ... nothing is like PIC18 series !!!! more regs, regs sizes, ... stack management, ... interrupts handling ....


Porting SF to other architectures is by far a very nice thing, but do not expect it to be done in few months or so. it's not a matter to change only the code generator.

and to finish this post, if it was for me, if I want to see something happen, is to have SF ported to ARM cores instead :o

Regards
octal

User avatar
octal
Registered User
Registered User
Posts: 586
Joined: Thu Jan 11, 2007 12:49 pm
Location: Paris IDF
Contact:

Post by octal » Wed Mar 05, 2008 9:52 am

TimB wrote: BTW would expect to pay only £100 for all 3?
hehehe ... Tim :lol:

users always want the price to be as small as the data bus of concerned chips :D

rmteo
Posts: 237
Joined: Fri Feb 29, 2008 7:02 pm
Location: Colorado, USA

Post by rmteo » Wed Mar 05, 2008 3:30 pm

Thanks all for your comments.

Some background. I already have BASIC compilers for the PIC16/18 and the PIC24/dsPIC from another source. However, as I said earlier, I think that SF is a great product and WILL purchase it for the PIC18 series.

If David were to come up with a version for the 16-bit PIC's (as a separate product), I would also be interested. It is good to know that it is in the future. I do not expect to it be included in the current package for US$150. It can be priced and sold seperate from the PIC18 version. What would be nice is if the SF product be something like this:
SF BASIC compiler for PIC18 - US$150

SF Advanced BASIC compiler for PIC24/dsPIC - US$250
If you already have the compiler for the PIC18, you can get the 16-bit version for $200 (instead of $250) - or somethig similar.

rmteo
Posts: 237
Joined: Fri Feb 29, 2008 7:02 pm
Location: Colorado, USA

PIC18F to PIC24F Migration: An Overview

Post by rmteo » Fri Mar 28, 2008 3:54 pm

For those who may be interested, this is an interesting document:
http://ww1.microchip.com/downloads/en/D ... 39764a.pdf

rmteo
Posts: 237
Joined: Fri Feb 29, 2008 7:02 pm
Location: Colorado, USA

Post by rmteo » Thu Oct 02, 2008 2:18 am

Any updates?

Post Reply