Hi, I am using the Keil uVision 5 simulator for debugging my LPC1768 code..
When I run the simulator, I get the following error. I tried with simple LED blink program, I get the same error.
*** error 65: access violation at 0xFFFFFFF4 : no 'write' permission
I have seen quite a few threads already on this topic.
1. Some suggested to use a REMAP flag in cpu dll parameter box, I even tried that but no success.
2. Or to use an ini file to MAP address 0x40000000 to 0x400FFFFF as read write. (This is actually APB bus address according to the datasheet and it is already mapped correctly I checked in the debugger Memory Map.
So there is no success so far. Please help if anyone has come across this error.
Another thing, I found obvious about the error is the address at which it reports violation. In the datasheet this address (0xE0100000 - 0xFFFFFFFF) is marked as reserved and clearly mentioned that access to reserved memory may result bus faults. I fail to understand why would a simple LED code even try to access that region or Could it be the startup file??
One more thing, I tried was to create a new project and I was able to run the simulator with same program. But after two three times, it resorts to same issue. This is quite weird. May be not something obvious.
Thanks.
LPC1768 is quite popular, I am pretty sure it is fully supported. I have worked with this earlier and I like the simulator, it helps test the full code with full flexibility before dumping into hardware. Though I am going to buy a ULINK2 debugger soon but I still want to use the simulator.
Regarding the error, 1. I am not able to step into at all, access violation error pops up at the very start of the debug session. 2. It is stuck at the first line of the startup file.
However, I was able to find out something but not sure what is causing this. So when I create a new project it could run the simulation for first few times, I see that the controller registers have valid values. SP - 0x00000260 LR - 0x0000013B PC - 0x00000220 And Other registers also have some values.
Later when I get the error, LR and PC registers have some corrupted values, I really don't understand what is causing that. SP - 0xFFFFFFE0 LR - 0xFFFFFFF9 SP - 0x00000000
I don't know what is corrupting these values, even though the startup file is same in both the case.
I think it has something to do with the reset if reset runs at start. Normal reset (when there is no error) will set the SP to 0xFFFFFFFF while in this case(access violation error) it is set 0xFFFFFFE0 which falls within reserved region hence causes the error. Do you have any idea what is causing this ??
Sorry for being too verbose.
I found the issue, though I don't know how to resolve it. The problem is with ROM settings for the target. My device uses the usb bootloader which is stored at 0x0000 to 0x2000 so I changed the IROM1 address base from 0x0 to 0x2000.
This somehow changes the default base address of SP from 0xFFFFFFFF to 0xFFFFFFE0 and since this falls under reserved area, I get access violation error.
If I change IROM1 base address back to zero and build the code with first uncheck and then recheck "Use Memory map layout from target dialog" option in the linker tab.
OR
Simply If I never check "Use Memory map layout from target dialog" option in the linker dialog. Then error never comes irrespective IROM1 address values.
May be you can throw some light on why the SP is changed depending on the IROM1 address settings.