Thanks Pablo and Vaclav for your replies, please see below for the followup :
Le mercredi 14 octobre 2009, Pablo Carmona A. wrote :
> I think that you'll need 2 C-files for your code. From the SDCC Manual,
> section 4.5:
>
> "For devices that have multiple code pages it is more efficient to use
> the same number of files as pages: Use
> up to 4 separate .c files for the 16F877, but only 2 files for the
> 16F874. This way the linker can put the code
> for each file into different code pages and there will be less page
> selection overhead."
According to the PIC16F886 datasheet, and as far as I can tell, it has 4
program pages : 0x0000-0x07FF, 0x0800-0x0FFF, 0x1000-0x17FF and 0x1800-0x1FFF
I'm however suprised that the sdcc / assembler / linker chain is able to fully
and smartly populate the 2 first pages from a single .c file, and will be unable
to reach the 3rd page... Which is however what I observe.
I will try to follow you suggestion and split my program into several .c files
- any clue for doing that appreciated as I'm no experienced C programmer,
that's my 1st opus on such hardware with such language and compiler chain ;-)
It however looks suboptimal to me to have to manually split the project into
several source files and try to balance "code weight" between them.
I would have hoped that some compiler parameter would have helped the thing to
do it by itself more smartly than I would ;-) - especially because it
obviously does it for the 2 1st pages...
I'll give this solution a shot anyway.
Thanks for your help, kind regards.
--
Michel Bouissou (OpenPGP ID 0xEB04D09C)
|