I am writing unit tests for a driver code. To run the tests on the host platform, I created fake registers with the same name as used by driver on the actual target. Some of the driver function call has const volatile uint32_t* as a function argument. I do not understand why reinterpret_cast<const volatile uint32_t*>(address) returns 1. Is there any workaround? I appreciate your suggestions. For your reference, the issue can be replicated by below code. Thanks!
#include <iostream>
#include <cstdint>
using namespace std;
uint32_t g_register = 5;
void driverFunction(const volatile uint32_t* f_input){
cout << f_input << " " << *f_input << "\n";
}
int main()
{
uintptr_t l_regAddress = reinterpret_cast<uintptr_t>(&g_register);
driverFunction(reinterpret_cast<const volatile uint32_t*>(l_regAddress));
return 0;
}
p.s: I can not make any change in the driver code.