G'day Raphael
> ------------------------------------------------------------------------
>
> Subject:
> Re: [Sdcc-user] pic14 port alternative name
> From:
> Raphael Neider <[EMAIL PROTECTED]>
> Date:
> Sun, 07 Sep 2008 21:13:04 +0200
> To:
> sdcc-user@lists.sourceforge.net
>
> To:
> sdcc-user@lists.sourceforge.net
>
>
> PORTB and PORTB_bits are declared in the same .c file (pic16fXXX.c), 
> so they get allocated into the *same* section for the linker to place. 
> If you add another object at the same address in your .c 
> (myproject.c), it ends up in a *different* section that is to be 
> placed at the same address already occupied by the section containing 
> PORTB and PORTB_bits.
>
>
> Preprocessor to the rescue: Use the beautiful and quite intuitive =:-]
>
> #define lcd (*(volatile __data lcd_t *)(PORTB_ADDR))
>
> void
> main (void)
> {
>     lcd.rs = 1;
>     if (lcd.e) {
>         lcd.d = 1;
>     } // if
> }
>
> to get where you want, though the code is considerable larger than 
> when accessing PORTB_bits. There is still a lot of optimization 
> potential.
>
> Alternatively you could file a feature request with the gputil team to 
> add an option to allow overlapping sections. SDCC cannot do anything 
> about this problem.
>
> Regards,
> Raphael
>
>
> ------------------------------------------------------------------------
Thanks for that, I will try it tonight after dinner.  I don't know that 
it will solve my problem, I had been able to
#define lcd PORTB_bits
and use it in that file ok.  But I can't seem to have the define passed 
to the linker.

I will try your suggestion.  Not to belittle your help Raphael, but I 
will try nearly anything at this stage.

The the current documentation saga, I noticed that others are using what 
might be called code modules and #including them in the source file 
which I prefer to avoid.

Thanks Raphael

pete

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Sdcc-user mailing list
Sdcc-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sdcc-user

Reply via email to