We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
When I set an Access Breakpoint on a memory range, I'd like to use the specific address when the breakpoint is triggered. For example:
func void showAddress(void) { if (BA_MODE == BA_WRITE) { printf("Write to 0x%X.\n", BA_ADDR); } else { printf("Read from 0x%X.\n", BA_ADDR); } } ba readwrite 0x40002000, 0x40, 1, "showAddress()"
Are there any system variables that represent the attributes of the access that triggers the breakpoint?
Please note: the "printf" in the code above is just an example. Actually I'd like to simulate certain hardware behaviour, for example memory mirrors when not all address lines are used. Such a feature could also help to write simulations for external devices.
Something very similar has been added recently into the ARM and Cortex simulators. It uses a few system variables to retrieve the specific break information and will be available in MDK 3.10.
The new system variables and their meaning are:
_BPHITADR_ : accessed address _BPHITACC_ : type of access - 0x01 // Exec 0x02 // Read-access 0x04 // Write-access 0x08 // Conditional-Breakpoint 0x10 // ESCape (Stop-Button) 0x20 // Access-Violation _BPHITNUM_ : number of the breakpoint causing the hit or -1 if caused otherwise _BPHITPC_ : address of the instruction causing the read or write hit, or execution address in case of none-access breakpoints
This works for any type of breakpoint including access breakpoints.
Here is an example on how the info can be extracted:
FUNC void CurAccess (void) { if ((_BPHITACC_ & 0x06) != 0) { // check access type printf ("++Access-break: A:=0x%08X\n", _BPHITADR_); } switch (_BPHITACC_) { // look more close on access-type case 0x01: printf ("++Exec [PC=0x%08X]\n", _BPHITPC_); break; case 0x02: printf (" Read [PC=0x%08X]\n", _BPHITPC_); break; case 0x04: printf (" Write [PC=0x%08X]\n", _BPHITPC_); break; case 0x08: printf ("++Cond-Break [PC=0x%08X]\n", _BPHITPC_); break; case 0x10: printf ("++Stopped [PC=0x%08X]\n", _BPHITPC_); break; case 0x20: printf ("++Access violation [PC=0x%08X]\n", _BPHITPC_); break; } if (_BPHITNUM_ != -1) { // some Breakpoint printf (" Breakpoint number := %d\n", _BPHITNUM_); } }
Thanks for the quick reply!
So my version (see below for a list of numbers) does not have these variables, does it?
uVision3 V3.12a CPU DLL: SARM.DLL V1.27e Dialog DLL: DARMP.DLL V1.09 Target DLL: BIN\UL2ARM.DLL V1.07 Dialog DLL: TARMP.DLL V1.08
Is there any other possibility to retrieve the address?
None of the uVision-MDK releases out in the world do have these system variables. They will come with next MDK release (currently in Release Candidate state).
Sorry, there is no way to get the accessed address/access type within a user or signal function.