Troubles with debug only on e2studio

Hello,

 

I'm currently trying to debug an old project of ours running an RL78 G13 (R5F101LKD)

The application is fully functional but I cannot debug yet.

The project is being built under eclipse with a specific "Makefile + opt files" build using iar toolchain for rl78.

 

I made a new "debug only" project under e2studio because I can debug it using raw eclipse + iar toolchain plugin / C-Spy, I read that it doesn't include debug support.

https://renesasrulz.com/e2studio/f/e2studio-forum/14649/iar-c-spy-is-not-visible-in-configuration-options-in-eclipse

“The plug-in manager adds the interface to control the build process with IAR compiler. It does not include debug support.”

 

I generated an elf for the purpose with the options -Felf and -yspc

This my new project config :

 

I get the following console output:

GDBServer for Renesas targets.
Version 7.5.0.v20190627-134950 [caabfd6d] (Jun 28 2019 16:07:54)


Starting server with the following options:
Raw options : C:\Renesas\e2_studio\DebugComp\\RL78\e2-server-gdb -g E1 -t R5F101LK -umFreq= 0 -usFreq= 0 -umClock= 1 -w 1 -usupplyVoltage= 0 -ucommMethod= 0 -usecurityID= 00000000000000000000 -upermitFlash= 1 -uuseWideVoltageMode= 1 -ueraseRom= 1 -uuseOnChipDebug= 0 -uuseUserOptionByte= 0 -uresetOnReload= 1 -ustopTimerEmu= 0 -ustopSerialEmu= 0 -umaskInternalResetSignal= 0 -umaskTargetResetSignal= 0 -n 0 -uverifyOnWritingMemory= 1 -uTraceCapture= 0 -l -uCore= SINGLE_CORE|enabled|1|main -uSyncMode= async -uFirstGDB= main

Connecting to E1/E20, RL78 Target
GDBServer endian : little
Target power : on
Starting target connection

Version Information:
RL78 E1/E20 Executor V4.03a [29 May 2018]

Finished target connection
GDB: 59478
Target connection status - OK
Starting download
Debug monitor area 1, writing to address 0x00000002 with data ffff
Options bytes, writing to address 0x000000c0 with data 79
Options bytes, writing to address 0x000000c1 with data ff
Options bytes, writing to address 0x000000c2 with data e0
Options bytes, writing to address 0x000000c3 with data 04
Correct values for address 0x000000c3, Options byte settings for debugging:
0b10000100
0b10000101

Security ID, writing to address 0x000000c4 with data ffffffffffffffffffff
Debug monitor area 2, writing to address 0x000000ce with data c1fc814400c0fc754600
write to '0x000000ce' to '0x000002cd' failed, part of debug monitor area
write to '0x000000ce' to '0x000002cd' failed, part of debug monitor area
Finished download
Disconnected from the Target Debugger.


 

I get the following output from the debugger console:

GNU gdb (GDB) 7.8.2-20181017-Build_1
Copyright (C) 2014 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <gnu.org/.../gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type "show copying"
and "show warranty" for details.
This GDB was configured as "--host=i686-pc-mingw32 --target=rl78-elf".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<www.gnu.org/.../>.
Find the GDB manual and other documentation resources online at:
<www.gnu.org/.../>.
For help, type "help".
Type "apropos word" to search for commands related to "word".
monitor set_io_access_width,RW,2,f00e0-f00e2,f0108-f011e,f0122-f012a,f0134,f0138,f0148-f014a,f0150-f0152,f0158-f015a,f0162-f016a,f0174,f0190-f019e,f01b2-f01be,f02f2,f02fa,fff10-fff12,fff18-fff1a,fff44-fff4a
monitor set_io_access_width,RW,2,fff64-fff6e,fff90,fffb2-fffb8,fffd0,fffd4,fffd8,fffdc,fffe0-ffff6
monitor set_io_access_width,R,2,f0100-f0106,f0120,f0140-f0142,f0160,f0180-f018e,f01a0-f01b0,fff1e
monitor set_io_access_width,RW,1,f0010-f0013,f0030-f0031,f0033-f0035,f0037,f003c,f003e,f0040-f0041,f0045,f0050-f0051,f0055,f0057,f0060,f006c,f006e,f0070-f0071,f0073-f0074,f0076-f0078,f007d,f00a0,f00a8
monitor set_io_access_width,RW,1,f00ac-f00af,f00e8,f00f0,f00f3-f00f5,f00fe,f0100,f0102,f0104,f0106,f0108,f010a,f010c,f010e,f0120,f0122,f0124,f0126,f012a,f0134,f0138,f0140,f0142,f0148,f014a,f0160,f0162,f0164
monitor set_io_access_width,RW,1,f0166,f016a,f0174,f01a0,f01a2,f01a4,f01a6,f01a8,f01aa,f01ac,f01ae,f01b0,f01b2,f01b4,f01b8,f01ba,f01bc,f01be,f0230-f0234,f02f0,fff00-fff07,fff0c-fff0e,fff10,fff12,fff1a-fff1b
monitor set_io_access_width,RW,1,fff1f-fff27,fff2c,fff2e,fff30-fff32,fff37-fff3b,fff44,fff46,fff48,fff4a,fff50-fff52,fff66-fff67,fff92-fff9e,fffa0-fffa6,fffa8-fffac,fffb0-fffbd,fffd0-fffd1,fffd4-fffd5
monitor set_io_access_width,RW,1,fffd8-fffd9,fffdc-fffdd,fffe0-fffef,ffffe
Function "__program_start" not defined.

 

I checked my .map at the addresses between 0x00CE and 0x00D8 (used by the debug monitor) and here it is:

SEGMENTS IN THE MODULE

  ======================

RCODE

  Relative segment, address: 000000CE - 000000CE (0x1 bytes), align: 0

  Segment part 1.

           ENTRY                   ADDRESS         REF BY

           =====                   =======         ======

           _exit                   000000CE        exit (?exit)

    -------------------------------------------------------------------------

RCODE

  Relative segment, address: 000000CF - 000000D2 (0x4 bytes), align: 0

  Segment part 2.

           ENTRY                   ADDRESS         REF BY

           =====                   =======         ======

           __cstart_call_dtors     000000CF        __record_needed_destruction (?cppinit)

    -------------------------------------------------------------------------

RCODE

  Relative segment, address: 000000D3 - 000000D7 (0x5 bytes), align: 0

  Segment part 4.             Intra module refs:   _exit

 

    -------------------------------------------------------------------------

 

but what I don't understand is that the startup is not in that area

 

RCODE
Relative segment, address: 0000060A - 00000631 (0x28 bytes), align: 0
Segment part 3. ROOT. Intra module refs: Segment part 2
ENTRY ADDRESS REF BY
===== ======= ======
?C_STARTUP 0000060A Absolute parts (?ABS_ENTRY_MOD)
@cstart 0000060A
__program_start 0000060A
LOCAL ADDRESS
===== =======
ram00 00000623

 

any hints?

thank you!

  • Hi azeaze,

    How's this issue? Were you able to fix this?

    JB
    RenesasRulz Forum Moderator

    https://renesasrulz.com/
    https://academy.renesas.com/
    https://en-us.knowledgebase.renesas.com/

  • In reply to JB:

    Hi JB,

    currently I'm stuck and I'm looking forward to hearing from Renesas ;)

    Thanks
    azeaze
  • Hello, azeaze.

    As RL78 Users Manual (Hardware) and the following FAQ tells, emulator uses the area (address 0x00CE-) where your code is placed.
    You need to configure linker option not to place any code/data there.

    FAQ: RL78 debugger launch failed with binary data write error
    https://en-support.renesas.com/knowledgeBase/18565004

    Users Manual: see chapter 26.3 "Securing of User Resources".
    https://www.renesas.com/us/en/search/keyword-search.html#q=R01UH0146

  • In reply to Okra:

    Thank you Okra.
    Yes as I expected there is a problem with the emulator area , but what I can't understand is why such a message `Function "__program_start" not defined.`?
  • In reply to azeaze:

    Debugger tells "__program_start" is not found in the loadmodule.
    I suppose "__program_start" was given as the name of function to place breakpoint (see "Startup" tab in Debug Configuration), the name can be wrong such as "_program_start".

  • In reply to Okra:

    no function __program_start does exist, and I tried with the 3 symbols that points to the startup (where I set the first breakpoint).

    bin>objdump -t main.elf | find "060a"
    0000060a g F RCODE 00000028 ?C_STARTUP
    0000060a g F RCODE 00000028 @cstart
    0000060a g F RCODE 00000028 __program_start
  • In reply to azeaze:

    With IAR compiler the start up code by default comes from the IAR library. Then the symbol for program start does not relate to any source code and you get a "symbol not found".
  • In reply to azeaze:

    > With IAR compiler the start up code by default comes from the IAR library.
    Ah, I got it.

    > where I set the first breakpoint
    Anyway, no necessary to set it (and no use to set a breakpoint at entry point).
    Just leave unchecked the checkbox and it should work.

  • In reply to Okra:

    Thank you Okra,

    I do not have the "function does not exist" problem anymore and the debugger seems to be running,

    I still have the message that tells me that the debug monitor area is already used even after I cleared the area from code.

    was:

    Security ID, writing to address 0x000000c4 with data ffffffffffffffffffff
    Debug monitor area 2, writing to address 0x000000ce with data c1fc814400c0fc754600
    write to '0x000000ce' to '0x000002cd' failed, part of debug monitor area
    write to '0x000000ce' to '0x000002cd' failed, part of debug monitor area
    Finished download

    now, after area was cleared out:

    Starting download
    Debug monitor area 1, writing to address 0x00000002 with data 0000
    write to '0x00000002' to '0x00000201' failed, part of debug monitor area
    Options bytes, writing to address 0x000000c0 with data 79
    Options bytes, writing to address 0x000000c1 with data ff
    Options bytes, writing to address 0x000000c2 with data e0
    Options bytes, writing to address 0x000000c3 with data 04
    Correct values for address 0x000000c3, Options byte settings for debugging:
    0b10000100
    0b10000101

    write to '0x00000002' to '0x00000201' failed, part of debug monitor area
    write to '0x00000002' to '0x00000201' failed, part of debug monitor area
    Finished download

    in my option file there is some area reserved before 0xce

    -Z(CODE)INTVEC=0000-007F
    -Z(CODE)CLTVEC=0080-00BF
    -Z(CODE)OPTBYTE=000C0-000C3
    -Z(CODE)SECUID=000C4-000CD

    but this is reserved, can't be removed (Error[e72]: Segment CLTVEC must be defined in a segment definition option (-Z, -b or -P))

    and a new error message: No source available for "?Subroutine0() at 0xffff"

     

    any hints? shall I open a new post?

  • In reply to azeaze:

    You may need to place "__RESERVE_OCD_ROM=1" in the Linker -> Config symbol definition to enable linker script definition to reserve On-chip debugger memory (see the *.icf file in your project).

  • In reply to Okra:

    I configured the linker option file with these lines (using makefile + iar for build , and e2studio debug only + gdb for debug):

    -crl78
    -Felf
    -yspc
    -z
    -xms
    -B
    -D__RESERVE_OCD_ROM=1
    -Z(CODE)INTVEC=0000-007F
    -Z(CODE)CLTVEC=0080-00BF
    -Z(CODE)OPTBYTE=000C0-000C3
    -Z(CODE)SECUID=000C4-000CD
    -Z(CODE)CODE,NEAR_CONST,NEAR_ID,SADDR_ID=4000
    -Z(FARCODE)XCODE,FAR_CONST,FAR_ID=4000
    -Z(CODE)RCODE,FSL_BCD,FSL_BECD,FSL_FCD,FSL_RCD_ROM,FSL_FECD,FSL_RCD=02CE-0FFF
    -Z(CODE)DIFUNCT,SWITCH,FSWITCH=02CE-0FFF
    ....

    Nevertheless, considering my .map, it failed reserving the area:

    SEGMENT SPACE START ADDRESS END ADDRESS SIZE TYPE ALIGN
    ======= ===== ============= =========== ==== ==== =====
    __aseg            00000000 rel 0
    INTVEC           00000000 - 0000002D 2E com 1
    CLTVEC           00000080 - 00000083 4 rel 1
    FAR_CONST     000000C0 - 000000C3 4 rel 0      <--- ?? where are OPTBYTE and SECUID, and why FAR_CONST is set twice?
    RCODE            000002CE - 000008BC 5EF rel 0
    FSL_BCD         000008BE - 000009C7 10A rel 1
    FSL_BECD       000009C8 - 00000A4E 87 rel 1
    FSL_FCD         00000A50 - 00000B76 127 rel 1
    FSL_RCD_ROM 00000B78 rel 1
    FSL_FECD       00000B78 - 00000C4A D3 rel 1
    FSL_RCD        00000C4C - 00000DEC 1A1 rel 1
    DIFUNCT        00000DEE - 00000EA5 B8 rel 1
    CODE             00004000 - 000042AF 2B0 rel 0
    NEAR_CONST 000042B0 - 0000437B CC rel 1
    SADDR_ID     0000437C rel 0
    NEAR_ID       0000437C rel 0
    XCODE          0000437C - 00025F13 21B98 rel 0
    FAR_CONST   00025F14 - 0002B9BB 5AA8 rel 1