Keil Logo

µVISION DEBUGGER: Error 65: Access Violation

SYMPTOMS

When trying to write to a variable or memory location, the Keil µVision Debugger issues an Error 65 message:

*** Error 65: Access violation at 0x00000004

I have specified this memory area in the Target options, but I still receive this error. Other versions of the error could be:

  • Error 65: Access violation at [Address] : No 'write' permission
  • Error 65: Access violation at [Address] : No 'read' permission
  • Error 65: Access violation at [Address] : No 'execute/read' permission

BACKGROUND

When the µVision Debugger loads an executable program, the µVision Simulator uses the loaded program and data segments to create a memory map:

  • Code segments are marked as executable
  • Data segments are marked as read/write
  • All other memory is unmapped and is, therefore, not marked for any type of access

While executing, the debugger checks that memory accesses are only made to objects that are defined in the program, i.e., the debugger by default only allows memory accesses to valid data objects. For any access that is outside of a defined C object, the µVision debugger generates an error message.

Usually, there is a programming error when you try to access unexpected locations. For example:

Note: If debugging on a target, Access Violation could mean a bus issue, device lockup, or memory remap is preventing the debugger from reaching the memory.

RESOLUTION

If the error is memory region that should be accessed, update the memory map the simulator uses. Define all the memory ranges that your program is permitted to access. Ensure each memory range has the proper permissions (read, write, execute) that match the memory of the actual hardware.

Use the Memory Map Dialog

  • While debugging, select Debug - Memory Map - the dialog opens
  • Enter a range in START, END, format
  • Choose the permissions (read, write, execute)
  • Click Map Range
  • Close the dialog

Use the MAP Command in the Command Window

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

Note: For 8051 devices, the address may need a prefix, e.g., a memory specifier in the table on this page. For example, In the Memory Map dialog C:0xF800 refers to Code address 0xF800.

Use a Debug Initialization File

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.

MAP  0x40000000, 0x4000003F  READ WRITE EXEC
// allow code execution for interrupt vector fetch

This should resolve the error.

MORE INFORMATION

SEE ALSO

Last Reviewed: Monday, February 8, 2021


Did this article provide the answer you needed?
 
Yes
No
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.