Improvements to "Cortex-M JTAG Debugging with VS Code" KB

This KB describes how to use Segger J-Link debug probe to JTAG debugging Cortex-M firmware on some Toradex SoMs, using VS Code.
Searching in google I found this wiki from Segger that seems very clear and effective (IMHO).
It describes how to set launch.json with the elements:

  • jlinkscript
  • svdFile

For iMX8M-Plus both of them are included in the IAR and SEGGER tool patch for i.MX8M Plus devices available on NXP website.

I took inspiration from this Segger woki and I decided to specify arm_toolchain_dir in settings.json

{
    "arm_toolchain_dir": "C:\\Program Files (x86)\\Arm GNU Toolchain arm-none-eabi\\11.3 rel1"
}

and in this way I can use the path both in:

  • tasks.json

    "env": 
          {
              "ARMGCC_DIR": "${config:arm_toolchain_dir}"
          }
    
  • launch.json

    "armToolchainPath": "${config:arm_toolchain_dir}/bin"
    

without the need to specify the path twice (as in the original Toradex KB).

I did it for Windows 10, but I see that in Segger wiki there is the Ubuntu section too (not tried).

Hi @vix,

Thanks for sharing this information with us. It looks like a better way of doing it. I will test it on ubuntu as well and, if it works, we could improve our documentation.

Thanks!

Best Regards,
Hiago.