Showing posts with label ARM. Show all posts
Showing posts with label ARM. Show all posts

Thursday, November 21, 2013

Signum JTAG under virtualbox

I'm using Gentoo Linux as the host and Windows (other OSes) as the guest system on my laptop. Some time ago I had to debug ARM device with Signum JTAG but after I installed drivers Windows 7 Device Manager says "This device cannot start. (Code 10)" and no one know how to fix it. I reisntalled it few times, checked old and new drivers but the same. I checked Google but no answer. But I found the solution a little bit later.

Friday, May 18, 2012

Tuesday, November 8, 2011

I looked through book about writing kernel modules in Linux (actually it's in russian lang). It's oriented on x86 architecture. I fount some not so real but interesting sample with syscall from inline assmebler code and port it to arm architecture. I used codesourcery toolchain.

Some information about arm syscalls in linux. According ARM EABI one use r7 register for syscall number and swi 0 (or svc 0, codesourcery gcc generate the same code) for syscall. One can use also r0-r5 registers for 32 bit parameters (or r0...r6 for 64 bit parameters, but them must be aligned to even number of registers)

Sunday, September 25, 2011

Include into assembler files .h files with definitions

This very general question how to incorporate C and Assembler. Bcoz sometimes you have many C sources and headers and you need rewrite something on assembler. Everybody knows about inline assembler in gcc. But not many knows that you can write into assembler and include some of required .h files. Linux kernel has some examples, but they not easy to look. I found some good explanation on ARM site [1] and adopt it for gcc


Thursday, June 16, 2011

embedded libc hell

Sometimes embedded world is a real hell place. Lets look

# cd /bin/
# ./lscgroup
-sh: ./lscgroup: not found
# ls -la lscgroup
-rwxr-xr-x 1 65534 65534 23138 May 27 2011 lscgroup

wtf??? it's executable but some strange error message. Let's look deeply

# ldd ./lscgroup
.......
libc.so.0 => /lib/libc.so.0 (0x4000e000)
ld-uClibc.so.0 => /lib/ld-uClibc.so.0 (0x40000000)
.......
libc.so.6 => not found (0x00000000)
.......
#

I compiled libcgroups with glibc and try to run under uClibc. I spent to investigate this issue whole day(( I dont have crosslaform with uClibc and I cant change board environment to glibc. And what we can do??? I found (my friends told me that it's the common way to solve problem like this). We can chroot into a new envornment. For example from uClibc chroot to glibc. Ok.
Download fedore core rootfs
http://ftp.linux.org.uk/pub/linux/arm/fedora/rootfs/fc6-arm-root-with-gcc.tar.bz2
it contains gcc!!! very usefull sometimes when all crash with cross building. Setup NFS server, unpack arch into dir, export dir (restart NFS server and check it with the command exportfs) and mount fedore core root to the device folder. After that you must mount /dev /proc /sys into chroot environment and chroot

mount -o bind /proc/ /root_fc/proc
mount -o bind /dev/ /root_fc/dev/
mount -o bind /sys/ /root_fc/sys/
chroot /root_fc/ /bin/sh

And....

# lscgroup
cgroups can't be listed: Cgroup is not mounted
#

it's working, check with ldd that all works fine.