[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: [avr-gcc-list] gcc builds wrong code?
From: |
Larry Barello |
Subject: |
RE: [avr-gcc-list] gcc builds wrong code? |
Date: |
Sun, 25 Jul 2004 14:17:40 -0700 |
You are the problem :) You need to load the contents of the FLASH table into
a regular C variable before accessing it. Read about accessing program
memory or FLASH in the faq that comes with libc. The macro's you need are
in "pgmspace.h"
-----Original Message-----
From: Klaus Rudolph
Hi all,
I wrote the following testcode and found that if a table of pointers to
functions
recides in flash "attribute progmem" the code is not correct.
Is the compiler doing the wrong or am I the problem :-)
...
volatile int all=0;
typedef int(*fp_t)(int) ;
// Version 1 fail
const fp_t __attribute__ ((progmem)) fp[]={f2,f3,f4,0} ;
//Version 2 ok
//const fp_t fp[]={f2,f3,f4,0} ;