SAM9-L9260 Linux program development

Hi all, i don’t have some experience with ARM or Linux. Firstly I want to write some application for this olimex board. Is it possible on a windows pc? Are they some cross-compiler available? I have much experience in C programming and AVR but this part is very difficult for beginners so i need your help :slight_smile:

The last few issues of Circuit Cellar Magazine featured articles on CoLinux, a Cross-Development strategy.

Personally, I recommend trying to develop your app on a native Linux install or Linux VM as far as you can first in a chrooted environment, then port your code to ARM. If you are new to linux then this is the way to go. Learning linux through a JTAG port would be foolish.

BTW learning Linux and its toolset is an eye-opening experience. It makes you see computers in a whole new, more realistic way, especially if you take the time to learn the shell. Linux is also layed out very logically and transparently from booting the kernel and initrd to fancy-pants GUI eyecandy.

According to the user guide from Olimex, there should be some cross-compilers on the supplied software CD. You will probably need a linux box to run them on, though. I have heard of a linux development package for Windows, but have not tried it. If you have space in your windows system for a second harddrive, you could put a linux distribution on it and set it up for dual boot. That’s what I ended up doing.

Ok thank you for reply!

So i have already installed arm-linux-gcc successfully (I hope it) compiled and tried the olimex example of this code:

#include <stdio.h>

int main(void)
{
	int i;
	for(i=0; i<100; i++)
	{
		
		printf("\n Hello World %d", i);
	}

	return 0;
}

But now instead of printf Output to terminal i got “no such file” Error:

sam9-l9260:~# wget http://192.168.108.104/hello

–15:42:59-- http://192.168.108.104/hello

=> `hello’

Connecting to 192.168.108.104:80… connected.

HTTP request sent, awaiting response… 200 OK

Length: 6,207 (6.1K) [text/plain]

100%[====================================>] 6,207 --.–K/s

15:42:59 (10.02 MB/s) - `hello’ saved [6207/6207]

sam9-l9260:~# ./hello

-bash: ./hello: Permission denied

sam9-l9260:~# chmod 777 hello

sam9-l9260:~# ./hello

-bash: ./hello: No such file or directory

sam9-l9260:~# ./hello

-bash: ./hello: No such file or directory

sam9-l9260:~# ls

hello

The file is on the board, see output of bash ls.

Any ideas what can be wrong?

Try looking at the file with od:

#od -xc -N1000 hello

Make sure it looks like an arm executable and linked to the right libc.

Make sure the kernel you have has support for the type of executable you compiled.

I tried now gnu arm cross compiler and it works:

sam9-l9260:~# wget http://192.168.108.104/hello2

–18:13:27-- http://192.168.108.104/hello2

=> `hello2’

Connecting to 192.168.108.104:80… connected.

HTTP request sent, awaiting response… 200 OK

Length: 7,139 (7.0K) [text/plain]

100%[====================================>] 7,139 --.–K/s

18:13:27 (11.31 MB/s) - `hello2’ saved [7139/7139]

sam9-l9260:~# chmod 777 hello2

sam9-l9260:~# ./hello2

Hello World 0

Hello World 1

Hello World 2

Hello World 3

Hello World 4

But wthan can be wrong with arm-linux-gcc compiles? The files seems to look ok. Here is file info, it may be helpfull for you to see some mistakes:

hello compiled with arm-linux-gcc:

sam9-l9260:~# file hello

hello: ELF 32-bit LSB executable, ARM, version 1 (ARM), dynamically linked (uses shared libs), not stripped

hello2 compile with arm-unknown-linux-gnu-gcc:

sam9-l9260:~# file hello2

hello2: ELF 32-bit LSB executable, ARM, version 1 (ARM), for GNU/Linux 2.4.3, dynamically linked (uses shared libs), for GNU/Linux 2.4.3, not stripped

Sorry for the following dumb questions (I am new at linux): How can i add hello2 to autostart to so it can run on power-up without root login?

hello: ELF 32-bit LSB executable, ARM, version 1 (ARM), dynamically linked (uses shared libs), not stripped

This means it is not compiled for arm linux, just arm, even though your compiler claims to be a linux compiler

Sorry for the following dumb questions (I am new at linux): How can i add hello2 to autostart to so it can run on power-up without root login?

Depending on when you would like it to run (early on vs last) use the linux startup scripts:

/etc/rc.x/ where x is the runlevel, which is usually 2. Scripts are executed alphanumerically if they start with an S, like S12Networking

The easiest place is, if it is there, many distros have a /etc/rc.local script that is executed last on bootup