Lpc makefiles full mapping

From Wiki at Neela Nurseries
Jump to: navigation, search

ARM processor notes  :  STM32F10x notes  :  LPCXpresso 1114  :  heap_1.c build recipe  :  LPCXpresso makefiles mapping (this article)



Overview

In LPCXpressor FreeRTOS demo the top level makefile is named 'makefile'. This is a little different than on the Unix side, where the default GNU makefile name is 'Makefile', but most LPCXpresso users are running on Windows stations, where the command shell DOS is case-insensitive. The primary makefile in LPCXpresso FreeRTOS demo refers to multiple other makefiles in both parent and child directores. Here is an incomplete map of makefiles in the project:


                               +--------------------------------------------+
                               |                 rtos-demo-3                |
                               |                                            |
                               |    makefile     objects.mk     sources.mk  | <-- sources.mk names all project subdirectories,
                               +--------------------------------------------+     these include:
                                                    |
                           ----+--------------------+--------                      *  Source/Common_Demo_Tasks
                               |                                                   *  Source/FreeRTOS_Source
                        +-------------+                                            *  Source/FreeRTOS_Source/portable/GCC/ARM_CM0
                        |   Source    |                                            *  Source/FreeRTOS_Source/portable/MemMang
                        |             |                                            *  Source
                        |  subdir.mk  |
                        +-------------+
                               |
                 +-------------+-----------+--------
                 |                         |
       +---------------------+   +-------------------+
       |  Common_Demo_Tasks  |   |  FreeRTOS_Source  |
       |                     |   |                   |
       |      subdir.mk      |   |     subdir.mk     |
       +---------------------+   +-------------------+
                                           |
                                 +-------------------+
                                 |     portable      |
                                 +-------------------+
                                           |
                             +-------------+--------+
                             |                      |
                      +-------------+        +-------------+
                      |     GCC     |        |   MemMang   |
                      +-------------+        |             |
                             |               |  subdir.mk  |
                             |               +-------------+
                             | 
                      +-------------+
                      |   ARM_CM0   |
                      |             |
                      |  subdir.mk  |
                      +-------------+

Notes: LPC's primary makefile named 'makefile' in the project root directory tries to include ../makefile.init, but this makefile is missing from the local rtos-demo-3 project. There is an instance of file makefile.init in ../.. but it refers to a different project. This makefile names two library paths and does not appear to be auto-generated:


     1 PROJECT_NAME=rtos-demo-with-mods
     2 
     3 LIBRARY_PATHS=\
     4 -L/opt/nxp/lpcxpresso-8p2p2/lpcxpresso/tools/arm-none-eabi/lib \
     5 -L/opt/nxp/lpcxpresso-8p2p2/lpcxpresso/tools/lib/gcc/arm-none-eabi/5.4.1
     6 
     7 
     8 
     9 # --- EOF ---


^ LPC makefile First Steps

LPC's primary makefile first attempts to include a makefile named 'makefile.init'. We don't see this in our given rtos-demo-3 root directory, nor in the parent dir to this directory. However from another project it looks like this init makefile sets a couple of library paths. Before talking more about the primary makefile's action here is an excerpt from this makefile:

Figure x -

-include ../makefile.init

RM := rm -rf

# All of the sources participating in the build are defined here
-include sources.mk
-include Source/FreeRTOS_Source/portable/MemMang/subdir.mk
-include Source/FreeRTOS_Source/portable/GCC/ARM_CM0/subdir.mk
-include Source/FreeRTOS_Source/subdir.mk
-include Source/Common_Demo_Tasks/subdir.mk
-include Source/subdir.mk
-include subdir.mk
-include objects.mk

ifneq ($(MAKECMDGOALS),clean)
ifneq ($(strip $(C_DEPS)),)
-include $(C_DEPS)
endif
endif

-include ../makefile.defs

This primary LPC makefile also defines targets 'all', '{project_name}.axf' and 'clean'. There is also a .PHONY target which lists targets 'all', 'clean' and 'dependents', which we are guessing make those targets .PHONY type targets which will always be built regarless of any file timestamps when make is called with their names among its arguments.

Perhaps the most interesting line so far is the line which expresses "-include $(C_DEPS)". C_DEPS is a variable which gets appended by many of the subdir.mk files. After including the various subdir.mk file $C_DEPS holds:

./Source/FreeRTOS_Source/portable/MemMang/heap_1.d  ./Source/FreeRTOS_Source/portable/GCC/ARM_CM0/port.d
./Source/FreeRTOS_Source/list.d ./Source/FreeRTOS_Source/queue.d ./Source/FreeRTOS_Source/tasks.d
./Source/FreeRTOS_Source/timers.d  ./Source/Common_Demo_Tasks/IntQueue.d
./Source/Common_Demo_Tasks/blocktim.d ./Source/Common_Demo_Tasks/countsem.d
./Source/Common_Demo_Tasks/recmutex.d  ./Source/IntQueueTimer.d ./Source/RegTest.d
./Source/cr_startup_lpc11.d ./Source/main-blinky.d ./Source/main-full.d ./Source/main.d


^ Dot d Dependency Files

These dependency files typically express the following data:

Source/FreeRTOS_Source/portable/MemMang/heap_1.o \
 Source/FreeRTOS_Source/portable/MemMang/heap_1.d: \
 ../Source/FreeRTOS_Source/portable/MemMang/heap_1.c \
 /home/${USER}/projects/nxp/rtos-demo-3/Source/FreeRTOS_Source/include/FreeRTOS.h \
 /home/${USER}/projects/nxp/rtos-demo-3/Source/FreeRTOSConfig.h \
 /home/${USER}/projects/nxp/rtos-demo-3/Source/FreeRTOS_Source/include/projdefs.h \
 /home/${USER}/projects/nxp/rtos-demo-3/Source/FreeRTOS_Source/include/portable.h \
 /home/${USER}/projects/nxp/rtos-demo-3/Source/FreeRTOS_Source/include/deprecated_definitions.h \
 /home/${USER}/projects/nxp/rtos-demo-3/Source/FreeRTOS_Source/portable/GCC/ARM_CM0/portmacro.h \
 /home/${USER}/projects/nxp/rtos-demo-3/Source/FreeRTOS_Source/include/mpu_wrappers.h \
 /home/${USER}/projects/nxp/rtos-demo-3/Source/FreeRTOS_Source/include/task.h \
 /home/${USER}/projects/nxp/rtos-demo-3/Source/FreeRTOS_Source/include/list.h

/home/${USER}/projects/nxp/rtos-demo-3/Source/FreeRTOS_Source/include/FreeRTOS.h:

/home/${USER}/projects/nxp/rtos-demo-3/Source/FreeRTOSConfig.h:

/home/${USER}/projects/nxp/rtos-demo-3/Source/FreeRTOS_Source/include/projdefs.h:

/home/${USER}/projects/nxp/rtos-demo-3/Source/FreeRTOS_Source/include/portable.h:

/home/${USER}/projects/nxp/rtos-demo-3/Source/FreeRTOS_Source/include/deprecated_definitions.h:

/home/${USER}/projects/nxp/rtos-demo-3/Source/FreeRTOS_Source/portable/GCC/ARM_CM0/portmacro.h:

/home/${USER}/projects/nxp/rtos-demo-3/Source/FreeRTOS_Source/include/mpu_wrappers.h:

/home/${USER}/projects/nxp/rtos-demo-3/Source/FreeRTOS_Source/include/task.h:

/home/${USER}/projects/nxp/rtos-demo-3/Source/FreeRTOS_Source/include/list.h:


What `make` first reports doing from within the LPCXpresso environment:

arm-none-eabi-gcc -D__REDLIB__ -DDEBUG -D__CODE_RED -D__USE_CMSIS=CMSISv2p00_LPC11xx -I"/home/${USER}/Downloads/freertos/FreeRTOSv10.0.1/FreeRTOS/Demo/CORTEX_M0_LPC1114_LPCXpresso/CMSISv2p00_LPC11xx/inc" -I"/home/${USER}/Downloads/freertos/tmp/FreeRTOSv10.0.1/FreeRTOS/Demo/CORTEX_M0_LPC1114_LPCXpresso/CMSISv2p00_LPC11xx/inc" -I"../../../Common/include" -I"/home/${USER}/projects/nxp/rtos-demo-3/Source/Common_Demo_Tasks/include" -I"/home/${USER}/projects/nxp/rtos-demo-3/Source" -I"/home/${USER}/projects/nxp/rtos-demo-3/Source/FreeRTOS_Source/include" -I"/home/${USER}/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"



- - - top of page - - -