Hello, On Wed, 22 Oct 2014 20:53:52 +0300 Andrii <[email protected]> wrote:
> Thanks for the patches! > > I've tried to apply both on uClibc-0.9.33.2 (latest official release). > uclibc-cm3-clone.patch was applied just well. > But I was not able to apply uclibc-cm3-testandset.patch correctly: > In libpthread/linuxthreads.old/sysdeps/arm/pt-machine.h > I don't have next lines: > - int unused = 0; > - return INTERNAL_SYSCALL_ARM (atomicops, , 4, SYS_ARM_ATOMIC_SET, > - spinlock, 1, unused); Yes, just skip that part of the patch. > But rest seems the same. > So I fixed it manually by copying ldrex/strex and testandset > functions. This patch also creates dot_config_pthreads-no-ldrex which > I used to build uclibc (also I enabled the USE_LDREXSTREX=y) > Correct. > The result is next (In app just usual pthread_create() used without > any other pthread calls) : > # ./the_app > 00026 : pthread_initialize: initial thread stack bounds: bos=0x1, > tos=0xffffffff > the_app started. version 6.76_threads > Starting sensor simulation thread > 00026 : __pthread_initialize_manager: manager stack: size=8160, > bos=0xa0696008, tos=0xa0697fe8 > 00026 : __pthread_initialize_manager: send REQ_DEBUG to manager thread > 00026 : pthread_create: write REQ_CREATE to manager thread > 00026 : pthread_create: before suspend(self) > [ 18.810000] > [ 18.810000] > [ 18.810000] the_app: unhandled MPU fault (0x08) at 0x00000000 > [pc=0xa0583ea8,sp=0xa0697fc0] > [ 18.810000] > > Actually I have same results on latest uclibc git without fixing clone > patch but with ldrex/strex fix. > > Any suggestions are welcome. > Looks like your build flags are not optimal for Cortex-M3. You are building as "march=armv7-m -mthumb". Try: make -s ARCH_CFLAGS= 'CPU_CFLAGS=-mthumb -march=armv7 -mfix-cortex-m3-ldrd' Also, make sure your application doesn't use big arrays located in stack. By default, stack size is only 4K for the Cortex-M applications. See arm-uclinuxeabi-flthdr utility to display and change the stack size. Regards, Sergei > Regards. > > > > On Wed, Oct 22, 2014 at 1:11 PM, Sergei Poselenov > <[email protected]> wrote: > > > Hello, > > > > On Thu, 9 Oct 2014 23:29:01 +0300 > > Andrii <[email protected]> wrote: > > > > > I'm trying to build uClibc for Cortex-M3 LPC17XX with codesourcery > > > g++ lite arm2010q1(189) toolchain. > > > I've tried 0.9.30.3, 0.9.33.2 and latest git a9bdc5d2 with almost > > > same results. > > > Here is the output from latest git: > > > > > > When trying to build with old linuxthreads: > > > CC libpthread/linuxthreads.old/mutex.os > > > /tmp/ccB7JHC6.s: Assembler messages: > > > /tmp/ccB7JHC6.s:29: Error: selected processor does not support ARM > > > opcodes /tmp/ccB7JHC6.s:30: Error: attempt to use an ARM > > > instruction on a Thumb-only processor -- `swp r3,r3,[r0]' > > > /tmp/ccB7JHC6.s:31: Error: attempt to use an ARM instruction on a > > > Thumb-only processor -- `orr r0,pc,#1' > > > /tmp/ccB7JHC6.s:32: Error: attempt to use an ARM instruction on a > > > Thumb-only processor -- `bx r0' > > > /tmp/ccB7JHC6.s:58: Error: selected processor does not support ARM > > > opcodes /tmp/ccB7JHC6.s:59: Error: attempt to use an ARM > > > instruction on a Thumb-only processor -- `swp r2,r2,[r0]' > > > /tmp/ccB7JHC6.s:60: Error: attempt to use an ARM instruction on a > > > Thumb-only processor -- `orr r0,pc,#1' > > > /tmp/ccB7JHC6.s:61: Error: attempt to use an ARM instruction on a > > > Thumb-only processor -- `bx r0' > > > make: *** [libpthread/linuxthreads.old/mutex.os] Error 1 > > > > > > New linux threads: > > > CC libpthread/linuxthreads/sysdeps/arm/pspinlock.os > > > In file included from ./libpthread/linuxthreads/descr.h:46, > > > from ./libpthread/linuxthreads/internals.h:36, > > > from > > > libpthread/linuxthreads/sysdeps/arm/pspinlock.c:21: > > ./libpthread/linuxthreads/sysdeps/arm/pt-machine.h:36: > > > warning: no previous prototype for 'testandset' > > > /tmp/cczGDaGC.s: Assembler messages: > > > /tmp/cczGDaGC.s:27: Error: selected processor does not support > > > Thumb mode `swp r3,r3,[r0]' > > > /tmp/cczGDaGC.s:46: Error: selected processor does not support > > > Thumb mode `swp r3,r3,[r0]' > > > make: *** [libpthread/linuxthreads/sysdeps/arm/pspinlock.os] > > > Error 1 > > > > > > NPTL: > > > ----- > > > CC libpthread/nptl/pthread_atfork.os > > > AS libpthread/nptl/sysdeps/unix/sysv/linux/arm/pt-vfork.os > > > > > libpthread/nptl/sysdeps/unix/sysv/linux/arm/../../../../../../../libc/sysdeps/linux/arm/vfork.S: > > > Assembler messages: > > > > > libpthread/nptl/sysdeps/unix/sysv/linux/arm/../../../../../../../libc/sysdeps/linux/arm/vfork.S:72: > > > Error: only SUBS PC, LR, #const allowed -- `sub pc,r0,#31' > > > > > libpthread/nptl/sysdeps/unix/sysv/linux/arm/../../../../../../../libc/sysdeps/linux/arm/vfork.S:74: > > > Error: thumb conditional instruction should be in IT block -- > > > `strne r3,[r2,#-1044]' > > > make: *** > > > [libpthread/nptl/sysdeps/unix/sysv/linux/arm/pt-vfork.os] Error 1 > > > > > > Extra CFLAGS : > > > march=armv7-m -mthumb -Wl, -elf2flt -Wa, -march=armv7-m -Wa, > > > -mthumb > > > > > > As I undestand thumb2 doesn't support swp instruction. But is > > > there a way to avoid hardcoded swp instructions in threads code > > > (spinlock implementation)? > > > > > Uclibc (still) lacks pthreads support on Cortex-M3. > > > > I'm attaching two patches: > > - implement testandset() for Cortex-M3. > > - Fix a bug in implementation of clone() for Cortex-M3. > > > > That should make pthreads work. Note also that we are building the > > "linuxthreads.old" pthreads configuration. > > > > > > Regards, > > > > Sergei Poselenov, > > Emcraft Systems > > > Regards. > > > _______________________________________________ > > > uClibc mailing list > > > [email protected] > > > http://lists.busybox.net/mailman/listinfo/uclibc > > > > _______________________________________________ uClibc mailing list [email protected] http://lists.busybox.net/mailman/listinfo/uclibc
