Compilation size descrepancy between using Flowcode 9 and 10

For general Flowcode discussion that does not belong in the other sections.
Post Reply
canary_wharfe
Posts: 88
http://meble-kuchenne.info.pl
Joined: Thu Dec 10, 2020 3:54 pm
Has thanked: 6 times
Been thanked: 11 times

Compilation size descrepancy between using Flowcode 9 and 10

Post by canary_wharfe »

Anyone have any ideas why I getting a compilation size descrepancy between using Flowcode 9 and 10 when selecting a 'Compile to HEX'?

Flowcode 10 is creating a HEX file that is 3% larger than Flowcode 9.

Flowcode 9, Hex File Size 63,776, 93 per cent of chip size
Flowcode 10, Hex File Size 65,600, 96 per cent of chip size
Flowcode Compiler options selection is Pickit 2, Microchip XC16.
IC Target is PIC24FV16KA302.

The program flowchart is identical for both versions of Flowcode and my compiler, linker assembler settings in the compiler options are identical in both cases as they are the default for the Pickit 2 as set by Flowcode and they are not editable.

Anyone?

mnfisher
Valued Contributor
Posts: 1512
Joined: Wed Dec 09, 2020 9:37 pm
Has thanked: 138 times
Been thanked: 725 times

Re: Compilation size descrepancy between using Flowcode 9 and 10

Post by mnfisher »

The CAL (included code (Chip Abstraction Layer?)) and components might differ somewhat between the two versions. Although in increase in total program size seems quite a lot?

96% doesn't allow much leeway !

By looking at code using each of components you are using in isolation - it might be possible to narrow this down (for example the LCD displays now have rather more functionality - fonts etc, although this is at the expense of memory)

It's usually possible to refactor code to reduce size if needed - pull reused (duplicated) code to separate macros.
Variables should be local wherever possible (globals always take space - locals only when the macro is in use - for this reason for loops should always use a local loop variable - otherwise a global is allocated (so 100 loops will require 100 x loop variables cf 1 if they all used a local variable)
(See the Pragmatic Programmer by Andrew Hunt and David Thomas for some excellent ideas on this)

Martin

canary_wharfe
Posts: 88
Joined: Thu Dec 10, 2020 3:54 pm
Has thanked: 6 times
Been thanked: 11 times

Re: Compilation size descrepancy between using Flowcode 9 and 10

Post by canary_wharfe »

Thanks Martin. I think you've probably hit the nail on the head. There is an LCD display in the code so I'll start by checking that out first.
... and yes I ought to be more diligent about my use of variables; local against global. Great tips. Much appreciated.

Post Reply