assembly 添加程序集文件时,SiFive上出现PlatformIO构建错误

xoefb8l8  于 2022-11-13  发布在  其他
关注(0)|答案(1)|浏览(165)

我已经在Ubuntu的vscode上安装了PlatformIO。我已经用Freedom E SDK创建了一个项目,并添加了一个简单的main.c文件:

int main(void)
{
    return 0;
}

然后,当我尝试构建时,它就起作用了:

Processing hifive1 (platform: sifive; board: hifive1; framework: freedom-e-sdk)
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Verbose mode can be enabled via `-v, --verbose` option
CONFIGURATION: https://docs.platformio.org/page/boards/sifive/hifive1.html
PLATFORM: SiFive (5.2.0) > HiFive1
HARDWARE: FE310 320MHz, 16KB RAM, 16MB 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
Compiling .pio/build/hifive1/src/main.o
...
Compiling .pio/build/hifive1/metal/switch.o
/home/dan/.platformio/packages/framework-freedom-e-sdk/freedom-metal/src/shutdown.c:15:9: note: #pragma message: There is no defined shutdown mechanism, metal_shutdown() will spin.
 #pragma message(                                                               \
         ^~~~~~~
Compiling .pio/build/hifive1/metal/synchronize_harts.o
...
Archiving .pio/build/hifive1/libmetal-gloss.a
Indexing .pio/build/hifive1/libmetal-gloss.a
Linking .pio/build/hifive1/firmware.elf
Checking size .pio/build/hifive1/firmware.elf
Advanced Memory Usage is available via "PlatformIO Home > Project Inspect"
RAM:   [===       ]  27.1% (used 4444 bytes from 16384 bytes)
Flash: [          ]   0.1% (used 10994 bytes from 16777216 bytes)
Building .pio/build/hifive1/firmware.hex
======= [SUCCESS] Took 1.72 seconds ================

但是,当我添加一个完全空的程序集文件(我需要在此项目中使用程序集)时,我收到一个错误:

Processing hifive1 (platform: sifive; board: hifive1; framework: freedom-e-sdk)
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Verbose mode can be enabled via `-v, --verbose` option
CONFIGURATION: https://docs.platformio.org/page/boards/sifive/hifive1.html
PLATFORM: SiFive (5.2.0) > HiFive1
HARDWARE: FE310 320MHz, 16KB RAM, 16MB 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
Compiling .pio/build/hifive1/src/main.o
Compiling .pio/build/hifive1/src/test.o
riscv64-unknown-elf-as: unrecognized option '-mcmodel=medlow'
Compiling .pio/build/hifive1/metal/atomic.o
Compiling .pio/build/hifive1/metal/button.o
Compiling .pio/build/hifive1/metal/cache.o
Compiling .pio/build/hifive1/metal/clock.o
Compiling .pio/build/hifive1/metal/cpu.o
Compiling .pio/build/hifive1/metal/drivers/fixed-clock.o
Compiling .pio/build/hifive1/metal/drivers/fixed-factor-clock.o
Compiling .pio/build/hifive1/metal/drivers/inline.o
Compiling .pio/build/hifive1/metal/drivers/riscv_clint0.o
Compiling .pio/build/hifive1/metal/drivers/riscv_cpu.o
*** [.pio/build/hifive1/src/test.o] Error 1
====================== [FAILED] Took 0.96 seconds ===========

看起来它使用的是我以前安装的工具链(riscv64-unknown-elf*),并且由于未知标志而出现错误:

riscv64-unknown-elf-as: unrecognized option '-mcmodel=medlow'

"我能做什么"

mklgxw1f

mklgxw1f1#

我已经通过将build_unflags = -mcmodel=medlow添加到platformio.ini文件中修复了该问题,因此它现在是:

[env:hifive1]
platform = sifive
board = hifive1
framework = freedom-e-sdk
build_unflags = -mcmodel=medlow

相关问题