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

Cortex-M0: What's included in the binary?

Hi,

I have two M0 projects.  The first project has only one assembly file startup.s.  The second project has one assembly file and one C file.  When I checked the memory map file of the second project (shown below), there are some extra object codes included in the final binary in addition to startup.o and a.o.  I presume they are related to C libararies.  Can someone describe what they are for?  Are these libaries required?  If not required do we have a way to exclude them?

Thanks a lot.

--- Memory map of project 1: startup.s ----

Memory Map of the image

  Image Entry point : 0x00000041

  Load Region LR_1 (Base: 0x00000000, Size: 0x0000015c, Max: 0xffffffff, ABSOLUTE)

    Execution Region ER_RO (Base: 0x00000000, Size: 0x0000015c, Max: 0xffffffff, ABSOLUTE)

    Base Addr    Size         Type   Attr      Idx    E Section Name        Object

    0x00000000   0x00000040   Data   RO            3    RESET               startup.o
    0x00000040   0x0000011c   Code   RO            4  * .text               startup.o

--- Memory map of project 2: startup.s & a.c ---

Memory Map of the image

  Image Entry point : 0x0000020d

  Load Region LR_1 (Base: 0x00000000, Size: 0x0000027c, Max: 0xffffffff, ABSOLUTE)

    Execution Region ER_RO (Base: 0x00000000, Size: 0x00000274, Max: 0xffffffff, ABSOLUTE)

    Base Addr    Size         Type   Attr      Idx    E Section Name        Object

    0x00000000   0x0000004c   Data   RO           20    RESET               startup.o
    0x0000004c   0x00000008   Code   RO           30  * !!!main             c_p.l(__main.o)
    0x00000054   0x0000003c   Code   RO          195    !!!scatter          c_p.l(__scatter.o)
    0x00000090   0x0000001a   Code   RO          197    !!handler_copy      c_p.l(__scatter_copy.o)
    0x000000aa   0x00000002   PAD
    0x000000ac   0x0000001c   Code   RO          199    !!handler_zi        c_p.l(__scatter_zi.o)
    0x000000c8   0x00000006   Code   RO           68    .ARM.Collect$$libinit$$00000000  c_p.l(libinit.o)
    0x000000ce   0x00000000   Code   RO           77    .ARM.Collect$$libinit$$00000006  c_p.l(libinit2.o)
    0x000000ce   0x00000000   Code   RO           79    .ARM.Collect$$libinit$$00000008  c_p.l(libinit2.o)
    0x000000ce   0x00000000   Code   RO           81    .ARM.Collect$$libinit$$0000000A  c_p.l(libinit2.o)
    0x000000ce   0x00000000   Code   RO           84    .ARM.Collect$$libinit$$0000000D  c_p.l(libinit2.o)
    0x000000ce   0x00000000   Code   RO           86    .ARM.Collect$$libinit$$0000000F  c_p.l(libinit2.o)
    0x000000ce   0x00000000   Code   RO           88    .ARM.Collect$$libinit$$00000011  c_p.l(libinit2.o)
    0x000000ce   0x00000000   Code   RO           90    .ARM.Collect$$libinit$$00000013  c_p.l(libinit2.o)
    0x000000ce   0x00000000   Code   RO           92    .ARM.Collect$$libinit$$00000015  c_p.l(libinit2.o)
    0x000000ce   0x00000000   Code   RO           94    .ARM.Collect$$libinit$$00000017  c_p.l(libinit2.o)
    0x000000ce   0x00000000   Code   RO           96    .ARM.Collect$$libinit$$00000019  c_p.l(libinit2.o)
    0x000000ce   0x00000000   Code   RO           98    .ARM.Collect$$libinit$$0000001B  c_p.l(libinit2.o)
    0x000000ce   0x00000000   Code   RO          100    .ARM.Collect$$libinit$$0000001D  c_p.l(libinit2.o)
    0x000000ce   0x00000000   Code   RO          102    .ARM.Collect$$libinit$$0000001F  c_p.l(libinit2.o)
    0x000000ce   0x00000000   Code   RO          104    .ARM.Collect$$libinit$$00000021  c_p.l(libinit2.o)
    0x000000ce   0x00000000   Code   RO          108    .ARM.Collect$$libinit$$00000028  c_p.l(libinit2.o)
    0x000000ce   0x00000000   Code   RO          110    .ARM.Collect$$libinit$$0000002A  c_p.l(libinit2.o)
    0x000000ce   0x00000000   Code   RO          112    .ARM.Collect$$libinit$$0000002C  c_p.l(libinit2.o)
    0x000000ce   0x00000000   Code   RO          114    .ARM.Collect$$libinit$$0000002E  c_p.l(libinit2.o)
    0x000000ce   0x00000002   Code   RO          115    .ARM.Collect$$libinit$$0000002F  c_p.l(libinit2.o)
    0x000000d0   0x00000002   Code   RO          136    .ARM.Collect$$libshutdown$$00000000  c_p.l(libshutdown.o)
    0x000000d2   0x00000000   Code   RO          150    .ARM.Collect$$libshutdown$$00000003  c_p.l(libshutdown2.o)
    0x000000d2   0x00000000   Code   RO          153    .ARM.Collect$$libshutdown$$00000006  c_p.l(libshutdown2.o)
    0x000000d2   0x00000000   Code   RO          156    .ARM.Collect$$libshutdown$$00000009  c_p.l(libshutdown2.o)
    0x000000d2   0x00000000   Code   RO          158    .ARM.Collect$$libshutdown$$0000000B  c_p.l(libshutdown2.o)
    0x000000d2   0x00000000   Code   RO          161    .ARM.Collect$$libshutdown$$0000000E  c_p.l(libshutdown2.o)
    0x000000d2   0x00000002   Code   RO          162    .ARM.Collect$$libshutdown$$0000000F  c_p.l(libshutdown2.o)
    0x000000d4   0x00000000   Code   RO           32    .ARM.Collect$$rtentry$$00000000  c_p.l(rtentry.o)
    0x000000d4   0x00000000   Code   RO           35    .ARM.Collect$$rtentry$$00000002  c_p.l(rtentry2.o)
    0x000000d4   0x00000004   Code   RO           52    .ARM.Collect$$rtentry$$00000005  c_p.l(rtentry5.o)
    0x000000d8   0x00000000   Code   RO           37    .ARM.Collect$$rtentry$$00000009  c_p.l(rtentry2.o)
    0x000000d8   0x00000004   Code   RO           38    .ARM.Collect$$rtentry$$0000000A  c_p.l(rtentry2.o)
    0x000000dc   0x00000000   Code   RO           40    .ARM.Collect$$rtentry$$0000000C  c_p.l(rtentry2.o)
    0x000000dc   0x00000008   Code   RO           41    .ARM.Collect$$rtentry$$0000000D  c_p.l(rtentry2.o)
    0x000000e4   0x00000004   Code   RO           53    .ARM.Collect$$rtentry$$00002716  c_p.l(rtentry5.o)
    0x000000e8   0x00000002   Code   RO           73    .ARM.Collect$$rtexit$$00000000  c_p.l(rtexit.o)
    0x000000ea   0x00000000   Code   RO          119    .ARM.Collect$$rtexit$$00000002  c_p.l(rtexit2.o)
    0x000000ea   0x00000004   Code   RO          120    .ARM.Collect$$rtexit$$00000003  c_p.l(rtexit2.o)
    0x000000ee   0x00000006   Code   RO          121    .ARM.Collect$$rtexit$$00000004  c_p.l(rtexit2.o)
    0x000000f4   0x00000118   Code   RO            1    .text               a.o
    0x0000020c   0x00000024   Code   RO           21  * .text               startup.o
    0x00000230   0x00000006   Code   RO           28    .text               c_p.l(heapauxi.o)
    0x00000236   0x0000000c   Code   RO           60    .text               c_p.l(exit.o)
    0x00000242   0x00000002   PAD
    0x00000244   0x0000000c   Code   RO          128    .text               c_p.l(sys_exit.o)
    0x00000250   0x00000002   Code   RO          139    .text               c_p.l(use_no_semi.o)
    0x00000252   0x00000000   Code   RO          141    .text               c_p.l(indicate_semi.o)
    0x00000252   0x00000002   PAD
    0x00000254   0x00000020   Data   RO          193    Region$$Table       anon$$obj.o

Parents
  • Hi wshen,

    I think the 2nd case includes another startup file which had been provided by the compiler. Are the procedure of compiling for both projects same? If you use GCC, how about adding the '-nostdlib' option to the command line?

    Best regards,
    Yasuhiko Koumoto.

Reply
  • Hi wshen,

    I think the 2nd case includes another startup file which had been provided by the compiler. Are the procedure of compiling for both projects same? If you use GCC, how about adding the '-nostdlib' option to the command line?

    Best regards,
    Yasuhiko Koumoto.

Children
No data