Keil Logo


Information in this article applies to:

  • Keil MDK All Versions
  • PK51 All Versions
  • C166 All Versions
  • C251 All Versions


My project includes a variable that I access using an absolute memory address. The µVision Debugger generates the following error whenever I try to write to the variable:

*** Error 65: Access violation at 0x00000004 : No 'write' permission

I have specified this memory area to the linker but I still receive this error.


When the µVision Debugger loads an executable program, it creates a memory map using the program and data segments from the program. Code segments are marked as executable while data segments are marked as read/write. All other memory is unmapped and is, therefore, not marked for any type of access.

The µVision Debugger checks that all memory accesses are made to objects that are defined in your C program. For any access that is outside of a defined C object, the µVision debugger generates an error 65: access violation message.

By default, the debugger allows only memory accesses to valid data objects. This is useful for finding uninitialized or incorrectly initialized pointers, for example. Usually, there is a programming error when you try to access unexpected locations.


If the error 65 is for an area that should be accessed, update the memory map the simulator uses. Define all the memory ranges that your program is permitted to access. Ensure that you set the permissions (read, write, execute) for each range to match your actual hardware.

  1. Use the Debug - Memory Map dialog. Enter a range in , format, choose the permissions (read, write, execute) and click Map Range

  2. Enter the MAP command in the Command window.

MAP  C:0xF800, C:0xF8FF  READ WRITE  // allow R/W access to IO space 

For the 80x51 targets the address might be prefixed with a memory space specifier as described in the table on this page. For example, C:0xF800 refers to Code address 0xF800.

Any memory map changes could be lost during the next debug session. Once you find the correct memory put the required MAP commands into a debugger INI file that can be entered under Project -> Options for Target -> Debug and create an initialization file.




The following Discussion Forum threads may provide information related to this topic.

Last Reviewed: Monday, October 26, 2020

Did this article provide the answer you needed?
Not Sure
  Arm logo
Important information

This site uses cookies to store information on your computer. By continuing to use our site, you consent to our cookies.

Change Settings

Privacy Policy Update

Arm’s Privacy Policy has been updated. By continuing to use our site, you consent to Arm’s Privacy Policy. Please review our Privacy Policy to learn more about our collection, use and transfers
of your data.