Difference between revisions of "Heap-1-dot-c"

From Wiki at Neela Nurseries
Jump to: navigation, search
m
m
Line 79: Line 79:
 
collect2: error: ld returned 1 exit status
 
collect2: error: ld returned 1 exit status
 
</pre>
 
</pre>
 +
 +
 +
<!-- comment -->
 +
 +
== Redlib Specs File ==
 +
 +
<pre>
 +
      1 %rename cpp default_cpp
 +
      2
 +
      3 *cpp:
 +
      4 -isystem =/../redlib/include -isystem =/../features/include -nostdinc %(default_cpp)
 +
      5
 +
</pre>
 +
 +
 +
 +
 +
[[#top|- - - top of page - - -]]
 +
 +
<!-- comment -->
  
  
  
 
<!-- comment -->
 
<!-- comment -->

Revision as of 17:27, 9 July 2018


Overview

This article to contain and amplify notes on -MF and -MT type calls to gcc, which build dependency rules for use in the larger project compilation process of LPCXpresso. Goal is to figure out how LPCXpresso builds its projects, how it calls `make` utility . . .


LPCXpresso Compiler Output From One Source File

make -r all

Building file: ../Source/FreeRTOS_Source/portable/MemMang/heap_1.c

Invoking: MCU C Compiler

arm-none-eabi-gcc -D__REDLIB__ -DDEBUG -D__CODE_RED -D__USE_CMSIS=CMSISv2p00_LPC11xx -I"/home/veris/Downloads/freertos/FreeRTOSv10.0.1/FreeRTOS/Demo/CORTEX_M0_LPC1114_LPCXpresso/CMSISv2p00_LPC11xx/inc" -I"/home/veris/Downloads/freertos/tmp/FreeRTOSv10.0.1/FreeRTOS/Demo/CORTEX_M0_LPC1114_LPCXpresso/CMSISv2p00_LPC11xx/inc" -I"../../../Common/include" -I"/home/veris/projects/nxp/rtos-demo-3/Source/Common_Demo_Tasks/include" -I"/home/veris/projects/nxp/rtos-demo-3/Source" -I"/home/veris/projects/nxp/rtos-demo-3/Source/FreeRTOS_Source/include" -I"/home/veris/projects/nxp/rtos-demo-3/Source/FreeRTOS_Source/portable/GCC/ARM_CM0" -O0 -g3 -Wall -c -fmessage-length=0 -fno-builtin -ffunction-sections -fdata-sections -Wextra -mcpu=cortex-m0 -mthumb -D__REDLIB__ -specs=redlib.specs -MMD -MP -MF"Source/FreeRTOS_Source/portable/MemMang/heap_1.d" -MT"Source/FreeRTOS_Source/portable/MemMang/heap_1.o" -MT"Source/FreeRTOS_Source/portable/MemMang/heap_1.d" -o "Source/FreeRTOS_Source/portable/MemMang/heap_1.o" "../Source/FreeRTOS_Source/portable/MemMang/heap_1.c"

Finished building: ../Source/FreeRTOS_Source/portable/MemMang/heap_1.c


Invocations

Trying to invoke gcc to observe dependency rule output for one source file:


## Note path is ~/projects/nxp/rtos-demo-3/Debug:

$ arm-none-eabi-gcc -MMD -MP -MF"Source/FreeRTOS_Source/portable/MemMang/heap_1.d" "../Source/FreeRTOS_Source/portable/MemMang/heap_1.c" -I"/home/veris/LPCXpresso/workspace/rtos-demo-3/Source/FreeRTOS_Source/include" -I"/home/veris/projects/nxp/rtos-demo-3/Source" -I"/home/veris/LPCXpresso/workspace/rtos-demo-3/Source/FreeRTOS_Source/portable/GCC/ARM_CM0"
/tmp/ccc6sGOb.s: Assembler messages:
/tmp/ccc6sGOb.s:118: Error: selected processor does not support ARM mode `cpsid i'

$

Adding reference to Arm Cortex M0 processor type:

$ arm-none-eabi-gcc -MMD -MP -MF"Source/FreeRTOS_Source/portable/MemMang/heap_1.d" "../Source/FreeRTOS_Source/portable/MemMang/heap_1.c" -I"/home/veris/LPCXpresso/workspace/rtos-demo-3/Source/FreeRTOS_Source/include" -I"/home/veris/projects/nxp/rtos-demo-3/Source" -I"/home/veris/LPCXpresso/workspace/rtos-demo-3/Source/FreeRTOS_Source/portable/GCC/ARM_CM0" -mcpu=cortex-m0
../Source/FreeRTOS_Source/portable/MemMang/heap_1.c:1:0: error: target CPU does not support ARM mode
 /*
 ^

$

Adding reference to use thumb type instructions:

$ arm-none-eabi-gcc -MMD -MP -MF"Source/FreeRTOS_Source/portable/MemMang/heap_1.d" "../Source/FreeRTOS_Source/portable/MemMang/heap_1.c" -I"/home/veris/LPCXpresso/workspace/rtos-demo-3/Source/FreeRTOS_Source/include" -I"/home/veris/projects/nxp/rtos-demo-3/Source" -I"/home/veris/LPCXpresso/workspace/rtos-demo-3/Source/FreeRTOS_Source/portable/GCC/ARM_CM0" -mcpu=cortex-m0 -mthumb
/usr/lib/gcc/arm-none-eabi/4.8/../../../arm-none-eabi/lib/armv6-m/libc.a(lib_a-exit.o): In function `exit':
/home/tin/projects/debian/arm-toolchain/collab-maint/newlib/build/arm-none-eabi/armv6-m/newlib/libc/stdlib/../../../../../../newlib/libc/stdlib/exit.c:70: undefined reference to `_exit'
/usr/lib/gcc/arm-none-eabi/4.8/../../../arm-none-eabi/lib/armv6-m/crt0.o: In function `_start':
/home/tin/projects/debian/arm-toolchain/collab-maint/newlib/build/arm-none-eabi/armv6-m/libgloss/arm/../../../../../libgloss/arm/crt0.S:420: undefined reference to `main'
/tmp/ccHnZU0F.o: In function `pvPortMalloc':
heap_1.c:(.text+0x1e): undefined reference to `vTaskSuspendAll'
heap_1.c:(.text+0x6c): undefined reference to `xTaskResumeAll'
heap_1.c:(.text+0x76): undefined reference to `vApplicationMallocFailedHook'
collect2: error: ld returned 1 exit status

$


Adding references to both linker scripts, to pull in definition of _ebss which is assigned to function named _exit:

$ arm-none-eabi-gcc -MMD -MP -MF"Source/FreeRTOS_Source/portable/MemMang/heap_1.d" "../Source/FreeRTOS_Source/portable/MemMang/heap_1.c" -I"/home/veris/LPCXpresso/workspace/rtos-demo-3/Source/FreeRTOS_Source/include" -I"/home/veris/projects/nxp/rtos-demo-3/Source" -I"/home/veris/LPCXpresso/workspace/rtos-demo-3/Source/FreeRTOS_Source/portable/GCC/ARM_CM0" -mcpu=cortex-m0 -mthumb -T./extra-linker-script.ld -T./RTOSDemo_Debug.ld



/usr/lib/gcc/arm-none-eabi/4.8/../../../arm-none-eabi/bin/ld: cannot find libcr_c.a
/usr/lib/gcc/arm-none-eabi/4.8/../../../arm-none-eabi/bin/ld: cannot find libcr_eabihelpers.a
collect2: error: ld returned 1 exit status


Redlib Specs File

      1 %rename cpp default_cpp
      2 
      3 *cpp:
      4 -isystem =/../redlib/include -isystem =/../features/include -nostdinc %(default_cpp)
      5 



- - - top of page - - -