embedded - How to create an array in C, writing to a specific memory address? -


i doing development on embedded system. need create array of integers using c. array must put in memory address, example, 0x12345678. integers in array should stored in chunk @ 0x12345678.

how can that?

regards, peter

it possible declare pointer assigned address, index thus:

static int* const arr = 0x12345678 ; 

however, less satisfactory because size of array not defined, , if location in normal ram, nothing stops linker instantiating other objects there. if location refers i/o space or memory not in link map, may suffice.

the safe "linker aware" method tool-chain specific; gcc , arm realview example have __attribute__ extensions such purposes.


Comments

Popular posts from this blog

c++ - Delete matches in OpenCV (Keypoints and descriptors) -

java - Could not locate OpenAL library -

sorting - opencl Bitonic sort with 64 bits keys -