The value of PORT1_VECTOR + VECTOR_OFFSET is an integer, which is not the
same as an addressable memory location.  In gcc4, the parameter to a memory
reference has to be an lvalue.

Try something like:

  asm("br %[add]" :: [add] "m" (*(uint16_t*)(PORT1_VECTOR +
VECTOR_OFFSET)));


Peter

On Tue, Jun 15, 2010 at 5:35 PM, Mark Rages <[email protected]> wrote:

> I'm writing a little bootloader and I am jumping from the interrupt
> vector to the relocated interrupted vector with little functions like
> this
>
> interrupt (PORT1_VECTOR) __attribute((naked)) PORT1SR (void) {
>  asm("br &0xfde4" :: );
> }
>
> This compiles and works fine.  But it is ugly and has a magic number
> in the assembly string.
>
> So I would like to parameterize it out of the way:
>
> #define VECTOR_OFFSET (-512)
>
> interrupt (PORT1_VECTOR) __attribute((naked)) PORT1SR (void) {
>  asm("br %[add]" :: [add] "m" (PORT1_VECTOR + VECTOR_OFFSET));
> }
>
> but this gives me an error:
> main.c: In function ‘PORT1SR’:
> main.c:18: error: memory input 0 is not directly addressable
>
> What does "not directly addressable" mean?
>
> Regards,
> Mark
> markra...@gmail
> --
> Mark Rages, Engineer
> Midwest Telecine LLC
> [email protected]
>
>
> ------------------------------------------------------------------------------
> ThinkGeek and WIRED's GeekDad team up for the Ultimate
> GeekDad Father's Day Giveaway. ONE MASSIVE PRIZE to the
> lucky parental unit.  See the prize list and enter to win:
> http://p.sf.net/sfu/thinkgeek-promo
> _______________________________________________
> Mspgcc-users mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/mspgcc-users
>

Reply via email to