Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The generated ELF file cannot be debugged #19

Open
mikisama opened this issue Oct 5, 2020 · 6 comments
Open

The generated ELF file cannot be debugged #19

mikisama opened this issue Oct 5, 2020 · 6 comments

Comments

@mikisama
Copy link

mikisama commented Oct 5, 2020

Hi, @dkulacz

I compiled my own GCC by modifying build-gcc-v850-elf-toolchain.sh. I even used it to porting FreeRTOS for RH850. It seems work well after I burn the SRecod into the MCU through Renesas E1. I create an IAR debug only project, but IAR was crashed and it seems that the ELF file generated by the self-build GCC can not be recognized by IAR debugger. However, when I compile my project again with GCC download from gcc-renesas.com, the IAR debugger works well.

Would you mind sharing some suggestions?

@dkulacz
Copy link
Owner

dkulacz commented Oct 5, 2020

Hi @mikisama,
Glad to hear it works well with FreeRTOS on RH850. Personally I've not tested debugging with IAR. Only debugging using GreenHills MULTI IDE + Renesas E1 was tested. Startup & linker script used in your project is custom one or newlib's built-in ? When custom linker used, maybe it is something related with .debug* sections in ELF. I can look at gcc-renesas.com toolchain in spare time, to check what is under the hood. Alternatively, you can generate map files for your binary for both toolchains and compare what differs.

@mikisama
Copy link
Author

Hi @dkulacz
Sorry for the late reply. I have compiled GCC 4.9.4, 7.2.0, 8.2.0, 9.3.0 and 10.2.0. They all work well, but they cannot be debugged using IAR. I also tried to compile GCC 4.9.2 and 4.8.5 with GCC 9.3.0 on Ubuntu 20.04, but the compilation failed. For GCC 9.3.0, the source code of GCC 4.9.2 and 4.8.5 may be too old. Finally, I gave up using IAR for debugging. I found that Renesas e2 studio contains an RH850 gdb server and it works fine.

I compared the generated map files. gcc-renesas.com toolchain have less .debug* sections, this may be the reason why the IAR debugger cannot work.

gcc_rh850_map_file.zip

@darklukee
Copy link
Collaborator

Hi @mikisama,
We have trouble using gcc-10. We get errors during linking: https://github.com/dkulacz/gcc-v850-elf-toolchain/runs/943995552?check_suite_focus=true

Did you change anything to make it work?

@mikisama
Copy link
Author

Hi @mikisama,
We have trouble using gcc-10. We get errors during linking: https://github.com/dkulacz/gcc-v850-elf-toolchain/runs/943995552?check_suite_focus=true

Did you change anything to make it work?

Hi @darklukee,
I don't use C++, so I only use --enable-languages=c. It seems that gcc-10 works well, but g++-10 does not......

@darklukee
Copy link
Collaborator

Hi @mikisama,
We have trouble using gcc-10. We get errors during linking: https://github.com/dkulacz/gcc-v850-elf-toolchain/runs/943995552?check_suite_focus=true
Did you change anything to make it work?

Hi @darklukee,
I don't use C++, so I only use --enable-languages=c. It seems that gcc-10 works well, but g++-10 does not......

Oh, ok. Thank you!

@mikisama
Copy link
Author

mikisama commented Jan 4, 2021

Hi, @dkulacz
I've figured out the cause of the problem.
The IAR does not support dwarf-4 ELF debug file which is generated by default.

I solved this problem in the following two steps:

  1. Build newlib with make -w ${NUMJOBS} TARGET_CFLAGS="-gdwarf-2"
  2. Build the project source with -gdwarf-2

My build script is here https://github.com/mikisama/Auto_Build_GCC_RH850/blob/master/build_gcc_rh850.sh

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants