This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Floating point issue?

I have found in my code where register R8 is being used as a loop variable in a FOR loop. In the loop, a call is made to a floating point library routine (fpcmp.s), which inadvertently destroys R8. This makes my FOR loop an infinite loop. Could this somehow be a setup issue? Has anyone else seen similar problems?

  • Dave;
    Can we get a small code frag of this problem?
    I have been unable to duplicate. Are you running on simulator or on a target board?
    I have access to the Atmel Sam7 and TI TMS470 eval boards.
    Bradford

  • I am using a target system. Code from list file is below. Problem occurs at Line 454. First Line of FPCMP destroys R8.

     00000418            ; SCOPE-START
     1376:                      for (k=0, ksav = 0;k < 5; k++)
     00000418          L_238:
     00000418  E3A08000  MOV         R8,#0x0
     0000041C  ---- Variable 'k' assigned to Register 'R8' ----
     0000041C  E3A03000  MOV         R3,#0x0
     00000420  ---- Variable 'ksav' assigned to Register 'R3' ----
     00000420  EA000010  B           L_236  ; Targ=0x468
     00000424          L_237:
     1378:                             if (vec0[k] < vec0[ksav])
     00000424  E1A00003  MOV         R0,R3 ; ksav
     00000428  E1A01C00  MOV         R1,R0,LSL #24 ; ksav
     0000042C  E1A01C21  MOV         R1,R1,LSR #24
     00000430  E1A01101  MOV         R1,R1,LSL #2
     00000434  E28D0008  ADD         R0,R13,#0x0008
     00000438  E7904001  LDR         R4,[R0,+R1]
     0000043C  E1A01008  MOV         R1,R8 ; k
     00000440  E1A01C01  MOV         R1,R1,LSL #24 ; k
     00000444  E1A01C21  MOV         R1,R1,LSR #24
     00000448  E1A01101  MOV         R1,R1,LSL #2
     0000044C  E7900001  LDR         R0,[R0,+R1]
     00000450  E1A01004  MOV         R1,R4
     00000454  EBFFFEE9  BL          ?C?FPCMP?A  ; Targ=0x0 ; ?C?FPCMP?A
     00000458  2A000000  BCS         L_234  ; Targ=0x460
     1380:                                    ksav = k;
     0000045C  E1A03008  MOV         R3,R8 ; k
     1382:                      }
     00000460          L_234:
     00000460  E2888001  ADD         R8,R8,#0x0001 ; k
     00000464  E20880FF  AND         R8,R8,#0x00FF
     00000468          L_236:
     00000468  E1A00008  MOV         R0,R8 ; k
     0000046C  E1A00C00  MOV         R0,R0,LSL #24 ; k
     00000470  E1A00C20  MOV         R0,R0,LSR #24
     00000474  E3500005  CMP         R0,#0x0005
     00000478  BAFFFFE9  BLT         L_237  ; Targ=0x424
     1383:                      if (j == 2)
     0000047C  E1A00002  MOV         R0,R2 ; j
     00000480  E1A00C00  MOV         R0,R0,LSL #24 ; j
     00000484  E1A00C20  MOV         R0,R0,LSR #24
     00000488  E3500002  CMP         R0,#0x0002
     0000048C  1A000005  BNE         L_240  ; Targ=0x4A8
     1384:                             min = vec0[ksav];    // saves third smallest element in min variable
     00000490  E1A00003  MOV         R0,R3 ; ksav
     00000494  E1A01C00  MOV         R1,R0,LSL #24 ; ksav
     00000498  E1A01C21  MOV         R1,R1,LSR #24
     0000049C  E1A01101  MOV         R1,R1,LSL #2
     000004A0  E28D0008  ADD         R0,R13,#0x0008
     000004A4  E7906001  LDR         R6,[R0,+R1]
     000004A8          L_240:
     1386:                      vec0[ksav]= 1.0e05;
     000004A8  E5100000  LDR         R0,=0x47C35000
     000004AC  E1A01003  MOV         R1,R3 ; ksav
     000004B0  E1A03C01  MOV         R3,R1,LSL #24 ; ksav
     000004B4  E1A03C23  MOV         R3,R3,LSR #24
     000004B8  E1A03103  MOV         R3,R3,LSL #2
     000004BC  E28D1008  ADD         R1,R13,#0x0008
     000004C0  E7810003  STR         R0,[R1,+R3]
     000004C4            ; SCOPE-END
    

  • Under what version of the Keil CARM compiler did you build the project that shows these symptoms?

  • IDE-Version:
    µVision3 V3.21
    Copyright (c) Keil Elektronik GmbH / Keil Software, Inc. 1995 - 2005

    License Information:
    Dave Burbick KDI
    KDI Precision Products
    LIC=----

    Tool Version Numbers:
    Toolchain Path: C:\Keil\ARM\BIN\
    C Compiler: CA.Exe V2.40a
    Assembler: AA.Exe V2.40a
    Linker/Locator: LA.Exe V2.40
    Librarian: LIBA.Exe V4.26
    Hex Converter: OHA.Exe V2.10
    CPU DLL: SARM.DLL V1.28
    Dialog DLL: DARMP.DLL V1.10
    Target DLL: BIN\UL2ARM.DLL V1.14
    Dialog DLL: TARMP.DLL V1.10

  • We have solved this issue. If you want a patch for your version, please send email to:

    support.intl@keil.com

    The fix will be part of the next release.

    Reinhard