Constant function pointer in On-chip Flash


#include "LPC177x_8x.H"

void f1(U8 *ptr);
void f2(U8 *ptr);
void (*fpTest1[2])(U8 *ptr1)={&f1,&f2};
void (*const fpTest[2])(U8 *ptr1)={&f1,&f2};
U8 b[2][2]={{0,1},{2,3}};

int main(void)
{
        (*fpTest[0])(b[0]);
   // fpTest[0]=&f2;
   //(*fpTest[0])(b[0]);
   (*fpTest[1])(b[1]);
}

void f1(U8 *ptr)
{
    volatile U8 a=0;
    volatile U8 b=0;
    a=*(ptr);
    b=*(ptr+1);

}

void f2(U8 *ptr)
{
    volatile U8 a=0;
    volatile U8 b=0;
    a=ptr[0];
    b=ptr[1];

}



Why does fpTest exist in On-Chip Flash and fpTest1 in SRAM?

More questions in this forum