Renesas


Renesas Electronics Corporation (TSE: 6723), the world's number one supplier of microcontrollers, is a premier supplier of advanced semiconductor solutions including microcontrollers, SoC solutions and a broad range of analog and power devices.

How to debug with e2 studio

Environment

Builder: Mbed CLI or Mbed Studio(version1.4.3)
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 2021-10, and install.

Install OpenOCD

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

Associate GR-MANGO config with OpenOCD

Notice

Please copy the "renesas_gr.cfg" file to scripts\board directory included in the OpenOCD installed location and keep the name of the file called "renesas_gr.cfg"

renesas_gr.cfg

# Renesas GR-PEACH(CMSIS-DAP)

source [find interface/cmsis-dap.cfg]

source [find target/swj-dp.tcl]

set _CHIPNAME rza1
swj_newdap $_CHIPNAME cpu -expected-id 0x3ba02477

set _TARGETNAME $_CHIPNAME.cpu
target create $_TARGETNAME cortex_a -chain-position $_TARGETNAME

adapter_khz 1000
reset_config trst_and_srst
debug_level 0
gdb_target_description enable
gdb_breakpoint_override hard
init
halt
cortex_a dbginit 

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

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

All wikipages