OpenWrt Forum Archive

Topic: How to compile a "hello word"-program for MIPSEL (ASUS WL500gP)??

The content of this topic has been archived on 19 Apr 2018. There are no obvious gaps in this topic, but there may still be some posts missing at the end.

Hello everybody!

I still use OpenWRT on my Asus WL500gP for a couple of years, but now I need your help. I want to develop a program to read measurement data received over RS232-to-USB and store them in an SQLight-Database. But I have problems by compiling an “hello word”-program.... :-(

1) I loaded “ToolChain and Libc Source for WL500gP “ (Version 3.2.3 - 192.25 MB) from the Asus-website.
2) Unpacking and exporting the paths under Kubuntu 9.10 (VM) works.
3) compiling

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

with
mipsel-linux-gcc -o /home/andre/wl500gpSDK/output/hello.exe /home/andre/wl500gpSDK/sourcecodes/hello.c
or
mipsel-linux-gcc -v -mips32 -mfp32 -EL -o /home/andre/wl500gpSDK/output/hello.exe /home/andre/wl500gpSDK/sourcecodes/hello.c
… doesn't show an error.
4) running the program on the router with kamikaze 8.09 tells me:

root@OpenWrt:~# ls -l
-rwxr-xr-x    1 root     root        15963 Dec  22 08:44 hello.exe
root@OpenWrt:~# ./hello.exe
-ash: ./hello.exe: not found
root@OpenWrt:~#

I copy the OpenWrt busybox and opkg from the Router to Kubuntu and this is the output from file:

andre@Kubuntu910VM:~/$ file busybox
erstellteProgramme/busybox: ELF 32-bit LSB executable, MIPS, MIPS32 version 1 (SYSV), dynamically linked (uses shared libs), corrupted section header size
andre@Kubuntu910VM:~/$ file opkg
erstellteProgramme/opkg: ELF 32-bit LSB executable, MIPS, MIPS32 version 1 (SYSV), dynamically linked (uses shared libs), corrupted section header size
andre@Kubuntu910VM:~/$ file hello.exe
erstellteProgramme/hallo.exe: ELF 32-bit LSB executable, MIPS, MIPS-I version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.2.15, not stripped
andre@Kubuntu910VM:~/$

My hello-program differs from the others.....


Something about my router....

KAMIKAZE (8.09, r14511) ----------------------------
  * 10 oz Vodka       Shake well with ice and strain
  * 10 oz Triple sec  mixture into 10 shot glasses. 
  * 10 oz lime juice  Salute!                       
---------------------------------------------------
root@OpenWrt:~# dmesg                               
CPU revision is: 00029006                           
Primary instruction cache 16kB, physically tagged, 2-way, linesize 16 bytes.
Primary data cache 16kB, 2-way, linesize 16 bytes.                         
Linux version 2.4.35.4 (nbd@baustelle) (gcc version 3.4.6 (OpenWrt-2.0)) #51 Sat Feb 14 23:44:13 CET 2009
Setting the PFC to its default value                                                                     
Determined physical RAM map:                                                                             
memory: 02000000 @ 00000000 (usable)                                                                   
On node 0 totalpages: 8192                                                                               
zone(0): 8192 pages.                                                                                     
zone(1): 0 pages.                                                                                       
zone(2): 0 pages.                                                                                       
Kernel command line: root=/dev/mtdblock2 rootfstype=squashfs,jffs2 init=/etc/preinit noinitrd console=ttyS0,115200
CPU: BCM4704 rev 9 at 264 MHz                                                                                     
Using 132.000 MHz high precision timer.                                                                           
Calibrating delay loop... 263.78 BogoMIPS                                                                         
Memory: 30468k/32768k available (1425k kernel code, 2300k reserved, 100k data, 84k init, 0k highmem)         

Can someone give me an advise what I'm doing wrong?

I want to use an already built cross-compiler before I would build my own...

Merry Christmas!

Hey Charlie!

Thanks for your reply! I allready saw the pages, but they couldn't help me. Till I read them again...
After a lot of reading I learned very much.... And I (better to say: google) found a tutorial: How to build your own Kamikaze-SDK

After some trial and error I finaly have my own SDK!! big_smile

The discussion might have continued from here.