Create project directory structure version 1

From Wiki at Neela Nurseries
Jump to: navigation, search

ARM processor notes  :  STM32F10x notes  :  LPCXpresso 1114  :  heap_1.c build recipe  :  LPCXpresso makefiles mapping


Overview

This article is most closely related to LPCXpresso 1114.

This article contains a few versions of a directory and file copying shell script, adapted from the FreeRTOS demo port project to LPCXpresso and the LPC1114 processor. The first version of this script worked for the initial project copying experiments, but quickly broke on second try due to hard-coded paths. Version two implements some variables which are still hard-coded in their assignment, but make for one point at which to adjust the source paths of the downloaded demo. This article likely to remain small and narrow in scope, part of the larger effort to learn LPCXpresso's toolchain and way of building projects, and how to move between GNU GCC `make` based projects and LPC based projects.

There are presently three versions of this script on the localhost where LPC 8p2p2 build studies take place. These versions are located in the following paths:

-rwxr--r-- 1 user user 4442 Jul 17 10:29 /home/${USER}/projects/nxp/rtos-demo-3--broken/create-project-directory-structure.sh
-rwxr--r-- 1 user user 4407 Jul 23 11:34 /home/${USER}/projects/nxp/rtos-demo-4/create-project-directory-structure.sh
-rwxr--r-- 1 user user 4458 Jul 26 13:11 /home/${USER}/projects/nxp/rtos-demo-5/create-project-directory-structure.sh

Versions of this script are very similar to one another, with mostly the addition of some comments echoed to the shell in which this script executes, plus some shell variables to better manage names of called utilities like `cp` and `ln` and to better manage long paths to files of the project.


^ Version 1

Figure 1 - create-project-directory-structure.sh

#!/bin/bash

# 2018-05-14 - Monday, started by Ted to carry out the work of DOS batch file included with NXP's RTOS demo . . .

MKDIR=/bin/mkdir
MKDIR_OPTIONS="-p -v"
COPY=/bin/cp
COPY_OPTIONS="-v"


echo "$0:  creating the required directory structure . . ."
${MKDIR} ${MKDIR_OPTIONS} Source/FreeRTOS_Source
${MKDIR} ${MKDIR_OPTIONS} Source/FreeRTOS_Source/include
${MKDIR} ${MKDIR_OPTIONS} Source/FreeRTOS_Source/portable
${MKDIR} ${MKDIR_OPTIONS} Source/FreeRTOS_Source/portable/GCC
${MKDIR} ${MKDIR_OPTIONS} Source/FreeRTOS_Source/portable/GCC/ARM_CM0
${MKDIR} ${MKDIR_OPTIONS} Source/FreeRTOS_Source/portable/MemMang
${MKDIR} ${MKDIR_OPTIONS} Source/Common_Demo_Tasks
${MKDIR} ${MKDIR_OPTIONS} Source/Common_Demo_Tasks/Include


echo "$0:  copying core FreeRTOS kernel files . . ."
${COPY} ${COPY_OPTIONS} ../../../Source/tasks.c Source/FreeRTOS_Source
${COPY} ${COPY_OPTIONS} ../../../Source/queue.c Source/FreeRTOS_Source
${COPY} ${COPY_OPTIONS} ../../../Source/list.c Source/FreeRTOS_Source
${COPY} ${COPY_OPTIONS} ../../../Source/timers.c Source/FreeRTOS_Source


echo "$0:  copying common header files . . ."
${COPY} ${COPY_OPTIONS} ../../../Source/include/*.* Source/FreeRTOS_Source/include

echo "$0:  copying portable layer files . . ."
${COPY} ${COPY_OPTIONS} ../../../Source/portable/GCC/ARM_CM0/*.* Source/FreeRTOS_Source/portable/GCC/ARM_CM0

echo "$0:  copying basic memory allocation files . . ."
${COPY} ${COPY_OPTIONS} ../../../Source/portable/MemMang/heap_1.c Source/FreeRTOS_Source/portable/MemMang


echo "$0:  copying files that define the common demo tasks . . ."
${COPY} ${COPY_OPTIONS} ../../Common/Minimal/blocktim.c Source/Common_Demo_Tasks
${COPY} ${COPY_OPTIONS} ../../Common/Minimal/recmutex.c Source/Common_Demo_Tasks
${COPY} ${COPY_OPTIONS} ../../Common/Minimal/countsem.c Source/Common_Demo_Tasks
${COPY} ${COPY_OPTIONS} ../../Common/Minimal/IntQueue.c Source/Common_Demo_Tasks


echo "$0:  copying common demo file headers . . .":
${COPY} ${COPY_OPTIONS} ../../Common/include/blocktim.h Source/Common_Demo_Tasks/include
${COPY} ${COPY_OPTIONS} ../../Common/include/recmutex.h Source/Common_Demo_Tasks/include
${COPY} ${COPY_OPTIONS} ../../Common/include/countsem.h Source/Common_Demo_Tasks/include
${COPY} ${COPY_OPTIONS} ../../Common/include/IntQueue.h Source/Common_Demo_Tasks/include



# ${MKDIR} ${MKDIR_OPTIONS}

echo "$0:  done."
echo


exit 0


^ Version 2

Version 2 of this script adds a couple variables to make source file paths more easy to adjust:

Figure 2 - create-project-directory-structure.sh

#!/bin/bash

# 2018-05-14 - Monday, started by Ted to carry out the work of DOS batch file included with NXP's RTOS demo . . .

MKDIR=/bin/mkdir
MKDIR_OPTIONS="-p -v"
COPY=/bin/cp
COPY_OPTIONS="-v"

// 2018-06-26 - Adding path elements that can change: 
PATH_TO_FREERTOS_SOURCE=${HOME}/Downloads/freertos/FreeRTOSv10.0.1/FreeRTOS
# PATH_TO_FREERTOS_COMMON_MINIMAL=${HOME}/Downloads/freertos/FreeRTOSv10.0.1/FreeRTOS/Demo/Common/Minimal
PATH_TO_FREERTOS_COMMON_MINIMAL=${PATH_TO_FREERTOS_SOURCE}/Demo/Common/Minimal
PATH_TO_FREERTOS_COMMON_INCLUDE=${PATH_TO_FREERTOS_SOURCE}/Demo/Common/include


echo "$0:  creating the required directory structure . . ."
${MKDIR} ${MKDIR_OPTIONS} Source/FreeRTOS_Source
${MKDIR} ${MKDIR_OPTIONS} Source/FreeRTOS_Source/include
${MKDIR} ${MKDIR_OPTIONS} Source/FreeRTOS_Source/portable
${MKDIR} ${MKDIR_OPTIONS} Source/FreeRTOS_Source/portable/GCC
${MKDIR} ${MKDIR_OPTIONS} Source/FreeRTOS_Source/portable/GCC/ARM_CM0
${MKDIR} ${MKDIR_OPTIONS} Source/FreeRTOS_Source/portable/MemMang
${MKDIR} ${MKDIR_OPTIONS} Source/Common_Demo_Tasks
${MKDIR} ${MKDIR_OPTIONS} Source/Common_Demo_Tasks/Include


echo "$0:  copying core FreeRTOS kernel files . . ."
# ${COPY} ${COPY_OPTIONS} ../../../Source/tasks.c Source/FreeRTOS_Source
# ${COPY} ${COPY_OPTIONS} ../../../Source/queue.c Source/FreeRTOS_Source
# ${COPY} ${COPY_OPTIONS} ../../../Source/list.c Source/FreeRTOS_Source
# ${COPY} ${COPY_OPTIONS} ../../../Source/timers.c Source/FreeRTOS_Source

${COPY} ${COPY_OPTIONS} ${PATH_TO_FREERTOS_SOURCE}/Source/tasks.c Source/FreeRTOS_Source
${COPY} ${COPY_OPTIONS} ${PATH_TO_FREERTOS_SOURCE}/Source/queue.c Source/FreeRTOS_Source
${COPY} ${COPY_OPTIONS} ${PATH_TO_FREERTOS_SOURCE}/Source/list.c Source/FreeRTOS_Source
${COPY} ${COPY_OPTIONS} ${PATH_TO_FREERTOS_SOURCE}/Source/timers.c Source/FreeRTOS_Source

echo "$0:  copying common header files . . ."
# ${COPY} ${COPY_OPTIONS} ../../../Source/include/*.* Source/FreeRTOS_Source/include
${COPY} ${COPY_OPTIONS} ${PATH_TO_FREERTOS_SOURCE}/Source/include/*.* Source/FreeRTOS_Source/include

echo "$0:  copying portable layer files . . ."
# ${COPY} ${COPY_OPTIONS} ../../../Source/portable/GCC/ARM_CM0/*.* Source/FreeRTOS_Source/portable/GCC/ARM_CM0
${COPY} ${COPY_OPTIONS} ${PATH_TO_FREERTOS_SOURCE}/Source/portable/GCC/ARM_CM0/*.* Source/FreeRTOS_Source/portable/GCC/ARM_CM0

echo "$0:  copying basic memory allocation files . . ."
# ${COPY} ${COPY_OPTIONS} ../../../Source/portable/MemMang/heap_1.c Source/FreeRTOS_Source/portable/MemMang
${COPY} ${COPY_OPTIONS} ${PATH_TO_FREERTOS_SOURCE}/Source/portable/MemMang/heap_1.c Source/FreeRTOS_Source/portable/MemMang


echo "$0:  copying files that define the common demo tasks . . ."
# ${COPY} ${COPY_OPTIONS} ../../Common/Minimal/blocktim.c Source/Common_Demo_Tasks
# ${COPY} ${COPY_OPTIONS} ../../Common/Minimal/recmutex.c Source/Common_Demo_Tasks
# ${COPY} ${COPY_OPTIONS} ../../Common/Minimal/countsem.c Source/Common_Demo_Tasks
# ${COPY} ${COPY_OPTIONS} ../../Common/Minimal/IntQueue.c Source/Common_Demo_Tasks

${COPY} ${COPY_OPTIONS} ${PATH_TO_FREERTOS_COMMON_MINIMAL}/blocktim.c Source/Common_Demo_Tasks
${COPY} ${COPY_OPTIONS} ${PATH_TO_FREERTOS_COMMON_MINIMAL}/recmutex.c Source/Common_Demo_Tasks
${COPY} ${COPY_OPTIONS} ${PATH_TO_FREERTOS_COMMON_MINIMAL}/countsem.c Source/Common_Demo_Tasks
${COPY} ${COPY_OPTIONS} ${PATH_TO_FREERTOS_COMMON_MINIMAL}/IntQueue.c Source/Common_Demo_Tasks


echo "$0:  copying common demo file headers . . .":
# ${COPY} ${COPY_OPTIONS} ../../Common/include/blocktim.h Source/Common_Demo_Tasks/include
# ${COPY} ${COPY_OPTIONS} ../../Common/include/recmutex.h Source/Common_Demo_Tasks/include
# ${COPY} ${COPY_OPTIONS} ../../Common/include/countsem.h Source/Common_Demo_Tasks/include
# ${COPY} ${COPY_OPTIONS} ../../Common/include/IntQueue.h Source/Common_Demo_Tasks/include

${COPY} ${COPY_OPTIONS} ${PATH_TO_FREERTOS_COMMON_INCLUDE}/blocktim.h Source/Common_Demo_Tasks/include
${COPY} ${COPY_OPTIONS} ${PATH_TO_FREERTOS_COMMON_INCLUDE}/recmutex.h Source/Common_Demo_Tasks/include
${COPY} ${COPY_OPTIONS} ${PATH_TO_FREERTOS_COMMON_INCLUDE}/countsem.h Source/Common_Demo_Tasks/include
${COPY} ${COPY_OPTIONS} ${PATH_TO_FREERTOS_COMMON_INCLUDE}/IntQueue.h Source/Common_Demo_Tasks/include


# ${MKDIR} ${MKDIR_OPTIONS}

echo "$0:  done."
echo


exit 0


^ Version 3

Version 3 not yet posted, but includes some improved messages including an early project identifier, to name to what the directory and file copying is related . . .



- - - top of page - - -