Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Physical and Virtual Address during debugging

Status
Not open for further replies.

kanni1303

Full Member level 3
Joined
Jun 29, 2012
Messages
164
Helped
12
Reputation
24
Reaction score
11
Trophy points
1,298
Location
Chennai, Tamil Nadu, India
Activity points
2,708
Hi,
I came across a problem today here is my code

Code:
#define NVMEM_ADDRS_PHY 0x1D07000     //Physical address
#define NVMEM_ADDRS_VIR 0xBD07000     //Virtual address

DWORD Flashval;
DWORD *Flashptr;
//Working to read the value
Flashptr= (DWORD *) NVMEM_ADDRS_VIR;
Flashval = (DWORD) *Flashptr;

//Not working but in watch it is working
Flashptr= (DWORD *) NVMEM_ADDRS_PHY;
Flashval = (DWORD) *Flashptr;
Nop();


the problem is using physical address I could write the data and during debugging the value was able to read( I kept break point on "Flashval = (DWORD) *Flashptr;" and on watches the data i wrote already was available, but after that line my controller resets)

I clearly know this is because of virtual and physical address issue, my question is during debugging how watch could read the value and why write was success but read was failed?
 

As a general rule of thumbs, although being perfectly possible, defining a physical address in C language is not a nice idea; Doing that, you are somehow competing with the compiler in allocating variables. It is better to let the linker do that for you. In addition, I would recommend to you debug variables content rather than adresses content.
 

As a general rule of thumbs, although being perfectly possible, defining a physical address in C language is not a nice idea; Doing that, you are somehow competing with the compiler in allocating variables. It is better to let the linker do that for you. In addition, I would recommend to you debug variables content rather than adresses content.

You didn't understood my question, I asked for why during debugging watch could able to read the memory value but controller not able to do?
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top