> But I get an error code (2) on my M0 board.

>   >FT_New_Memory_Face: 2

>The error codes are given in file `fterrdef.h'; error 2 means `unknown file 
>format'.  Maybe an endianness problem while setting up the external array 
>holding 
>the PCF data?
I believe no. this font file is tested in my cortex-r4 board.
When I put a .fon(winfnt.c) or .pcf.Z(pcf.c+ftlzw.c), I get the same result.
The cortex-M0 board is little endian too.
(Maybe it is useless to run freetype2 on a cortex-m0 board. :D)


If you activate debugging with 

  #define FT_DEBUG_LEVEL_ERROR
  #define FT_DEBUG_LEVEL_TRACE

>in `ftoption.h', then setting the environment variable `FT2_DEBUG' to `any:7' 
>you will perhaps get more detailed information on the problem FreeType has 
>encountered.  
>[In case your environment doesn't have environment variables you have to 
>adjust `ftdebug.c' accordingly.]
    FT_BASE_DEF( void )
    ft_debug_init( void )
    {
      const char*  ft2_debug = ft_getenv( "FT2_DEBUG" );
+     const char any7[] = "any:7";
      
+     ft2_debug = any7;

And change these lines:
-    vfprintf( stderr, fmt, ap );
+    printf(fmt, ap);

And add -DFT_DEBUG_LEVEL_ERROR -DFT_DEBUG_LEVEL_TRACE

//#ifdef FT_DEBUG_LEVEL_ERROR
#if 1

  /* documentation is in ftdebug.h */

  FT_BASE_DEF( void )


Hmm.... no output.

Of course there could also be a bug in FreeType.  However, I can't debug this...

> By the way, the assembly code is broken with thumb2:
>   >  static __inline FT_Int32
>   >  FT_MulFix_arm( FT_Int32  a,
>   >                 FT_Int32  b )
>   >  {
>   >    FT_Int32  t, t2;
>   >
>   >
>   >    __asm
>   >    {
>   >      smull t2, t,  b,  a           /* (lo=t2,hi=t) = a*b */
>   >      mov   a,  t,  asr #31         /* a   = (hi >> 31) */
>   >      add   a,  a,  #0x8000         /* a  += 0x8000 */
>   >      adds  t2, t2, a               /* t2 += a */
>   >      adc   t,  t,  #0              /* t  += carry */
>   >      mov   a,  t2, lsr #16         /* a   = t2 >> 16 */
>   >      orr   a,  a,  t,  lsl #16     /* a  |= t << 16 */
>   >    }
>   >    return a;
>   >  }

> Can you fix it?  I have zero knowledge w.r.t. assembler code.

I will try, can you tell me what it's intention...
I can write a small program to test this separate.

This is the code I found in freetype and make a little change:
  int32_t FT_MulFix_C( int32_t  a_, int32_t  b_ )
  {
        int64_t ab = (int64_t)a_ * (int64_t)b_;

        /* this requires arithmetic right shift of signed numbers */
        return (int32_t)( ( ab + 0x8000L - ( ab < 0 ) ) >> 16 );
  }
  
Some staff:
http://www.keil.com/forum/59448/64bit-arithmetic-on-cortex-m0/

int64_t is supported, but generate long code like this:

FT_MulFix_C PROC
        PUSH     {r4,lr}
        BL       __ARM_common_ll_mulss
        CMP      r1,#0
        BGE      |L0.14|
        MOVS     r2,#1
        B        |L0.16|
|L0.14|
        MOVS     r2,#0
|L0.16|
        ASRS     r3,r2,#31
        SUBS     r0,r0,r2
        SBCS     r1,r1,r3
        MOVS     r3,#1
        LSLS     r3,r3,#15
        MOVS     r2,#0
        ADDS     r0,r0,r3
        ADCS     r1,r1,r2
        LSLS     r1,r1,#16
        LSRS     r0,r0,#16
        ORRS     r0,r0,r1
        POP      {r4,pc}
        ENDP


        AREA ||.arm_vfe_header||, DATA, READONLY, NOALLOC, ALIGN=2

        DCD      0x00000000

        AREA ||i.__ARM_common_ll_mulss||, COMGROUP=__ARM_common_ll_mulss, CODE, 
READONLY, ALIGN=1

__ARM_common_ll_mulss PROC
        PUSH     {r3-r7,lr}
        ASRS     r4,r0,#16
        UXTH     r3,r1
        MOV      r6,r4
        UXTH     r2,r0
        MULS     r6,r3,r6
        ASRS     r5,r1,#16
        MOV      r0,r2
        ASRS     r7,r6,#16
        MULS     r0,r3,r0
        LSLS     r6,r6,#16
        ADDS     r0,r0,r6
        MOVS     r1,#0
        ADCS     r1,r1,r7
        MOV      r6,r2
        MULS     r6,r5,r6
        ASRS     r7,r6,#16
        LSLS     r6,r6,#16
        ADDS     r0,r0,r6
        ADCS     r1,r1,r7
        MOV      r6,r4
        MULS     r6,r5,r6
        ADDS     r1,r1,r6
        POP      {r3-r7,pc}
        ENDP

duhaunpeng




_______________________________________________
Freetype-devel mailing list
Freetype-devel@nongnu.org
https://lists.nongnu.org/mailman/listinfo/freetype-devel

Reply via email to