Hello. Im working with R5F51135 mcu, using E2 lite and IAR 3.10.2. When I download code and start debugging, code doesnt reach main function. I can step through assembly just fine. While investigating I noticed that device gets stuck in a loop while trying to initialize variables. Specifically it gets stuck in ___iar_lz77_init_single2 function. If I program flash using Renesas Flash Programmer code works just fine. So its somehow related to debugger but I have no idea whats wrong. Any ideas?
Hello dear Paumas, Thank you for posting to the Renesas community. According to your statements, your problem might be because of mismatching clocks between hardware and debugger, or debug feature activation.
Please check the settings below:
1-Make sure the debug feature is set in the smart configurator setting
2-Debugger is configured properly
3- Working frequency is set properly In the e2 debugger setting, if you're using an external crystal make sure it's checked and the correct value is specified.
I hope this information was helpful. If you require any further assistance, please don't hesitate to ask.
Best regards. Hossein
If this or any other user's response answers your concern, kindly verify the answer. Thank you!
Renesas Engineering Community Moderatorhttps://community.renesas.com/https://academy.renesas.com/en-support.renesas.com/.../
Debugger starts fine. I can step in C startup code and assembly. So technically debugger works. The problem is that while initializing variables, device gets into loop that never ends. Its quite hard to understand what exactly assembly tries to do here but, as I said, it happens in ___iar_lz77_init_single2 function. Strangely enough, if I flash mcu with hex file (without debugger) everything works fine. So it must be something wrong with how debugger inserts extra code to compiled hex.
That makes sense Paumas, did you check the above? sometimes after running the startup code, the clock configuration changes which might be the reason for the debugging failure. Also, did you check the 'Run to main' option in the debugger setting?After all, if the problem presists, that would be great to share your debugging session codes. Best regards.
Yes, I checked that. It looks fine. 'Run to main' is selected. Here is debugging session code:
It skips call to main and goes to ___iar_data_init2
Code jumps to subroutine (JSR directive) ___iar_zero_init2
Comes back to ___iar_data_init2. From there it reaches JSR again and goes to ___iar_lz77_init_single2
And loops here forever.
Dear Paumas, sorry for the late. I'm not sure if your problem is solved or not yet.
Do you have the same problem when creating a fresh project or with a fully programmed MCU?
how about memory usage of your code?
Can you try changing the compiler optimization settings (Set it to none)? Also, update your compiler and smart configurator if you are using it.
Please keep me updated on that.
Regards,
Hossein.