title: Memory utilization for unwind support (on ARM architecture)
body: <p>I am currently working trying to develop software for a SAM7X256 microcontroller in C. The device is running contiki OS and I am using the yagarto toolchain.</p>
  
  <p>While studying the map file (to try to figure out why the .text region had grown so much) I discovered that several kb of the .text region where assigned to unwind support (see below)</p>
  
  <pre><code>.text           0x00116824      0xee4 c:/toolchains/yagarto/bin/../lib/gcc/arm-none-eabi/4.6.2\libgcc.a(unwind-arm.o)
                  0x00116c4c                _Unwind_VRS_Get
                  ......   
                  0x0011763c                __gnu_Unwind_Backtrace
  
  .text           0x00117708      0x1b0 c:/toolchains/yagarto/bin/../lib/gcc/arm-none-eabi/4.6.2\libgcc.a(libunwind.o)
                  0x00117708                __restore_core_regs
                  0x00117708                restore_core_regs
                  ....
                  0x00117894                _Unwind_Backtrace
  
  .text           0x001178b8      0x558 c:/toolchains/yagarto/bin/../lib/gcc/arm-none-eabi/4.6.2\libgcc.a(pr-support.o)
                  0x00117958                __gnu_unwind_execute
                  ...
                  0x00117e08                _Unwind_GetTextRelBase
  </code></pre>
  
  <p>I have tried finding looking for some information on unwinding and found <a href="http://en.wikipedia.org/wiki/Call_stack#Unwinding">1</a> and <a href="http://sourceware.org/binutils/docs/as/ARM-Unwinding-Tutorial.html">2</a>. However the following is still unclear to me:</p>
  
  <ol>
  <li>When/why do I need unwinding support?</li>
  <li>What part of my code is causing pr-support.o, unwind-arm.o and libunwind.o to be linked?</li>
  <li>If applicable, how do I avoid linking the items below. </li>
  </ol>
  
  <p>In case it is necessary I am including a link to the complete <a href="http://pastebin.com/HuAXLPrh">map file</a> </p>
  
  <p>Thanks in advance for your help </p>
  
  <p><strong>Edit 1:
  Adding Linker commands</strong></p>
  
  <pre><code>CC       = arm-none-eabi-gcc
  CFLAGSNO = -I. -I$(CONTIKI)/core -I$(CONTIKI_CPU) -I$(CONTIKI_CPU)/loader \
         -I$(CONTIKI_CPU)/dbg-io \
             -I$(CONTIKI)/platform/$(TARGET) \
             ${addprefix -I,$(APPDIRS)} \
             -DWITH_UIP -DWITH_ASCII -DMCK=$(MCK) \
             -Wall $(ARCH_FLAGS) -g -D SUBTARGET=$(SUBTARGET)
  
  CFLAGS  += $(CFLAGSNO) -O -DRUN_AS_SYSTEM -DROM_RUN  -ffunction-sections
  
  LDFLAGS += -L $(CONTIKI_CPU) --verbose -T $(LINKERSCRIPT) -nostartfiles  -Wl,-Map,$(TARGET).map
  
  $(CC) $(LDFLAGS) $(CFLAGS) -nostartfiles -o project.elf -lc Project.a
  </code></pre>