In an effort to understand pointers when working with embedded systems, I am trying to understand what is happening in this code that is accessing a memory mapped register:
uint32_t regval = *(uint32_t *)0x40048004U;
In my mind, without the type casting it means that regval is now equal to the memory contents of the address. I imagine that should be enough but it isn't. But when type casting it, you are treating it like a pointer for a single operation, which seems a bit redundant.
So you are treating regval like the memory contents of an unknown address that points to the memory contents of 0x40048004U? Why is the type casting even necessary?