J-Link Programming Failed messages

This site uses cookies. By continuing to browse this site, you are agreeing to our Cookie Policy.

  • J-Link Programming Failed messages

    I am using a J-Link Plus with IAR v6.50.6 and an STM32F103xE processor. I have been using the standard J-Link with only hardware breakpoints with success for years. Since using the Plus i am having many difficulties. When i set a breakpoint, hit it and start single-stepping, after about 4 steps, i get "Programming failed" messages and i can no longer debug and have to reset the target. I notice that when i set breakpoints they default to type 'hardware'. Then when i start single stepping, they are still hardware, and when 6 total hardware breakpoints are reached, the error occurs. Why is it using hardware breakpoints as the default? It would be nice to set the default to use flash breakpoints. But so far, i would say this tool is not usable. I have downloaded JLink Arm 4.82 and when it asked me to re-flash the device i said OK and it did. But it has not helped with this issue. Do you have any ideas what may be wrong?
    Thanks, Mark
  • Hi Mark,

    I am sorry to hear that you run into trouble after switching from an old J-Link to a new J-Link Plus.
    This should not be the case and we are not aware of any issues regarding this setup.

    We gave it a quick try with an STM3210E-EVAL (STM32F103ZET6 on it) + IAR v6.50.6 but everything works just fine.
    It sounds a bit like the project is not configured correctly. Is it possible that you provide us your project?
    If you do not want to share it in the forum you can sent it via e-mail to https://www.segger.com/support/technical-support/ with a link to this forum thread.

    Please find attached the project we used for our test. It contains two debug configuration (RAM and FLASH). Can you please give both configuration a try and
    check if you see the same behavior as before? It should run out-of-the-box.

    Best regards
  • Hi Eric,

    Thanks for the reply... My project is fairly large and i would have to spend quite a bit of time to make it generic. But what i notice is that when the "Programming Failed" message appears with a specific address, when i look at the contents of the code at that address in the map listing, i wonder about it. The code i have at that address (where it's failing to set a breakpoint) is in the heap management code. That code exists in an IAR library (dlMalloc). Is there some way to specify where breakpoints get set? I am not trying to set a breakpoint anywhere near that library. The other issue is that i keep seeing hardware breakpoints getting set. Does J-Link first use hardware breakpoints and when they run out start using flash breakpoints? And how does it determine where to write the flash breakpoint?
  • Hi Mark,

    Did you have the chance to gave the project i have attached to my previous post a try? Does it show the same issue or does it work correctly?
    Is there some way to specify where breakpoints get set?
    In general breakpoints should only be set to the addresses where the IDE (or the user) tells the debugger to set the breakpoints. So if EWARM tells J-Link to set a breakpoint in the heap management code, J-Link will set it there.
    The other issue is that i keep seeing hardware breakpoints getting set.
    Please allow me to ask why this is an issue? Are they set although you did not set a breakpoint? This should not be the case.
    Does J-Link first use hardware breakpoints and when they run out start using flash breakpoints?
    Yes, J-Link first tries to use hardware breakpoints. If it runs out of hardware breakpoints, J-Link tries to use the flash breakpoints. The STM32F103ZET6 has 6 hardware breakpoints available. So the first 6 breakpoints should set as hardware breakpoint and the seventh as flash. You can check this in the J-Link Control Panel. Just click on the small J-Link icon in the windows task bar and switch to the "Breakpoints tab". I have attached a screenshot how the Breakpoints tab should look like. Can you please set 7 breakpoints in your application and post the screenshot?

    Best regards
    • J-LinkControlpanel_Breakpoi.gif

      21.97 kB, 848×506, viewed 751 times
  • My question, "Is there some way to specify where breakpoints get set? " was poorly stated. What i really meant is there some way to tell J-Link where in flash to set breakpoints? I would like to understand the mechanism of how flash breakpoints work in general.

    I'm attaching a snapshot of the control panel when a failure occurs.
    I'm attaching a snapshot of my actual breakpoints in IAR.

    • IAR Breakpoints.gif

      114.45 kB, 675×582, viewed 632 times
    • JLink Panel.png

      67.77 kB, 566×760, viewed 660 times
  • Is there some way we can get to the bottom of this? Our memory map is somewhat complex. We have serial flash mapped in, but i don't see this as a potential problem since all the errors i have seen begin with the address 0x801xxxxx (various addresses in internal flash). I have tried this with 2 separate JLink Plus's. I have no problems when i am using the base Jlink with only hardware breakpoints. I think i can send you our .icf files, .ewp file and our.map file, but i don't think i can send you the whole project (source code). I have also tried this with IAR 7.10.1 with the same results.

    BTW, this error only occurs if i set more than 6 breakpoints. We also reproduced the same results on another associate's computer system.

    The post was edited 1 time, last by mwelo ().

  • Hi,

    Sorry, but we do not understand your question...
    What do you mean with?:

    What i really meant is there some way to tell J-Link where in flash to set breakpoints?

    How do you expect them to work?
    For the debugger there is *no* difference in how flash breakpoints work apart from hardware breakpoints.
    The debugger tells the DLL: "Set a breakpoint at address xxx" and that's it.

    The DLL will then do everything necessary, internally:
    Save the original instruction at address xxx
    Replace it by a breakpoint instruction
    Reprogram the flash sector with the new data

    Same when removing a flash breakpoint.

    Can you please provide a stripped-down example project that allows reproduction of the problem and runs on almost any hardware that is based on the device you are using.
    Should not be too hard to prepare such a project but without it, there is not much we can do here since we cannot reproduce the problem.
    And without being able to reproduce it here, we cannot fix it (if it is something on the J-Link side)

    Best regards