Creating the toolchain for the 9m2443

Hi,

I have attempted to create a toolchain that will produce a working application on the 9m2443 without success (a hello world app). after many attempts I wonder if I am missing something obvious here in the toolchain settings. the test app result in “Illegal instruction” on the module but will run on raspberry pi & cubieboards. I looked at the patch files from the digitoolchain to help me using the latest crosstoll-ng. arch armv4t

here are the settings & output from readelf & file.

Those files are too long to fit here, I could send via email

crosstoll-ng .config

Target options

CT_ARCH=“arm”
CT_ARCH_DEFAULT_HAS_MMU=y
CT_ARCH_DEFAULT_LE=y
CT_ARCH_DEFAULT_32=y
CT_ARCH_ARCH=“armv4t”
CT_ARCH_CPU=“”
CT_ARCH_TUNE=“”
CT_ARCH_FPU=“”
CT_ARCH_LE=y
CT_ARCH_32=y
CT_ARCH_BITNESS=32
CT_ARCH_FLOAT_SW=y
CT_TARGET_CFLAGS=“”
CT_TARGET_LDFLAGS=“”
CT_ARCH_arm=y

uCLibC .config

Removed

readelf -a / file output

ELF Header:
Magic: 7f 45 4c 46 01 01 01 00 00 00 00 00 00 00 00 00
Class: ELF32
Data: 2’s complement, little endian
Version: 1 (current)
OS/ABI: UNIX - System V
ABI Version: 0
Type: EXEC (Executable file)
Machine: ARM
Version: 0x1
Entry point address: 0x80f0
Start of program headers: 52 (bytes into file)
Start of section headers: 43228 (bytes into file)
Flags: 0x5000002, has entry point, Version5 EABI
Size of this header: 52 (bytes)
Size of program headers: 32 (bytes)
Number of program headers: 5
Size of section headers: 40 (bytes)
Number of section headers: 28
Section header string table index: 25

Section Headers:
[Nr] Name Type Addr Off Size ES Flg Lk Inf Al
[ 0] NULL 00000000 000000 000000 00 0 0 0
[ 1] .init PROGBITS 000080d4 0000d4 000010 00 AX 0 0 4
[ 2] .text PROGBITS 000080f0 0000f0 003f04 00 AX 0 0 16
[ 3] .fini PROGBITS 0000bff4 003ff4 000010 00 AX 0 0 4
[ 4] .rodata PROGBITS 0000c004 004004 000016 00 A 0 0 4
[ 5] .ARM.extab PROGBITS 0000c01c 00401c 00003c 00 A 0 0 4
[ 6] .ARM.exidx ARM_EXIDX 0000c058 004058 000108 00 AL 2 0 4
[ 7] .eh_frame PROGBITS 0000c160 004160 000004 00 A 0 0 4
[ 8] .tbss NOBITS 00014164 004164 000008 00 WAT 0 0 4
[ 9] .init_array INIT_ARRAY 00014164 004164 000004 00 WA 0 0 4
[10] .fini_array FINI_ARRAY 00014168 004168 000004 00 WA 0 0 4
[11] .jcr PROGBITS 0001416c 00416c 000004 00 WA 0 0 4
[12] .got PROGBITS 00014170 004170 000074 04 WA 0 0 4
[13] .data PROGBITS 000141e4 0041e4 0000f8 00 WA 0 0 4
[14] .bss NOBITS 000142dc 0042dc 0025c4 00 WA 0 0 4
[15] .comment PROGBITS 00000000 0042dc 00004f 01 MS 0 0 1
[16] .ARM.attributes ARM_ATTRIBUTES 00000000 00432b 000028 00 0 0 1
[17] .debug_aranges PROGBITS 00000000 004358 0000a0 00 0 0 8
[18] .debug_info PROGBITS 00000000 0043f8 002745 00 0 0 1
[19] .debug_abbrev PROGBITS 00000000 006b3d 0006c4 00 0 0 1
[20] .debug_line PROGBITS 00000000 007201 0008a5 00 0 0 1
[21] .debug_frame PROGBITS 00000000 007aa8 000418 00 0 0 4
[22] .debug_str PROGBITS 00000000 007ec0 000cd9 01 MS 0 0 1
[23] .debug_loc PROGBITS 00000000 008b99 001b62 00 0 0 1
[24] .debug_ranges PROGBITS 00000000 00a6fb 0000d8 00 0 0 1
[25] .shstrtab STRTAB 00000000 00a7d3 000107 00 0 0 1
[26] .symtab SYMTAB 00000000 00ad3c 002140 10 27 284 4
[27] .strtab STRTAB 00000000 00ce7c 001511 00 0 0 1
Key to Flags:
W (write), A (alloc), X (execute), M (merge), S (strings)
I (info), L (link order), G (group), T (TLS), E (exclude), x (unknown)
O (extra OS processing required) o (OS specific), p (processor specific)

There are no section groups in this file.

Program Headers:
Type Offset VirtAddr PhysAddr FileSiz MemSiz Flg Align
EXIDX 0x004058 0x0000c058 0x0000c058 0x00108 0x00108 R 0x4
LOAD 0x000000 0x00008000 0x00008000 0x04164 0x04164 R E 0x8000
LOAD 0x004164 0x00014164 0x00014164 0x00178 0x0273c RW 0x8000
TLS 0x004164 0x00014164 0x00014164 0x00000 0x00008 R 0x4
GNU_STACK 0x000000 0x00000000 0x00000000 0x00000 0x00000 RW 0x4

Section to Segment mapping:
Segment Sections…
00 .ARM.exidx
01 .init .text .fini .rodata .ARM.extab .ARM.exidx .eh_frame
02 .init_array .fini_array .jcr .got .data .bss
03 .tbss
04

There is no dynamic section in this file.

There are no relocations in this file.

Unwind table index ‘.ARM.exidx’ at offset 0x4058 contains 33 entries:

ML: REMOVED

0xb728 <__libc_setup_tls>: 0x1 [cantunwind]

Symbol table ‘.symtab’ contains 532 entries:

ML: REMOVED

No version information found in this file.
Attribute Section: aeabi
File Attributes
Tag_CPU_name: “4T”
Tag_CPU_arch: v4T
Tag_ARM_ISA_use: Yes
Tag_THUMB_ISA_use: Thumb-1
Tag_ABI_PCS_wchar_t: 4
Tag_ABI_FP_denormal: Needed
Tag_ABI_FP_exceptions: Needed
Tag_ABI_FP_number_model: IEEE 754
Tag_ABI_align_needed: 8-byte
Tag_ABI_enum_size: int
Tag_DIV_use: Not allowed

test_5: ELF 32-bit LSB executable, ARM, EABI5 version 1 (SYSV), statically linked, not stripped

Run result

/home/DmsAdmin # ./test_5
Illegal instruction
/home/DmsAdmin # strace ./test_5
execve(“./test_5”, [“./test_5”], [/* 9 vars */]) = 0
— SIGILL (Illegal instruction) @ 0 (0) —
+++ killed by SIGILL +++
Illegal instruction
/home/DmsAdmin # ltrace ./test_5
ltrace: Couldn’t get section header from “./test_5”
/home/DmsAdmin # gdb ./test_5
GNU gdb 6.7.1
Copyright (C) 2007 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type “show copying”
and “show warranty” for details.
This GDB was configured as “arm-unknown-linux-uclibcgnueabi”…
“/home/DmsAdmin/test_5”: not in executable format: File format not recognized
(gdb) r
Starting program:
No executable file specified.
Use the “file” or “exec-file” command.
(gdb) q
/home/DmsAdmin #

test_ct.cpp

/*

  • test_ct.cpp
  • Created on: 2015-03-27
  •  Author: marc
    

*/

#include
#include

int main ()
{
printf("Hello world
");
}

Are you using digi Embedded Linux? What version? What is your goal? DEL 5.7.2 is the latest version supporting cc9m2443 and it comes with a toolchain and corsscompiling for it is pretty easy.

Leonid, yes I am usein DigiEL 5.7.2 with all the updates availables but the fact is there are features present in the kernel that are unavailable or not working with the toolchain provided by Digi as stated before eventfd is not supported and signalfd breaks when compiling the app. using eventfd in my application (portes from WinCE) is the best solution, reason why I spent lots of time trying to get it to work. I would rather design the app the right way for this and future platform rather than starting on the wrong foot having to #ifdef the future.

I have also found that one could tell the linker where to find the dynamic libraries loader which will be great but the beginning of all is a working static app

regards