How to debug with e2 studio

Environment

Builder: Mbed CLI or Mbed Studio(version1.2.0)
Toolchain: GNU ARM Embedded Toolchain(version 9) or ARM C Compiler (version 6.14)
Debugger: Renesas e2 studio
https://os.mbed.com/media/uploads/luyao/e2studio2.png

Setup Procedure

Install e2 studio

Please download e2studio 7.8.0 or 2020-07, and install.

Install OpenOCD

Please download exe file of OpenOCD v0.10.0-201601101000-dev, and install.

Associate GR-MANGO config with OpenOCD

Please download renesas_gr.cfg and copy it to scripts\board directory included in the OpenOCD installed location.
According to the version of the windows operating system and the version of OpenOCD, it should be located as follows:

Windows OS(32bit), OpenOCD(32bit):
・C:\Program Files\GNU ARM Eclipse\OpenOCD\0.10.0-201601101000-dev\scripts\board
Windows OS(64bit), OpenOCD(32bit):
・C:\Program Files (x86)\GNU ARM Eclipse\OpenOCD\0.10.0-201601101000-dev\scripts\board
Windows OS(64bit), OpenOCD(64bit):
・ C:\Program Files\GNU ARM Eclipse\OpenOCD\0.10.0-201601101000-dev\scripts\board

Install OpenOCD add-in to e2studio

  1. Launch e2studio.
  2. Select[Help]menu→[Install new software...]
  3. Input http://gnuarmeclipse.sourceforge.net/updates to [Work with] box, and click [Add] button.
    https://os.mbed.com/media/uploads/luyao/e2studio21.png

  4. A window will pop up and the http://gnuarmeclipse.sourceforge.net/updates is placed in the [Location] box automatically. Click add button.
    https://os.mbed.com/media/uploads/luyao/e2studio63.png

  5. Check [GNU ARM C/C++ OpenOCD Debugging] and push [Next >] button.
    https://os.mbed.com/media/uploads/luyao/e2studio64.png

  6. Install and restart e2studio.

Configure OpenOCD on e2studio

  1. Select [Window] -> [Preferences].
  2. Select [MCU] - [Global OpenOCD Path]. https://os.mbed.com/media/uploads/luyao/e2studio23.png

  3. Check if the directory and executable are filled with OpenOCD installation folder and openocd.ex respectively. If not, please input OpenOCD installation folder and openocd.exe there and click [OK]. Note that the default OpenOCD installation folder should be as follows:
    • Windows OS(32bit), OpenOCD(32bit):
      ・C:\Program Files\GNU ARM Eclipse\OpenOCD\0.10.0-201601101000-dev\bin
    • Windows OS(64bit), OpenOCD(32bit):
      ・C:\Program Files (x86)\GNU ARM Eclipse\OpenOCD\0.10.0-201601101000-dev\bin
    • Windows OS(64bit), OpenOCD(64bit):
      ・ C:\Program Files\GNU ARM Eclipse\OpenOCD\0.10.0-201601101000-dev\bin

The way to debug

Notice

If there is no ".gdbinit " file in the project folder. (where the .project file exists.)
Please copy the ".gdbinit" file to your project folder and keep the name of the file called ".gdbinit"

.gdbinit

define hook-step
mon cortex_a maskisr on
end

define hook-stepi
mon cortex_a maskisr on
end

define hook-next
mon cortex_a maskisr on
end

define hook-nexti
mon cortex_a maskisr on
end

define hook-finish
mon cortex_a maskisr on
end

define hook-stop
mon cortex_a maskisr off
end

define hook-kill
mon reset init
end

set mem inaccessible-by-default off
  1. Connect USB cable. Mbed drive will start up.
  2. Copy ".bin" file to Mbed drive.
  3. Reconnect USB cable.
  4. Select project to debug in e2 studio.
  5. Select [Run] menu ->[Debug Configuration].
  6. Select [GDB OpenOCD Debugging] , then right click it and choose "New Configuration". https://os.mbed.com/media/uploads/luyao/e2studio66.png

  7. Select your project in [GDB OpenOCD Debugging]
  8. In the [Main] tab, please write the applicable project name in"Project" and the applicable elf file path in "C/C++ Application". Select "Use Active" in the build configuration. https://os.mbed.com/media/uploads/luyao/e2studio54.png

  9. In the [Debugger] tab, write <-f board/renesas_gr.cfg> in "Config options".
    "arm-none-eabi-gdb" is described in GDB Client Setup "Executable". https://os.mbed.com/media/uploads/luyao/e2studio51.png

  10. In the [Startup] tab, uncheck "Initial Reset" and "Enable ARM semihosting".
    Uncheck "Load executable" in the Load Symbols and Executable part. https://os.mbed.com/media/uploads/luyao/e2sutdio43.png

  11. The [Source] tab and [Common] tab are left as default.
  12. Click the "Apply" then click the "Debug".
  13. If you want to reset the debug. Select the "Debugger Console" view and enter the following command.
monitor reset halt


Please log in to post comments.