define pointer to array from struct in c

49 Views Asked by At

i have tried to access array of registers in stm32f103 MCU by struct method like this:

typedef struct
{
volatile u32 MNVIC_IABR[3];

}MNVIC_IABR_T;

#define MNVIC_IABR  ((volatile MNVIC_IABR_T*) 0xE000E300)

but it gives me error :

In file included from ../src/MNVIC_program.c:8:0:
../include/MNVIC_PRIVATE.h:58:21: error: expected identifier before '(' token
#define MNVIC_IABR  ((volatile MNVIC_IABR_T*) 0xE000E300)
                 ^

i have discovered the problem , it was name of pointer which is the same name of register in last line, so i make change and it is working now :

#define MNVIC_IABR_STRUCT  ((volatile MNVIC_IABR_T*) 0xE000E300)
0

There are 0 best solutions below