Ease of porting to Firewing

Coding and general discussion relating to the compiler

Moderators: David Barker, Jerry Messina

Post Reply
SHughes_Fusion
Posts: 219
Joined: Wed Sep 11, 2013 1:27 pm
Location: Chesterfield

Ease of porting to Firewing

Post by SHughes_Fusion » Fri May 19, 2017 3:45 pm

I've got a project where feature creep has been more than expected and I'm starting to struggle to cram it all in to a PIC18. Moving to a PIC24 would offer lots of additional benefits above the extra RAM I'd have access to but having spent a long time developing the firmware in Swordfish I'm wondering how easy it is to port code over to Firewing?

Fully understand there will be many, many issues with underlying differences in architecture but if it would be a case of 'start again' then I'll probably redesign from the ground up rather than just wangle a new processor in...

User avatar
Coccoliso
Posts: 152
Joined: Mon Feb 17, 2014 10:34 am

Re: Ease of porting to Firewing

Post by Coccoliso » Sat May 20, 2017 8:11 am

Hi,

you better use Swordfish Toolsuite for Firewing and recompile your sources for the PIC18 family and test it with your current HW.
When your whole PIC18 HW works you can switch to other core and you've already learned how to use the new environment :D
I ported all from Swordfish to Firewing (and also vice versa for FT800 module ) and it isn't difficult, before you write a nice conversion table of variable types (and also try to use enums instead of constants).
You need to be careful how FW is structured .. as some modules are loaded by default while the UserLibrary should be divided for different core (18/24/32) and you better for all your library respects this rule for I/O and everything goes smoothly

I understand that this code is slightly out of place because the example I posted is for Firewing but..

Code: Select all

#if _core = &H0018 
   imports "MY16LIB"
#elseif _core = &H0012
   #option USE_SPI_HARDWARE = true
   imports "MY08LIB"
#else
   #error "Unknow device CORE" 
#endif

Jerry Messina
Swordfish Developer
Posts: 1469
Joined: Fri Jan 30, 2009 6:27 pm
Location: US

Re: Ease of porting to Firewing

Post by Jerry Messina » Sun May 21, 2017 10:05 pm

I'm starting to struggle to cram it all in to a PIC18
I haven't done a lot of comparisons between the two, but something to keep in mind is the difference in the program word size. A pic18 128K part has 64K instruction words, while the same size for a pic24 is roughly 42K of instructions (assuming all "single word" instructions).

XC16 doesn't seem as good at generating instruction code compared to Swordfish. That's a VERY subjective observation on my part, and it's going to vary a LOT depending on the code I'd imagine. My point is doubling the memory size doesn't necessarily get you double the code space.

SHughes_Fusion
Posts: 219
Joined: Wed Sep 11, 2013 1:27 pm
Location: Chesterfield

Re: Ease of porting to Firewing

Post by SHughes_Fusion » Mon May 22, 2017 7:18 am

Coccoliso - Good idea, I'd not thought of trying Firewing for the current project.

Jerry - Understand your point, but it's actually RAM that is the main constraining factor in this application. I'm doing a lot of comms (both Bluetooth and USB) and also have a GLCD to update. Being able to have >1k serial buffers would help performance a lot which just isn't possible under the K22 architecture. I know the K42 is due soon with slightly bigger RAM but a general core performance boost wouldn't go amiss either. The majority of variables I'm using are Words (or bigger) so going to at least a 16 bit core would be a benefit there as well.

Jerry Messina
Swordfish Developer
Posts: 1469
Joined: Fri Jan 30, 2009 6:27 pm
Location: US

Re: Ease of porting to Firewing

Post by Jerry Messina » Mon May 22, 2017 10:33 am

The 4K RAM limit is something I run into a lot too. I don't know if David's going to be adding support for the K42, so it might not be prudent to wait around for it.

Lucky for me I usually have an ethernet chip that I can steal some RAM from, but the pic24 upgrade would be a nice addition.

Post Reply