Proper way of storing a register address on ARM Cortex M4?
At its most basic way, you cast the address as a "pointer to 32 bit value", dereference it and get the value.

x=*((int*)(0x40000800+0x34))


(int*) is the casting, making the number a pointer which points to an int type.

*(....) is to dereference the pointer.

0x40000800+0x34 is in the parenthesis to prevent an addition error. Casting has predecence over addition and addition an integer to a pointer not the same as addition of integers.

For taking a step further, define the peripherals as structs. It has to be guaranteed by the compiler that it will take place in memory as the sequence you write. Don't forget that structs are virtual definitions like 'int'. For example:

struct TIMg_st {volatile u32 CR1,bos0,SMCR,DIER,SR,EGR,CCMR1,bos1,CCER,CNT,PSC,ARR,bos2,CCR1,bos3[6],OR;};


When you make a pointer which points to that struct (so not an int type this time), for example:

(struct TIMg_st*)0x40000800


You can reach its elements without hassle. For example:

*((struct TIMg_st*)0x40000800).CCR1


Or, for an easier scripting;

((struct TIMg_st*)0x40000800)-&gt;CCR1


To make things easier just turn it into a definition:

#define TIM4 ((struct TIMg_st*)0x40000800)


So now it is just

TIM4-&gt;CCR1


and this is simply an unsigned 32 bit value.
The value in the register might be 16 bit or 8 bit, that is not a problem. The important thing is their allocation width and you design the struct according to that. All the elements of structure are uint32 because they are all 32 bit allocated.