AnsweredAssumed Answered

Linking bare metal "hello word" for i.MX25

Question asked by Christian N on Apr 13, 2015
Latest reply on Apr 23, 2015 by Yuri Muhin

Giving the following source code

 

#include <stdio.h>

 

/*extern void _get_reg_general(unsigned int *reg_gen);*/

 

void main(void)

{

   unsigned int reg_generales[12], cont;

  

  /* _get_reg_general(reg_generales);*/

  

   printf("\nRegistros de proposito general\n");

   for(cont=0; cont<13; cont++)

   {

      printf("   reg[%d]=0x%08x\n", cont, reg_generales[cont]);

   } 

}

 

I try to compile it with the following commands

 

/opt/freescale/usr/local/gcc-4.4.4-glibc-2.11.1-multilib-1.0/arm-fsl-linux-gnueabi/bin/arm-fsl-linux-gnueabi-gcc-4.4.4 -march=armv5te -S dump_cpu_mix.c -o dump_cpu_mix.s.arm

 

/opt/freescale/usr/local/gcc-4.4.4-glibc-2.11.1-multilib-1.0/arm-fsl-linux-gnueabi/bin/arm-fsl-linux-gnueabi-as dump_cpu_mix.s.arm -o dump_cpu_mix.elf.arm

 

/opt/freescale/usr/local/gcc-4.4.4-glibc-2.11.1-multilib-1.0/arm-fsl-linux-gnueabi/bin/arm-fsl-linux-gnueabi-ld -dynamic-linker /opt/freescale/usr/local/gcc-4.4.4-glibc-2.11.1-multilib-1.0/arm-fsl-linux-gnueabi/arm-fsl-linux-gnueabi/multi-libs/armv5te/lib/ld-linux.so.3 /opt/freescale/usr/local/gcc-4.4.4-glibc-2.11.1-multilib-1.0/arm-fsl-linux-gnueabi/arm-fsl-linux-gnueabi/multi-libs/armv5te/usr/lib/crt1.o /opt/freescale/usr/local/gcc-4.4.4-glibc-2.11.1-multilib-1.0/arm-fsl-linux-gnueabi/arm-fsl-linux-gnueabi/multi-libs/armv5te/usr/lib/crti.o -lc /opt/freescale/usr/local/gcc-4.4.4-glibc-2.11.1-multilib-1.0/arm-fsl-linux-gnueabi/arm-fsl-linux-gnueabi/multi-libs/armv5te/usr/lib/crtn.o dump_cpu_mix.elf.arm -o dump_cpu_mix.o.arm

 

Trying to run it, I get the following error

-sh: ./dump_cpu_mix.o.arm: not found

 

checking permissions

-rwxrwxrwx1 root root      6955 Apr 13  2015 dump_cpu_mix.o.arm

 

comparing with the elf generated by

/opt/freescale/usr/local/gcc-4.4.4-glibc-2.11.1-multilib-1.0/arm-fsl-linux-gnueabi/bin/arm-fsl-linux-gnueabi-gcc-4.4.4 -march=armv5te dump_cpu_mix.c -o whatthehell.o -v

(-v output

/mnt/freescale/bsp_git/usr/local/gcc-4.4.4-glibc-2.11.1-multilib-1.0/arm-fsl-linux-gnueabi/bin/../lib/gcc/arm-fsl-linux-gnueabi/4.4.4/../../../../arm-fsl-linux-gnueabi/bin/as -march=armv5te -meabi=5 -o /tmp/cc6gOz5r.o /tmp/ccvHMq7M.s

 

COMPILER_PATH=/mnt/freescale/bsp_git/usr/local/gcc-4.4.4-glibc-2.11.1-multilib-1.0/arm-fsl-linux-gnueabi/bin/../libexec/gcc/arm-fsl-linux-gnueabi/4.4.4/:/mnt/freescale/bsp_git/usr/local/gcc-4.4.4-glibc-2.11.1-multilib-1.0/arm-fsl-linux-gnueabi/bin/../libexec/gcc/:/mnt/freescale/bsp_git/usr/local/gcc-4.4.4-glibc-2.11.1-multilib-1.0/arm-fsl-linux-gnueabi/bin/../lib/gcc/arm-fsl-linux-gnueabi/4.4.4/../../../../arm-fsl-linux-gnueabi/bin/

 

LIBRARY_PATH=/mnt/freescale/bsp_git/usr/local/gcc-4.4.4-glibc-2.11.1-multilib-1.0/arm-fsl-linux-gnueabi/bin/../lib/gcc/arm-fsl-linux-gnueabi/4.4.4/armv5te/:/mnt/freescale/bsp_git/usr/local/gcc-4.4.4-glibc-2.11.1-multilib-1.0/arm-fsl-linux-gnueabi/bin/../lib/gcc/arm-fsl-linux-gnueabi/4.4.4/:/mnt/freescale/bsp_git/usr/local/gcc-4.4.4-glibc-2.11.1-multilib-1.0/arm-fsl-linux-gnueabi/bin/../lib/gcc/:/mnt/freescale/bsp_git/usr/local/gcc-4.4.4-glibc-2.11.1-multilib-1.0/arm-fsl-linux-gnueabi/bin/../arm-fsl-linux-gnueabi/multi-libs/armv5te/lib/:/mnt/freescale/bsp_git/usr/local/gcc-4.4.4-glibc-2.11.1-multilib-1.0/arm-fsl-linux-gnueabi/bin/../arm-fsl-linux-gnueabi/multi-libs/armv5te/usr/lib/

 

COLLECT_GCC_OPTIONS='-march=armv5te' '-o' 'niidea' '-v'

/mnt/freescale/bsp_git/usr/local/gcc-4.4.4-glibc-2.11.1-multilib-1.0/arm-fsl-linux-gnueabi/bin/../libexec/gcc/arm-fsl-linux-gnueabi/4.4.4/collect2 --sysroot=/mnt/freescale/bsp_git/usr/local/gcc-4.4.4-glibc-2.11.1-multilib-1.0/arm-fsl-linux-gnueabi/bin/../arm-fsl-linux-gnueabi/multi-libs/armv5te --eh-frame-hdr -dynamic-linker /lib/ld-linux.so.3 -X -m armelf_linux_eabi -o niidea /mnt/freescale/bsp_git/usr/local/gcc-4.4.4-glibc-2.11.1-multilib-1.0/arm-fsl-linux-gnueabi/bin/../arm-fsl-linux-gnueabi/multi-libs/armv5te/usr/lib/crt1.o /mnt/freescale/bsp_git/usr/local/gcc-4.4.4-glibc-2.11.1-multilib-1.0/arm-fsl-linux-gnueabi/bin/../arm-fsl-linux-gnueabi/multi-libs/armv5te/usr/lib/crti.o /mnt/freescale/bsp_git/usr/local/gcc-4.4.4-glibc-2.11.1-multilib-1.0/arm-fsl-linux-gnueabi/bin/../lib/gcc/arm-fsl-linux-gnueabi/4.4.4/armv5te/crtbegin.o -L/mnt/freescale/bsp_git/usr/local/gcc-4.4.4-glibc-2.11.1-multilib-1.0/arm-fsl-linux-gnueabi/bin/../lib/gcc/arm-fsl-linux-gnueabi/4.4.4/armv5te -L/mnt/freescale/bsp_git/usr/local/gcc-4.4.4-glibc-2.11.1-multilib-1.0/arm-fsl-linux-gnueabi/bin/../lib/gcc/arm-fsl-linux-gnueabi/4.4.4 -L/mnt/freescale/bsp_git/usr/local/gcc-4.4.4-glibc-2.11.1-multilib-1.0/arm-fsl-linux-gnueabi/bin/../lib/gcc -L/mnt/freescale/bsp_git/usr/local/gcc-4.4.4-glibc-2.11.1-multilib-1.0/arm-fsl-linux-gnueabi/bin/../arm-fsl-linux-gnueabi/multi-libs/armv5te/lib -L/mnt/freescale/bsp_git/usr/local/gcc-4.4.4-glibc-2.11.1-multilib-1.0/arm-fsl-linux-gnueabi/bin/../arm-fsl-linux-gnueabi/multi-libs/armv5te/usr/lib /tmp/cc6gOz5r.o -lgcc --as-needed -lgcc_s --no-as-needed -lc -lgcc --as-needed -lgcc_s --no-as-needed /mnt/freescale/bsp_git/usr/local/gcc-4.4.4-glibc-2.11.1-multilib-1.0/arm-fsl-linux-gnueabi/bin/../lib/gcc/arm-fsl-linux-gnueabi/4.4.4/armv5te/crtend.o /mnt/freescale/bsp_git/usr/local/gcc-4.4.4-glibc-2.11.1-multilib-1.0/arm-fsl-linux-gnueabi/bin/../arm-fsl-linux-gnueabi/multi-libs/armv5te/usr/lib/crtn.o

 

)

 

(using file command)

whatthehell.o:             ELF 32-bit LSB executable, ARM, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.26, not stripped

dump_cpu_mix.o.arm: ELF 32-bit LSB executable, ARM, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.26, not stripped

 

 

What step have I forgot? Based on past experience this "should" have worked, but I obviously messed this up. Any hints, hopefully I have included enough information

Outcomes