I am running this c program in gcc. The below works for one variable.
#define dataBlk_tx0 ((volatile unsigned int *) 0x20000ACB)
But if I want to create an array and write to it how would I do this, this array needs to be defined before main?
#define dataBlk_tx0 ((volatile unsigned int * x[8]) 0x20000ACB)
main{
dataBlk_tx0[0] = 5;
}
dataBlk_tx0points to. Just use it like this:dataBlk_tx0[0],dataBlk_tx0[1]etc. Just use#define dataBlk_tx0 ((volatile unsigned int *) 0x20000ACB)(without the final;)#define dataBlk_tx0 ((volatile unsigned int (*)[8]) 0x20000ACB), but then you would need to access the elements using constructions such as(*dataBlk_tx0)[0] = 5;ordataBlk_tx0[0][0] = 5;, so it would be much simpler to follow @Jabberwocky's suggestion in the comment above to avoid the need for the extra level of dereferencing/indexing.