This is the mail archive of the newlib@sourceware.cygnus.com mailing list for the newlib project.
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
Hello! I've compiled newlib-1.8.1 for use with a SH-7032 board (SH-1 cpu kernel): ./configure -v --target=sh-coff --prefix=/usr/local/sh-coff --host=i586-unknown-linux --norecursion Debugging some initial test programs (I'm not very experienced with gcc used for embedded systems) I got illegal opcode messages and found that memset.S from newlib/libc/machine/sh indeed uses dt <reg> commands which are only available for SH-2 and better cpu kernels. My workaround was a substitution of the dt opcodes: ! ! Fast SH memset ! ! by Toshiyasu Morita (tm@netcom.com) ! ! Entry: r4: destination pointer ! r5: fill value ! r6: byte count ! ! Exit: r0-r3: trashed ! #include "asm.h" ENTRY(memset) mov r4,r3 ! Save return value mov r6,r0 ! Check explicitly for zero cmp/eq #0,r0 bt L_exit mov #12,r0 ! Check for small number of bytes cmp/gt r6,r0 bt L_store_byte_loop neg r4,r0 ! Align destination add #4,r0 and #3,r0 tst r0,r0 bt L_dup_bytes .balignw 4,0x0009 L_align_loop: mov.b r5,@r4 add #-1,r6 add #1,r4 add #-1,r0 ! Substitute for dt r0 cmp/eq #0,r0 ! Substitute for dt r0 bf L_align_loop L_dup_bytes: extu.b r5,r5 ! Duplicate bytes across longword swap.b r5,r0 or r0,r5 swap.w r5,r0 or r0,r5 mov r6,r2 ! Calculate number of double longwords shlr2 r2 shlr r2 .balignw 4,0x0009 L_store_long_loop: mov.l r5,@r4 ! Store double longs to memory add #-1,r2 ! Substitute for dt r2 tst r2,r2 ! Substitute for dt r2 mov.l r5,@(4,r4) add #8,r4 bf L_store_long_loop mov #7,r0 and r0,r6 tst r6,r6 bt L_exit .balignw 4,0x0009 L_store_byte_loop: mov.b r5,@r4 ! Store bytes to memory add #1,r4 add #-1,r6 ! Substitute for dt r6 tst r6,r6 ! Substitute for dt r6 bf L_store_byte_loop L_exit: rts mov r3,r0 Thank you very much for this really good development system! Yours, Jens Decker -- ___________________________________________________________ * Jens Decker * * Universitaet Regensburg * * Institut fuer Physikalische und Theoretische Chemie * * Lehrst. Prof. Dick * * Universitaetstr. 31 * * 93059 Regensburg * * * * Tel: +49-941/943-4473, -4458 Fax: -4488 Room: 22.2.14 * * Email: Jens.Decker@chemie.uni-regensburg.de * * WWW (coming up): http:// * * rchsg41.chemie.uni-regensburg.de/group/Jens.Decker.html * ___________________________________________________________