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

Missing GDB patch in toolchain leads to "Unable to decode 6 byte instructions in prologue" error #10

Open
maxgerhardt opened this issue Oct 13, 2020 · 0 comments

Comments

@maxgerhardt
Copy link

maxgerhardt commented Oct 13, 2020

A user reported to us in https://community.platformio.org/t/pio-debug-error-unable-to-decode-6-byte-instructions-in-prologue-at-0x0000000020010648/16470 that attempting to debug an application with the platformio.ini

[env:hifive1-revb]
platform = sifive
board = hifive1-revb
framework = freedom-e-sdk

on the very latest platform and toolchain version, on Mac OS, gives an internal GDB error

img

In the riscv repos, this issue is addressed by this commit in the GDB repo

riscvarchive/riscv-binutils-gdb@312617a

which happened on 5 Jun 2019. However, even when manually installing the latest toolchain version through my repo, which is equivalent to the riscv64-unknown-elf-gcc-8.3.0-2020.04.0-x86_64-apple-darwin.tar.gz download on https://www.sifive.com/software, the error remains.

This indicates that the SiFive built toolchains don't include the patch I think or aren't directly built from https://github.com/riscv/riscv-gnu-toolchain?

Sadly I can't get a usable toolchain when compiling the above toolchain (with ./configure --prefix=/opt/riscv --enable-multilib --disable-linux). The linking process then fails for a simple hello example with errors like

/home/max/.platformio/packages/toolchain-riscv/bin/../lib/gcc/riscv64-unknown-elf/10.2.0/../../../../riscv64-unknown-elf/bin/ld: .pio/build/hifive1-revb/libmetal.a(shutdown.o):(.sbss.__metal_dt_prci_10008000+0x0): multiple definition of `__metal_dt_prci_10008000'; .pio/build/hifive1-revb/libmetal.a(synchronize_harts.o):(.sbss.__metal_dt_prci_10008000+0x0): first defined here
/home/max/.platformio/packages/toolchain-riscv/bin/../lib/gcc/riscv64-unknown-elf/10.2.0/../../../../riscv64-unknown-elf/bin/ld: .pio/build/hifive1-revb/libmetal.a(shutdown.o):(.bss.__metal_dt_clock_4+0x0): multiple definition of `__metal_dt_clock_4'; .pio/build/hifive1-revb/libmetal.a(synchronize_harts.o):(.bss.__metal_dt_clock_4+0x0): first defined here

So I wasn't able to get a toolchain replacement working. For reproduction, that toolchain is at https://github.com/maxgerhardt/toolchain-riscv-linux.

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

1 participant