[ABANDONED] Debug issue with Segger JLink in Keil - One Keil project with multiple targets and heterogeneous MCUs

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

  • [ABANDONED] Debug issue with Segger JLink in Keil - One Keil project with multiple targets and heterogeneous MCUs

    Greetings,

    I have a custom designed board with 3 MCUs: 2x EFM32TG11B120F128 (Tiny geckos/Cortex-M0) and 1x EFM32GG11B420F2048 (Giant gecko/Cortex-M4). I have a single Keil project with three targets, so I can share code files, build and deploy each version from a single project. I'm downloading the firmware and debugging on a Segger JLink.

    When I started working on this board, I began with programming the two tiny geckos. There were no issues with either of these mcus, I could compile, download and debug these mcus without any issue.

    Then I moved on to the giant gecko mcu. I found that I could compile and download, but I could not enter debug mode. The JLink always produced the error message: "Jlink cortex-m error / Cannot access Memory".

    JLinkLog.txt extract (when trying to enter debug):

    JLinkLog.txt wrote:


    T8848 136:831.926 JLINK_ReadReg(XPSR)
    T8848 136:831.933 - 0.009ms returns 0x01000000
    T8848 136:853.718 JLINK_ReadMemU32(0xF004000C, 0x1 Items)
    T8848 136:853.750 CPU_ReadMem(4 bytes @ 0xF004000C)
    T8848 136:854.003 failed
    T8848 136:854.015 - 0.300ms returns -1 (0xFFFFFFFF)
    T8848 138:412.731 JLINK_Close()
    T8848 138:412.965 CPU_ReadMem(4 bytes @ 0xE0001000)
    T8848 138:413.175 CPU_WriteMem(4 bytes @ 0xE0001004)
    T8848 138:427.718 - 15.004ms
    T8848 138:427.739
    T8848 138:427.745 Closed

    (0xF004000C is an unused memory location in the giant gecko).

    I initally suspected that I had made a mistake with the hardware design, but I managed to prove that the mcu was working correctly by creating a simple test project just for the giant gecko mcu, which compiled and downloaded correctly and could sucessfully enter debug mode.

    After some investigation, I found that if I closed Keil, deleted the JLinkSettings.ini file from the project directory and reloaded Keil, that I could successfully enter debug mode for the giant gecko MCU. The JLinkSettings.ini file has a line that specifies the target MCU, this was being set to the tiny gecko and not being updated when changing target to the giant gecko.

    Second JLinkLog.txt extract (when trying to enter debug):

    JLinkLog.txt wrote:

    T8848 136:648.351 JLINK_ExecCommand("ProjectFile = "C:\Users\admin\Documents\Code\Energy Micro\C16 WIP\Project\JLinkSettings.ini"", ...).
    T8848 136:649.718 Device "EFM32TG11BXXXF128" selected.
    T8848 136:650.586 - 2.243ms returns 0x00
    T8848 136:650.741 JLINK_ExecCommand("Device = EFM32GG11B420F2048GQ100", ...).
    T8848 136:651.032 Device "EFM32TG11BXXXF128" selected.
    T8848 136:651.843 - 1.097ms returns 0x00
    T8848 136:651.864 JLINK_GetHardwareVersion()
    T8848 136:651.870 - 0.009ms returns 101000
    I've noticed that there is a single JLinkSettings.ini file per keil project. Perhaps there needs to be a JLinkSettings.ini file for each target instead of a global .ini file at the project level?

    I'm also a little suspicious of the line: JLINK_ExecCommand("Device = EFM32GG11B420F2048GQ100", ...), it seems to have been ignored.

    At the moment I can get round the issue by closing Keil, deleting the JLinkSettings.ini file and restarting Keil. This is not too bothersome if I do infrequent context switches between targets, but its still a little irratating. Is there a way I can get the JLink to always understand which device it should be targeting?

    Best regards,
    Jonathan