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

Reading *.lst or *.ELF file

Dear All,

I'm trying to tracking the .lst file as the below.
but I'm confused what is the current pc value?

Fron here, 0x010002b4: 4902 .I LDR r1,[pc,#8] ; [0x10002c0] = 0x20000000

Does [0x10002c0] mean the current 'pc' value or should I have to consider that value already calculated by #8?

What exactly does 0x10002c0 mean?

... SystemInit 0x010002b4: 4902 .I LDR r1,[pc,#8] ; [0x10002c0] = 0x20000000 0x010002b6: 4801 .H LDR r0,[pc,#4] ; [0x10002bc] = 0x2faf080 0x010002b8: 6008 .' STR r0,[r1,#0] 0x010002ba: 4770 pG BX lr $d 0x010002bc: 02faf080 .... DCD 50000000 0x010002c0: 20000000 ... DCD 536870912 $t

Thanks in advance.

  • Oh.. of course yes.

    Here is the code,
    Especially I don't know what does [0x10002c0] mean at the below.

    SystemInit 0x010002b4: 4902 .I LDR r1,[pc,#8] ; [0x10002c0] = 0x20000000

    
        RESET
        __Vectors
            0x01000000:    20000208    ...     DCD    536871432
            0x01000004:    010002c5    ....    DCD    16777925
            0x01000008:    010002cd    ....    DCD    16777933
            0x0100000c:    010002cf    ....    DCD    16777935
            0x01000010:    010002d1    ....    DCD    16777937
            0x01000014:    010002d3    ....    DCD    16777939
            0x01000018:    010002d5    ....    DCD    16777941
        __main_after_scatterload
        _main_clock
        _main_cpp_init
        _main_init
            0x010000c8:    4800        .H      LDR      r0,[pc,#0] ; [0x10000cc] = 0x10001bf
            0x010000ca:    4700        .G      BX       r0
        $d
            0x010000cc:    010001bf    ....    DCD    16777663
        .ARM.Collect$$$$00002712
        __lit__00000000
        __rt_final_cpp
        __rt_final_exit
            0x010000d0:    20000208    ...     DCD    536871432
        $t
        .emb_text
        FlashLoader_ASM
            0x010000d4:    2000        .       MOVS     r0,#0
            0x010000de:    0000        ..      MOVS     r0,r0
        .text
        UartStdOutInit
            0x010000e0:    4848        HH      LDR      r0,[pc,#288] ; [0x1000204] =
            0x010000fe:    4770        pG      BX       lr
            0x010001ba:    6021        !'      STR      r1,[r4,#0]
            0x010001bc:    e7fe        ..      B        0x10001bc ; FlashLoader + 160
        main
            0x010001be:    4811        .H      LDR      r0,[pc,#68] ; [0x1000204] = 0x40006000
            0x010001c0:    b510        ..      PUSH     {r4,lr}
            0x010001c2:    2110        .!      MOVS     r1,#0x10
            0x010001c4:    6101        .a      STR      r1,[r0,#0x10]
            0x010001c6:    2141        A!      MOVS     r1,#0x41
    
            0x010002a8:    0000000a    ....    DCD    10
        $t
        .text
        SystemCoreClockUpdate
            0x010002ac:    4904        .I      LDR      r1,[pc,#16] ; [0x10002c0] = 0x20000000
            0x010002ae:    4803        .H      LDR      r0,[pc,#12] ; [0x10002bc] = 0x2faf080
            0x010002b0:    6008        .'      STR      r0,[r1,#0]
            0x010002b2:    4770        pG      BX       lr
        SystemInit
            0x010002b4:    4902        .I      LDR      r1,[pc,#8] ; [0x10002c0] = 0x20000000
            0x010002b6:    4801        .H      LDR      r0,[pc,#4] ; [0x10002bc] = 0x2faf080
            0x010002b8:    6008        .'      STR      r0,[r1,#0]
            0x010002ba:    4770        pG      BX       lr
        $d
            0x010002bc:    02faf080    ....    DCD    50000000
            0x010002c0:    20000000    ...     DCD    536870912
        $t
        .text
        Reset_Handler
            0x010002c4:    4806        .H      LDR      r0,[pc,#24] ; [0x10002e0] = 0x10002b5
            0x010002c6:    4780        .G      BLX      r0
            0x010002c8:    4806        .H      LDR      r0,[pc,#24] ; [0x10002e4] = 0x10000c1
            0x010002ca:    4700        .G      BX       r0
    
    

  • I want to add one more question.
    Where is the __rt_entry ?, Especially I want to know where exactly to start jump to main() function from startup code.

  • It is the computed address of PC+8 which then holds the literal 0x20000000
    The literal pool being placed outside of the executing code
    If using assembler, perhaps take a course on it

  • Thanks so much letting me know it,

    never mind the below question.

    Now I'm trying to understand the startup.s code of Cortex CM3 with assembly code also.
    I come across the "Application Note 107 - ARM Infocenter", it say that booting sequence goes to __main then __rt_entry sequence. and automatically after __rt_entry, main is called.
    so far I get it.

    But problem is that I can't grep "__rt_entry" in the source files. So I asked this question also.

    Once I'll try again to understand the startup.s code.

    Thanks.

  • The linker builds structures describing the load regions and initialization in the form of copying and zeroing regions of RAM. It also pulls in library code to perform these run time start up tasks, whether it is the scatter loader, or decompression routines for the statics. Some of these things will not be provided to you in source code form.