Boris Goldshield
Boris Goldshield

Reputation: 41

Error: Illegal Instruction. Mips cross-compiler

I compile simple program on Linux x64 with Mips cross-compiller and upload it on my router with scp. When i run this program, i have error: Illegal instruction .

My program:

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

/proc/cpuinfo of my 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

Compile:

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

Upload:

scp hello [email protected]:/tmp

Run:

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

Upvotes: 3

Views: 805

Answers (1)

Boris Goldshield
Boris Goldshield

Reputation: 41

Solved.

I use another toolchain. Link: https://www.mips.com/develop/tools/codescape-mips-sdk/download-codescape-mips-sdk-essentials/.

For MIPS Classic Legacy CPU IP Cores: 4k, M4k, M14k, 24k, 34k, 74k, 1004k, 1074k with the same compile command.

Upvotes: 1

Related Questions