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.
“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 connectionGDB: 59478Target connection status - OKStarting downloadDebug monitor area 1, writing to address 0x00000002 with data ffffOptions bytes, writing to address 0x000000c0 with data 79Options bytes, writing to address 0x000000c1 with data ffOptions bytes, writing to address 0x000000c2 with data e0Options bytes, writing to address 0x000000c3 with data 04Correct values for address 0x000000c3, Options byte settings for debugging: 0b10000100 0b10000101
Security ID, writing to address 0x000000c4 with data ffffffffffffffffffffDebug monitor area 2, writing to address 0x000000ce with data c1fc814400c0fc754600write to '0x000000ce' to '0x000002cd' failed, part of debug monitor areawrite to '0x000000ce' to '0x000002cd' failed, part of debug monitor areaFinished downloadDisconnected from the Target Debugger.
I get the following output from the debugger console:
I checked my .map at the addresses between 0x00CE and 0x00D8 (used by the debug monitor) and here it is:
SEGMENTS IN THE MODULE
Relative segment, address: 000000CE - 000000CE (0x1 bytes), align: 0
Segment part 1.
ENTRY ADDRESS REF BY
===== ======= ======
_exit 000000CE exit (?exit)
Relative segment, address: 000000CF - 000000D2 (0x4 bytes), align: 0
Segment part 2.
===== ======= ======
__cstart_call_dtors 000000CF __record_needed_destruction (?cppinit)
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
How's this issue? Were you able to fix this?
JBRenesasRulz Forum Moderator
In reply to JB:
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 errorhttps://en-support.renesas.com/knowledgeBase/18565004Users 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:
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".
> With IAR compiler the start up code by default comes from the IAR library.Ah, I got it.> where I set the first breakpointAnyway, no necessary to set it (and no use to set a breakpoint at entry point). Just leave unchecked the checkbox and it should work.
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.
Security ID, writing to address 0x000000c4 with data ffffffffffffffffffffDebug monitor area 2, writing to address 0x000000ce with data c1fc814400c0fc754600write to '0x000000ce' to '0x000002cd' failed, part of debug monitor areawrite to '0x000000ce' to '0x000002cd' failed, part of debug monitor areaFinished download
now, after area was cleared out:
Starting downloadDebug monitor area 1, writing to address 0x00000002 with data 0000write to '0x00000002' to '0x00000201' failed, part of debug monitor areaOptions bytes, writing to address 0x000000c0 with data 79Options bytes, writing to address 0x000000c1 with data ffOptions bytes, writing to address 0x000000c2 with data e0Options bytes, writing to address 0x000000c3 with data 04Correct values for address 0x000000c3, Options byte settings for debugging: 0b10000100 0b10000101
write to '0x00000002' to '0x00000201' failed, part of debug monitor areawrite to '0x00000002' to '0x00000201' failed, part of debug monitor areaFinished download
in my option file there is some area reserved before 0xce
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?
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).
I configured the linker option file with these lines (using makefile + iar for build , and e2studio debug only + gdb for debug):
Nevertheless, considering my .map, it failed reserving the area:
SEGMENT SPACE START ADDRESS END ADDRESS SIZE TYPE ALIGN======= ===== ============= =========== ==== ==== =====__aseg 00000000 rel 0INTVEC 00000000 - 0000002D 2E com 1CLTVEC 00000080 - 00000083 4 rel 1FAR_CONST 000000C0 - 000000C3 4 rel 0 <--- ?? where are OPTBYTE and SECUID, and why FAR_CONST is set twice?RCODE 000002CE - 000008BC 5EF rel 0FSL_BCD 000008BE - 000009C7 10A rel 1FSL_BECD 000009C8 - 00000A4E 87 rel 1FSL_FCD 00000A50 - 00000B76 127 rel 1FSL_RCD_ROM 00000B78 rel 1FSL_FECD 00000B78 - 00000C4A D3 rel 1FSL_RCD 00000C4C - 00000DEC 1A1 rel 1DIFUNCT 00000DEE - 00000EA5 B8 rel 1CODE 00004000 - 000042AF 2B0 rel 0NEAR_CONST 000042B0 - 0000437B CC rel 1SADDR_ID 0000437C rel 0NEAR_ID 0000437C rel 0XCODE 0000437C - 00025F13 21B98 rel 0FAR_CONST 00025F14 - 0002B9BB 5AA8 rel 1