0
\$\begingroup\$

I am using an STM32F407VGT board with an STLINK V2 programmer in keil IDE. I have downloaded to the board a very simple code:

#include "stm32f407xx.h"
#include <stdint.h>
int main(void)
{
 RCC_TypeDef *pRCC;
 GPIO_TypeDef *pGPIO;
 pRCC = RCC;
 pGPIO = GPIOA;
 pRCC->APB2ENR |= (1 << 0); 
 pGPIO->PUPDR = 0x11;
 return 0;
}

The problem is that when I try to enter to Debug Session, I cant use breakpoints or see the memory, the command window shows "cannot access memory". I have done the needed debug setup, even I have tried changing the parameters but I just cant ́t access the memory on debug, but i do not have problems loading my code. I have also tried on Eclipse/OpenOCD and I also can download the code to the board, but it has the same issue with debugging.

This is my board enter image description here

and this is how keil looks.

enter image description here

asked Feb 13, 2018 at 5:50
\$\endgroup\$
2
  • \$\begingroup\$ replace your return 0; with a while(1);. You don't want to return from main in an embedded situation. \$\endgroup\$ Commented Feb 13, 2018 at 8:32
  • \$\begingroup\$ You need to write a Configuration file for you controller that tells what area(Address) of the Memory is what! You need to added that when debugging. I don't remember how you do but I have written one somewhere. Will write more when I get near Home PC \$\endgroup\$ Commented Feb 13, 2018 at 13:09

3 Answers 3

0
\$\begingroup\$

I had nearly same problem and I could solve it with the help of this.

In the debugger hardware setting window you have to explicitly select SW, otherwise the debugger will try to use the full JTAG interface for debugging. right click on your project root folder> Option for target ...> debug> use: STlink> settings> Port: SW

answered Feb 13, 2018 at 6:01
\$\endgroup\$
2
  • \$\begingroup\$ I already changed this but the problem is still there. Did you do another change to your configuration? Which board are you using? \$\endgroup\$ Commented Feb 13, 2018 at 6:17
  • \$\begingroup\$ I used STM32F4DISCOVERY board that employing STM32F407VGT6 micro-controller. I think I also changed Debug > Connect & Reset Options value other than Normal. \$\endgroup\$ Commented Feb 13, 2018 at 6:30
0
\$\begingroup\$

http://www.keil.com/forum/59779/-error-65-access-violation-at-0x40023800-no-read-permission/

Hope this helps to write an initialisation file for your controller for debugging!

answered Feb 13, 2018 at 13:12
\$\endgroup\$
0
\$\begingroup\$

I have solved this problem. I didn ́t know it is needed to set the boot0 and boot1 pins to GND/VCC according to the desired boot mode. Here you can find the link to the boot mode explanation. If you want to have main flash memory boot, you have to set boot1 pins to GND.

answered Feb 14, 2018 at 4:48
\$\endgroup\$

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.