Error: Illegal Instruction. Mips cross-compiler

Error: Illegal Instruction. Mips cross-compiler

我使用 Mips 交叉编译器在 Linux x64 上编译简单程序,然后使用 scp 将其上传到我的路由器上。当我 运行 这个程序时,我有错误: 非法指令 .

我的程序:

#include <stdio.h>
int main(void)
{
  printf("Hello, world!");
  return 0;
}

/proc/cpuinfo 我的 mips-box:

system type         : Atheros AR9330 rev 1
machine             : TP-LINK TL-WR741ND v4
processor           : 0
cpu model           : MIPS 24Kc V7.4
isa                 : mips1 mips2 mips32r1 mips32r2
ASEs implemented    : mips16

编译:

mips-linux-gnu-gcc -static -march=24kc -o hello hello.c

上传:

scp hello root@192.168.1.1:/tmp

运行:

root@OpenWrt:/tmp# ./hello
Illegal instruction

已解决。

我使用另一个工具链。 Link: https://www.mips.com/develop/tools/codescape-mips-sdk/download-codescape-mips-sdk-essentials/.

对于 MIPS Classic Legacy CPU IP 内核:4k、M4k、M14k、24k、34k、74k、1004k、1074k 使用相同的编译命令。