keil调试 *** Error 65: Access violation at 0x00000004 : No 'write' permission问题解决方法

µVISION DEBUGGER: ERROR 65 (ACCESS VIOLATION)


Information in this article applies to:

  • MDK All Versions
  • Cx51 All Versions
  • C166 All Versions
  • C251 All Versions

SYMPTOMS

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.

CAUSE

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.

RESOLUTION

Enable memory regions for absolute memory accesses using the MAP debugger command or the Debug - Memory Map dialog. 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.

You may put the required MAP commands into a debugger INI file that can be entered under Project -> Options for Target -> Debug -> Initialization file. For example, the content of such a file may be:

MAP  0xF800, 0xF8FF  READ WRITE  // allow R/W access to IO space
原文地址:http://www.keil.com/support/docs/814.htm
  • 0
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值