[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: [avr-gcc-list] Array of pointers to functions revisited...

From: Martin Krüger
Subject: RE: [avr-gcc-list] Array of pointers to functions revisited...
Date: Mon, 19 Jul 2004 08:43:58 GMT

Hello Royce

------- Ursprüngliche Nachricht ------- 
Von:  Royce & Sharal Pereira  <address@hidden> 
Datum: Mon, 19 Jul 2004 03:22:23 +0530 
Betreff: [avr-gcc-list] Array of pointers to functions revisited... 

>I am repeating an earlier mail with some comments, as I had some problems with 
>the solutions I>
>The array call_fun had anything but the addresses of fun1, fun2 etc. !!

As far as i can see it contains the correct adresses.
Remember the avr programm-memory is orgenized in 16 bit words.
So the adress is always half of what you would expect if the memory was 
organized in 8 bits.

In the .lst file I see a   '.word pm(fun1)' instead of a '.word fun1' etc.(BTW 
What's this pm ?)

>The second problem is- The line-
>does not get the desired address correctly. 
>fun= pgm_read_word(call_fun[f_cnt]);

Yes here is still a bug.
You must use a dereferencing operator:

fun= pgm_read_word(&call_fun[f_cnt]);

> There is a un-necessary 'ld' before 'lpm' which destroys
>the Z reg, so that the fetched address is wrong

lpm needs the pointer to the programm menory in the Z reg.
So this ld isnt unneccessary at all.


avr-gcc-list mailing list

Sichern Sie sich Ihre Premium E-Mail-Adresse bei Lycos: eigene Domain, 1000 MB 
Mailspeicher, 100 free SMS, POP3, Weiterleitung und Hightech Spamschutz: 

reply via email to

[Prev in Thread] Current Thread [Next in Thread]