Skip to content

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

@maxgerhardt

Description

@maxgerhardt

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions