Page 1 of 6
Toolchain guidance needed
Posted: Sat Sep 21, 2013 1:54 am
by prairie
So I've tried all the toolchains available at sourceforge and none will produce a binary that will run on my platform (D8000 T-GAP8AKUC armv7). I've just been testing with a simple hello world.c and getting seg faults that have something to do with memory mapping
strace -Tt ./hello
00:44:23 execve("./hello", ["./hello"], [/* 47 vars */]) = 0 <0.001105>
00:44:23 brk(0) = 0x11000 <0.000028>
00:44:23 --- {si_signo=SIGSEGV, si_code=SEGV_MAPERR, si_addr=0x40fa6968} (Segmentation fault) ---
00:44:23 +++ killed by SIGSEGV +++
Segmentation fault
So I figure I have to compile my own toolchain with sources for my platform, but I haven't been able to follow the
B-series wiki example because there isn't a clear correspondence between that example and my sources. The distribution package (11_UNxxD7xx0) for my platform includes:
bcm_usbshim.tgz
binutils-2010q1.tgz
busybox-1.14.3-vdlinux.tgz
DPA_S_RT3572_LinuxSTA_V2.4.0.4.tgz
ffmpeg_0.5.tgz
GenoaP_VDLinux_OpenSource.tgz
glibc-2.11-2010q1.tgz
gloox-0.9.9.12.tar.bz2
iptables-1.4.8.tgz
LGPL_glib.tgz
LGPL_mms.tgz
libgphoto2.3.1.tar.gz
libiconv_1_9_1.tar.tar
libthai-0.1.6.tar.gz
libusb1.0.tar.gz
readme
RT3572_LinuxAP_V2.5.0.3.tgz
SDL.zip
wireless_tools.29.tgz
xfsprogs-3.0.5.tgz
I have successfully compiled the GenoaP kernel but really don't know where to go next to build the toolchain. Has anyone built a toolchain from this source distro? Any tips would be greatly appreciated. thx
Re: Toolchain guidance needed
Posted: Sat Sep 21, 2013 10:20 am
by juusso
i have feeling your tv is not arm, but mstar? or?
i remember plasmas of d series were mstar based..
or... gap& should be arm. give the output of
cat /proc/cpuinfo
Re: Toolchain guidance needed
Posted: Sat Sep 21, 2013 11:50 am
by prairie
D7 plasma is mstar, D8 is arm.
cat /proc/cpuinfo
Processor : ARMv7 Processor rev 2 (v7l)
BogoMIPS : 798.72
Features : swp half thumb fastmult vfp edsp neon vfpv3
CPU implementer : 0x41
CPU architecture: 7
CPU variant : 0x2
CPU part : 0xc08
CPU revision : 2
Hardware : Samsung SDP1002 Evaluation board
Revision : 0000
Serial : 0000000000000000
Is
Code: Select all
svn checkout svn://svn.code.sf.net/p/samygo/code/develop/toolchains/T-GAS_GAP VDLinux-armv7a8
the same as
Code: Select all
http://sourceforge.net/projects/samygo/files/Toolchains/VDLinux-armv7a8-toolchain-lite_20100630.tgz/download
?
Re: Toolchain guidance needed
Posted: Sat Sep 21, 2013 11:51 am
by juusso
yea. same but slightly updated.
Re: Toolchain guidance needed
Posted: Sat Sep 21, 2013 11:55 am
by juusso
i think you have problems with environment. what does it mean -compiled kernel, but don't have toolchain

without toolchain you can't compile kernel
possible that you have compiled kernel from sources with x86 native toolchain for your PC. or?
what is cmdline you use for compillation?
viewtopic.php?t=5148#p36675
Re: Toolchain guidance needed
Posted: Sat Sep 21, 2013 12:13 pm
by prairie
Yes the kernel compiled with CROSS_COMPILE = arm-v7a8-linux-gnueabi toolchain (lite) but compiling simple program like hello.c doesn't run on TV. Command line CFLAGS are:
Code: Select all
-pipe -march=arm7-a -mcpu=cortex-a8 -mtune=cortex-a8 -mfpu=vfp3 -msoft-float -mfloat-abi=softfp -mabi=aapcs-linux -mthumb-interwork
I've also tried removing all the fine tuning options and just using -march=arm7-a
Re: Toolchain guidance needed
Posted: Sat Sep 21, 2013 12:16 pm
by juusso
Example of Makefile for your simple helloworld.c :
Code: Select all
CROSS_COMPILE = arm-v7a8-linux-gnueabi-
CC = $(CROSS_COMPILE)gcc
SRC_DIR = ./
OBJ_DIR = $(SRC_DIR)
INC = \
-I$(SRC_DIR)
EXTRA_CFLAGS = -Wall -fPIC
CFLAGS = -c -O2 $(INC) $(EXTRA_CFLAGS) $(DEFS)
OBJS =helloworld.o
SRCS =helloworld.c
DEFS =-DARM7 -DD_SERIES #-DDEBUG_LOG
TARGET_SO =hello.so
OBJ_SUFFIX =o
all : $(TARGET_SO)
.c.$(OBJ_SUFFIX):
@echo Compile $(CC)... [$@]
$(CC) $< $(CFLAGS) -o $*.$(OBJ_SUFFIX)
O16S = $(SRCS:.c=.$(OBJ_SUFFIX))
$(TARGET_SO) : $(O16S)
@echo Linking ... [$@]
$(CC) $(DEFS) -fPIC -shared -Wl,-soname,$(TARGET_SO) -o $(TARGET_SO) $(OBJS) $(EXTRA_CFLAGS) -lm -ldl
clean :
rm -rf $(OBJS) $(TARGET_SO)
.SUFFIXES = .c .o
you dont use fPIC?

Re: Toolchain guidance needed
Posted: Sat Sep 21, 2013 12:37 pm
by prairie
juuso wrote:Example of Makefile for your simple helloworld.c :
...
you dont use fPIC?


What's that?
That Makefile is generating a missing separator error at line:
Re: Toolchain guidance needed
Posted: Sat Sep 21, 2013 12:41 pm
by bugficks
fPIC is kinda only useful for shared libs (.so) . he tries to create an executable. exe always get it's own process heap while .so get mapped into that and when 2 .so have same base address one needs to get relocated. there comes PIC into place. position-independent-code
Re: Toolchain guidance needed
Posted: Sat Sep 21, 2013 12:44 pm
by juusso
i just gave example to you. It comes not from me so i can`t troubleshoot. But you can look at cmdline and you see you use complete different code (stole from... c series?). Ok, maybe i`m not who have deep compiling knowledge, but i can tell you what i would do if i were you...
Optional you can try this:
Code: Select all
arm-v7a8-linux-gnueabi-gcc -O2 -c helloworld.c -o helloworld.o
arm-v7a8-linux-gnueabi-gcc -shared -Wl -o hello helloworld.o