[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [microblaze-uclinux] [patch] microblaze pthread support





Yes John,
I did look on to the threaddemos make file n changed
it accordingly..

more over I also included the following statement in
the /config/config.in

bool 'pThreads threaddemos'
CONFIG_USER_THREADDEMOS_THREADDEMOS
bool 'pThreads sumThread'
CONFIG_USER_SUMTHREAD_SUMTHREAD


I also downloaded the patch and followed the steps you
mentioned. 

when I said make it gives me an error saying it cannot
find -lpthread ..

the make file looks like this 

SUMTHREAD_TARGET=sumThread

SUMTHREAD_OBJS=sumThread.o

TARGETS=$(SUMTHREAD_TARGET) 

FLTFLAGS  += -v

all:	$(TARGETS)

$(SUMTHREAD_TARGET): $(SUMTHREAD_OBJS) 
	$(CC) $(LDFLAGS) -o $@ $< $(LIBPTHREAD) $(LDLIBS)

clean:
	rm -f $(TARGETS) *.gdb *.elf *.elf2flt *.o *~ core

romfs:
	$(ROMFSINST) /bin/$(SUMTHREAD_TARGET)




--- John Williams <jwilliams@itee.uq.edu.au> wrote:
> Hi folks,
> 
> I've had a very quick look at this pthreads stuff -
> attached is a 
> preliminary patch to enable pthread support for
> microblaze.  I've built 
> it against the user/threaddemos, and it seems to
> work (well it produces 
> some output and doesn't crash the kernel, so that's
> good enough for me 
> right now!).
> 
> (Greg - would you please apply these to your local
> tree for inclusion in 
> the next uClinux-dist?)
> 
> Installation:
> -------------
> 
>  From the uClinux-dist directory:
> 
> (1) extract the tar.gz
> 
> $ tar -xzf microblaze-pthreads.tar.gz
> 
> 
> (2) apply the patch
> 
> $ patch -p0 < microblaze-pthreads.patch
> 
> 
> (3) delete the old uClibc config:
> 
> $ rm uClibc/.config
> 
> 
> (4) make menuconfig, then simply exit and save.
> 
> (5) make clean; make dep; make
> 
> In the user/vendor configuration under misc.
> applications there is a 
> threaddemo option, enable that if you want to test
> it.
> 
> Badri - you should look at the Makefiles in the
> user/threaddemos 
> directory to get ideas on how to build threaded
> applications.
> 
> Cheers,
> 
> John
> > Index: uClibc/extra/Configs/Config.microblaze
>
===================================================================
> RCS file:
>
/var/cvs/uClinux-dist/uClibc/extra/Configs/Config.microblaze,v
> retrieving revision 1.1.1.1
> diff -u -b -B -w -p -r1.1.1.1 Config.microblaze
> --- uClibc/extra/Configs/Config.microblaze
> 2003/09/02 05:13:59	1.1.1.1
> +++ uClibc/extra/Configs/Config.microblaze
> 2003/12/01 01:25:48
> @@ -30,7 +30,7 @@ config ARCH_HAS_NO_FPU
>  
>  config ARCH_HAS_C_SYMBOL_PREFIX
>  	bool
> -	default y
> +	default n
>  
>  config HAVE_NO_PIC
>  	bool
> Index:
> uClibc/extra/Configs/Config.microblaze.default
>
===================================================================
> RCS file:
>
/var/cvs/uClinux-dist/uClibc/extra/Configs/Config.microblaze.default,v
> retrieving revision 1.1.1.1
> diff -u -b -B -w -p -r1.1.1.1
> Config.microblaze.default
> --- uClibc/extra/Configs/Config.microblaze.default
> 2003/09/02 05:13:59	1.1.1.1
> +++ uClibc/extra/Configs/Config.microblaze.default
> 2003/12/01 01:25:48
> @@ -8,7 +8,7 @@
>  HAVE_ELF=y
>  ARCH_HAS_NO_MMU=y
>  ARCH_HAS_NO_FPU=y
> -ARCH_HAS_C_SYMBOL_PREFIX=y
> +# ARCH_HAS_C_SYMBOL_PREFIX=y
>  HAVE_NO_PIC=y
>  CROSS="mb-"
>  UCLIBC_HAS_FLOATS=y
> @@ -18,12 +18,12 @@ WARNINGS="-Wall"
> 
>
KERNEL_SOURCE="/home/jwilliam/uClinux-dist/linux-2.4.x"
>  UCLIBC_UCLINUX_BROKEN_MUNMAP=y
>  EXCLUDE_BRK=y
> -C_SYMBOL_PREFIX="_"
> +C_SYMBOL_PREFIX=""
>  
>  #
>  # General Library Settings
>  #
> -# UCLIBC_HAS_THREADS is not set
> +UCLIBC_HAS_THREADS=y
>  UCLIBC_HAS_LFS=y
>  MALLOC=y
>  # MALLOC_930716 is not set
> Index:
> uClibc/libc/sysdeps/linux/microblaze/__longjmp.S
>
===================================================================
> RCS file:
>
/var/cvs/uClinux-dist/uClibc/libc/sysdeps/linux/microblaze/__longjmp.S,v
> retrieving revision 1.1.1.1
> diff -u -b -B -w -p -r1.1.1.1 __longjmp.S
> --- uClibc/libc/sysdeps/linux/microblaze/__longjmp.S
> 2003/09/02 05:14:27	1.1.1.1
> +++ uClibc/libc/sysdeps/linux/microblaze/__longjmp.S
> 2003/12/01 01:25:51
> @@ -23,19 +23,21 @@ C_ENTRY(__longjmp):
>  	/* load registers from memory to r5 (arg0)*/
>  	lwi	r1, r5, 0
>  	lwi	r15, r5, 4
> -	lwi	r18, r5, 8
> -	lwi	r19, r5, 12
> -	lwi	r20, r5, 16
> -	lwi	r21, r5, 20 
> -	lwi	r22, r5, 24 
> -	lwi	r23, r5, 28
> -	lwi	r24, r5, 32 
> -	lwi	r25, r5, 36
> -	lwi	r26, r5, 40
> -	lwi	r27, r5, 44
> -	lwi	r28, r5, 48
> -	lwi	r29, r5, 52
> -	lwi	r30, r5, 56
> +	lwi	r2,  r5, 8
> +	lwi	r13, r5, 12
> +	lwi	r18, r5, 16
> +	lwi	r19, r5, 20
> +	lwi	r20, r5, 24
> +	lwi	r21, r5, 28
> +	lwi	r22, r5, 32
> +	lwi	r23, r5, 36
> +	lwi	r24, r5, 40
> +	lwi	r25, r5, 44
> +	lwi	r26, r5, 48
> +	lwi	r27, r5, 52
> +	lwi	r28, r5, 56
> +	lwi	r29, r5, 60
> +	lwi	r30, r5, 64
>  	
>  	addi	r3, r0, 1		// return val
>  	rtsd	r15, 8			// normal return
> Index: uClibc/libc/sysdeps/linux/microblaze/clone.c
>
===================================================================
> RCS file:
>
/var/cvs/uClinux-dist/uClibc/libc/sysdeps/linux/microblaze/clone.c,v
> retrieving revision 1.1.1.1
> diff -u -b -B -w -p -r1.1.1.1 clone.c
> --- uClibc/libc/sysdeps/linux/microblaze/clone.c
> 2003/09/02 05:14:28	1.1.1.1
> +++ uClibc/libc/sysdeps/linux/microblaze/clone.c
> 2003/12/01 01:25:51
> @@ -31,7 +31,7 @@ clone (int (*fn)(void *arg), void
> *child
>        arg0 = flags;
>        arg1 = (unsigned long)child_stack;
>        syscall = __NR_clone;
> -      asm volatile ("bralid r17, trap;nop;" 
> +      asm volatile ("bralid r17, 0x08;nop;" 
>  		    : "=r" (rval), "=r" (syscall)
>  		    : "1" (syscall), "r" (arg0), "r" (arg1)
>  		    : SYSCALL_CLOBBERS);
> @@ -41,7 +41,7 @@ clone (int (*fn)(void *arg), void
> *child
>  	{
>  	  arg0 = (*fn) (arg);
>  	  syscall = __NR_exit;
> -	  asm volatile ("bralid r17, trap;nop;" 
> +	  asm volatile ("bralid r17, 0x08;nop;" 
>  			: "=r" (rval), "=r" (syscall)
>  			: "1" (syscall), "r" (arg0)
>  			: SYSCALL_CLOBBERS);
> Index: uClibc/libc/sysdeps/linux/microblaze/setjmp.S
>
===================================================================
> RCS file:
>
/var/cvs/uClinux-dist/uClibc/libc/sysdeps/linux/microblaze/setjmp.S,v
> retrieving revision 1.1.1.1
> diff -u -b -B -w -p -r1.1.1.1 setjmp.S
> --- uClibc/libc/sysdeps/linux/microblaze/setjmp.S
> 2003/05/23 00:38:20	1.1.1.1
> +++ uClibc/libc/sysdeps/linux/microblaze/setjmp.S
> 2003/12/01 01:25:51
> @@ -33,19 +33,22 @@ C_SYMBOL_NAME(__sigsetjmp):
>  	/* Save registers relative to r5 (arg0)*/
>  	swi	r1, r5, 0			/* stack pointer */
>  	swi	r15, r5, 4			/* link register */
> -	swi	r18, r5, 8			/* assembler temp */
> -	swi	r19, r5, 12			/* now call-preserved regs */
> -	swi	r20, r5, 16
> -	swi	r21, r5, 20
> -	swi	r22, r5, 24
> -	swi	r23, r5, 28
> -	swi	r24, r5, 32
> -	swi	r25, r5, 36
> -	swi	r26, r5, 40
> -	swi	r27, r5, 44
> -	swi	r28, r5, 48
> -	swi	r29, r5, 52
> -	swi	r30, r5, 56
> +	swi	r2,  r5, 8			/* SDA and SDA2 ptrs */
> +	swi	r13, r5, 12
> +	swi	r18, r5, 16			/* assembler temp */
> +	swi	r19, r5, 20			/* now call-preserved regs */
> +	swi	r20, r5, 24
> +	swi	r21, r5, 28
> +	swi	r22, r5, 32
> +	swi	r23, r5, 36 
> +	swi	r24, r5, 40
> +	swi	r25, r5, 44
> +	swi	r26, r5, 48
> +	swi	r27, r5, 52
> +	swi	r28, r5, 56
> +	swi	r29, r5, 60
> +	swi	r30, r5, 64
> +	swi	r31, r5, 68
>  
>  	/* Make a tail call to __sigjmp_save; it takes the
> same args.  */
>  	braid	C_SYMBOL_NAME(__sigjmp_save)
> Index:
> uClibc/libc/sysdeps/linux/microblaze/syscall.c
>
===================================================================
> RCS file:
>
/var/cvs/uClinux-dist/uClibc/libc/sysdeps/linux/microblaze/syscall.c,v
> retrieving revision 1.1.1.2
> diff -u -b -B -w -p -r1.1.1.2 syscall.c
> --- uClibc/libc/sysdeps/linux/microblaze/syscall.c
> 2003/09/02 05:14:28	1.1.1.2
> +++ uClibc/libc/sysdeps/linux/microblaze/syscall.c
> 2003/12/01 01:25:51
> @@ -36,16 +36,10 @@ syscall (long num, arg_t a1,
> arg_t a2, a
>    register unsigned long ret asm (SYSCALL_RET);
>  	unsigned long ret_sav;
>  
> -  *((unsigned long *)0xFFFF4004) = (unsigned
> int)('+');
> -  asm ("brlid r17, 08x; nop;" 
> +  asm ("bralid r17, 0x08; nop;" 
>         : "=r" (ret)
>         : "r" (syscall), "r" (a), "r" (b), "r" (c),
> "r" 
=== message truncated ===

> ATTACHMENT part 3 application/x-gzip
name=microblaze-pthreads.tar.gz



__________________________________
Do you Yahoo!?
Free Pop-Up Blocker - Get it now
http://companion.yahoo.com/
___________________________
microblaze-uclinux mailing list
microblaze-uclinux@itee.uq.edu.au
Project Home Page : http://www.itee.uq.edu.au/~jwilliams/mblaze-uclinux
Mailing List Archive : http://www.itee.uq.edu.au/~listarch/microblaze-uclinux/