Page 1 of 1

Cannot run executable on OLIMEX SAM9_L9260

Posted: Mon Apr 07, 2008 7:03 am
by pca260
Hello,

My configuration :
Olimex Sam9_9260 with default linux 2.6.23 uclibc installation

NB
Cross chain on Linux ubuntu :
gcc 3.4
Comes from olimex CD
I have been able to successfully cross compile and then run the linux kernel with this installation.



my Makefile :

TRGT = arm-linux-
CC = $(TRGT)gcc
CP = $(TRGT)objcopy
AS = $(TRGT)gcc -x assembler-with-cpp
BIN = $(CP) -O ihex

MCU = arm9

# List all default C defines here, like -D_DEBUG=1
DDEFS =

# List all default ASM defines here, like -D_DEBUG=1
DADEFS =

# List all default directories to look for include files here
DINCDIR =

# List the default directory to look for the libraries here
DLIBDIR = /usr/local/arm/3.4/lib

# List all default libraries here
DLIBS =

#
# End of default section
##############################################################################################

##############################################################################################
# Start of user section
#

# Define project name here
PROJECT = salut


# List all user C define here, like -D_DEBUG=1
UDEFS =

# Define ASM defines here
UADEFS =

# List C source files here
SRC = ./src/hello.c ./src/main.c

# List ASM source files here
ASRC =

# List all user directories here
UINCDIR = ./inc

# List the user directory to look for the libraries here
ULIBDIR =

# List all user libraries here
ULIBS =

# Define optimisation level here
OPT = -O0

#
# End of user defines
##############################################################################################


INCDIR = $(patsubst %,-I%,$(DINCDIR) $(UINCDIR))
LIBDIR = $(patsubst %,-L%,$(DLIBDIR) $(ULIBDIR))
DEFS = $(DDEFS) $(UDEFS)
ADEFS = $(DADEFS) $(UADEFS)
OBJS = $(ASRC:.S=.o) $(SRC:.c=.o)
LIBS = $(DLIBS) $(ULIBS)
MCFLAGS = -mcpu=$(MCU)

ASFLAGS = $(MCFLAGS) -g -gdwarf-2 -Wa,-amhls=$(<:.S=.lst) $(ADEFS)
#CPFLAGS = $(MCFLAGS) $(OPT) -gdwarf-2 -mthumb-interwork -fomit-frame-pointer -Wall -Wstrict-prototypes -fverbose-asm -Wa,-ahlms=$(<:.c=.lst) $(DEFS)
LDFLAGS = $(MCFLAGS) -Wl,--cref,--no-warn-mismatch $(LIBDIR)

CPFLAGS = $(MCFLAGS) $(OPT)

# Generate dependency information
CPFLAGS += -MD -MP -MF .dep/$(@F).d

#
# makefile rules
#

all: $(OBJS) $(PROJECT).elf

%o : %c
$(CC) -c $(CPFLAGS) -I . $(INCDIR) $< -o $@

%o : %S
$(AS) -c $(ASFLAGS) $< -o $@

%elf: $(OBJS)
$(CC) $(OBJS) $(LDFLAGS) $(LIBS) -o $@

%hex: %elf
$(BIN) $< $@

clean:
-rm -f $(OBJS)
-rm -f $(PROJECT).elf
-rm -f $(PROJECT).map
-rm -f $(PROJECT).hex
-rm -f $(SRC:.c=.c.bak)
-rm -f $(SRC:.c=.lst)
-rm -f $(ASRC:.S=.S.bak)
-rm -f $(ASRC:.S=.lst)
-rm -fR .dep



When the copy the result (salut.elf) on the olimex board with ftp and do the chmod +x salut.elf then run ./salut.elf the result is :
-bash: ./salut.elf : No such file or directory

I must be stupid but i am stuck can anybody help me ...
Best regards
Philippe :evil:

Posted: Wed Apr 23, 2008 7:13 am
by octera
Hi!
I have the same problem. Here you can see the trace :

***Computer compiling***
octera@octera-desktop:~/Tests$
cat main.c
#include <stdio.h>
int main(void){
printf("Hello World\n\r");
return 0;
}
octera@octera-desktop:~/Tests$
arm-linux-gcc -Wall -o main main.c
octera@octera-desktop:~/Tests$

***Olimex Card***
sam9-l9260:~# scp octera@172.25.2.55:./Tests/main .
octera@172.25.2.55's password:
main 100% 6158 6.0KB/s 00:00
sam9-l9260:~# ls -l
total 1
-rwxr-xr-x 1 root root 6158 Apr 23 11:56 main
sam9-l9260:~# ./main
-bash: ./main: No such file or directory
sam9-l9260:~#


A another question : how can I make a apt-get?
***Olimex Card***
sam9-l9260:~# apt-get install build-essential
Reading package lists... Error!
E: Couldn't make mmap of 12582912 bytes - mmap (22 Invalid argument)
W: Unable to munmap
E: The package lists or status file could not be parsed or opened.
sam9-l9260:~#

Thanks

Posted: Wed Apr 23, 2008 9:06 am
by OLIMEX
there is how to make hello world in the users manual:
http://www.olimex.com/dev/pdf/ARM/ATMEL/SAM9-L9260.pdf

Posted: Thu Apr 24, 2008 1:39 am
by octera
Hi,
Where can I find the new version of the compiler? On your CD this is the 3.4, but on your PDF this is the 4.1.1, so I have check the link (http://arm.cirrus.com/) in the PDF, but nothing about the compiler.
Can you help me?

Thanks
EDIT : Forget I have not seen the tools directory!
:oops: sorry.

Posted: Thu Apr 24, 2008 5:13 am
by octera
So, after downloading the new version of the compiler, I have already the same error : No such file or directory.
I think that I must give some arguments to the compiler, but I don't know wich.

For the moment I compil with this command line : arm-linux-gcc -Wall -o main main.c
No error, no warning.

Must I add anything to the compiler?
Thanks

Posted: Fri Aug 22, 2008 7:07 am
by Nap
Hi,

try -static