需求:
在windows上编译RISC的code:
操作方法:
- 安装git bash, 因为git bash可以执行解析linux命令行;可以解析make指令;
- 安装risc-v的gcc工具链:gnu-mcu-eclipse-riscv-none-gcc-8.2.0-2.2-20190521-0004-centos64.tgz,解压到D:\software\gcc\路径下面:bin文件的完整路径: D:\software\gcc\gnu-mcu-eclipse\riscv-none-gcc\8.2.0-2.2-20190521-0004\bin;并将bin文件的路径配置环境变量;
- 代码放在E:\Porject\firmware路径下面;
- 通过git bash 切到 firmware 路径下,执行make 出现以下问题:
zDarkBlue@Host MINGW64 /e/Porject/firmware
$ make
/d/software/gcc/gnu-mcu-eclipse/riscv-none-gcc/8.2.0-2.2-20190521-0004/bin/riscv-none-embed-gcc -c -march=rv32imac -mabi=ilp32 -fno-builtin-printf -Wall -Werror -fno-common -DHW_DATA32 -D__BYTE_ORDER=__LITTLE_ENDIAN -D__USE_INLINES__ -DAML_CFG_SELECT_LEVEL=3 -DBUILD_TYPE=FLASH_BUILD -DAML_CFG_ProjBT_VERSION=AML_HW_ProjBT_VERSION_T2_0_0 -DHW_RADIO=HWradio_W2 -DSLIP_HCI=1 -DSLIP_NO_ENABLE=1 -DBT_HCI_INTERFACE=1 -Ihost_if -Ihw_dep -Ilink_ctrl -Ilink_mngt -Isystem -Itest_ctrl -Ile_ctrl -Icoex -Iram -Ii2c -Ipatch -Ibt_rf/aml_rf_w2 -Iproj_dep/w2 -Ihal -Iriscv_bsp -DRISCV_CPU_ENABLE -DRISCV_INTR_MODIFY riscv_bsp/entry.s -o riscv_bsp/entry.o
/usr/bin/sh: /d/software/gcc/gnu-mcu-eclipse/riscv-none-gcc/8.2.0-2.2-20190521-0004/bin/riscv-none-embed-gcc: cannot execute binary file: Exec format error
make: *** [makefile_riscV:426: riscv_bsp/entry.o] Error 126
另外,make 的版本如下:
zDarkBlue@Host MINGW64 /e/Porject/firmware
$ make -v
GNU Make 4.3
This program is built by Equation Solution <http://www.Equation.com>.
Copyright (C) 1988-2020 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.