Allocate a variable at a specific address
I need to allocate a variable that needs to be located at a specific address, say at address 0x00010000 everytime I compile and run my program. I'm interfacing with another piece of hardware that expects a certain value to be at that address. I was just wondering how I can do this in C (or even if it could be done at all). While I know I could just do it with a pointer to that location,
*(0x00010000) = number;
I would really like to allocate space for it so it doesn't get overwritten by anything else.
If not then I would need to allocate this variable in assembly (mips risc architecture) to be located at 0x00010000, and well, I don't know how to do that either. My guess is to use assembly directives (pseudo-ops?) to do this if can't be done in C.... Any help or suggestions would be appriciated.