Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Error: Illegal Instruction. Mips cross-compiler

Tags:

c

mips

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
like image 391
Boris Goldshield Avatar asked May 14 '26 18:05

Boris Goldshield


1 Answers

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.

like image 188
Boris Goldshield Avatar answered May 19 '26 04:05

Boris Goldshield