This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Compiler/RM48L730: issue : F021 flash API in gcc project

Part Number: RM48L730

Tool/software: TI C/C++ Compiler

Hi,

I am using F021 flash api in a RM48L730 projects compiled with arm-gcc-eabi.

when I disassembly my project, some instructions in the library function are undefined.

example :  Fapi_issueAsyncCommandWithAddress function

Disassembly of section .text:Fapi_issueAsyncCommandWithAddress:

08001f08 <Fapi_issueAsyncCommandWithAddress>:
 8001f08:       b538            push    {r3, r4, r5, lr}
 8001f0a:       4605            mov     r5, r0
 8001f0c:       460c            mov     r4, r1
 8001f0e:       2d06            cmp     r5, #6
 8001f10:       d005            beq.n   8001f1e <Fapi_issueAsyncCommandWithAddress+0x16>
 8001f12:       2d08            cmp     r5, #8
 8001f14:       d003            beq.n   8001f1e <Fapi_issueAsyncCommandWithAddress+0x16>
 8001f16:       2d0e            cmp     r5, #14
 8001f18:       bf18            it      ne
 8001f1a:       2005            movne   r0, #5
 8001f1c:       d108            bne.n   8001f30 <Fapi_issueAsyncCommandWithAddress+0x28>
 8001f1e:       2010            movs    r0, #16
 8001f20:       f7ff faee       bl      8001500 <_Fapi_issueFsmCommand>
 8001f24:       4803            ldr     r0, [pc, #12]   ; (8001f34 <Fapi_issueAsyncCommandWithAddress+0x2c>)
 8001f26:       6004            str     r4, [r0, #0]
 8001f28:       4628            mov     r0, r5
 8001f2a:       f7ff fae9       bl      8001500 <_Fapi_issueFsmCommand>
 8001f2e:       2000            movs    r0, #0
 8001f30:       bd38            pop     {r3, r4, r5, pc}
 8001f32:       46c0            nop                     ; (mov r8, r8)
 8001f34:       fff87110                        ; <UNDEFINED> instruction: 0xfff87110          ; it generate a prefetched exception
 8001f38:       00003241        andeq   r3, r0, r1, asr #4

with code studio composer (armdis tools), it gives the following assembly :

8001f08:              Fapi_issueAsyncCommandWithAddress:
8001f08:               .thumb
8001f08: 38B5             PUSH            {R3, R4, R5, LR}
8001f0a: 0546             MOV             R5, R0
8001f0c: 0C46             MOV             R4, R1
8001f0e: 062D             CMP             R5, #6
8001f10: 05D0             BEQ             0x08001F1E
8001f12: 082D             CMP             R5, #8
8001f14: 03D0             BEQ             0x08001F1E
8001f16: 0E2D             CMP             R5, #14
8001f18: 18BF             IT              NE
8001f1a: 0520             MOVNE           R0, #5
8001f1c: 08D1             BNE             0x08001F30
8001f1e:              $C$L1:
8001f1e: 1020             MOVS            R0, #16
8001f20: FFF7EEFA         BL              0x08001500
8001f24: 0348             LDR             R0, $C$CON1 [0x8001f34]
8001f26: 0460             STR             R4, [R0]
8001f28: 2846             MOV             R0, R5
8001f2a: FFF7E9FA         BL              0x08001500
8001f2e: 0020             MOVS            R0, #0
8001f30:              $C$L2:
8001f30: 38BD             POP             {R3, R4, R5, PC}
8001f32: C046             MOV             R8, R8
8001f34:              $d:                                                          ; equivalent line of the undefined instruction above 
8001f34:              $C$CON1:
8001f34: 1071            .half		 0x7110
8001f36: F8FF            .half		 0xFFF8
8001f38:              $d:
8001f38: 4132            .half		 0x3241
8001f3a: 0000            .half		 0x0000
8001f3c: 0054            .half		 0x5400
8001f3e: 4900            .half		 0x0049


how to resolve this issue ?

  • Hello Ratid,

    The difference you are seeing is that the CCS tools identify that the information is data where the GCC tools appear to identify it as an instruction. If your issue is that the GCC tools are incorrectly representing it, then I suspect the proper path for resolution would be to check with the GCC community since these tools are not directly supported by TI. If there is an issue with execution and the code is not working as needed.

    Also, I am not certain of your intended use of the disassembly, but please be aware of the limitations of use as outlined in the license agreement and also note that programming of the Hercules devices with source other than the approved library sources will potentially void the warranty for the devices.
  • Hello Chuck,

    Thank you for reply !

    Is there any version compiled for GCC tools? Or we are obliged to use CCS?

    please be reassured, I am using the library as it is, but when I got the prefetched abort exception I debugued the assembly to find what causing the exception.

    I remain open to all suggestions ! thank you,

    regards,
  • Hello Ratid,

    No issues on the use of the assembly/disassembly for debug for sure but it looks like the GCC disassembly has an issue with some of the symbols and has incorrectly identified data for an instruction.

    In regard to compiles for GCC vs. CCS. The F021 Flash API is compiled to be EABI compliant. This is the standard for ARM binary. In your initial post, you mentioned that you were compiling with a GCC compiler that was EABI compliant? If so, it should simply be a matter of linking in the object code/binary and the compiler would not be relevant. This could also be some issues with the symbols included in the object files that could throw some curves at the GCC tools.

    For debugging the prefetch abort exception, have a look at the CP15 error status register which should have information about the offending address.