This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

*** error 57: illegal address (0x8000000)

I get the below error message when I start the ULINK debugger with my KEIL MCBSTM32 eval board:


Cannot access Memory
*** error 57: illegal address (0x8000000)

I've searched KEIL's website for error 57, but couldn't find anything. I've searched uVsion help, but couldn't find anything. Can someone point me to where these types of errors are documented?

The debugger is actually stopped at address 0x80001A4, and these are the instructions before and at that line:


0x080001A0 F002BBF6 B.W 0x080002990
0x080001A4 4804 LDR r0,[PC,#32] ; @0x080001C8

and this is what's at 0x080001C8:

0x080001C8 00ED LSLS r5,r5,#3

and this is what's at 0x08002990:

0x08002990 4770 BX lr

Address 0x8000000 is the start of flash ROM for the uC on this eval board (an STM32F103RBT6). I'm using the default KEIL assembly startup code (STM32F103x.s) and the default project options for where ROM and RAM is (IROM1 at 0x8000000 with size = 0x20000, and IRAM1 at 0x20000000 with size = 0x5000).

If I start the debugger then stop it, I get this error message:


ULINK - Cortex-M Error
Could not stop Cortex-M device!
Please check the JTAG cable

I found some knowledgebase articles that suggested slowing down the JTAG clock, using internal or external 3.3V inside the ULINK, and/or making sure that a hardware reset was used with the ULINK; so I tried those suggestions. Unfortunately, they didn't change my symptoms.

I've been trying to find somwhere where I could insert a breakpoint to try to step through the startup code, but uVision won't let me put a breakpoint anywhere in the startup assembly code (and yes, I do have the "Debug Information" checkbox checked in the project options). I've unchecked the debugger "Reset and Run" and "Run to main()" options, but when I start the debugger and try to single step, I can only step a few times and then the code appears to start and never stop. If I hit the "halt" button, I get the same error message about not being able to stop the uC.

The debugger always starts at address 0x080001A4 with the error message about not being able to access memory.

Can anyone suggest something else to do that might fix these problems?

Thanks,
Dave.

Parents
  • Well... I had tried a new way to organize source code for this project, and on a whim I decided to go back to my old way of organizing it (all source code for the project in one directory). That made the error 57 error go away. No idea why that is!

    Also, now I get the assembly source code in the disassembly window (which I didn't get before), and I can see that the line of code where the debugger stops (0x080001A4) is where the assembly code is trying to jump to the library startup code (I think):


    117: LDR R0, =__main
    0x080001A4 LDR r0,[PC#32] ; @0x080001C8

    If I "step into" at that point, the debugger stops at:


    __main:
    0x080000EC BL.W __scatterload_rt2_thumb_only (0x080000F4)

    I started single-stepping through this code, and it seems to run okay (the debugger doesn't crash); but if I try to run to [my] main, the debugger never makes it there. If I then try to halt the debugger, I get that same error message about not being able to stop the debugger.

    Should I expect the KEIL IDE to work right with projects where the source code is not in a single directory?

    Also, other than including the cortexm3_macros.s and cortexm3.h files in my project, do I need to do anything else in order to be able to use the macros in these files?

    Does anyone know if there's a problem with the default startup code for the STM32F10x parts?

    Thanks,
    Dave.

Reply
  • Well... I had tried a new way to organize source code for this project, and on a whim I decided to go back to my old way of organizing it (all source code for the project in one directory). That made the error 57 error go away. No idea why that is!

    Also, now I get the assembly source code in the disassembly window (which I didn't get before), and I can see that the line of code where the debugger stops (0x080001A4) is where the assembly code is trying to jump to the library startup code (I think):


    117: LDR R0, =__main
    0x080001A4 LDR r0,[PC#32] ; @0x080001C8

    If I "step into" at that point, the debugger stops at:


    __main:
    0x080000EC BL.W __scatterload_rt2_thumb_only (0x080000F4)

    I started single-stepping through this code, and it seems to run okay (the debugger doesn't crash); but if I try to run to [my] main, the debugger never makes it there. If I then try to halt the debugger, I get that same error message about not being able to stop the debugger.

    Should I expect the KEIL IDE to work right with projects where the source code is not in a single directory?

    Also, other than including the cortexm3_macros.s and cortexm3.h files in my project, do I need to do anything else in order to be able to use the macros in these files?

    Does anyone know if there's a problem with the default startup code for the STM32F10x parts?

    Thanks,
    Dave.

Children