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...
Ease of porting to Firewing
Moderators: David Barker, Jerry Messina
-
- Posts: 219
- Joined: Wed Sep 11, 2013 1:27 pm
- Location: Chesterfield
Re: Ease of porting to Firewing
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
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..
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
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
-
- Swordfish Developer
- Posts: 1471
- Joined: Fri Jan 30, 2009 6:27 pm
- Location: US
Re: Ease of porting to Firewing
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).I'm starting to struggle to cram it all in to a PIC18
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.
-
- Posts: 219
- Joined: Wed Sep 11, 2013 1:27 pm
- Location: Chesterfield
Re: Ease of porting to Firewing
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 - 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.
-
- Swordfish Developer
- Posts: 1471
- Joined: Fri Jan 30, 2009 6:27 pm
- Location: US
Re: Ease of porting to Firewing
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.
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.