Debugging 错误:ELF文件无效,仅支持32位文件

Debugging 错误:ELF文件无效,仅支持32位文件,debugging,embedded,riscv,platformio,Debugging,Embedded,Riscv,Platformio,我正在尝试调试HiFive上的hello world应用程序,该应用程序是使用PlatformIO Core(CLI)工具发布的。我已使用以下Wiki设置了该实用程序: 并使用以下命令调试应用程序: 启动调试会话时,我遇到一个奇怪的错误: Error: invalid ELF file, only 32bits files are supported embedded:startup.tcl:486: Error: ** Programming Failed ** 以下是完整的详细日志: a

我正在尝试调试HiFive上的hello world应用程序,该应用程序是使用PlatformIO Core(CLI)工具发布的。我已使用以下Wiki设置了该实用程序:

并使用以下命令调试应用程序:

启动调试会话时,我遇到一个奇怪的错误:

Error: invalid ELF file, only 32bits files are supported
embedded:startup.tcl:486: Error: ** Programming Failed **
以下是完整的详细日志:

arshadaleem@lmlpt52:~/platformio/platform-sifive/examples/freedom-e-sdk_hello$ platformio run -e sifive-hifive-unleashed --target upload -v
Processing sifive-hifive-unleashed (platform: sifive; framework: freedom-e-sdk; board: hifive-unleashed; monitor_speed: 115200)
----------------------------------------------------------------------------------------------------------------------------------------------
CONFIGURATION: https://docs.platformio.org/page/boards/sifive/hifive-unleashed.html
PLATFORM: SiFive (2.4.0) > HiFive Unleashed
HARDWARE: FU540 1500MHz, 8GB RAM, 32MB Flash
DEBUG: Current (ftdi) On-board (ftdi, qemu, renode)
PACKAGES: 
 - framework-freedom-e-sdk 2.20050003.200818 (2005.0.3) 
 - tool-jlink 1.65200.0 (6.52.0) 
 - tool-openocd-riscv 2.1000.20190927 (10.0) 
 - toolchain-riscv 1.80300.190927 (8.3.0)
LDF: Library Dependency Finder -> 
LDF Modes: Finder ~ chain, Compatibility ~ soft
Found 0 compatible libraries
Scanning dependencies...
No dependencies
Building in release mode
MethodWrapper(["checkprogsize"], [".pio/build/sifive-hifive-unleashed/firmware.elf"])
Advanced Memory Usage is available via "PlatformIO Home > Project Inspect"
RAM:   [          ]   0.0% (used 17380 bytes from 8589934592 bytes)
Flash: [          ]   0.1% (used 23612 bytes from 33554432 bytes)
text       data     bss     dec     hex filename
  13716    9896    7484   31096    7978 .pio/build/sifive-hifive-unleashed/firmware.elf
<lambda>(["upload"], [".pio/build/sifive-hifive-unleashed/firmware.elf"])
AVAILABLE: ftdi
CURRENT: upload_protocol = ftdi
openocd -c "debug_level 2" -s /home/arshadaleem/.platformio/packages/tool-openocd-riscv -s /share/openocd/scripts -f /home/arshadaleem/.platformio/packages/framework-freedom-e-sdk/bsp/sifive-hifive-unleashed/openocd.cfg -c "program {.pio/build/sifive-hifive-unleashed/firmware.elf}  verify; shutdown;"
Open On-Chip Debugger 0.10.0+dev (SiFive OpenOCD 0.10.0-2019.08.2)
Licensed under GNU GPL v2
For bug reports:
    https://github.com/sifive/freedom-tools/issues
debug_level: 2
adapter speed: 10000 kHz
Info : auto-selecting first available session transport "jtag". To override use 'transport select <transport>'.
Info : Hardware thread awareness created
Info : ftdi: if you experience problems at higher adapter clocks, try the command "ftdi_tdo_sample_edge falling"
Info : clock speed 10000 kHz
Info : JTAG tap: riscv.cpu tap/device found: 0x20000913 (mfg: 0x489 (SiFive Inc), part: 0x0000, ver: 0x2)
Info : datacount=2 progbufsize=16
Info : Disabling abstract command reads from CSRs.
Info : Core 0 could not be made part of halt group 1.
Info : Examined RISC-V core; found 5 harts
Info :  hart 0: XLEN=64, misa=0x8000000000101105
Info :  hart 1: currently disabled
Info :  hart 2: currently disabled
Info :  hart 3: currently disabled
Info :  hart 4: currently disabled
Info : datacount=2 progbufsize=16
Info : Disabling abstract command reads from CSRs.
Info : Core 1 could not be made part of halt group 1.
Info : Examined RISC-V core; found 5 harts
Info :  hart 0: currently disabled
Info :  hart 1: XLEN=64, misa=0x800000000014112d
Info :  hart 2: currently disabled
Info :  hart 3: currently disabled
Info :  hart 4: currently disabled
Info : datacount=2 progbufsize=16
Info : Disabling abstract command reads from CSRs.
Info : Core 2 could not be made part of halt group 1.
Info : Examined RISC-V core; found 5 harts
Info :  hart 0: currently disabled
Info :  hart 1: currently disabled
Info :  hart 2: XLEN=64, misa=0x800000000014112d
Info :  hart 3: currently disabled
Info :  hart 4: currently disabled
Info : datacount=2 progbufsize=16
Info : Disabling abstract command reads from CSRs.
Info : Core 3 could not be made part of halt group 1.
Info : Examined RISC-V core; found 5 harts
Info :  hart 0: currently disabled
Info :  hart 1: currently disabled
Info :  hart 2: currently disabled
Info :  hart 3: XLEN=64, misa=0x800000000014112d
Info :  hart 4: currently disabled
Info : datacount=2 progbufsize=16
Info : Disabling abstract command reads from CSRs.
Info : Core 4 could not be made part of halt group 1.
Info : Examined RISC-V core; found 5 harts
Info :  hart 0: currently disabled
Info :  hart 1: currently disabled
Info :  hart 2: currently disabled
Info :  hart 3: currently disabled
Info :  hart 4: XLEN=64, misa=0x800000000014112d
Info : Listening on port 3333 for gdb connections
Info : Found flash device 'issi is25wp256d' (ID 0x0019709d)
Warn : device needs paging or 4-byte addresses - not implemented
cleared protection for sectors 64 through 511 on flash bank 0
Ready for Remote Connections
Info : JTAG tap: riscv.cpu tap/device found: 0x20000913 (mfg: 0x489 (SiFive Inc), part: 0x0000, ver: 0x2)
** Programming Started **
auto erase enabled
Error: invalid ELF file, only 32bits files are supported
embedded:startup.tcl:486: Error: ** Programming Failed **
in procedure 'program' 
in procedure 'program_error' called at file "embedded:startup.tcl", line 545
at file "embedded:startup.tcl", line 486
*** [upload] Error 1
========================================================= [FAILED] Took 0.82 seconds =========================================================
(penv) 
platformio run
命令的详细输出:

arshadaleem@lmlpt52:~/platformio/platform-sifive/examples/freedom-e-sdk_hello$ platformio run -v
Processing sifive-hifive-unleashed (platform: sifive; framework: freedom-e-sdk; board: hifive-unleashed; monitor_speed: 115200)
----------------------------------------------------------------------------------------------------------------------------------------------
CONFIGURATION: https://docs.platformio.org/page/boards/sifive/hifive-unleashed.html
PLATFORM: SiFive (2.4.0) > HiFive Unleashed
HARDWARE: FU540 1500MHz, 8GB RAM, 32MB Flash
DEBUG: Current (ftdi) On-board (ftdi, qemu, renode)
PACKAGES: 
 - framework-freedom-e-sdk 2.20050003.200818 (2005.0.3) 
 - toolchain-riscv 1.80300.190927 (8.3.0)
LDF: Library Dependency Finder -> 
LDF Modes: Finder ~ chain, Compatibility ~ soft
Found 0 compatible libraries
Scanning dependencies...
No dependencies
Building in release mode
riscv64-unknown-elf-gcc -o .pio/build/sifive-hifive-unleashed/src/hello.o -c -Os -Wall -march=rv64imac -mabi=lp64 -mcmodel=medany -ffunction-sections -fdata-sections --specs=nano.specs -DPLATFORMIO=50001 -DPACKAGE_NAME=\"freedom-metal\" -DPACKAGE_TARNAME=\"freedom-metal\" -DPACKAGE_VERSION=\"v0.1.2\" "-DPACKAGE_STRING=\"freedom-metal v0.1.2\"" -DPACKAGE=\"freedom-metal\" -DVERSION=\"v0.1.2\" -DMTIME_RATE_HZ_DEF=1000000 -Iinclude -Isrc -I.pio/build/sifive-hifive-unleashed -I/home/arshadaleem/.platformio/packages/framework-freedom-e-sdk/freedom-metal src/hello.c
riscv64-unknown-elf-gcc -o .pio/build/sifive-hifive-unleashed/metal/atomic.o -c -Os -Wall -march=rv64imac -mabi=lp64 -mcmodel=medany -ffunction-sections -fdata-sections --specs=nano.specs -DPLATFORMIO=50001 -DPACKAGE_NAME=\"freedom-metal\" -DPACKAGE_TARNAME=\"freedom-metal\" -DPACKAGE_VERSION=\"v0.1.2\" "-DPACKAGE_STRING=\"freedom-metal v0.1.2\"" -DPACKAGE=\"freedom-metal\" -DVERSION=\"v0.1.2\" -DMTIME_RATE_HZ_DEF=1000000 -I.pio/build/sifive-hifive-unleashed -I/home/arshadaleem/.platformio/packages/framework-freedom-e-sdk/freedom-metal /home/arshadaleem/.platformio/packages/framework-freedom-e-sdk/freedom-metal/src/atomic.c
任何消除此错误的指针都将非常有用


谢谢。

什么是“readelf-h.pio/build/sifive hifive unreleased/firmware.elf”的输出?更新了我问题中的输出。默认情况下,我得到了一个32位elf文件。因为它是为rv32imc arch编译的。您可以添加“platformio run-v”的输出来查看编译命令吗?你修改过拱门了吗?我得到了64位ELF文件,并设置为rv64imac。添加了一个有问题的日志片段。好的,是@yflion,是openocd不支持rv64。我在这里打开了platformIO的一个问题:
arshadaleem@lmlpt52:~/platformio/platform-sifive/examples/freedom-e-sdk_hello$ platformio run -v
Processing sifive-hifive-unleashed (platform: sifive; framework: freedom-e-sdk; board: hifive-unleashed; monitor_speed: 115200)
----------------------------------------------------------------------------------------------------------------------------------------------
CONFIGURATION: https://docs.platformio.org/page/boards/sifive/hifive-unleashed.html
PLATFORM: SiFive (2.4.0) > HiFive Unleashed
HARDWARE: FU540 1500MHz, 8GB RAM, 32MB Flash
DEBUG: Current (ftdi) On-board (ftdi, qemu, renode)
PACKAGES: 
 - framework-freedom-e-sdk 2.20050003.200818 (2005.0.3) 
 - toolchain-riscv 1.80300.190927 (8.3.0)
LDF: Library Dependency Finder -> 
LDF Modes: Finder ~ chain, Compatibility ~ soft
Found 0 compatible libraries
Scanning dependencies...
No dependencies
Building in release mode
riscv64-unknown-elf-gcc -o .pio/build/sifive-hifive-unleashed/src/hello.o -c -Os -Wall -march=rv64imac -mabi=lp64 -mcmodel=medany -ffunction-sections -fdata-sections --specs=nano.specs -DPLATFORMIO=50001 -DPACKAGE_NAME=\"freedom-metal\" -DPACKAGE_TARNAME=\"freedom-metal\" -DPACKAGE_VERSION=\"v0.1.2\" "-DPACKAGE_STRING=\"freedom-metal v0.1.2\"" -DPACKAGE=\"freedom-metal\" -DVERSION=\"v0.1.2\" -DMTIME_RATE_HZ_DEF=1000000 -Iinclude -Isrc -I.pio/build/sifive-hifive-unleashed -I/home/arshadaleem/.platformio/packages/framework-freedom-e-sdk/freedom-metal src/hello.c
riscv64-unknown-elf-gcc -o .pio/build/sifive-hifive-unleashed/metal/atomic.o -c -Os -Wall -march=rv64imac -mabi=lp64 -mcmodel=medany -ffunction-sections -fdata-sections --specs=nano.specs -DPLATFORMIO=50001 -DPACKAGE_NAME=\"freedom-metal\" -DPACKAGE_TARNAME=\"freedom-metal\" -DPACKAGE_VERSION=\"v0.1.2\" "-DPACKAGE_STRING=\"freedom-metal v0.1.2\"" -DPACKAGE=\"freedom-metal\" -DVERSION=\"v0.1.2\" -DMTIME_RATE_HZ_DEF=1000000 -I.pio/build/sifive-hifive-unleashed -I/home/arshadaleem/.platformio/packages/framework-freedom-e-sdk/freedom-metal /home/arshadaleem/.platformio/packages/framework-freedom-e-sdk/freedom-metal/src/atomic.c