Difference between revisions of "Heap-1-dot-c"
m |
m |
||
Line 108: | Line 108: | ||
$ | $ | ||
</pre> | </pre> | ||
+ | |||
+ | |||
+ | - STEP - | ||
+ | |||
+ | After several tries to see rule generation put to standard out, it seems from the following errors that LPCXpresso's calls to make happen in the context of first referring to a souce file which defines a function named main(): | ||
+ | |||
+ | <pre> | ||
+ | $ arm-none-eabi-gcc -MD -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 -L/opt/nxp/lpcxpresso-8p2p2/lpcxpresso/tools/arm-none-eabi/lib/thumb -L/opt/nxp/lpcxpresso-8p2p2/lpcxpresso/tools/lib/gcc/arm-none-eabi/5.4.1/thumb | ||
+ | |||
+ | |||
+ | |||
+ | /usr/lib/gcc/arm-none-eabi/4.8/../../../arm-none-eabi/bin/ld: warning: cannot find entry symbol ResetISR; defaulting to 00000000 | ||
+ | /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' | ||
+ | /home/tin/projects/debian/arm-toolchain/collab-maint/newlib/build/arm-none-eabi/armv6-m/libgloss/arm/../../../../../libgloss/arm/crt0.S:422: undefined reference to `__bss_start__' | ||
+ | /home/tin/projects/debian/arm-toolchain/collab-maint/newlib/build/arm-none-eabi/armv6-m/libgloss/arm/../../../../../libgloss/arm/crt0.S:422: undefined reference to `__bss_end__' | ||
+ | /tmp/ccJoJpYZ.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 | ||
+ | |||
+ | $ | ||
+ | </pre> | ||
+ | |||
Revision as of 18:19, 9 July 2018
Contents
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
- STEP -
$ arm-none-eabi-gcc -MD -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 $
- STEP - added -L to point linker to libcr_c.a:
$ arm-none-eabi-gcc -MD -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 -L/opt/nxp/lpcxpresso-8p2p2/lpcxpresso/tools/arm-none-eabi/lib/thumb /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 $
- STEP -
After several tries to see rule generation put to standard out, it seems from the following errors that LPCXpresso's calls to make happen in the context of first referring to a souce file which defines a function named main():
$ arm-none-eabi-gcc -MD -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 -L/opt/nxp/lpcxpresso-8p2p2/lpcxpresso/tools/arm-none-eabi/lib/thumb -L/opt/nxp/lpcxpresso-8p2p2/lpcxpresso/tools/lib/gcc/arm-none-eabi/5.4.1/thumb /usr/lib/gcc/arm-none-eabi/4.8/../../../arm-none-eabi/bin/ld: warning: cannot find entry symbol ResetISR; defaulting to 00000000 /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' /home/tin/projects/debian/arm-toolchain/collab-maint/newlib/build/arm-none-eabi/armv6-m/libgloss/arm/../../../../../libgloss/arm/crt0.S:422: undefined reference to `__bss_start__' /home/tin/projects/debian/arm-toolchain/collab-maint/newlib/build/arm-none-eabi/armv6-m/libgloss/arm/../../../../../libgloss/arm/crt0.S:422: undefined reference to `__bss_end__' /tmp/ccJoJpYZ.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 $
Redlib Specs File
Contents of the redlib specs file are as follows:
1 %rename cpp default_cpp 2 3 *cpp: 4 -isystem =/../redlib/include -isystem =/../features/include -nostdinc %(default_cpp) 5
While there is no path with "features/include" in itself on the localhost, there is a path with "redlib/include" as part of that path. This path leads to these header files:
$ locate redlib | grep redlib/include /opt/nxp/lpcxpresso-8p2p2/lpcxpresso/tools/redlib/include /opt/nxp/lpcxpresso-8p2p2/lpcxpresso/tools/redlib/include/assert.h /opt/nxp/lpcxpresso-8p2p2/lpcxpresso/tools/redlib/include/ctype.h /opt/nxp/lpcxpresso-8p2p2/lpcxpresso/tools/redlib/include/errno.h /opt/nxp/lpcxpresso-8p2p2/lpcxpresso/tools/redlib/include/float.h /opt/nxp/lpcxpresso-8p2p2/lpcxpresso/tools/redlib/include/limits.h /opt/nxp/lpcxpresso-8p2p2/lpcxpresso/tools/redlib/include/locale.h /opt/nxp/lpcxpresso-8p2p2/lpcxpresso/tools/redlib/include/math.h /opt/nxp/lpcxpresso-8p2p2/lpcxpresso/tools/redlib/include/setjmp.h /opt/nxp/lpcxpresso-8p2p2/lpcxpresso/tools/redlib/include/signal.h /opt/nxp/lpcxpresso-8p2p2/lpcxpresso/tools/redlib/include/stdarg.h /opt/nxp/lpcxpresso-8p2p2/lpcxpresso/tools/redlib/include/stdbool.h /opt/nxp/lpcxpresso-8p2p2/lpcxpresso/tools/redlib/include/stddef.h /opt/nxp/lpcxpresso-8p2p2/lpcxpresso/tools/redlib/include/stdint.h /opt/nxp/lpcxpresso-8p2p2/lpcxpresso/tools/redlib/include/stdio.h /opt/nxp/lpcxpresso-8p2p2/lpcxpresso/tools/redlib/include/stdlib.h /opt/nxp/lpcxpresso-8p2p2/lpcxpresso/tools/redlib/include/string.h /opt/nxp/lpcxpresso-8p2p2/lpcxpresso/tools/redlib/include/sys /opt/nxp/lpcxpresso-8p2p2/lpcxpresso/tools/redlib/include/time.h /opt/nxp/lpcxpresso-8p2p2/lpcxpresso/tools/redlib/include/sys/libconfig-arm.h /opt/nxp/lpcxpresso-8p2p2/lpcxpresso/tools/redlib/include/sys/libconfig.h /opt/nxp/lpcxpresso-8p2p2/lpcxpresso/tools/redlib/include/sys/redlib_version.h
Actually there are a couple paths on the local host which have "features/include" as part of their expressed paths:
$ locate features/include /opt/nxp/lpcxpresso-8p2p2/lpcxpresso/tools/features/include /opt/nxp/lpcxpresso-8p2p2/lpcxpresso/tools/features/include/NXP /opt/nxp/lpcxpresso-8p2p2/lpcxpresso/tools/features/include/cr_mtb_buffer.h /opt/nxp/lpcxpresso-8p2p2/lpcxpresso/tools/features/include/cr_section_macros.h /opt/nxp/lpcxpresso-8p2p2/lpcxpresso/tools/features/include/NXP/crp.h /usr/share/qt4/mkspecs/features/include_source_dir.prf