其他分享
首页 > 其他分享> > MDK debug时出现*** error 65: access violation at问题

MDK debug时出现*** error 65: access violation at问题

作者:互联网

简介

本文针对的是访问内存权限的问题,其他问题暂时不讨论。

问题描述

使用mdk arm调试keil工程的时候遇到错误*** error 65: access violation at 0xE0042004 : no 'write' permission,如下图:
1234

问题分析

访问内存地址没有权限,可能是没有读权限,可能是没有写权限或者执行权限。

解决办法

办法1:

进入debug模式,调出memory map工具(在debug选项下),添加对应的内存映射范围,并设置权限;

如下图所示:
12

办法2:

新建一个*.ini文件,把内存映射范围和权限添加进去(使用MAP命令),然后把这个文件设置为debug初始化脚本。示例如下:

//
/
STM32DBG.INI: STM32 Debugger Initialization File /
/
/
// <<< Use Configuration Wizard in Context Menu >>> //
//
/
This file is part of the uVision/ARM development tools. /
/
Copyright (c) 2005-2007 Keil Software. All rights reserved. /
/
This software may only be used under the terms of a valid, current, /
/
end user licence from KEIL for a compatible version of KEIL software /
/
development tools. Nothing else gives you the right to use this software. /
/
/
MAP 0xE0042004, 0xE0042104 READ WRITE // allow R/W access to IO space

FUNC void DebugSetup (void) {
// Debug MCU Configuration
// <o1.0> DBG_SLEEP Debug Sleep Mode
// <o1.1> DBG_STOP Debug Stop Mode
// <o1.2> DBG_STANDBY Debug Standby Mode
// <o1.5> TRACE_IOEN Trace I/O Enable
// <o1.6..7> TRACE_MODE Trace Mode
// <0=> Asynchronous
// <1=> Synchronous: TRACEDATA Size 1
// <2=> Synchronous: TRACEDATA Size 2
// <3=> Synchronous: TRACEDATA Size 4
// <o1.8> DBG_IWDG_STOP Independant Watchdog Stopped when Core is halted
// <o1.9> DBG_WWDG_STOP Window Watchdog Stopped when Core is halted
// <o1.10> DBG_TIM1_STOP Timer 1 Stopped when Core is halted
// <o1.11> DBG_TIM2_STOP Timer 2 Stopped when Core is halted
// <o1.12> DBG_TIM3_STOP Timer 3 Stopped when Core is halted
// <o1.13> DBG_TIM4_STOP Timer 4 Stopped when Core is halted
// <o1.14> DBG_CAN_STOP CAN Stopped when Core is halted
//

_WDWORD(0xE0042004, 0x00000027); // DBGMCU_CR
_WDWORD(0xE000ED08, 0x20000000); // Setup Vector Table Offset Register
}

DebugSetup(); // Debugger Setup

关键语句:MAP 0xE0042004, 0xE0042104 READ WRITE
其他不用关心

3

标签:MDK,Core,violation,STOP,halted,when,DBG,access,Stopped
来源: https://www.cnblogs.com/lxyjrx/p/16250513.html