Difference between revisions of "LPCXpresso"

From Wiki at Neela Nurseries
Jump to: navigation, search
m
m (^ A2D configuration)
 
(57 intermediate revisions by the same user not shown)
Line 25: Line 25:
 
   $ lpc21isp -bin ./RTOSDemo.bin /dev/ttyUSB0 9600 8000000
 
   $ lpc21isp -bin ./RTOSDemo.bin /dev/ttyUSB0 9600 8000000
 
</pre>
 
</pre>
 +
 +
 +
Per following NXP forum post it looks like LPC1114 internal oscillator runs at 12MHz +/-1% . . .
 +
 +
*  https://community.nxp.com/thread/427297
  
  
Line 120: Line 125:
 
== [[#top|^]] Talking With and Programming LPC1114 Dev Board ==
 
== [[#top|^]] Talking With and Programming LPC1114 Dev Board ==
  
Powering down, grounding pins P0.1 and P0.3, then powering up, ungrounding both those pins and issuing part signature read command:
+
This article section talks about two pins on the LPC1114 LPC1343 dev board which need be pulled low to put the target chip into programming mode.  This article section also talks about the Unix and Linux based command line utility `lpc21isp` which can communitcate serially with the target MCU, and also has a not-very-documented terminal mode, for receiving and sending bytes over the same serial lines once firmware is running on the MCU.
 +
 +
To begin we power down the dev board, ground pins P0.1 and P0.3, then power up and and issue part signature read command:
 +
 
 
<pre>
 
<pre>
$ sudo lpc21isp -detectonly /dev/ttyUSB0 9600 12000
+
$ lpc21isp -detectonly /dev/ttyUSB0 9600 12000
 
lpc21isp version 1.97
 
lpc21isp version 1.97
 
Synchronizing (ESC to abort). OK
 
Synchronizing (ESC to abort). OK
Line 136: Line 144:
  
 
<pre>
 
<pre>
$ sudo lpc21isp -bin ./RTOSDemo.bin /dev/ttyUSB0 9600 8000000
+
$ lpc21isp -bin ./RTOSDemo.bin /dev/ttyUSB0 9600 8000000
 
lpc21isp version 1.97
 
lpc21isp version 1.97
 
File ./RTOSDemo.bin:
 
File ./RTOSDemo.bin:
Line 158: Line 166:
  
  
<!-- comment -->
+
In searching for information about lpc21isp's terminal mode we find:
== - - - - - &nbsp; - - - - - &nbsp; - - - - - &nbsp; - - - - - &nbsp; - - - - - &nbsp; - - - - - &nbsp; - - - - - &nbsp; - - - - - &nbsp; - - - - - &nbsp; - - - - - &nbsp; - - - - - &nbsp; - - - - - &nbsp; - - - - - &nbsp; - - - - - &nbsp; - - - - - &nbsp; - - - - - &nbsp; - - - - - ==
+
 
<font color="white">.</font><br />
+
*  https://www.embeddedrelated.com/showthread/lpc2000/36858-1.php
  
== [[#top|^]] Demos and Appplications ==
 
  
 
<!-- comment -->
 
<!-- comment -->
  
== [[#top|^]] I2C References And Notes ==
+
== [[#top|^]] General Programming Connections Using SWCLK SWDIO and ISP ==
  
*  https://learn.sparkfun.com/tutorials/i2c
+
Is it possible to use an FTDI cable or similar to program an LPC11xx microcontroller in circuit, whose SWCLK, SWDIO, RESET and ISP pins are available? On Google performing search "LPC1114 program using ISP SWDIO pins" . . .
*  http://www.ti.com/lit/an/slva704/slva704.pdf
 
* http://i2c.info/i2c-bus-specification  . . . i2c START and STOP conditions explained
 
  
Looking for 'ACK' signal specification in i2c context . . .
+
<ul>
*  https://www.nxp.com/docs/en/user-guide/UM10204.pdf
+
*  https://community.nxp.com/thread/424744<br />
  
ACK_ERROR occurs in routine I2c_WriteByte(), which in turn calls I2C_WriteBit() with a value and a timeout valueThe timeout value is assigned in main.c:
+
Mbed looked good at first but compiling only allowed on Mbed cloud servers, so internet connection always required:
 +
*  https://os.mbed.com/platforms/mbed-LPC1768/<br />
 +
* https://os.mbed.com/handbook/Firmware-LPC1768-LPC11U24  . . . mbed firmware updates<br />
  
  ./main.c:64:    SCD30_Init(0x61, 10); // SCD30 listens on address 0x61 with 10ms I2c timeout
+
Here a reference to NXP manual UM10398:
 +
*  https://community.nxp.com/thread/426207<br />
 +
</ul>
  
Sensirion I2C and USART capable sensor:
 
*  https://cdn.sos.sk/productdata/45/79/f68c98fa/scd30-1.pdf
 
  
*  https://www.i2c-bus.org/addressing/general-call-address/ i2c broadcast address is zero (0)
+
<!-- comment -->
  
 +
== - - - - - &nbsp; - - - - - &nbsp; - - - - - &nbsp; - - - - - &nbsp; - - - - - &nbsp; - - - - - &nbsp; - - - - - &nbsp; - - - - - &nbsp; - - - - - &nbsp; - - - - - &nbsp; - - - - - &nbsp; - - - - - &nbsp; - - - - - &nbsp; - - - - - &nbsp; - - - - - &nbsp; - - - - - &nbsp; - - - - - ==
 +
<font color="white">.</font><br />
  
<!-- comment -->
+
== [[#top|^]] LPCXPRESSO C/C++ DEVELOPMENT TOOLKIT [CDT] ==
  
== [[#top|^]] LPCXpresso 1114 board and FreeRTOS ==
+
=== [[#top|^]] Views and Perspectives ===
  
In order to get started with the FreeRTOS port demo project to the LPC1114 board, a batch file (or shell script) need be run to create a particular directory structure and copy files into some project-expected places.  There is mention on the ported NXP project page on FreeRTOS site that LPCXpresso IDE can provide makefile based projects, and "managed make" projects. The managed make projects require all sources on which a given project depends to be located within given project's top level directory.
+
Found in 'Help - LPCXpresso IDE User Guide' . . .
  
There is mention of a batch file which on our Linux box appears to be <code>~/Downloads/freertos/FreeRTOSv10.0.1/FreeRTOS/Demo/CORTEX_M0_LPC1114_LPCXpresso/RTOSDemo/CreateProjectDirectoryStructure.bat</code>.
+
<i>
 +
<p>
 +
"Views in the C/C++ perspective
 +
</p>
  
*  https://www.freertos.org/FreeRTOS-for-Cortex-M0-LPC1114-LPCXpresso.html
+
<p>
**  https://www.freertos.org/a00017.html  . . . FreeRTOS source code organization, this link noted elsewhere on wiki
+
The C/C++ views are panels that help you perform the tasks involved in creating C/C++ programs. The C/C++ perspective displays these panels in a single Eclipse window.
 +
</p>
 +
 
 +
<p>
 +
Changing Views:<br />
 +
You can add views to a perspective. From the menu bar choose Window > Show View > Other and select a new view from the Show View dialog.<br />
 +
To reset the current perspective to its original layout, from the menu bar choose Window > Reset Perspective."
 +
</p>
 +
</i>
  
  
Getting close but having trouble setting up and fully compiling LPC1114 FreeRTOS demo . . . build fails for not finding header file IntQueue.h, as included by file IntQueue.c in the same directory:
+
<ul>
 +
<li> https://www.mouser.com/pdfdocs/LPCXpresso_IDE_User_Guide.pdf . . . CMSIS defined page 21<br />
 +
</ul>
  
<pre>
 
user@localhost:~/LPCXpresso/workspace$ ls -l ./FreeRTOS/Demo/CORTEX_M0_LPC1114_LPCXpresso/RTOSDemo/Source
 
total 84
 
drwxr-xr-x 3 user user  4096 May 14 13:07 Common_Demo_Tasks
 
-rw-r--r-- 1 user user  4364 May 14 13:12 FreeRTOSConfig.h
 
drwxr-xr-x 4 user user  4096 May 14 12:22 FreeRTOS_Source
 
-rw-r--r-- 1 user user  3587 Dec 18 14:36 IntQueueTimer.c
 
-rw-r--r-- 1 user user  1496 Dec 18 14:36 IntQueueTimer.h
 
-rw-r--r-- 1 user user  5925 Dec 18 14:36 RegTest.c
 
-rw-r--r-- 1 user user 16008 Nov 16  2016 cr_startup_lpc11.c
 
-rw-r--r-- 1 user user  8416 Dec 18 14:36 main-blinky.c
 
-rw-r--r-- 1 user user 11663 Dec 18 14:36 main-full.c
 
-rw-r--r-- 1 user user 10694 Dec 18 14:36 main.c
 
  
user@localhost:~/LPCXpresso/workspace$
+
<!-- comment -->
</pre>
 
  
 +
== - - - - - &nbsp; - - - - - &nbsp; - - - - - &nbsp; - - - - - &nbsp; - - - - - &nbsp; - - - - - &nbsp; - - - - - &nbsp; - - - - - &nbsp; - - - - - &nbsp; - - - - - &nbsp; - - - - - &nbsp; - - - - - &nbsp; - - - - - &nbsp; - - - - - &nbsp; - - - - - &nbsp; - - - - - &nbsp; - - - - - ==
 +
<font color="white">.</font><br />
  
[[media:linked-resources.png|LPCXpresso project linked resources]]
+
== [[#top|^]] DEMOS AND APPLICATIONS ==
  
...Trouble uploading screen capture in .PNG format! MediaWiki error message:
+
This section of LPCExpresso wiki article dedicated to notes and references on various LPC1114 and related code topics and projects. As of 2018-11-02 Friday microcontroller and uC peripheral topics include #I2C, #PWM and #FreeRTOS.  Over time more topics will be added here.  The topic on #FreeRTOS includes a lot of subsections, which partially detail wiki contributor Ted's efforts to port the LPCXpresso FreeRTOS demo to the command lined based GCC toolchain as run under a cerca 2017 stable Debian release. In this effort Ted got as far as compiling the sources, but the "Xpresso to GCC port" version fails at an assembly stage, which arm-none-eabi-as complaining that it "cannot honor width suffix". This error may be misleading, as in the case where the format of assembly code may be for a different assembler from a different toolchain.  Have yet to resolve this question . . - TMH
  
"
+
A few places which may be good startig points, pick-up-again points include these following pages.  These mention that the issue may be one of a compiler generating thumb or thumb1 type assembly code, when the assembler then expects non-thumb assembly code:
Action failed
+
<ul>
 +
<li> https://reviews.llvm.org/D15707<br />
 +
<li> https://github.com/ARMmbed/mbed-cli/issues/554<br />
 +
<li> https://answers.launchpad.net/gcc-arm-embedded/+question/255448<br />
 +
</ul>
  
Could not open lock file for "mwstore://local-backend/local-public/3/33/Linked-resources.png".
 
  
Return to Main Page.
+
<!-- comment -->
"
 
  
Textual data from screen whose image capture failed to upload:
+
=== [[#top|^]] I2C References And Notes ===
  
<pre>
+
* https://learn.sparkfun.com/tutorials/i2c
# Properties for RTOSDemo
+
*  http://www.ti.com/lit/an/slva704/slva704.pdf  . . . Good I2C reference from TI Texas Instruments, eight (8) pages length
# v Resource
+
*  http://i2c.info/i2c-bus-specification  . . . i2c START and STOP conditions explained
#        Linked Resource     
+
- 2018-11-19 Monday -
# Path Variables
+
*  https://www.nxp.com/docs/en/application-note/AN4803.pdf  . . . different processor MC56F827xx but useful notes
#
 
# ECLIPSE_HOME    /opt/nxp/lpcxpresso-8p2p2/lpcxpresso/
 
# PARENT_LOC      /home/user/LPCXpresso/workspace
 
# PROJECT_LOC      /home/user/Downloads/freertos/FreeRTOSv10.0.1/FreeRTOS/Demo/CORTEX_M0_LPC1114_LPCXpresso/RTOSDemo
 
# WORKSPACE_LOC    /home/user/LPCXpresso/workspace
 
</pre>
 
  
  
ISSUE - case insensitive Windows filename of needed header file needs attention, symbolic linking one fix:
+
Looking for 'ACK' signal specification in i2c context . . .
 +
*  https://www.nxp.com/docs/en/user-guide/UM10204.pdf
  
* https://community.nxp.com/thread/420898
+
ACK_ERROR occurs in routine I2c_WriteByte(), which in turn calls I2C_WriteBit() with a value and a timeout value. The timeout value is assigned in main.c:
  
 +
  ./main.c:64:    SCD30_Init(0x61, 10); // SCD30 listens on address 0x61 with 10ms I2c timeout
  
<!-- comment -->
+
Sensirion I2C and USART capable sensor:
 +
*  https://cdn.sos.sk/productdata/45/79/f68c98fa/scd30-1.pdf
  
<!--
+
* https://www.i2c-bus.org/addressing/general-call-address/ i2c broadcast address is zero (0)
== - - - - -  - - - - -  - - - - - - - - - -  - - - - -  - - - - -  - - - - -  - - - - -  - - - - -  - - - - - ==
 
-->
 
  
  
<!-- comment -->
+
2018-11-08 Thursday
  
== [[#top|^]] Copying FreeRTOS Demo Project To Begin New Project ==
+
Looking for demo code to show I2C functionality using an LPC1114 micro:
  
- 2018-06-13 TUE -<br />
+
~/Downloads/nxp/lpcopen$ grep -nr <font color="red">BOARD_NXP_XPRESSO_</font> ./*
Today's goal is to copy the FreeRTOS demo which runs on an LPCXpresso development board, and to bring this copy of the project up as a second or additional project in LPC IDE's workspaceFrom here then next step is to add one-way then bidirectional UART communications to the project.
+
./nxp_lpcxpresso_11u14_board_lib/inc/board.h:42:/** @defgroup <font color="red">BOARD_NXP_XPRESSO_</font>11U14 NXP LPC11U14 LPCXpresso board support software API functions
 +
./nxp_lpcxpresso_11u14_board_lib/inc/board.h:50:/** @defgroup <font color="red">BOARD_NXP_XPRESSO_</font>11U14_OPTIONS BOARD: NXP LPC11U14 LPCXpresso board build options
 +
./nxp_lpcxpresso_11u14_board_lib/inc/board.h:78:#define <font color="red">BOARD_NXP_XPRESSO_</font>11U14
 +
./nxp_lpcxpresso_11u14_periph_adc/example/src/adc_11xx.c:53:#if (defined(<font color="red">BOARD_NXP_XPRESSO_</font>11U14) || defined(BOARD_NGX_BLUEBOARD_11U24))
 +
  ./nxp_lpcxpresso_11u14_periph_adc/example/src/adc_11xx.c:55:#elif defined(<font color="red">BOARD_NXP_XPRESSO_</font>11C24)
 +
./nxp_lpcxpresso_11u14_periph_clkout/example/src/clkout.c:51:#if (defined(<font color="red">BOARD_NXP_XPRESSO_</font>11U14) || defined(BOARD_NGX_BLUEBOARD_11U24))
 +
./nxp_lpcxpresso_11u14_periph_clkout/example/src/clkout.c:54:#elif defined(<font color="red">BOARD_NXP_XPRESSO_</font>11C24)
 +
./nxp_lpcxpresso_11u14_periph_i2c/example/src/i2c.c:95:#if (defined(<font color="red">BOARD_NXP_XPRESSO_</font>11U14) || defined(BOARD_NGX_BLUEBOARD_11U24))
 +
./nxp_lpcxpresso_11u14_periph_i2c/example/src/i2c.c:99:#elif (defined(<font color="red">BOARD_NXP_XPRESSO_</font>11C24) || defined(BOARD_MCORE48_1125))
 +
./nxp_lpcxpresso_11u14_periph_pinint/example/src/pinint.c:38:#if defined (<font color="red">BOARD_NXP_XPRESSO_</font>11U14)
 +
./nxp_lpcxpresso_11u14_periph_pinint/example/src/pinint.c:45:#endif /* defined (<font color="red">BOARD_NXP_XPRESSO_</font>11U14) */
 +
./nxp_lpcxpresso_11u14_periph_pinint/example/src/pinint.c:47:#if defined (<font color="red">BOARD_NXP_XPRESSO_</font>11C24)
 +
./nxp_lpcxpresso_11u14_periph_pinint/example/src/pinint.c:54:#endif /* defined (<font color="red">BOARD_NXP_XPRESSO_</font>11C24) */
 +
./nxp_lpcxpresso_11u14_periph_pinint/example/src/pinint.c:109:#if defined (<font color="red">BOARD_NXP_XPRESSO_</font>11U14)
 +
./nxp_lpcxpresso_11u14_periph_pinint/example/src/pinint.c:128:#if defined (<font color="red">BOARD_NXP_XPRESSO_</font>11C24)
 +
./nxp_lpcxpresso_11u14_periph_pinint/example/src/pinint.c:153:#if defined (<font color="red">BOARD_NXP_XPRESSO_</font>11C24)
 +
./nxp_lpcxpresso_11u14_periph_ssp/example/src/ssp.c:76:#if (defined(<font color="red">BOARD_NXP_XPRESSO_</font>11U14) || defined(BOARD_NGX_BLUEBOARD_11U24))
 +
./nxp_lpcxpresso_11u14_periph_ssp/example/src/ssp.c:82:#elif defined(<font color="red">BOARD_NXP_XPRESSO_</font>11C24)
 +
./nxp_lpcxpresso_11u14_periph_uart/example/src/uart.c:63:#if (defined(<font color="red">BOARD_NXP_XPRESSO_</font>11U14) || defined(BOARD_NGX_BLUEBOARD_11U24))
 +
./nxp_lpcxpresso_11u14_periph_uart/example/src/uart.c:66:#elif (defined(<font color="red">BOARD_NXP_XPRESSO_</font>11C24) || defined(BOARD_MCORE48_1125))
 +
./nxp_lpcxpresso_11u14_usbd_lib_cdc_uart/example/src/cdc_uart.c:81:#if (defined(<font color="red">BOARD_NXP_XPRESSO_</font>11U14) || defined(BOARD_NGX_BLUEBOARD_11U24))
  
A separate second goal is to craft a GNU makefile to build this same demo project.
+
Looks like line 78 is the key line above, in file named <code>board.h</code>.
  
Looking at project properties by means of right clicking the top level folder in LPCXpresso's project navigation pane, the project's location on the file system is:
+
=== [[#top|^]] missing clock signal in AP I2C code output ===
  
 +
2018-11-20 TUE - So we have an issue where, initially it looked like there was no I2C clock signal on SCL, and no data signal, just a brief blip on SCL.  This was Last Friday evening, and Monday.  Now Tuesday we see a normal pulse train of nine low-to-high-to-low clock transitions.  These occur in just under 200 microseconds.  Prior to this there is an I2C start condition, where SDA goes high to low followed by SCL going high to low.  Then both SCL and SDA are low for about 13 milliseconds, a very long time!  After 13 milliseconds SCL begins its train pulse. After the second high to low SCL, the data line SDA goes high four the next four clock pulses, then low for a pulse then high.
  
  localhost:/home/${USER}/Downloads/freertos/FreeRTOSv10.0.1/FreeRTOS/Demo/CORTEX_M0_LPC1114_LPCXpresso/RTOSDemo
+
QUESTION 3: why takes SCL so long to start its pulse train after the I2C start condition appears?
  
  
This path also matches the result we get when searching for a unique-to-project port header file named IntQueue.h, invoking `locate IntQueue.h | grep 1114`The path is a directory longer due to the location of this header file in the port's dir structure, but the narrowed search result path agrees with the path shown in LPC's project location.
+
<pre>
 +
-- mark 1 -- 1 -  
 +
milliamp PWM at percent duty cycle of:  0x38
 +
sending I2C message to SCD30 sensor asking for serial number . . .
 +
io_i2c.c:  StartNewJob() executing,
 +
io_i2c.c:  ISR_State_SendCommand() called,
 +
io_i2c.c: ISR_State_ReadString() called,
 +
status of I2C read command to query sensor for serial number: 00 00 00 00
 +
io_i2c.c:  I2C_Stop() called,
 +
io_i2c.c:  StartNewJob() executing,
 +
back from sending I2C command, scd30_buffer holds:
 +
</pre>
  
The readily visible, top level contents of this directory are:
 
  
  ~/Downloads/freertos/FreeRTOSv10.0.1/FreeRTOS/Demo/CORTEX_M0_LPC1114_LPCXpresso/RTOSDemo$ ls
+
2018-11-21 WED
  CreateProjectDirectoryStructure.bat  Source
 
  Debug                                create-project-directory-structure.sh
 
  
There are a couple of hidden project files here, created and or used by LPCXpresso:
+
Hi,
  
  $ ls -a
+
Regarding my I2C trouble-shooting, I observed a normal clock signal on SCL starting yesterday, but there are some unexpected delays on the order of 12 or 13 milliseconds. There is also almost no dataOnly one byte of data observed as a train of nine clock pulses at about 25 microseconds per pulse occur. Specifically what appears to be happening is a valid I2C start condition, where SDA goes low and SCL follows likewise going low within a few microseconds. Then both SCL and SDA are low for about 13 milliseconds, then a single byte worth of clocking and data. SDA then returns to highSCL stays low for about 37 milliseconds longer. Except for nine clock pulses on SCL that clock line is low for about 52 milliseconds in total after each call to IO_I2C_SendCommand()Nothing else happening on the I2C lines.
  .   .cproject .settings                            Debug  create-project-directory-structure.sh
 
  ..  .project  CreateProjectDirectoryStructure.bat Source
 
  
<i><b>Note:</b> &nbsp;in the LPCXpresso managed product directory there are hidden files named .cproject and .project . . .</i>
+
Prior to sending any commands my code calls IO_I2C_Reset(). Any ideas what would cause this initial delay before SCL clock pulses, and the longer "SCL low" time afterward?
  
Both files .cproject and .project are XML files.  The file .cproject is longer among these two files and includes details of the compiler used in a given project, plus options passed to this compiler, plus at least one project include path.  The file named .project contains in the first few lines a line expressing the project name as LPCXpresso IDE knows itThis project name must be unique among projects imported to a given LPCXpresso workspaceThis workspace on Unix and Linux-like systems defaults to the directory ${HOME}/LPCXpresso.
+
Your code project uses the I2C hardware module in the LPC1114, so that you need not bit bang things like the shifting of bytes into bits, and the toggling of SCL to create needed clock signals on the I2C busTo the I2C part of your project I am able to make a comparison with a demo program I adapted a few months back, a demo in which there is a bit-banged single master implemented I2C driverIn that driver I see that in order for the demo to read back a string of bytes from a sensor, it calls the following routines by their names in the demo:
  
The make dir and copying commands which can be invoked after creating project directory structure is:
+
  error = SCD30_StartWriteAccess();
 +
  error = SCD30_WriteCommand(CMD_READ_SERIALNBR);
 +
  SCD30_StopAccess();
 +
  error = SCD30_StartReadAccess();
 +
  SCD30_StopAccess();
  
  $ mkdir -pv ~/projects/nxp/rtos-demo-4
+
I notice that your project's ISR_State_SendCommand() routine supports I2C write, read and ping type commands.  So is my understanding and code use correct, that my client code may call IO_I2C_SendCommand() with a buffer containing the command for the slave device?  Ahh but wait, I only get one pointer to character (or uint8_t) buffer in this routine's parameter list.  So in calling IO_I2C_SendCommand() how can I read back data from an I2C slave device?  I think I'm missing a basic understanding of how to use your I2C driver . . .
  $ cp -prv ./* ./.[cp]* ~/projects/nxp/rtos-demo-4
 
  
 +
- Ted
  
  
 +
=== [[#top|^]] SCD30 data and CRC bytes three at a time ===
  
The name of the project we're attempting to copy and start as a new and editable project is 'RTOSDemo', a patterm which appears several times in file .cproject:
 
  
<i>Figure x -</i>
+
Bit-banged routine from Sensirion to read n bytes from sensor, reads them three at a time:
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
 
$ grep -n RTOSDemo ../.cproject
 
&nbsp;
 
<font color="green">23</font><font color="cyan">:</font> <builder arguments="-r" buildPath="${workspace_loc<font color="cyan">:</font>/<font color="red">RTOSDemo</font>/Debug}" command="make" id="com.crt.advproject.builder.exe.debug.1260101970" keepEnvironmentInBuildfile="true" managedBuildOn="true" name="Gnu Make Builder" superClass="com.crt.advproject.builder.exe.debug"/>
 
<font color="green">40</font><font color="cyan">:</font> <listOptionValue builtIn="false" value="&quot;${workspace_loc<font color="cyan">:</font>/FreeRTOS/Demo/CORTEX_M0_LPC1114_LPCXpresso/<font color="red">RTOSDemo</font>/Source}&quot;"/>
 
<font color="green">61</font><font color="cyan">:</font> <option id="com.crt.advproject.link.script.1758870530" name="Linker script" superClass="com.crt.advproject.link.script" value="&quot;<font color="red">RTOSDemo</font>_Debug.ld&quot;" valueType="string"/>
 
<font color="green">118</font><font color="cyan">:</font> <builder buildPath="${workspace_loc<font color="cyan">:</font>/<font color="red">RTOSDemo</font>/Release}" id="com.crt.advproject.builder.exe.release.1281961847" keepEnvironmentInBuildfile="false" managedBuildOn="true" name="Gnu Make Builder" superClass="com.crt.advproject.builder.exe.release"/>
 
<font color="green">149</font><font color="cyan">:</font> <option id="com.crt.advproject.link.script.1856833348" name="Linker script" superClass="com.crt.advproject.link.script" value="&quot;<font color="red">RTOSDemo</font>_Release.ld&quot;" valueType="string"/>
 
<font color="green">182</font><font color="cyan">:</font> <project id="<font color="red">RTOSDemo</font>.com.crt.advproject.projecttype.exe.777175218" name="Executable" projectType="com.crt.advproject.projecttype.exe"/>
 
<font color="green">343</font><font color="cyan">:</font> <resource resourceType="PROJECT" workspacePath="/<font color="red">RTOSDemo</font>"/>
 
<font color="green">346</font><font color="cyan">:</font> <resource resourceType="PROJECT" workspacePath="/<font color="red">RTOSDemo</font>"/>
 
&nbsp;
 
$
 
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
 
  
Unfortunately the LPC1114 FreeRTOS demo project name is used in two or three different ways in the file named .cproject.  Most of the time it is used as the project's name, but a couple of times this text pattern appears in the filenames of linker scripts.  In another instance it's part of a host system directory path to the project.  The places where pattern 'RTOSDemo' most closely relates to LPCXpresso project are where it appears on lines which refer to ${workspace_loc}. Given this it looks like we want to change the project name RTOSDemo to a new project name on lines 23, 118, 343 and 346, where this name stands for a project name, rather than part of a path or part of a linker script filename.
+
<pre>
 +
etError SCD30_ReadAndRemoveCrc(u8t data[], u32t noOfBytesToRead)^M
 +
{^M
 +
  etError error = NO_ERROR; // error code^M
 +
  u16t word;^M
 +
  u32t byteCounter = 0;^M
 +
  u32t writeIndex = 0;^M
 +
  noOfBytesToRead = (noOfBytesToRead+1)/2*3; // must be multiple of two plus one byte crc per word^M
 +
  ^M
 +
  ^M
 +
  while(byteCounter<noOfBytesToRead)^M
 +
  {^M
 +
    if (byteCounter <noOfBytesToRead-3) ^M
 +
      error = SCD30_Read2BytesAndCrc(&word, ACK, _timeoutI2c);^M
 +
    else^M  
 +
      error = SCD30_Read2BytesAndCrc(&word,NACK, _timeoutI2c); // send nack for last byte^M
 +
    ^M
 +
    data[writeIndex++] = (u8t)((word >> 8) & 0x00FF);^M
 +
    data[writeIndex++] = (u8t)(word & 0x00FF);^M
 +
  ^M
 +
    byteCounter += 3;^M
 +
  }^M
 +
  ^M
 +
  return error;^M
 +
}
 +
</pre>
  
 +
The routine to read two bytes and a single byte CRC is implemented this way:
  
<!-- <span style="id:background-light-green; background-color: #b2f9ba">zztop</span> -->
+
<pre>
<span style="background-color: #bcd6ff"> <br />QUESTION:  to what does the pattern <i>RTOSDemo.com.crt.advproject.projecttype.exe.777175218</i> refer?  Is this a reference to or name of an executable file?  Or exe file plus project configuration? - TMH<br /> <br /> </span>
+
static etError SCD30_Read2BytesAndCrc(u16t* data, etI2cAck finaleAckNack,^M
 +
                                      u8t timeout)^M
 +
{^M
 +
  etError error;    // error code^M
 +
  u8t    bytes[2]; // read data array^M
 +
  u8t    checksum; // checksum byte^M
 +
^M
 +
  // read two data bytes and one checksum byte^M
 +
                        error = I2c_ReadByte(&bytes[0], ACK, timeout);^M
 +
  if(error == NO_ERROR) error = I2c_ReadByte(&bytes[1], ACK, timeout);^M
 +
  if(error == NO_ERROR) error = I2c_ReadByte(&checksum, finaleAckNack, timeout);^M
 +
  ^M
 +
  // verify checksum^M
 +
  if(error == NO_ERROR) error = SCD30_CheckCrc(bytes, 2, checksum);^M
 +
  ^M
 +
  // combine the two bytes to a 16-bit value^M
 +
  *data = (bytes[0] << 8) | bytes[1];^M
 +
  ^M
 +
  return error;^M
 +
}
 +
</pre>
  
 +
The routine <i>SCD30_Read2BytesAndCrc()</i> in turn reads one byte at a time by calling the following routine:
 +
 +
<pre>
 +
etError I2c_ReadByte(u8t* byte, etI2cAck ack, u32t timeout)^M
 +
{^M
 +
  etError error = NO_ERROR;^M
 +
  u8t mask;^M
 +
  u8t bit;^M
 +
  *byte = 0;^M
 +
  ^M
 +
  for (mask = 0; mask < 8; mask++) ^M
 +
  {^M
 +
    error = I2c_ReadBit(&bit, timeout);^M
 +
    if (error != NO_ERROR)^M
 +
      break;^M
 +
    ^M
 +
    *byte =  *byte | (bit << (7-mask));^M
 +
  }^M
 +
  error = I2c_WriteBit(ack == NACK, timeout);^M
 +
^M
 +
  return error;^M
 +
}
 +
</pre>
  
LPCXpresso file .project contains two references to the pattern RTOSDemo:
 
  
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
+
<!-- comment -->
<span style="background-color: #363e45">
 
$ grep -n RTOSDemo ../.project
 
<font color="green">3</font><font color="cyan">:</font> <name><font color="red">RTOSDemo</font></name>
 
<font color="green">35</font><font color="cyan">:</font> <value>${workspace_loc<font color="cyan">:</font>/<font color="red">RTOSDemo</font>/Debug}</value>
 
</span>
 
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
 
  
 +
=== [[#top|^]] SCD30 article code ===
  
<!-- comment -->
+
*  https://os.mbed.com/users/loopsva/code/scd30/file/24bb922e179c/scd30.cpp/
 +
*  https://os.mbed.com/users/loopsva/code/scd30/file/24bb922e179c/scd30.h/
  
=== [[#top|^]] <i>edit point - create directory structure script</i> ===
+
<pre>
 +
#define SCD30_I2C_ADDR                  0xc2
  
A file worth noting here is a shell script which Ted adapted from a DOS batch file which ships with the RTOS demo.  The original batch file and the adapted shell script create a directory structure and copy FreeRTOS header and source files to these directories, placing all sources in the local copy of the project.  While the following script does the copying job for a project in one particular path relative to the FreeRTOS download path, Ted amended this script further to put relative source path elements into variables.  This makes the script more adjustable to be executed in different locations.  As of 2018-07-09 Monday that improved script not posted here on this wiki article yet . . .
+
#define SCD30_CMMD_STRT_CONT_MEAS      0x0010
 +
#define SCD30_CMMD_STOP_CONT_MEAS      0x0104
 +
#define SCD30_CMMD_SET_MEAS_INTVL      0x4600
 +
#define SCD30_CMMD_GET_READY_STAT      0x0202
 +
#define SCD30_CMMD_READ_MEAS            0x0300
 +
#define SCD30_CMMD_D_A_SELF_CALIB      0x5306
 +
#define SCD30_CMMD_FORCE_CALIB_VAL      0x5204
 +
#define SCD30_CMMD_SET_TEMP_OFFS        0x5403
 +
#define SCD30_CMMD_SET_ALT_COMP        0x5102
 +
#define SCD30_CMMD_SOFT_RESET          0xd304
  
*  [[create_project_directory_structure__version_1|Script create project directory structure, version 1]]
+
#define SCD30_CMMD_READ_SERIALNBR      0xD033
 +
#define SCD30_CMMD_READ_ARTICLECODE    0xD025
 +
#define SCD30_CMMD_START_SINGLE_MEAS    0x0006
 +
   
 +
#define SCD30_POLYNOMIAL                0x131  // P(x) = x^8 + x^5 + x^4 + 1 = 100110001
 +
#define SCD30_CRC_INIT                  0xff
  
*  [[create_project_directory_structure__version_1#script_version_2|Script create project directory structure, version 2]]
+
#define SCD30_SN_SIZE                  33      //size of the s/n ascii string + CRC values
 +
</pre>
  
<i><b>2018-07-13 NOTE:</b>  with one or both versions of this script there may be an error where IntQueue.h and three other FreeRTOS header files do not get copied to the new local project instance.  It may be necessary until a fix found to manually copy these files as follows:
 
<ul>
 
$ cp -p blocktim.h recmutex.h countsem.h IntQueue.h /home/user/projects/nxp/rtos-demo-4/Source/Common_Demo_Tasks/Include
 
</ul>
 
</i>
 
  
 +
Alright couple things to check 2018-12-14:  make sure I2C_Stop() is getting called, and review and follow to code the comment block in I2C source file lines 307..310 in original code.  This is a comment above and to describe the void i2c-stop(void) function . . .
  
Before and after running `make clean` from the IDE:
 
  
<i>Figure x - FreeRTOS demo directories and size of build time files:</i>
 
  
<pre>
+
<!-- comment -->
$ du -k .
+
 
280 ./Debug/Source/Common_Demo_Tasks
+
 
68 ./Debug/Source/FreeRTOS_Source/portable/GCC/ARM_CM0
 
72 ./Debug/Source/FreeRTOS_Source/portable/GCC
 
64 ./Debug/Source/FreeRTOS_Source/portable/MemMang
 
140 ./Debug/Source/FreeRTOS_Source/portable
 
472 ./Debug/Source/FreeRTOS_Source
 
1112 ./Debug/Source
 
1408 ./Debug
 
4 ./Source/Common_Demo_Tasks/Include
 
88 ./Source/Common_Demo_Tasks
 
28 ./Source/FreeRTOS_Source/portable/GCC/ARM_CM0
 
32 ./Source/FreeRTOS_Source/portable/GCC
 
12 ./Source/FreeRTOS_Source/portable/MemMang
 
48 ./Source/FreeRTOS_Source/portable
 
540 ./Source/FreeRTOS_Source/include
 
900 ./Source/FreeRTOS_Source
 
1068 ./Source
 
8 ./.settings
 
2548 .
 
  
$ du -k .
+
- - - - - &nbsp; - - - - - &nbsp; - - - - - &nbsp; - - - - - &nbsp; - - - - - &nbsp; - - - - - &nbsp; - - - - - &nbsp; - - - - - &nbsp; - - - - - &nbsp; - - - - - &nbsp; - - - - - &nbsp; - - - - - &nbsp; - - - - - &nbsp; - - - - - &nbsp; - - - - - &nbsp; - - - - - &nbsp; - - - - -
8 ./Debug/Source/Common_Demo_Tasks
+
<font color="white">.</font><br />
8 ./Debug/Source/FreeRTOS_Source/portable/GCC/ARM_CM0
+
- - - - - &nbsp; - - - - - &nbsp; - - - - - &nbsp; - - - - - &nbsp; - - - - - &nbsp; - - - - - &nbsp; - - - - - &nbsp; - - - - - &nbsp; - - - - - &nbsp; - - - - - &nbsp; - - - - - &nbsp; - - - - - &nbsp; - - - - - &nbsp; - - - - - &nbsp; - - - - - &nbsp; - - - - - &nbsp; - - - - -
12 ./Debug/Source/FreeRTOS_Source/portable/GCC
+
<font color="white">.</font><br />
8 ./Debug/Source/FreeRTOS_Source/portable/MemMang
+
- - - - - &nbsp; - - - - - &nbsp; - - - - - &nbsp; - - - - - &nbsp; - - - - - &nbsp; - - - - - &nbsp; - - - - - &nbsp; - - - - - &nbsp; - - - - - &nbsp; - - - - - &nbsp; - - - - - &nbsp; - - - - - &nbsp; - - - - - &nbsp; - - - - - &nbsp; - - - - - &nbsp; - - - - - &nbsp; - - - - -
24 ./Debug/Source/FreeRTOS_Source/portable
+
<font color="white">.</font><br />
32 ./Debug/Source/FreeRTOS_Source
 
48 ./Debug/Source
 
192 ./Debug
 
4 ./Source/Common_Demo_Tasks/Include
 
88 ./Source/Common_Demo_Tasks
 
28 ./Source/FreeRTOS_Source/portable/GCC/ARM_CM0
 
32 ./Source/FreeRTOS_Source/portable/GCC
 
12 ./Source/FreeRTOS_Source/portable/MemMang
 
48 ./Source/FreeRTOS_Source/portable
 
540 ./Source/FreeRTOS_Source/include
 
900 ./Source/FreeRTOS_Source
 
1068 ./Source
 
8 ./.settings
 
1332 .
 
</pre>
 
  
The above figure is a verbose way of showing approximate size of combined build time files such as object files.  But this snippet also shows project directories and directory structure.  This structure is largely created by the DOS batch file on Windows hosts, and in this case created by the shell script which mimics those same steps.  Manually copying this project with these directories then, there should be no need to run the batch file . . .
+
=== - - - - ===
  
 +
<font color="white">.</font><br />
 +
<font color="white">.</font><br />
 +
<font color="white">.</font><br />
  
<!-- comment -->
 
  
== - - - - - &nbsp; - - - - - &nbsp; - - - - - &nbsp; - - - - - &nbsp; - - - - - &nbsp; - - - - - &nbsp; - - - - - &nbsp; - - - - - &nbsp; - - - - - &nbsp; - - - - - &nbsp; - - - - - &nbsp; - - - - - &nbsp; - - - - - &nbsp; - - - - - &nbsp; - - - - - &nbsp; - - - - - &nbsp; - - - - - ==
 
. <br />
 
  
 
<!-- comment -->
 
<!-- comment -->
  
== [[#top|^]] Makefile Clues - Deriving A Working Makefile From LPCXpresso Projects ==
+
=== [[#top|^]] Pulse Width Modulation PWM in LPC1114 mC ===
  
<span style="background:#fcf87d;"><i>NOTE: This section on makefile derivation / porting not yet well organized. Work here underway - TMH</i></span>
+
2018-11-02 - Reading up on LPX1114 timer configuration and uses:
 +
 
 +
<ul>
 +
*  http://www.ocfreaks.com/lpc1114-timer-programming-tutorial/<br />
 +
*  http://www.ocfreaks.com/lpc1114-pwm-programming-tutorial/<br />
 +
</ul>
  
It's really frustrating to understand how LPCXpresso builds software projects.  LPCXpresso automatically generates a makefile, [[#makefile-generated-by-lpcxpresso|and child makefiles]] in additional subdirectories of its imported and created projects.  For example, LPCXpresso creates child makefiles in each directory which contains project sources.  These child makefiles are read by the `make` utility recursively, as LPCXpresso calls its choice of `make` with the -r option.
 
  
Some options which would normally be encapsulated in the makefile are held in some other settings space or stored files of LPCXpresso and passed to the call to make at build time.  This makes it harder to see all the details of the project build recipe, because they're spread out over multiple files, and some options do not even appear to be stored in files.
+
<!-- comment -->
  
According to an NXP Community thread, LPCXpresso supports command line based project builds . . .
+
=== [[#top|^]] LPCXpresso 1114 board and FreeRTOS ===
*  https://community.nxp.com/thread/388962
 
  
 +
In order to get started with the FreeRTOS port demo project to the LPC1114 board, a batch file (or shell script) need be run to create a particular directory structure and copy files into some project-expected places.  There is mention on the ported NXP project page on FreeRTOS site that LPCXpresso IDE can provide makefile based projects, and "managed make" projects.  The managed make projects require all sources on which a given project depends to be located within given project's top level directory.
  
Despite possible command line based builds we have not yet learned how to set this up, and are presently stuck with LPCXpresso's default build process.  This build process includes a utility or option called <code>CDT builder</code>, which appears next to a checkbox in one of the dialog boxes under a given project's properties:
+
There is mention of a batch file which on our Linux box appears to be <code>~/Downloads/freertos/FreeRTOSv10.0.1/FreeRTOS/Demo/CORTEX_M0_LPC1114_LPCXpresso/RTOSDemo/CreateProjectDirectoryStructure.bat</code>.
  
  Properties --> Builders
+
*  https://www.freertos.org/FreeRTOS-for-Cortex-M0-LPC1114-LPCXpresso.html
 +
**  https://www.freertos.org/a00017.html  . . . FreeRTOS source code organization, this link noted elsewhere on wiki
  
[[File:Screenshot--2018-07-03--lpcxpresso-project-properties-dialog-box.png|800px|image 800x600 px]]
 
  
A couple of supporting lpcxpresso project makefiles include <code>makefile.init</code> and <code>subdir.mk</code>. These files contain respectively:
+
Getting close but having trouble setting up and fully compiling LPC1114 FreeRTOS demo . . . build fails for not finding header file IntQueue.h, as included by file IntQueue.c in the same directory:
  
<i> Figure x - example makefile.init file:</i>
 
 
<pre>
 
<pre>
      1 PROJECT_NAME=rtos-demo-with-mods
+
user@localhost:~/LPCXpresso/workspace$ ls -l ./FreeRTOS/Demo/CORTEX_M0_LPC1114_LPCXpresso/RTOSDemo/Source
      2
+
total 84
      3 LIBRARY_PATHS=\
+
drwxr-xr-x 3 user user  4096 May 14 13:07 Common_Demo_Tasks
      4 -L/opt/nxp/lpcxpresso-8p2p2/lpcxpresso/tools/arm-none-eabi/lib \
+
-rw-r--r-- 1 user user  4364 May 14 13:12 FreeRTOSConfig.h
      5 -L/opt/nxp/lpcxpresso-8p2p2/lpcxpresso/tools/lib/gcc/arm-none-eabi/5.4.1
+
drwxr-xr-x 4 user user  4096 May 14 12:22 FreeRTOS_Source
      6
+
-rw-r--r-- 1 user user  3587 Dec 18 14:36 IntQueueTimer.c
      7
+
-rw-r--r-- 1 user user  1496 Dec 18 14:36 IntQueueTimer.h
      8
+
-rw-r--r-- 1 user user  5925 Dec 18 14:36 RegTest.c
      9 # --- EOF ---
+
-rw-r--r-- 1 user user 16008 Nov 16  2016 cr_startup_lpc11.c
 +
-rw-r--r-- 1 user user  8416 Dec 18 14:36 main-blinky.c
 +
-rw-r--r-- 1 user user 11663 Dec 18 14:36 main-full.c
 +
-rw-r--r-- 1 user user 10694 Dec 18 14:36 main.c
 +
 
 +
user@localhost:~/LPCXpresso/workspace$
 
</pre>
 
</pre>
  
Hmm this one looks hand-crafted by Ted . . . here's another from the FreeRTOS demo project:
 
  
<i> Figure x - example makefile.init file:</i>
+
[[media:linked-resources.png|LPCXpresso project linked resources]]
<pre>
 
      1 ################################################################################^M
 
      2 # Automatically-generated file. Do not edit!^M
 
      3 ################################################################################^M
 
      4 ^M
 
      5 PATH := $(PATH):C:\PROGRA~2\KPIT\GNUARM~1.02-\ARM-NO~1\ARM-NO~1\bin;C:\PROGRA~2\KPIT\GNUARM~1.02-\ARM-NO~1\ARM-NO~1\libexec\gcc\arm-none-eabi\4.9-GNUARM-NONE_v14.02
 
</pre>
 
  
<i> Figure x - example subdir.mk file:</i>
+
...Trouble uploading screen capture in .PNG format!  MediaWiki error message:
<pre>
 
  
      1 ################################################################################
+
"
      2 # Automatically-generated file. Do not edit!
+
Action failed
      3 ################################################################################
+
 
      4
+
Could not open lock file for "mwstore://local-backend/local-public/3/33/Linked-resources.png".
      5 # Add inputs and outputs from these tool invocations to the build variables
+
 
      6 C_SRCS += \
+
Return to Main Page.
      7 ../Source/IntQueueTimer.c \
+
"
      8 ../Source/RegTest.c \
+
 
      9 ../Source/cr_startup_lpc11.c \
+
Textual data from screen whose image capture failed to upload:
    10 ../Source/main-blinky.c \
+
 
    11 ../Source/main-full.c \
+
<pre>
    12 ../Source/main.c
+
# Properties for RTOSDemo
    13
+
# v  Resource
    14 OBJS += \
+
#        Linked Resource     
    15 ./Source/IntQueueTimer.o \
+
# Path Variables
    16 ./Source/RegTest.o \
+
#
    17 ./Source/cr_startup_lpc11.o \
+
# ECLIPSE_HOME    /opt/nxp/lpcxpresso-8p2p2/lpcxpresso/
    18 ./Source/main-blinky.o \
+
# PARENT_LOC      /home/user/LPCXpresso/workspace
    19 ./Source/main-full.o \
+
# PROJECT_LOC      /home/user/Downloads/freertos/FreeRTOSv10.0.1/FreeRTOS/Demo/CORTEX_M0_LPC1114_LPCXpresso/RTOSDemo
    20 ./Source/main.o
+
# WORKSPACE_LOC    /home/user/LPCXpresso/workspace
    21
+
</pre>
    22 C_DEPS += \
+
 
    23 ./Source/IntQueueTimer.d \
+
 
    24 ./Source/RegTest.d \
+
ISSUE - case insensitive Windows filename of needed header file needs attention, symbolic linking one fix:
    25 ./Source/cr_startup_lpc11.d \
+
 
    26 ./Source/main-blinky.d \
+
*  https://community.nxp.com/thread/420898
    27 ./Source/main-full.d \
+
 
    28 ./Source/main.d
+
 
    29
+
<!-- comment -->
    30
 
    31 # Each subdirectory must supply rules for building sources it contributes
 
    32 Source/%.o: ../Source/%.c
 
    33        @echo 'Building file: $<'
 
    34        @echo 'Invoking: MCU C Compiler'
 
    35        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/Downloads/freertos/FreeRTOSv10.0.1/FreeRTOS/Demo/CORTEX_M0_LPC1114_LPCXpresso/RTOSDemo/Source/Common_Demo_Tasks/include" -I"/home/user/Downloads/freertos/FreeRTOSv10.0.1/FreeRTOS/Demo/CORTEX_M0_LPC1114_LPCXpresso/RTOSDemo/Source" -I"/home/user/Downloads/freertos/FreeRTOSv10.0.1/FreeRTOS/Demo/CORTEX_M0_LPC1114_LPCXpresso/RTOSDemo/Source/FreeRTOS_Source/include" -I"/home/user/Downloads/freertos/FreeRTOSv10.0.1/FreeRTOS/Demo/CORTEX_M0_LPC1114_LPCXpresso/RTOSDemo/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"$(@:%.o=%.d)" -MT"$(@:%.o=%.o)" -MT"$(@:%.o=%.d)" -o "$@" "$<"
 
    36        @echo 'Finished building: $<'
 
    37        @echo ' '
 
    38
 
    39 Source/cr_startup_lpc11.o: ../Source/cr_startup_lpc11.c
 
    40        @echo 'Building file: $<'
 
    41        @echo 'Invoking: MCU C Compiler'
 
    42        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/Downloads/freertos/FreeRTOSv10.0.1/FreeRTOS/Demo/CORTEX_M0_LPC1114_LPCXpresso/RTOSDemo/Source/Common_Demo_Tasks/include" -I"/home/user/Downloads/freertos/FreeRTOSv10.0.1/FreeRTOS/Demo/CORTEX_M0_LPC1114_LPCXpresso/RTOSDemo/Source" -I"/home/user/Downloads/freertos/FreeRTOSv10.0.1/FreeRTOS/Demo/CORTEX_M0_LPC1114_LPCXpresso/RTOSDemo/Source/FreeRTOS_Source/include" -I"/home/user/Downloads/freertos/FreeRTOSv10.0.1/FreeRTOS/Demo/CORTEX_M0_LPC1114_LPCXpresso/RTOSDemo/Source/FreeRTOS_Source/portable/GCC/ARM_CM0" -O0 -Os -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"$(@:%.o=%.d)" -MT"Source/cr_startup_lpc11.d" -o "$@" "$<"
 
    43        @echo 'Finished building: $<'
 
    44        @echo ' '
 
    45
 
    46
 
</pre>
 
  
 +
<!--
 +
== - - - - -  - - - - -  - - - - -  - - - - -  - - - - -  - - - - -  - - - - -  - - - - -  - - - - -  - - - - - ==
 +
-->
  
- 2018-07-12 -
 
  
And here is an interesting line from the .cproject file:
+
<!-- comment -->
  
      23    <builder arguments="-r" buildPath="${workspace_loc:/rtos-demo-3/Debug}" command="make" id="com.crt.advproject.builder.exe.debug.1260101970" keepEnvironmentInBuildfile="false" managedBuildOn="true" name="Gnu Make Builder" superClass="com.crt.advproject.builder.exe.debug"/>^M
+
=== [[#top|^]] Copying FreeRTOS Demo Project To Begin New Project ===
  
 +
- 2018-06-13 TUE -<br />
 +
Today's goal is to copy the FreeRTOS demo which runs on an LPCXpresso development board, and to bring this copy of the project up as a second or additional project in LPC IDE's workspace.  From here then next step is to add one-way then bidirectional UART communications to the project.
  
=== [[#top|^]] What we know about LPCXpresso project makefiles ===
+
A separate second goal is to craft a GNU makefile to build this same demo project.
  
What we know so far about LPCXpresso project makefiles:  LPCXPresso projects typically use multiple makefiles, including a "top level" makefile which includes several other makefiles.  The called makefiles include:
+
Looking at project properties by means of right clicking the top level folder in LPCXpresso's project navigation pane, the project's location on the file system is:
  
  *  makefile.init
 
  *  makefile.deps
 
  *  sources.mk
 
  *  objects.mk
 
  
and one of the following subdir makefiles for each project directory which holds sources:
+
  localhost:/home/${USER}/Downloads/freertos/FreeRTOSv10.0.1/FreeRTOS/Demo/CORTEX_M0_LPC1114_LPCXpresso/RTOSDemo
  
  *  subdir.mk
 
  
It looks also as though these files come pre-built and bundled with the FreeRTOS demo, which includes a port to LPC1114 family microcontrollersSince they're already present in the downloadable project / port from FreeRTOS dot org, we can't as easily know or find out how these files are or were originally created. All of the makefiles begin with a comment block which warns "DO NOT EDIT":
+
This path also matches the result we get when searching for a unique-to-project port header file named IntQueue.h, invoking `locate IntQueue.h | grep 1114`The path is a directory longer due to the location of this header file in the port's dir structure, but the narrowed search result path agrees with the path shown in LPC's project location.
  
<pre>
+
The readily visible, top level contents of this directory are:
      1 ################################################################################
 
      2 # Automatically-generated file. Do not edit!
 
      3 ################################################################################
 
</pre>
 
  
 +
  ~/Downloads/freertos/FreeRTOSv10.0.1/FreeRTOS/Demo/CORTEX_M0_LPC1114_LPCXpresso/RTOSDemo$ ls
 +
  CreateProjectDirectoryStructure.bat  Source
 +
  Debug                                create-project-directory-structure.sh
  
Here are the instances of subdir makefiles:
+
There are a couple of hidden project files here, created and or used by LPCXpresso:
  
<code>
+
  $ ls -a
$ locate <font color="red">subdir.mk</font> | grep Downloads | grep <font color="red">subdir.mk</font>
+
  .   .cproject  .settings                            Debug   create-project-directory-structure.sh
/home/${USER}/Downloads/freertos/FreeRTOSv10.0.1/FreeRTOS/Demo/CORTEX_M0_LPC1114_LPCXpresso/CMSISv2p00_LPC11xx/Debug/src/<font color="red">subdir.mk</font>
+
  .. .project  CreateProjectDirectoryStructure.bat  Source
/home/${USER}/Downloads/freertos/FreeRTOSv10.0.1/FreeRTOS/Demo/CORTEX_M0_LPC1114_LPCXpresso/RTOSDemo/Debug/Source/<font color="red">subdir.mk</font>
 
/home/${USER}/Downloads/freertos/FreeRTOSv10.0.1/FreeRTOS/Demo/CORTEX_M0_LPC1114_LPCXpresso/RTOSDemo/Debug/Source/Common_Demo_Tasks/<font color="red">subdir.mk</font>
 
/home/${USER}/Downloads/freertos/FreeRTOSv10.0.1/FreeRTOS/Demo/CORTEX_M0_LPC1114_LPCXpresso/RTOSDemo/Debug/Source/FreeRTOS_Source/<font color="red">subdir.mk</font>
 
/home/${USER}/Downloads/freertos/FreeRTOSv10.0.1/FreeRTOS/Demo/CORTEX_M0_LPC1114_LPCXpresso/RTOSDemo/Debug/Source/FreeRTOS_Source/portable/GCC/ARM_CM0/<font color="red">subdir.mk</font>
 
/home/${USER}/Downloads/freertos/FreeRTOSv10.0.1/FreeRTOS/Demo/CORTEX_M0_LPC1114_LPCXpresso/RTOSDemo/Debug/Source/FreeRTOS_Source/portable/MemMang/<font color="red">subdir.mk</font>
 
</code>
 
  
 +
<i><b>Note:</b> &nbsp;in the LPCXpresso managed product directory there are hidden files named .cproject and .project . . .</i>
  
 +
Both files .cproject and .project are XML files.  The file .cproject is longer among these two files and includes details of the compiler used in a given project, plus options passed to this compiler, plus at least one project include path.  The file named .project contains in the first few lines a line expressing the project name as LPCXpresso IDE knows it.  This project name must be unique among projects imported to a given LPCXpresso workspace.  This workspace on Unix and Linux-like systems defaults to the directory ${HOME}/LPCXpresso.
  
<!-- comment -->
+
The make dir and copying commands which can be invoked after creating project directory structure is:
  
<!-- === <i>edit point - build messages</i> === -->
+
  $ mkdir -pv ~/projects/nxp/rtos-demo-4
 +
  $ cp -prv ./* ./.[cp]* ~/projects/nxp/rtos-demo-4
  
== [[#top|^]] LPC build messages ==
 
  
Build messages from LPCXpresso 8p2p2 CDT builder here on [[rtos_demo_3_build_messages|wiki page 'rtos-demo-3 build messages']].  Next figure or excerpt ahead shows a complete capture of a FreeRTOS demo firmware build as built by LPCXpresso's calls to make.
 
  
Article contributor Ted noting here that these build messages tell a lot about the build process but also leave a lot of the recipe's details out.  For example, it's not obvious from these compiler messages that the build process is described by multiple makefiles.  It's also not always obvious what environment variable settings the 'make' utility -- in this case LPCXpresso -- and its called commands enjoy as they run.  One clue to this effect is how LPC's build messages show a specifications file option <i>-specs=redlib.specs</i> which names an extent file but not its full path.  How does the compiler know where to look for this file?  There must be a search path variable somewhere.  Unfortunately GNU GCC's web documentation doesn't go into any detail about the way in which gcc searched for specs files.
 
  
<i><b>2018-07-16 NOTE:</blines of the build messages excerpted below contain [https://gcc.gnu.org/onlinedocs/gcc/Preprocessor-Options.html#Preprocessor-Options -MT and -MF compiler options]In the excerpts these are followed by specific source files, but in the subdir.mk makefiles these are followed by pattern substitution rules.</i>
+
The name of the project we're attempting to copy and start as a new and editable project is 'RTOSDemo', a patterm which appears several times in file .cproject:
 +
 
 +
<i>Figure x -</i>
 +
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
 +
$ grep -n RTOSDemo ../.cproject
 +
&nbsp;
 +
<font color="green">23</font><font color="cyan">:</font> <builder arguments="-r" buildPath="${workspace_loc<font color="cyan">:</font>/<font color="red">RTOSDemo</font>/Debug}" command="make" id="com.crt.advproject.builder.exe.debug.1260101970" keepEnvironmentInBuildfile="true" managedBuildOn="true" name="Gnu Make Builder" superClass="com.crt.advproject.builder.exe.debug"/>
 +
<font color="green">40</font><font color="cyan">:</font> <listOptionValue builtIn="false" value="&quot;${workspace_loc<font color="cyan">:</font>/FreeRTOS/Demo/CORTEX_M0_LPC1114_LPCXpresso/<font color="red">RTOSDemo</font>/Source}&quot;"/>
 +
<font color="green">61</font><font color="cyan">:</font> <option id="com.crt.advproject.link.script.1758870530" name="Linker script" superClass="com.crt.advproject.link.script" value="&quot;<font color="red">RTOSDemo</font>_Debug.ld&quot;" valueType="string"/>
 +
<font color="green">118</font><font color="cyan">:</font> <builder buildPath="${workspace_loc<font color="cyan">:</font>/<font color="red">RTOSDemo</font>/Release}" id="com.crt.advproject.builder.exe.release.1281961847" keepEnvironmentInBuildfile="false" managedBuildOn="true" name="Gnu Make Builder" superClass="com.crt.advproject.builder.exe.release"/>
 +
<font color="green">149</font><font color="cyan">:</font> <option id="com.crt.advproject.link.script.1856833348" name="Linker script" superClass="com.crt.advproject.link.script" value="&quot;<font color="red">RTOSDemo</font>_Release.ld&quot;" valueType="string"/>
 +
  <font color="green">182</font><font color="cyan">:</font> <project id="<font color="red">RTOSDemo</font>.com.crt.advproject.projecttype.exe.777175218" name="Executable" projectType="com.crt.advproject.projecttype.exe"/>
 +
<font color="green">343</font><font color="cyan">:</font> <resource resourceType="PROJECT" workspacePath="/<font color="red">RTOSDemo</font>"/>
 +
<font color="green">346</font><font color="cyan">:</font> <resource resourceType="PROJECT" workspacePath="/<font color="red">RTOSDemo</font>"/>
 +
&nbsp;
 +
$
 +
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
 +
 
 +
Unfortunately the LPC1114 FreeRTOS demo project name is used in two or three different ways in the file named .cprojectMost of the time it is used as the project's name, but a couple of times this text pattern appears in the filenames of linker scripts. In another instance it's part of a host system directory path to the project.  The places where pattern 'RTOSDemo' most closely relates to LPCXpresso project are where it appears on lines which refer to ${workspace_loc}.  Given this it looks like we want to change the project name RTOSDemo to a new project name on lines 23, 118, 343 and 346, where this name stands for a project name, rather than part of a path or part of a linker script filename.
  
<i><b>2018-07-26 NOTE:</b>  following line from .cproject file hints at variable which holds path to the Redlib specs files:
 
    315        <runAction arguments="-c 'gcc -E -P -v -dD &quot;${plugin_state_location}/${specs_file}&quot;'" command="sh" useDefault="true"/>
 
</i>
 
  
All the same here is the LPCXpresso output of a successful build of FreeRTOS demo program targeted for the LPC1114 Cortex-M0 processor:
+
<!-- <span style="id:background-light-green; background-color: #b2f9ba">zztop</span> -->
 +
<span style="background-color: #bcd6ff"> <br />QUESTION:  to what does the pattern <i>RTOSDemo.com.crt.advproject.projecttype.exe.777175218</i> refer?  Is this a reference to or name of an executable file?  Or exe file plus project configuration? - TMH<br /> <br /> </span>
  
  
<span id="start_of_lpc_build_output"></span>
+
LPCXpresso file .project contains two references to the pattern RTOSDemo:
[[#end_of_lpc_build_output|<b>v</b> end of LPC's build output]]
 
<i> Figure x - Build output from LPCXpresso console:</i>
 
  
<pre>
+
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
09:52:03 **** Build of configuration Debug for project RTOSDemo ****
+
<span style="background-color: #363e45">
make -r all
+
$ grep -n RTOSDemo ../.project
Building file: ../Source/FreeRTOS_Source/portable/MemMang/heap_1.c
+
<font color="green">3</font><font color="cyan">:</font> <name><font color="red">RTOSDemo</font></name>
Invoking: MCU C Compiler
+
<font color="green">35</font><font color="cyan">:</font> <value>${workspace_loc<font color="cyan">:</font>/<font color="red">RTOSDemo</font>/Debug}</value>
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/Downloads/freertos/FreeRTOSv10.0.1/FreeRTOS/Demo/CORTEX_M0_LPC1114_LPCXpresso/RTOSDemo/Source/Common_Demo_Tasks/include" -I"/home/user/Downloads/freertos/FreeRTOSv10.0.1/FreeRTOS/Demo/CORTEX_M0_LPC1114_LPCXpresso/RTOSDemo/Source" -I"/home/user/Downloads/freertos/FreeRTOSv10.0.1/FreeRTOS/Demo/CORTEX_M0_LPC1114_LPCXpresso/RTOSDemo/Source/FreeRTOS_Source/include" -I"/home/user/Downloads/freertos/FreeRTOSv10.0.1/FreeRTOS/Demo/CORTEX_M0_LPC1114_LPCXpresso/RTOSDemo/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"
+
</span>
Finished building: ../Source/FreeRTOS_Source/portable/MemMang/heap_1.c
+
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
   
+
 
Building file: ../Source/FreeRTOS_Source/portable/GCC/ARM_CM0/port.c
+
 
Invoking: MCU C Compiler
+
<!-- comment -->
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/Downloads/freertos/FreeRTOSv10.0.1/FreeRTOS/Demo/CORTEX_M0_LPC1114_LPCXpresso/RTOSDemo/Source/Common_Demo_Tasks/include" -I"/home/user/Downloads/freertos/FreeRTOSv10.0.1/FreeRTOS/Demo/CORTEX_M0_LPC1114_LPCXpresso/RTOSDemo/Source" -I"/home/user/Downloads/freertos/FreeRTOSv10.0.1/FreeRTOS/Demo/CORTEX_M0_LPC1114_LPCXpresso/RTOSDemo/Source/FreeRTOS_Source/include" -I"/home/user/Downloads/freertos/FreeRTOSv10.0.1/FreeRTOS/Demo/CORTEX_M0_LPC1114_LPCXpresso/RTOSDemo/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/GCC/ARM_CM0/port.d" -MT"Source/FreeRTOS_Source/portable/GCC/ARM_CM0/port.o" -MT"Source/FreeRTOS_Source/portable/GCC/ARM_CM0/port.d" -o "Source/FreeRTOS_Source/portable/GCC/ARM_CM0/port.o" "../Source/FreeRTOS_Source/portable/GCC/ARM_CM0/port.c"
+
 
Finished building: ../Source/FreeRTOS_Source/portable/GCC/ARM_CM0/port.c
+
==== [[#top|^]] <i>edit point - create directory structure script</i> ====
+
 
Building file: ../Source/FreeRTOS_Source/list.c
+
A file worth noting here is a shell script which Ted adapted from a DOS batch file which ships with the RTOS demo. The original batch file and the adapted shell script create a directory structure and copy FreeRTOS header and source files to these directories, placing all sources in the local copy of the project. While the following script does the copying job for a project in one particular path relative to the FreeRTOS download path, Ted amended this script further to put relative source path elements into variables. This makes the script more adjustable to be executed in different locations. As of 2018-07-09 Monday that improved script not posted here on this wiki article yet . . .
Invoking: MCU C Compiler
+
 
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/Downloads/freertos/FreeRTOSv10.0.1/FreeRTOS/Demo/CORTEX_M0_LPC1114_LPCXpresso/RTOSDemo/Source/Common_Demo_Tasks/include" -I"/home/user/Downloads/freertos/FreeRTOSv10.0.1/FreeRTOS/Demo/CORTEX_M0_LPC1114_LPCXpresso/RTOSDemo/Source" -I"/home/user/Downloads/freertos/FreeRTOSv10.0.1/FreeRTOS/Demo/CORTEX_M0_LPC1114_LPCXpresso/RTOSDemo/Source/FreeRTOS_Source/include" -I"/home/user/Downloads/freertos/FreeRTOSv10.0.1/FreeRTOS/Demo/CORTEX_M0_LPC1114_LPCXpresso/RTOSDemo/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/list.d" -MT"Source/FreeRTOS_Source/list.o" -MT"Source/FreeRTOS_Source/list.d" -o "Source/FreeRTOS_Source/list.o" "../Source/FreeRTOS_Source/list.c"
+
* [[create_project_directory_structure__version_1|Script create project directory structure, version 1]]
Finished building: ../Source/FreeRTOS_Source/list.c
+
 
+
*  [[create_project_directory_structure__version_1#script_version_2|Script create project directory structure, version 2]]
Building file: ../Source/FreeRTOS_Source/queue.c
+
 
Invoking: MCU C Compiler
+
<i><b>2018-07-13 NOTE:</b>  with one or both versions of this script there may be an error where IntQueue.h and three other FreeRTOS header files do not get copied to the new local project instance. It may be necessary until a fix found to manually copy these files as follows:
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/Downloads/freertos/FreeRTOSv10.0.1/FreeRTOS/Demo/CORTEX_M0_LPC1114_LPCXpresso/RTOSDemo/Source/Common_Demo_Tasks/include" -I"/home/user/Downloads/freertos/FreeRTOSv10.0.1/FreeRTOS/Demo/CORTEX_M0_LPC1114_LPCXpresso/RTOSDemo/Source" -I"/home/user/Downloads/freertos/FreeRTOSv10.0.1/FreeRTOS/Demo/CORTEX_M0_LPC1114_LPCXpresso/RTOSDemo/Source/FreeRTOS_Source/include" -I"/home/user/Downloads/freertos/FreeRTOSv10.0.1/FreeRTOS/Demo/CORTEX_M0_LPC1114_LPCXpresso/RTOSDemo/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/queue.d" -MT"Source/FreeRTOS_Source/queue.o" -MT"Source/FreeRTOS_Source/queue.d" -o "Source/FreeRTOS_Source/queue.o" "../Source/FreeRTOS_Source/queue.c"
+
<ul>
Finished building: ../Source/FreeRTOS_Source/queue.c
+
$ cp -p blocktim.h recmutex.h countsem.h IntQueue.h /home/user/projects/nxp/rtos-demo-4/Source/Common_Demo_Tasks/Include
+
</ul>
Building file: ../Source/FreeRTOS_Source/tasks.c
+
</i>
Invoking: MCU C Compiler
+
 
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/Downloads/freertos/FreeRTOSv10.0.1/FreeRTOS/Demo/CORTEX_M0_LPC1114_LPCXpresso/RTOSDemo/Source/Common_Demo_Tasks/include" -I"/home/user/Downloads/freertos/FreeRTOSv10.0.1/FreeRTOS/Demo/CORTEX_M0_LPC1114_LPCXpresso/RTOSDemo/Source" -I"/home/user/Downloads/freertos/FreeRTOSv10.0.1/FreeRTOS/Demo/CORTEX_M0_LPC1114_LPCXpresso/RTOSDemo/Source/FreeRTOS_Source/include" -I"/home/user/Downloads/freertos/FreeRTOSv10.0.1/FreeRTOS/Demo/CORTEX_M0_LPC1114_LPCXpresso/RTOSDemo/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/tasks.d" -MT"Source/FreeRTOS_Source/tasks.o" -MT"Source/FreeRTOS_Source/tasks.d" -o "Source/FreeRTOS_Source/tasks.o" "../Source/FreeRTOS_Source/tasks.c"
+
 
Finished building: ../Source/FreeRTOS_Source/tasks.c
+
Before and after running `make clean` from the IDE:
+
 
Building file: ../Source/FreeRTOS_Source/timers.c
+
<i>Figure x - FreeRTOS demo directories and size of build time files:</i>
Invoking: MCU C Compiler
+
 
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/Downloads/freertos/FreeRTOSv10.0.1/FreeRTOS/Demo/CORTEX_M0_LPC1114_LPCXpresso/RTOSDemo/Source/Common_Demo_Tasks/include" -I"/home/user/Downloads/freertos/FreeRTOSv10.0.1/FreeRTOS/Demo/CORTEX_M0_LPC1114_LPCXpresso/RTOSDemo/Source" -I"/home/user/Downloads/freertos/FreeRTOSv10.0.1/FreeRTOS/Demo/CORTEX_M0_LPC1114_LPCXpresso/RTOSDemo/Source/FreeRTOS_Source/include" -I"/home/user/Downloads/freertos/FreeRTOSv10.0.1/FreeRTOS/Demo/CORTEX_M0_LPC1114_LPCXpresso/RTOSDemo/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/timers.d" -MT"Source/FreeRTOS_Source/timers.o" -MT"Source/FreeRTOS_Source/timers.d" -o "Source/FreeRTOS_Source/timers.o" "../Source/FreeRTOS_Source/timers.c"
+
<pre>
Finished building: ../Source/FreeRTOS_Source/timers.c
+
$ du -k .
+
280 ./Debug/Source/Common_Demo_Tasks
Building file: ../Source/Common_Demo_Tasks/IntQueue.c
+
68 ./Debug/Source/FreeRTOS_Source/portable/GCC/ARM_CM0
Invoking: MCU C Compiler
+
72 ./Debug/Source/FreeRTOS_Source/portable/GCC
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/Downloads/freertos/FreeRTOSv10.0.1/FreeRTOS/Demo/CORTEX_M0_LPC1114_LPCXpresso/RTOSDemo/Source/Common_Demo_Tasks/include" -I"/home/user/Downloads/freertos/FreeRTOSv10.0.1/FreeRTOS/Demo/CORTEX_M0_LPC1114_LPCXpresso/RTOSDemo/Source" -I"/home/user/Downloads/freertos/FreeRTOSv10.0.1/FreeRTOS/Demo/CORTEX_M0_LPC1114_LPCXpresso/RTOSDemo/Source/FreeRTOS_Source/include" -I"/home/user/Downloads/freertos/FreeRTOSv10.0.1/FreeRTOS/Demo/CORTEX_M0_LPC1114_LPCXpresso/RTOSDemo/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/Common_Demo_Tasks/IntQueue.d" -MT"Source/Common_Demo_Tasks/IntQueue.o" -MT"Source/Common_Demo_Tasks/IntQueue.d" -o "Source/Common_Demo_Tasks/IntQueue.o" "../Source/Common_Demo_Tasks/IntQueue.c"
+
64 ./Debug/Source/FreeRTOS_Source/portable/MemMang
Finished building: ../Source/Common_Demo_Tasks/IntQueue.c
+
140 ./Debug/Source/FreeRTOS_Source/portable
+
472 ./Debug/Source/FreeRTOS_Source
Building file: ../Source/Common_Demo_Tasks/blocktim.c
+
1112 ./Debug/Source
Invoking: MCU C Compiler
+
1408 ./Debug
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/Downloads/freertos/FreeRTOSv10.0.1/FreeRTOS/Demo/CORTEX_M0_LPC1114_LPCXpresso/RTOSDemo/Source/Common_Demo_Tasks/include" -I"/home/user/Downloads/freertos/FreeRTOSv10.0.1/FreeRTOS/Demo/CORTEX_M0_LPC1114_LPCXpresso/RTOSDemo/Source" -I"/home/user/Downloads/freertos/FreeRTOSv10.0.1/FreeRTOS/Demo/CORTEX_M0_LPC1114_LPCXpresso/RTOSDemo/Source/FreeRTOS_Source/include" -I"/home/user/Downloads/freertos/FreeRTOSv10.0.1/FreeRTOS/Demo/CORTEX_M0_LPC1114_LPCXpresso/RTOSDemo/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/Common_Demo_Tasks/blocktim.d" -MT"Source/Common_Demo_Tasks/blocktim.o" -MT"Source/Common_Demo_Tasks/blocktim.d" -o "Source/Common_Demo_Tasks/blocktim.o" "../Source/Common_Demo_Tasks/blocktim.c"
+
4 ./Source/Common_Demo_Tasks/Include
Finished building: ../Source/Common_Demo_Tasks/blocktim.c
+
88 ./Source/Common_Demo_Tasks
+
28 ./Source/FreeRTOS_Source/portable/GCC/ARM_CM0
Building file: ../Source/Common_Demo_Tasks/countsem.c
+
32 ./Source/FreeRTOS_Source/portable/GCC
Invoking: MCU C Compiler
+
12 ./Source/FreeRTOS_Source/portable/MemMang
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/Downloads/freertos/FreeRTOSv10.0.1/FreeRTOS/Demo/CORTEX_M0_LPC1114_LPCXpresso/RTOSDemo/Source/Common_Demo_Tasks/include" -I"/home/user/Downloads/freertos/FreeRTOSv10.0.1/FreeRTOS/Demo/CORTEX_M0_LPC1114_LPCXpresso/RTOSDemo/Source" -I"/home/user/Downloads/freertos/FreeRTOSv10.0.1/FreeRTOS/Demo/CORTEX_M0_LPC1114_LPCXpresso/RTOSDemo/Source/FreeRTOS_Source/include" -I"/home/user/Downloads/freertos/FreeRTOSv10.0.1/FreeRTOS/Demo/CORTEX_M0_LPC1114_LPCXpresso/RTOSDemo/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/Common_Demo_Tasks/countsem.d" -MT"Source/Common_Demo_Tasks/countsem.o" -MT"Source/Common_Demo_Tasks/countsem.d" -o "Source/Common_Demo_Tasks/countsem.o" "../Source/Common_Demo_Tasks/countsem.c"
+
48 ./Source/FreeRTOS_Source/portable
Finished building: ../Source/Common_Demo_Tasks/countsem.c
+
540 ./Source/FreeRTOS_Source/include
+
900 ./Source/FreeRTOS_Source
Building file: ../Source/Common_Demo_Tasks/recmutex.c
+
1068 ./Source
Invoking: MCU C Compiler
+
8 ./.settings
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/Downloads/freertos/FreeRTOSv10.0.1/FreeRTOS/Demo/CORTEX_M0_LPC1114_LPCXpresso/RTOSDemo/Source/Common_Demo_Tasks/include" -I"/home/user/Downloads/freertos/FreeRTOSv10.0.1/FreeRTOS/Demo/CORTEX_M0_LPC1114_LPCXpresso/RTOSDemo/Source" -I"/home/user/Downloads/freertos/FreeRTOSv10.0.1/FreeRTOS/Demo/CORTEX_M0_LPC1114_LPCXpresso/RTOSDemo/Source/FreeRTOS_Source/include" -I"/home/user/Downloads/freertos/FreeRTOSv10.0.1/FreeRTOS/Demo/CORTEX_M0_LPC1114_LPCXpresso/RTOSDemo/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/Common_Demo_Tasks/recmutex.d" -MT"Source/Common_Demo_Tasks/recmutex.o" -MT"Source/Common_Demo_Tasks/recmutex.d" -o "Source/Common_Demo_Tasks/recmutex.o" "../Source/Common_Demo_Tasks/recmutex.c"
+
2548 .
Finished building: ../Source/Common_Demo_Tasks/recmutex.c
+
 
+
$ du -k .
Building file: ../Source/IntQueueTimer.c
+
8 ./Debug/Source/Common_Demo_Tasks
Invoking: MCU C Compiler
+
8 ./Debug/Source/FreeRTOS_Source/portable/GCC/ARM_CM0
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/Downloads/freertos/FreeRTOSv10.0.1/FreeRTOS/Demo/CORTEX_M0_LPC1114_LPCXpresso/RTOSDemo/Source/Common_Demo_Tasks/include" -I"/home/user/Downloads/freertos/FreeRTOSv10.0.1/FreeRTOS/Demo/CORTEX_M0_LPC1114_LPCXpresso/RTOSDemo/Source" -I"/home/user/Downloads/freertos/FreeRTOSv10.0.1/FreeRTOS/Demo/CORTEX_M0_LPC1114_LPCXpresso/RTOSDemo/Source/FreeRTOS_Source/include" -I"/home/user/Downloads/freertos/FreeRTOSv10.0.1/FreeRTOS/Demo/CORTEX_M0_LPC1114_LPCXpresso/RTOSDemo/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/IntQueueTimer.d" -MT"Source/IntQueueTimer.o" -MT"Source/IntQueueTimer.d" -o "Source/IntQueueTimer.o" "../Source/IntQueueTimer.c"
+
12 ./Debug/Source/FreeRTOS_Source/portable/GCC
Finished building: ../Source/IntQueueTimer.c
+
8 ./Debug/Source/FreeRTOS_Source/portable/MemMang
+
24 ./Debug/Source/FreeRTOS_Source/portable
Building file: ../Source/RegTest.c
+
32 ./Debug/Source/FreeRTOS_Source
Invoking: MCU C Compiler
+
48 ./Debug/Source
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/Downloads/freertos/FreeRTOSv10.0.1/FreeRTOS/Demo/CORTEX_M0_LPC1114_LPCXpresso/RTOSDemo/Source/Common_Demo_Tasks/include" -I"/home/user/Downloads/freertos/FreeRTOSv10.0.1/FreeRTOS/Demo/CORTEX_M0_LPC1114_LPCXpresso/RTOSDemo/Source" -I"/home/user/Downloads/freertos/FreeRTOSv10.0.1/FreeRTOS/Demo/CORTEX_M0_LPC1114_LPCXpresso/RTOSDemo/Source/FreeRTOS_Source/include" -I"/home/user/Downloads/freertos/FreeRTOSv10.0.1/FreeRTOS/Demo/CORTEX_M0_LPC1114_LPCXpresso/RTOSDemo/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/RegTest.d" -MT"Source/RegTest.o" -MT"Source/RegTest.d" -o "Source/RegTest.o" "../Source/RegTest.c"
+
192 ./Debug
Finished building: ../Source/RegTest.c
+
4 ./Source/Common_Demo_Tasks/Include
+
88 ./Source/Common_Demo_Tasks
Building file: ../Source/cr_startup_lpc11.c
+
28 ./Source/FreeRTOS_Source/portable/GCC/ARM_CM0
Invoking: MCU C Compiler
+
32 ./Source/FreeRTOS_Source/portable/GCC
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/Downloads/freertos/FreeRTOSv10.0.1/FreeRTOS/Demo/CORTEX_M0_LPC1114_LPCXpresso/RTOSDemo/Source/Common_Demo_Tasks/include" -I"/home/user/Downloads/freertos/FreeRTOSv10.0.1/FreeRTOS/Demo/CORTEX_M0_LPC1114_LPCXpresso/RTOSDemo/Source" -I"/home/user/Downloads/freertos/FreeRTOSv10.0.1/FreeRTOS/Demo/CORTEX_M0_LPC1114_LPCXpresso/RTOSDemo/Source/FreeRTOS_Source/include" -I"/home/user/Downloads/freertos/FreeRTOSv10.0.1/FreeRTOS/Demo/CORTEX_M0_LPC1114_LPCXpresso/RTOSDemo/Source/FreeRTOS_Source/portable/GCC/ARM_CM0" -O0 -Os -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/cr_startup_lpc11.d" -MT"Source/cr_startup_lpc11.d" -o "Source/cr_startup_lpc11.o" "../Source/cr_startup_lpc11.c"
+
12 ./Source/FreeRTOS_Source/portable/MemMang
../Source/cr_startup_lpc11.c: In function 'pop_registers_from_fault_stack':
+
48 ./Source/FreeRTOS_Source/portable
../Source/cr_startup_lpc11.c:348:23: warning: variable 'stacked_psr' set but not used [-Wunused-but-set-variable]
+
540 ./Source/FreeRTOS_Source/include
volatile unsigned int stacked_psr;
+
900 ./Source/FreeRTOS_Source
                      ^
+
1068 ./Source
../Source/cr_startup_lpc11.c:347:23: warning: variable 'stacked_pc' set but not used [-Wunused-but-set-variable]
+
8 ./.settings
volatile unsigned int stacked_pc;
+
1332 .
                      ^
+
</pre>
../Source/cr_startup_lpc11.c:346:23: warning: variable 'stacked_lr' set but not used [-Wunused-but-set-variable]
+
 
volatile unsigned int stacked_lr;
+
The above figure is a verbose way of showing approximate size of combined build time files such as object files. But this snippet also shows project directories and directory structure. This structure is largely created by the DOS batch file on Windows hosts, and in this case created by the shell script which mimics those same steps. Manually copying this project with these directories then, there should be no need to run the batch file . . .
                      ^
+
 
../Source/cr_startup_lpc11.c:345:23: warning: variable 'stacked_r12' set but not used [-Wunused-but-set-variable]
+
 
volatile unsigned int stacked_r12;
+
<!-- comment -->
                      ^
+
 
../Source/cr_startup_lpc11.c:344:23: warning: variable 'stacked_r3' set but not used [-Wunused-but-set-variable]
+
=== [[#top|^]] Makefile Clues - Deriving A Working Makefile From LPCXpresso Projects ===
volatile unsigned int stacked_r3;
+
 
                      ^
+
<span style="background:#fcf87d;"><i>NOTE:  This section on makefile derivation / porting not yet well organized.  Work here underway - TMH</i></span>
../Source/cr_startup_lpc11.c:343:23: warning: variable 'stacked_r2' set but not used [-Wunused-but-set-variable]
+
 
volatile unsigned int stacked_r2;
+
It's really frustrating to understand how LPCXpresso builds software projects.  LPCXpresso automatically generates a makefile, [[#makefile-generated-by-lpcxpresso|and child makefiles]] in additional subdirectories of its imported and created projects. For example, LPCXpresso creates child makefiles in each directory which contains project sources. These child makefiles are read by the `make` utility recursively, as LPCXpresso calls its choice of `make` with the -r option.
                      ^
+
 
../Source/cr_startup_lpc11.c:342:23: warning: variable 'stacked_r1' set but not used [-Wunused-but-set-variable]
+
Some options which would normally be encapsulated in the makefile are held in some other settings space or stored files of LPCXpresso and passed to the call to make at build time.  This makes it harder to see all the details of the project build recipe, because they're spread out over multiple files, and some options do not even appear to be stored in files.
volatile unsigned int stacked_r1;
+
 
                      ^
+
According to an NXP Community thread, LPCXpresso supports command line based project builds . . .
../Source/cr_startup_lpc11.c:341:23: warning: variable 'stacked_r0' set but not used [-Wunused-but-set-variable]
+
*  https://community.nxp.com/thread/388962
volatile unsigned int stacked_r0;
+
 
                      ^
+
 
Finished building: ../Source/cr_startup_lpc11.c
+
Despite possible command line based builds we have not yet learned how to set this up, and are presently stuck with LPCXpresso's default build process. This build process includes a utility or option called <code>CDT builder</code>, which appears next to a checkbox in one of the dialog boxes under a given project's properties:
+
 
Building file: ../Source/main-blinky.c
+
  Properties --> Builders
Invoking: MCU C Compiler
+
 
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/Downloads/freertos/FreeRTOSv10.0.1/FreeRTOS/Demo/CORTEX_M0_LPC1114_LPCXpresso/RTOSDemo/Source/Common_Demo_Tasks/include" -I"/home/user/Downloads/freertos/FreeRTOSv10.0.1/FreeRTOS/Demo/CORTEX_M0_LPC1114_LPCXpresso/RTOSDemo/Source" -I"/home/user/Downloads/freertos/FreeRTOSv10.0.1/FreeRTOS/Demo/CORTEX_M0_LPC1114_LPCXpresso/RTOSDemo/Source/FreeRTOS_Source/include" -I"/home/user/Downloads/freertos/FreeRTOSv10.0.1/FreeRTOS/Demo/CORTEX_M0_LPC1114_LPCXpresso/RTOSDemo/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/main-blinky.d" -MT"Source/main-blinky.o" -MT"Source/main-blinky.d" -o "Source/main-blinky.o" "../Source/main-blinky.c"
+
[[File:Screenshot--2018-07-03--lpcxpresso-project-properties-dialog-box.png|800px|image 800x600 px]]
Finished building: ../Source/main-blinky.c
+
 
+
A couple of supporting lpcxpresso project makefiles include <code>makefile.init</code> and <code>subdir.mk</code>.  These files contain respectively:
Building file: ../Source/main-full.c
+
 
Invoking: MCU C Compiler
+
<i> Figure x - example makefile.init file:</i>
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/Downloads/freertos/FreeRTOSv10.0.1/FreeRTOS/Demo/CORTEX_M0_LPC1114_LPCXpresso/RTOSDemo/Source/Common_Demo_Tasks/include" -I"/home/user/Downloads/freertos/FreeRTOSv10.0.1/FreeRTOS/Demo/CORTEX_M0_LPC1114_LPCXpresso/RTOSDemo/Source" -I"/home/user/Downloads/freertos/FreeRTOSv10.0.1/FreeRTOS/Demo/CORTEX_M0_LPC1114_LPCXpresso/RTOSDemo/Source/FreeRTOS_Source/include" -I"/home/user/Downloads/freertos/FreeRTOSv10.0.1/FreeRTOS/Demo/CORTEX_M0_LPC1114_LPCXpresso/RTOSDemo/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/main-full.d" -MT"Source/main-full.o" -MT"Source/main-full.d" -o "Source/main-full.o" "../Source/main-full.c"
+
<pre>
Finished building: ../Source/main-full.c
+
      1 PROJECT_NAME=rtos-demo-with-mods
+
      2
Building file: ../Source/main.c
+
      3 LIBRARY_PATHS=\
Invoking: MCU C Compiler
+
      4 -L/opt/nxp/lpcxpresso-8p2p2/lpcxpresso/tools/arm-none-eabi/lib \
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/Downloads/freertos/FreeRTOSv10.0.1/FreeRTOS/Demo/CORTEX_M0_LPC1114_LPCXpresso/RTOSDemo/Source/Common_Demo_Tasks/include" -I"/home/user/Downloads/freertos/FreeRTOSv10.0.1/FreeRTOS/Demo/CORTEX_M0_LPC1114_LPCXpresso/RTOSDemo/Source" -I"/home/user/Downloads/freertos/FreeRTOSv10.0.1/FreeRTOS/Demo/CORTEX_M0_LPC1114_LPCXpresso/RTOSDemo/Source/FreeRTOS_Source/include" -I"/home/user/Downloads/freertos/FreeRTOSv10.0.1/FreeRTOS/Demo/CORTEX_M0_LPC1114_LPCXpresso/RTOSDemo/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/main.d" -MT"Source/main.o" -MT"Source/main.d" -o "Source/main.o" "../Source/main.c"
+
      5 -L/opt/nxp/lpcxpresso-8p2p2/lpcxpresso/tools/lib/gcc/arm-none-eabi/5.4.1
Finished building: ../Source/main.c
+
      6
+
      7
Building target: RTOSDemo.axf
+
      8
Invoking: MCU Linker
+
      9 # --- EOF ---
arm-none-eabi-gcc -nostdlib -L"/home/user/Downloads/freertos/FreeRTOSv10.0.1/FreeRTOS/Demo/CORTEX_M0_LPC1114_LPCXpresso/CMSISv2p00_LPC11xx/Debug" -Xlinker -Map=RTOSDemo.map -Xlinker --gc-sections -mcpu=cortex-m0 -mthumb -T "RTOSDemo_Debug.ld" -o "RTOSDemo.axf"  ./Source/FreeRTOS_Source/portable/MemMang/heap_1.o  ./Source/FreeRTOS_Source/portable/GCC/ARM_CM0/port.o  ./Source/FreeRTOS_Source/list.o ./Source/FreeRTOS_Source/queue.o ./Source/FreeRTOS_Source/tasks.o ./Source/FreeRTOS_Source/timers.o  ./Source/Common_Demo_Tasks/IntQueue.o ./Source/Common_Demo_Tasks/blocktim.o ./Source/Common_Demo_Tasks/countsem.o ./Source/Common_Demo_Tasks/recmutex.o  ./Source/IntQueueTimer.o ./Source/RegTest.o ./Source/cr_startup_lpc11.o ./Source/main-blinky.o ./Source/main-full.o ./Source/main.o  -lCMSISv2p00_LPC11xx
+
</pre>
Finished building target: RTOSDemo.axf
+
 
+
Hmm this one looks hand-crafted by Ted . . . here's another from the FreeRTOS demo project:
make --no-print-directory post-build
+
 
Performing post-build steps
+
<i> Figure x - example makefile.init file:</i>
arm-none-eabi-size RTOSDemo.axf; # arm-none-eabi-objcopy -O binary RTOSDemo.axf RTOSDemo.bin ; checksum -p LPC1114_301 -d RTOSDemo.bin;
+
<pre>
  text   data     bss     dec     hex filename
+
      1 ################################################################################^M
  10568     12   7328   17908   45f4 RTOSDemo.axf
+
      2 # Automatically-generated file. Do not edit!^M
+
      3 ################################################################################^M
 
+
      4 ^M
09:52:06 Build Finished (took 3s.868ms)
+
      5 PATH := $(PATH):C:\PROGRA~2\KPIT\GNUARM~1.02-\ARM-NO~1\ARM-NO~1\bin;C:\PROGRA~2\KPIT\GNUARM~1.02-\ARM-NO~1\ARM-NO~1\libexec\gcc\arm-none-eabi\4.9-GNUARM-NONE_v14.02
 
</pre>
 
</pre>
  
<span id="end_of_lpc_build_output"></span>
+
<i> Figure x - example subdir.mk file:</i>
[[#start_of_lpc_build_output|^ start of LPC's build output]]
+
<pre>
  
So days further down the road we find that LPC'x build output references source file RegTest.c, but this file is not explicitly copied by the original DOS "set up project dirs" batch file, and so also not copied by the bash script version to set up project dirs, headers and source files.  Yet this C file is getting pulled into the project at build time.  Strange, what's the intent here?  Or
+
      1 ################################################################################
 
+
      2 # Automatically-generated file. Do not edit!
QUESTION: &nbsp;is this common to have one or more source files pulled in at build time, while they're not mentioned in any makefile?
+
      3 ################################################################################
 
+
      4
 
+
      5 # Add inputs and outputs from these tool invocations to the build variables
<!-- comment -->
+
      6 C_SRCS += \
 
+
      7 ../Source/IntQueueTimer.c \
== [[#top|^]] Build Issues While Developing Makefile ==
+
      8 ../Source/RegTest.c \
 
+
      9 ../Source/cr_startup_lpc11.c \
2018-06-15 - One of the first issues we encounter while creating a makefile for the FreeRTOS demo targeting LPC1114 processor is gcc's complaint of not finding the specifications file named redlib.specs. Gcc.gnu.org talks about specs files at this page:
+
    10 ../Source/main-blinky.c \
 
+
    11 ../Source/main-full.c \
*  https://gcc.gnu.org/onlinedocs/gcc/Spec-Files.html
+
    12 ../Source/main.c
 
+
    13
Here is our error message:
+
    14 OBJS += \
 
+
    15 ./Source/IntQueueTimer.o \
<pre>
+
    16 ./Source/RegTest.o \
$ make
+
    17 ./Source/cr_startup_lpc11.o \
- ## rtos-demo-with-mods - starting,
+
    18 ./Source/main-blinky.o \
- ## in makefile project name set to 'rtos-demo-with-mods',
+
    19 ./Source/main-full.o \
- ## project root directory set to '/home/user/projects/nxp/rtos-demo',
+
    20 ./Source/main.o
- ## setting compiler flags . . .\n
+
    21
- rtos-demo-with-mods - including common makefile after all var' assignments and recipe declarations,
+
    22 C_DEPS += \
- rtos-demo-with-mods - to bring in often shared information which this project too needs . . .
+
    23 ./Source/IntQueueTimer.d \
- makefile.common - declaring recipes to convert, compile, clean and debug project . . .
+
    24 ./Source/RegTest.d \
- makefile.common - pulling in dependencies of all .o files . . .
+
    25 ./Source/cr_startup_lpc11.d \
- makefile.common - done.
+
    26 ./Source/main-blinky.d \
/usr/bin/arm-none-eabi-gcc -c -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/Downloads/freertos/FreeRTOSv10.0.1/FreeRTOS/Demo/CORTEX_M0_LPC1114_LPCXpresso/RTOSDemo/Source/Common_Demo_Tasks/include" -I"/home/user/Downloads/freertos/FreeRTOSv10.0.1/FreeRTOS/Demo/CORTEX_M0_LPC1114_LPCXpresso/RTOSDemo/Source" -I"/home/user/Downloads/freertos/FreeRTOSv10.0.1/FreeRTOS/Demo/CORTEX_M0_LPC1114_LPCXpresso/RTOSDemo/Source/FreeRTOS_Source/include" -I"/home/user/Downloads/freertos/FreeRTOSv10.0.1/FreeRTOS/Demo/CORTEX_M0_LPC1114_LPCXpresso/RTOSDemo/Source/FreeRTOS_Source/portable/GCC/ARM_CM0" -O0 -g3 -Wall -fmessage-length=0 -fno-builtin -ffunction-sections -fdata-sections -Wextra -mcpu=cortex-m0 -mthumb -D__REDLIB__ -specs=redlib.specs -MMD -MP ./Source/FreeRTOS_Source/portable/MemMang/heap_1.c -o heap_1.o
+
    27 ./Source/main-full.d \
arm-none-eabi-gcc: error: redlib.specs: No such file or directory
+
    28 ./Source/main.d
makefile.common:105: recipe for target 'heap_1.o' failed
+
    29
make: *** [heap_1.o] Error 1
+
    30
 
+
    31 # Each subdirectory must supply rules for building sources it contributes
$
+
    32 Source/%.o: ../Source/%.c
 +
    33        @echo 'Building file: $<'
 +
    34        @echo 'Invoking: MCU C Compiler'
 +
    35        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/Downloads/freertos/FreeRTOSv10.0.1/FreeRTOS/Demo/CORTEX_M0_LPC1114_LPCXpresso/RTOSDemo/Source/Common_Demo_Tasks/include" -I"/home/user/Downloads/freertos/FreeRTOSv10.0.1/FreeRTOS/Demo/CORTEX_M0_LPC1114_LPCXpresso/RTOSDemo/Source" -I"/home/user/Downloads/freertos/FreeRTOSv10.0.1/FreeRTOS/Demo/CORTEX_M0_LPC1114_LPCXpresso/RTOSDemo/Source/FreeRTOS_Source/include" -I"/home/user/Downloads/freertos/FreeRTOSv10.0.1/FreeRTOS/Demo/CORTEX_M0_LPC1114_LPCXpresso/RTOSDemo/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"$(@:%.o=%.d)" -MT"$(@:%.o=%.o)" -MT"$(@:%.o=%.d)" -o "$@" "$<"
 +
    36        @echo 'Finished building: $<'
 +
    37        @echo ' '
 +
    38
 +
    39 Source/cr_startup_lpc11.o: ../Source/cr_startup_lpc11.c
 +
    40        @echo 'Building file: $<'
 +
    41        @echo 'Invoking: MCU C Compiler'
 +
    42        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/Downloads/freertos/FreeRTOSv10.0.1/FreeRTOS/Demo/CORTEX_M0_LPC1114_LPCXpresso/RTOSDemo/Source/Common_Demo_Tasks/include" -I"/home/user/Downloads/freertos/FreeRTOSv10.0.1/FreeRTOS/Demo/CORTEX_M0_LPC1114_LPCXpresso/RTOSDemo/Source" -I"/home/user/Downloads/freertos/FreeRTOSv10.0.1/FreeRTOS/Demo/CORTEX_M0_LPC1114_LPCXpresso/RTOSDemo/Source/FreeRTOS_Source/include" -I"/home/user/Downloads/freertos/FreeRTOSv10.0.1/FreeRTOS/Demo/CORTEX_M0_LPC1114_LPCXpresso/RTOSDemo/Source/FreeRTOS_Source/portable/GCC/ARM_CM0" -O0 -Os -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"$(@:%.o=%.d)" -MT"Source/cr_startup_lpc11.d" -o "$@" "$<"
 +
    43        @echo 'Finished building: $<'
 +
    44        @echo ' '
 +
    45
 +
    46
 
</pre>
 
</pre>
  
  
We've solved a couple of simple vpath and -I include path problems, but are running into something maybe more subtle or obscure.  Gcc is getting an assembly file and does not know how to compile this assembly:
+
- 2018-07-12 -
 +
 
 +
And here is an interesting line from the .cproject file:
  
<i>Figure x - snippet of assembly file confusion . . .</i>
+
      23    <builder arguments="-r" buildPath="${workspace_loc:/rtos-demo-3/Debug}" command="make" id="com.crt.advproject.builder.exe.debug.1260101970" keepEnvironmentInBuildfile="false" managedBuildOn="true" name="Gnu Make Builder" superClass="com.crt.advproject.builder.exe.debug"/>^M
  
<pre>
 
  .
 
  .
 
  .
 
/usr/bin/arm-none-eabi-gcc -c -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/Downloads/freertos/FreeRTOSv10.0.1/FreeRTOS/Demo/CORTEX_M0_LPC1114_LPCXpresso/RTOSDemo/Source/Common_Demo_Tasks/include" -I"/home/user/Downloads/freertos/FreeRTOSv10.0.1/FreeRTOS/Demo/CORTEX_M0_LPC1114_LPCXpresso/RTOSDemo/Source" -I"/home/user/Downloads/freertos/FreeRTOSv10.0.1/FreeRTOS/Demo/CORTEX_M0_LPC1114_LPCXpresso/RTOSDemo/Source/FreeRTOS_Source/include" -I"/home/user/Downloads/freertos/FreeRTOSv10.0.1/FreeRTOS/Demo/CORTEX_M0_LPC1114_LPCXpresso/RTOSDemo/Source/FreeRTOS_Source/portable/GCC/ARM_CM0" -I"/opt/nxp/lpcxpresso-8p2p2/lpcxpresso/tools/arm-none-eabi/include" -I"/opt/nxp/lpcxpresso-8p2p2/lpcxpresso/tools/lib/gcc/arm-none-eabi/5.4.1/include" -O0 -g3 -Wall -fmessage-length=0 -fno-builtin -ffunction-sections -fdata-sections -Wextra -mcpu=cortex-m0 -mthumb -D__REDLIB__ -specs=/opt/nxp/lpcxpresso-8p2p2/lpcxpresso/tools/arm-none-eabi/lib/redlib.specs -MMD -MP ./Source/FreeRTOS_Source/portable/GCC/ARM_CM0/port.c -o port.o
 
/tmp/cc6yN6nv.s: Assembler messages:
 
/tmp/cc6yN6nv.s:232: Error: cannot honor width suffix -- `mov r1,#255'
 
/tmp/cc6yN6nv.s:233: Error: cannot honor width suffix -- `lsl r1,r1,#16'
 
/tmp/cc6yN6nv.s:234: Error: cannot honor width suffix -- `orr r2,r1'
 
/tmp/cc6yN6nv.s:240: Error: cannot honor width suffix -- `mov r1,#255'
 
/tmp/cc6yN6nv.s:241: Error: cannot honor width suffix -- `lsl r1,r1,#24'
 
/tmp/cc6yN6nv.s:242: Error: cannot honor width suffix -- `orr r2,r1'
 
/tmp/cc6yN6nv.s:248: Error: cannot honor width suffix -- `mov r2,#0'
 
/tmp/cc6yN6nv.s:257: Error: cannot honor width suffix -- `mov r3,#0'
 
/tmp/cc6yN6nv.s:290: Error: cannot honor width suffix -- `mov r3,#250'
 
/tmp/cc6yN6nv.s:291: Error: cannot honor width suffix -- `lsl r3,r3,#2'
 
/tmp/cc6yN6nv.s:331: Error: cannot honor width suffix -- `mov r2,#128'
 
/tmp/cc6yN6nv.s:332: Error: cannot honor width suffix -- `lsl r2,r2,#21'
 
/tmp/cc6yN6nv.s:378: Error: lo register required -- `add r2,r3,#1'
 
/tmp/cc6yN6nv.s:433: Error: lo register required -- `sub r2,r3,#1'
 
/tmp/cc6yN6nv.s:586: Error: cannot honor width suffix -- `mov r2,#128'
 
/tmp/cc6yN6nv.s:587: Error: cannot honor width suffix -- `lsl r2,r2,#21'
 
/tmp/cc6yN6nv.s:626: Error: cannot honor width suffix -- `mov r2,#0'
 
/tmp/cc6yN6nv.s:630: Error: cannot honor width suffix -- `mov r2,#0'
 
/tmp/cc6yN6nv.s:637: Error: cannot honor width suffix -- `mov r3,#250'
 
/tmp/cc6yN6nv.s:638: Error: cannot honor width suffix -- `lsl r1,r3,#2'
 
/tmp/cc6yN6nv.s:641: Error: lo register required -- `sub r3,r3,#1'
 
/tmp/cc6yN6nv.s:645: Error: cannot honor width suffix -- `mov r2,#7'
 
makefile.common:108: recipe for target 'port.o' failed
 
make: *** [port.o] Error 1
 
  
 +
=== [[#top|^]] What we know about LPCXpresso project makefiles ===
 +
 +
What we know so far about LPCXpresso project makefiles:  LPCXPresso projects typically use multiple makefiles, including a "top level" makefile which includes several other makefiles.  The called makefiles include:
 +
 +
  *  makefile.init
 +
  *  makefile.deps
 +
  *  sources.mk
 +
  *  objects.mk
 +
 +
and one of the following subdir makefiles for each project directory which holds sources:
 +
 +
  *  subdir.mk
 +
 +
It looks also as though these files come pre-built and bundled with the FreeRTOS demo, which includes a port to LPC1114 family microcontrollers.  Since they're already present in the downloadable project / port from FreeRTOS dot org, we can't as easily know or find out how these files are or were originally created.  All of the makefiles begin with a comment block which warns "DO NOT EDIT":
 +
 +
<pre>
 +
      1 ################################################################################
 +
      2 # Automatically-generated file. Do not edit!
 +
      3 ################################################################################
 
</pre>
 
</pre>
  
<!-- comment -->
 
  
=== [[#top|^]] <i>arm-none-eabi-as: cannot honor width suffix</i> ===
+
Here are the instances of subdir makefiles:
 
+
 
*  https://github.com/ARMmbed/mbed-cli/issues/554
+
<code>
 +
$ locate <font color="red">subdir.mk</font> | grep Downloads | grep <font color="red">subdir.mk</font>
 +
/home/${USER}/Downloads/freertos/FreeRTOSv10.0.1/FreeRTOS/Demo/CORTEX_M0_LPC1114_LPCXpresso/CMSISv2p00_LPC11xx/Debug/src/<font color="red">subdir.mk</font>
 +
/home/${USER}/Downloads/freertos/FreeRTOSv10.0.1/FreeRTOS/Demo/CORTEX_M0_LPC1114_LPCXpresso/RTOSDemo/Debug/Source/<font color="red">subdir.mk</font>
 +
/home/${USER}/Downloads/freertos/FreeRTOSv10.0.1/FreeRTOS/Demo/CORTEX_M0_LPC1114_LPCXpresso/RTOSDemo/Debug/Source/Common_Demo_Tasks/<font color="red">subdir.mk</font>
 +
/home/${USER}/Downloads/freertos/FreeRTOSv10.0.1/FreeRTOS/Demo/CORTEX_M0_LPC1114_LPCXpresso/RTOSDemo/Debug/Source/FreeRTOS_Source/<font color="red">subdir.mk</font>
 +
/home/${USER}/Downloads/freertos/FreeRTOSv10.0.1/FreeRTOS/Demo/CORTEX_M0_LPC1114_LPCXpresso/RTOSDemo/Debug/Source/FreeRTOS_Source/portable/GCC/ARM_CM0/<font color="red">subdir.mk</font>
 +
/home/${USER}/Downloads/freertos/FreeRTOSv10.0.1/FreeRTOS/Demo/CORTEX_M0_LPC1114_LPCXpresso/RTOSDemo/Debug/Source/FreeRTOS_Source/portable/MemMang/<font color="red">subdir.mk</font>
 +
</code>
 +
 
  
  
 
<!-- comment -->
 
<!-- comment -->
  
=== [[#top|^]]  <i>edit point - LPCXpresso make output compare GNU make output</i> ===
+
<!-- === <i>edit point - build messages</i> === -->
  
Comparing LPCXpresso build console output with GNU make output at command line, the "hand rolled" makefile way, see build output messages captured in figure after this paragraph.  Ted noting also that we now have a better idea why the hand-crafted GNU makefile isn't fully building the project.  This capture doesn't reflect some of the issues we've -- since its taking -- discovered how the subdir.mk files add to the LPC project make rules list, as well as adding tokens to vars C_DEPS, OBJS and C_SRCS.  Here is the comparative build process output:
+
=== [[#top|^]] LPC build messages ===
  
<pre>
+
Build messages from LPCXpresso 8p2p2 CDT builder here on [[rtos_demo_3_build_messages|wiki page 'rtos-demo-3 build messages']].  Next figure or excerpt ahead shows a complete capture of a FreeRTOS demo firmware build as built by LPCXpresso's calls to make.
FROM LPCXPRESSO BUILD CONSOLE:
 
  
make -r all
+
Article contributor Ted noting here that these build messages tell a lot about the build process but also leave a lot of the recipe's details out. For example, it's not obvious from these compiler messages that the build process is described by multiple makefiles. It's also not always obvious what environment variable settings the 'make' utility -- in this case LPCXpresso -- and its called commands enjoy as they run. One clue to this effect is how LPC's build messages show a specifications file option <i>-specs=redlib.specs</i> which names an extent file but not its full path. How does the compiler know where to look for this file?  There must be a search path variable somewhere. Unfortunately GNU GCC's web documentation doesn't go into any detail about the way in which gcc searched for specs files.
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/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/Downloads/freertos/FreeRTOSv10.0.1/FreeRTOS/Demo/CORTEX_M0_LPC1114_LPCXpresso/RTOSDemo/Source/Common_Demo_Tasks/include" -I"/home/user/Downloads/freertos/FreeRTOSv10.0.1/FreeRTOS/Demo/CORTEX_M0_LPC1114_LPCXpresso/RTOSDemo/Source" -I"/home/user/Downloads/freertos/FreeRTOSv10.0.1/FreeRTOS/Demo/CORTEX_M0_LPC1114_LPCXpresso/RTOSDemo/Source/FreeRTOS_Source/include" -I"/home/user/Downloads/freertos/FreeRTOSv10.0.1/FreeRTOS/Demo/CORTEX_M0_LPC1114_LPCXpresso/RTOSDemo/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
 
  
HAND-ROLLED:
+
<i><b>2018-07-16 NOTE:</b>  lines of the build messages excerpted below contain [https://gcc.gnu.org/onlinedocs/gcc/Preprocessor-Options.html#Preprocessor-Options -MT and -MF compiler options].  In the excerpts these are followed by specific source files, but in the subdir.mk makefiles these are followed by pattern substitution rules.</i>
 +
 
 +
<i><b>2018-07-26 NOTE:</b>  following line from .cproject file hints at variable which holds path to the Redlib specs files:
 +
    315        <runAction arguments="-c 'gcc -E -P -v -dD &quot;${plugin_state_location}/${specs_file}&quot;'" command="sh" useDefault="true"/>
 +
</i>
 +
 
 +
All the same here is the LPCXpresso output of a successful build of FreeRTOS demo program targeted for the LPC1114 Cortex-M0 processor:
  
/usr/bin/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/Downloads/freertos/FreeRTOSv10.0.1/FreeRTOS/Demo/CORTEX_M0_LPC1114_LPCXpresso/RTOSDemo/Source/Common_Demo_Tasks/include" -I"/home/user/Downloads/freertos/FreeRTOSv10.0.1/FreeRTOS/Demo/CORTEX_M0_LPC1114_LPCXpresso/RTOSDemo/Source" -I"/home/user/Downloads/freertos/FreeRTOSv10.0.1/FreeRTOS/Demo/CORTEX_M0_LPC1114_LPCXpresso/RTOSDemo/Source/FreeRTOS_Source/include" -I"/home/user/Downloads/freertos/FreeRTOSv10.0.1/FreeRTOS/Demo/CORTEX_M0_LPC1114_LPCXpresso/RTOSDemo/Source/FreeRTOS_Source/portable/GCC/ARM_CM0" -I"/opt/nxp/lpcxpresso-8p2p2/lpcxpresso/tools/arm-none-eabi/include" -I"/opt/nxp/lpcxpresso-8p2p2/lpcxpresso/tools/lib/gcc/arm-none-eabi/5.4.1/include" -O0 -g3 -Wall -fmessage-length=0 -fno-builtin -ffunction-sections -fdata-sections -Wextra -mcpu=cortex-m0 -mthumb -D__REDLIB__ -specs=/opt/nxp/lpcxpresso-8p2p2/lpcxpresso/tools/arm-none-eabi/lib/redlib.specs -MMD -MP -c ./Source/FreeRTOS_Source/portable/MemMang/heap_1.c -o heap_1.o
 
</pre>
 
 
<span style="id:background-light-green; background-color: #b2f9ba">
 
<i>TO-DO 2018-06-25:  break out the above two compiler invocations into one option per line, for easier comparison, - TMH</i>
 
</span>
 
  
 +
<span id="start_of_lpc_build_output"></span>
 +
[[#end_of_lpc_build_output|<b>v</b> end of LPC's build output]]
 +
<i> Figure x - Build output from LPCXpresso console:</i>
  
 
<pre>
 
<pre>
arm-none-eabi-gcc                                       /usr/bin/arm-none-eabi-gcc
+
09:52:03 **** Build of configuration Debug for project RTOSDemo ****
-D__REDLIB__                                           -D__REDLIB__
+
make -r all
-DDEBUG                                                -DDEBUG
+
Building file: ../Source/FreeRTOS_Source/portable/MemMang/heap_1.c
-D__CODE_RED                                           -D__CODE_RED
+
Invoking: MCU C Compiler
-D__USE_CMSIS=CMSISv2p00_LPC11xx                       -D__USE_CMSIS=CMSISv2p00_LPC11xx
+
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/Downloads/freertos/FreeRTOSv10.0.1/FreeRTOS/Demo/CORTEX_M0_LPC1114_LPCXpresso/RTOSDemo/Source/Common_Demo_Tasks/include" -I"/home/user/Downloads/freertos/FreeRTOSv10.0.1/FreeRTOS/Demo/CORTEX_M0_LPC1114_LPCXpresso/RTOSDemo/Source" -I"/home/user/Downloads/freertos/FreeRTOSv10.0.1/FreeRTOS/Demo/CORTEX_M0_LPC1114_LPCXpresso/RTOSDemo/Source/FreeRTOS_Source/include" -I"/home/user/Downloads/freertos/FreeRTOSv10.0.1/FreeRTOS/Demo/CORTEX_M0_LPC1114_LPCXpresso/RTOSDemo/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"
( -I options - long lines )                            ( -I options - long lines )
+
Finished building: ../Source/FreeRTOS_Source/portable/MemMang/heap_1.c
-O0                                                    -O0 
+
-g3                                                    -g3
+
Building file: ../Source/FreeRTOS_Source/portable/GCC/ARM_CM0/port.c
-Wall                                                  -Wall
+
Invoking: MCU C Compiler
-c
+
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/Downloads/freertos/FreeRTOSv10.0.1/FreeRTOS/Demo/CORTEX_M0_LPC1114_LPCXpresso/RTOSDemo/Source/Common_Demo_Tasks/include" -I"/home/user/Downloads/freertos/FreeRTOSv10.0.1/FreeRTOS/Demo/CORTEX_M0_LPC1114_LPCXpresso/RTOSDemo/Source" -I"/home/user/Downloads/freertos/FreeRTOSv10.0.1/FreeRTOS/Demo/CORTEX_M0_LPC1114_LPCXpresso/RTOSDemo/Source/FreeRTOS_Source/include" -I"/home/user/Downloads/freertos/FreeRTOSv10.0.1/FreeRTOS/Demo/CORTEX_M0_LPC1114_LPCXpresso/RTOSDemo/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/GCC/ARM_CM0/port.d" -MT"Source/FreeRTOS_Source/portable/GCC/ARM_CM0/port.o" -MT"Source/FreeRTOS_Source/portable/GCC/ARM_CM0/port.d" -o "Source/FreeRTOS_Source/portable/GCC/ARM_CM0/port.o" "../Source/FreeRTOS_Source/portable/GCC/ARM_CM0/port.c"
-fmessage-length=0                                     -fmessage-length=0
+
Finished building: ../Source/FreeRTOS_Source/portable/GCC/ARM_CM0/port.c
-fno-builtin                                          -fno-builtin
+
-ffunction-sections                                    -ffunction-sections
+
Building file: ../Source/FreeRTOS_Source/list.c
-fdata-sections                                        -fdata-sections
+
Invoking: MCU C Compiler
-Wextra                                                -Wextra
+
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/Downloads/freertos/FreeRTOSv10.0.1/FreeRTOS/Demo/CORTEX_M0_LPC1114_LPCXpresso/RTOSDemo/Source/Common_Demo_Tasks/include" -I"/home/user/Downloads/freertos/FreeRTOSv10.0.1/FreeRTOS/Demo/CORTEX_M0_LPC1114_LPCXpresso/RTOSDemo/Source" -I"/home/user/Downloads/freertos/FreeRTOSv10.0.1/FreeRTOS/Demo/CORTEX_M0_LPC1114_LPCXpresso/RTOSDemo/Source/FreeRTOS_Source/include" -I"/home/user/Downloads/freertos/FreeRTOSv10.0.1/FreeRTOS/Demo/CORTEX_M0_LPC1114_LPCXpresso/RTOSDemo/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/list.d" -MT"Source/FreeRTOS_Source/list.o" -MT"Source/FreeRTOS_Source/list.d" -o "Source/FreeRTOS_Source/list.o" "../Source/FreeRTOS_Source/list.c"
-mcpu=cortex-m0                                        -mcpu=cortex-m0
+
Finished building: ../Source/FreeRTOS_Source/list.c
-mthumb                                                -mthumb
+
-D__REDLIB__                                          -D__REDLIB__
+
Building file: ../Source/FreeRTOS_Source/queue.c
-specs=redlib.specs                                    -specs=/opt/nxp/lpcxpresso-8p2p2/lpcxpresso/tools/arm-none-eabi/lib/redlib.specs
+
Invoking: MCU C Compiler
-MMD                                                  -MMD      ./Source/FreeRTOS_Source/portable/MemMang/heap_1.c -o heap_1.o
+
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/Downloads/freertos/FreeRTOSv10.0.1/FreeRTOS/Demo/CORTEX_M0_LPC1114_LPCXpresso/RTOSDemo/Source/Common_Demo_Tasks/include" -I"/home/user/Downloads/freertos/FreeRTOSv10.0.1/FreeRTOS/Demo/CORTEX_M0_LPC1114_LPCXpresso/RTOSDemo/Source" -I"/home/user/Downloads/freertos/FreeRTOSv10.0.1/FreeRTOS/Demo/CORTEX_M0_LPC1114_LPCXpresso/RTOSDemo/Source/FreeRTOS_Source/include" -I"/home/user/Downloads/freertos/FreeRTOSv10.0.1/FreeRTOS/Demo/CORTEX_M0_LPC1114_LPCXpresso/RTOSDemo/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/queue.d" -MT"Source/FreeRTOS_Source/queue.o" -MT"Source/FreeRTOS_Source/queue.d" -o "Source/FreeRTOS_Source/queue.o" "../Source/FreeRTOS_Source/queue.c"
-MP                                                    -MP
+
Finished building: ../Source/FreeRTOS_Source/queue.c
-MF"Source/FreeRTOS_Source/portable/MemMang/heap_1.d"
+
-MT"Source/FreeRTOS_Source/portable/MemMang/heap_1.o"
+
Building file: ../Source/FreeRTOS_Source/tasks.c
-MT"Source/FreeRTOS_Source/portable/MemMang/heap_1.d"
+
Invoking: MCU C Compiler
-o
+
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/Downloads/freertos/FreeRTOSv10.0.1/FreeRTOS/Demo/CORTEX_M0_LPC1114_LPCXpresso/RTOSDemo/Source/Common_Demo_Tasks/include" -I"/home/user/Downloads/freertos/FreeRTOSv10.0.1/FreeRTOS/Demo/CORTEX_M0_LPC1114_LPCXpresso/RTOSDemo/Source" -I"/home/user/Downloads/freertos/FreeRTOSv10.0.1/FreeRTOS/Demo/CORTEX_M0_LPC1114_LPCXpresso/RTOSDemo/Source/FreeRTOS_Source/include" -I"/home/user/Downloads/freertos/FreeRTOSv10.0.1/FreeRTOS/Demo/CORTEX_M0_LPC1114_LPCXpresso/RTOSDemo/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/tasks.d" -MT"Source/FreeRTOS_Source/tasks.o" -MT"Source/FreeRTOS_Source/tasks.d" -o "Source/FreeRTOS_Source/tasks.o" "../Source/FreeRTOS_Source/tasks.c"
"Source/FreeRTOS_Source/portable/MemMang/heap_1.o"
+
Finished building: ../Source/FreeRTOS_Source/tasks.c
"../Source/FreeRTOS_Source/portable/MemMang/heap_1.c"
+
                                                      -c
+
Building file: ../Source/FreeRTOS_Source/timers.c
                                                      ./Source/FreeRTOS_Source/portable/MemMang/heap_1.c
+
Invoking: MCU C Compiler
                                                      -o
+
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/Downloads/freertos/FreeRTOSv10.0.1/FreeRTOS/Demo/CORTEX_M0_LPC1114_LPCXpresso/RTOSDemo/Source/Common_Demo_Tasks/include" -I"/home/user/Downloads/freertos/FreeRTOSv10.0.1/FreeRTOS/Demo/CORTEX_M0_LPC1114_LPCXpresso/RTOSDemo/Source" -I"/home/user/Downloads/freertos/FreeRTOSv10.0.1/FreeRTOS/Demo/CORTEX_M0_LPC1114_LPCXpresso/RTOSDemo/Source/FreeRTOS_Source/include" -I"/home/user/Downloads/freertos/FreeRTOSv10.0.1/FreeRTOS/Demo/CORTEX_M0_LPC1114_LPCXpresso/RTOSDemo/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/timers.d" -MT"Source/FreeRTOS_Source/timers.o" -MT"Source/FreeRTOS_Source/timers.d" -o "Source/FreeRTOS_Source/timers.o" "../Source/FreeRTOS_Source/timers.c"
                                                      heap_1.o
+
Finished building: ../Source/FreeRTOS_Source/timers.c
 
+
 
+
Building file: ../Source/Common_Demo_Tasks/IntQueue.c
The -I include paths of each captured `make` output:
+
Invoking: MCU C Compiler
 
+
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/Downloads/freertos/FreeRTOSv10.0.1/FreeRTOS/Demo/CORTEX_M0_LPC1114_LPCXpresso/RTOSDemo/Source/Common_Demo_Tasks/include" -I"/home/user/Downloads/freertos/FreeRTOSv10.0.1/FreeRTOS/Demo/CORTEX_M0_LPC1114_LPCXpresso/RTOSDemo/Source" -I"/home/user/Downloads/freertos/FreeRTOSv10.0.1/FreeRTOS/Demo/CORTEX_M0_LPC1114_LPCXpresso/RTOSDemo/Source/FreeRTOS_Source/include" -I"/home/user/Downloads/freertos/FreeRTOSv10.0.1/FreeRTOS/Demo/CORTEX_M0_LPC1114_LPCXpresso/RTOSDemo/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/Common_Demo_Tasks/IntQueue.d" -MT"Source/Common_Demo_Tasks/IntQueue.o" -MT"Source/Common_Demo_Tasks/IntQueue.d" -o "Source/Common_Demo_Tasks/IntQueue.o" "../Source/Common_Demo_Tasks/IntQueue.c"
-I"/home/user/Downloads/freertos/FreeRTOSv10.0.1/FreeRTOS/Demo/CORTEX_M0_LPC1114_LPCXpresso/CMSISv2p00_LPC11xx/inc"                              -I"/home/user/Downloads/freertos/FreeRTOSv10.0.1/FreeRTOS/Demo/CORTEX_M0_LPC1114_LPCXpresso/CMSISv2p00_LPC11xx/inc"
+
Finished building: ../Source/Common_Demo_Tasks/IntQueue.c
-I"/home/user/Downloads/freertos/tmp/FreeRTOSv10.0.1/FreeRTOS/Demo/CORTEX_M0_LPC1114_LPCXpresso/CMSISv2p00_LPC11xx/inc"
+
-I"../../../Common/include"
+
Building file: ../Source/Common_Demo_Tasks/blocktim.c
-I"/home/user/Downloads/freertos/FreeRTOSv10.0.1/FreeRTOS/Demo/CORTEX_M0_LPC1114_LPCXpresso/RTOSDemo/Source/Common_Demo_Tasks/include"
+
Invoking: MCU C Compiler
-I"/home/user/Downloads/freertos/FreeRTOSv10.0.1/FreeRTOS/Demo/CORTEX_M0_LPC1114_LPCXpresso/RTOSDemo/Source"
+
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/Downloads/freertos/FreeRTOSv10.0.1/FreeRTOS/Demo/CORTEX_M0_LPC1114_LPCXpresso/RTOSDemo/Source/Common_Demo_Tasks/include" -I"/home/user/Downloads/freertos/FreeRTOSv10.0.1/FreeRTOS/Demo/CORTEX_M0_LPC1114_LPCXpresso/RTOSDemo/Source" -I"/home/user/Downloads/freertos/FreeRTOSv10.0.1/FreeRTOS/Demo/CORTEX_M0_LPC1114_LPCXpresso/RTOSDemo/Source/FreeRTOS_Source/include" -I"/home/user/Downloads/freertos/FreeRTOSv10.0.1/FreeRTOS/Demo/CORTEX_M0_LPC1114_LPCXpresso/RTOSDemo/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/Common_Demo_Tasks/blocktim.d" -MT"Source/Common_Demo_Tasks/blocktim.o" -MT"Source/Common_Demo_Tasks/blocktim.d" -o "Source/Common_Demo_Tasks/blocktim.o" "../Source/Common_Demo_Tasks/blocktim.c"
-I"/home/user/Downloads/freertos/FreeRTOSv10.0.1/FreeRTOS/Demo/CORTEX_M0_LPC1114_LPCXpresso/RTOSDemo/Source/FreeRTOS_Source/include"
+
Finished building: ../Source/Common_Demo_Tasks/blocktim.c
-I"/home/user/Downloads/freertos/FreeRTOSv10.0.1/FreeRTOS/Demo/CORTEX_M0_LPC1114_LPCXpresso/RTOSDemo/Source/FreeRTOS_Source/portable/GCC/ARM_CM0"
+
</pre>
+
Building file: ../Source/Common_Demo_Tasks/countsem.c
 
+
Invoking: MCU C Compiler
 
+
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/Downloads/freertos/FreeRTOSv10.0.1/FreeRTOS/Demo/CORTEX_M0_LPC1114_LPCXpresso/RTOSDemo/Source/Common_Demo_Tasks/include" -I"/home/user/Downloads/freertos/FreeRTOSv10.0.1/FreeRTOS/Demo/CORTEX_M0_LPC1114_LPCXpresso/RTOSDemo/Source" -I"/home/user/Downloads/freertos/FreeRTOSv10.0.1/FreeRTOS/Demo/CORTEX_M0_LPC1114_LPCXpresso/RTOSDemo/Source/FreeRTOS_Source/include" -I"/home/user/Downloads/freertos/FreeRTOSv10.0.1/FreeRTOS/Demo/CORTEX_M0_LPC1114_LPCXpresso/RTOSDemo/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/Common_Demo_Tasks/countsem.d" -MT"Source/Common_Demo_Tasks/countsem.o" -MT"Source/Common_Demo_Tasks/countsem.d" -o "Source/Common_Demo_Tasks/countsem.o" "../Source/Common_Demo_Tasks/countsem.c"
Ok a lot going on here. Also noting that when gcc given -v option for more verbose output, there are some non-existent paths which gcc mentions, which are expressed in the redlib.specs file.  These don't look like a source of problems.  Also notice there are two identical but differently named instances of the cross-assembler gnu-none-eabi-as:
+
Finished building: ../Source/Common_Demo_Tasks/countsem.c
 
+
<i>Figure x - </i>
+
Building file: ../Source/Common_Demo_Tasks/recmutex.c
 
+
Invoking: MCU C Compiler
<pre>
+
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/Downloads/freertos/FreeRTOSv10.0.1/FreeRTOS/Demo/CORTEX_M0_LPC1114_LPCXpresso/RTOSDemo/Source/Common_Demo_Tasks/include" -I"/home/user/Downloads/freertos/FreeRTOSv10.0.1/FreeRTOS/Demo/CORTEX_M0_LPC1114_LPCXpresso/RTOSDemo/Source" -I"/home/user/Downloads/freertos/FreeRTOSv10.0.1/FreeRTOS/Demo/CORTEX_M0_LPC1114_LPCXpresso/RTOSDemo/Source/FreeRTOS_Source/include" -I"/home/user/Downloads/freertos/FreeRTOSv10.0.1/FreeRTOS/Demo/CORTEX_M0_LPC1114_LPCXpresso/RTOSDemo/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/Common_Demo_Tasks/recmutex.d" -MT"Source/Common_Demo_Tasks/recmutex.o" -MT"Source/Common_Demo_Tasks/recmutex.d" -o "Source/Common_Demo_Tasks/recmutex.o" "../Source/Common_Demo_Tasks/recmutex.c"
$ diff /usr/bin/arm-none-eabi-as /usr/lib/arm-none-eabi/bin/as
+
Finished building: ../Source/Common_Demo_Tasks/recmutex.c
 
+
$ file /usr/bin/arm-none-eabi-as
+
Building file: ../Source/IntQueueTimer.c
/usr/bin/arm-none-eabi-as: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), dynamically linked, interpreter /lib/ld-linux.so.2, for GNU/Linux 2.6.32, BuildID[sha1]=f5a9351dcc0223be42093524a835a2a3dff2b84f, stripped
+
Invoking: MCU C Compiler
 
+
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/Downloads/freertos/FreeRTOSv10.0.1/FreeRTOS/Demo/CORTEX_M0_LPC1114_LPCXpresso/RTOSDemo/Source/Common_Demo_Tasks/include" -I"/home/user/Downloads/freertos/FreeRTOSv10.0.1/FreeRTOS/Demo/CORTEX_M0_LPC1114_LPCXpresso/RTOSDemo/Source" -I"/home/user/Downloads/freertos/FreeRTOSv10.0.1/FreeRTOS/Demo/CORTEX_M0_LPC1114_LPCXpresso/RTOSDemo/Source/FreeRTOS_Source/include" -I"/home/user/Downloads/freertos/FreeRTOSv10.0.1/FreeRTOS/Demo/CORTEX_M0_LPC1114_LPCXpresso/RTOSDemo/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/IntQueueTimer.d" -MT"Source/IntQueueTimer.o" -MT"Source/IntQueueTimer.d" -o "Source/IntQueueTimer.o" "../Source/IntQueueTimer.c"
$ file /usr/lib/arm-none-eabi/bin/as
+
Finished building: ../Source/IntQueueTimer.c
/usr/lib/arm-none-eabi/bin/as: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), dynamically linked, interpreter /lib/ld-linux.so.2, for GNU/Linux 2.6.32, BuildID[sha1]=f5a9351dcc0223be42093524a835a2a3dff2b84f, stripped
+
 
+
Building file: ../Source/RegTest.c
$
+
Invoking: MCU C Compiler
</pre>
+
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/Downloads/freertos/FreeRTOSv10.0.1/FreeRTOS/Demo/CORTEX_M0_LPC1114_LPCXpresso/RTOSDemo/Source/Common_Demo_Tasks/include" -I"/home/user/Downloads/freertos/FreeRTOSv10.0.1/FreeRTOS/Demo/CORTEX_M0_LPC1114_LPCXpresso/RTOSDemo/Source" -I"/home/user/Downloads/freertos/FreeRTOSv10.0.1/FreeRTOS/Demo/CORTEX_M0_LPC1114_LPCXpresso/RTOSDemo/Source/FreeRTOS_Source/include" -I"/home/user/Downloads/freertos/FreeRTOSv10.0.1/FreeRTOS/Demo/CORTEX_M0_LPC1114_LPCXpresso/RTOSDemo/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/RegTest.d" -MT"Source/RegTest.o" -MT"Source/RegTest.d" -o "Source/RegTest.o" "../Source/RegTest.c"
 
+
Finished building: ../Source/RegTest.c
=== [[#top|^]] <i>edit point - gcc 6.3 or newer may be needed</i> ===
+
 
+
Building file: ../Source/cr_startup_lpc11.c
An obscure error appears now with our call to the GNU assembler, which gives a complaint about width suffixes in one of FreeRTOS demo assembly files.  Per https://sourceforge.net/p/freertos/discussion/382005/thread/8041642a/ we may need a newer version of gcc, e.g. 6.3 over 4.x in order to get past the error:
+
Invoking: MCU C Compiler
 
+
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/Downloads/freertos/FreeRTOSv10.0.1/FreeRTOS/Demo/CORTEX_M0_LPC1114_LPCXpresso/RTOSDemo/Source/Common_Demo_Tasks/include" -I"/home/user/Downloads/freertos/FreeRTOSv10.0.1/FreeRTOS/Demo/CORTEX_M0_LPC1114_LPCXpresso/RTOSDemo/Source" -I"/home/user/Downloads/freertos/FreeRTOSv10.0.1/FreeRTOS/Demo/CORTEX_M0_LPC1114_LPCXpresso/RTOSDemo/Source/FreeRTOS_Source/include" -I"/home/user/Downloads/freertos/FreeRTOSv10.0.1/FreeRTOS/Demo/CORTEX_M0_LPC1114_LPCXpresso/RTOSDemo/Source/FreeRTOS_Source/portable/GCC/ARM_CM0" -O0 -Os -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/cr_startup_lpc11.d" -MT"Source/cr_startup_lpc11.d" -o "Source/cr_startup_lpc11.o" "../Source/cr_startup_lpc11.c"
<pre>
+
../Source/cr_startup_lpc11.c: In function 'pop_registers_from_fault_stack':
GNU assembler version 2.25 (arm-none-eabi) using BFD version (2.25-5+5+b1) 2.25
+
../Source/cr_startup_lpc11.c:348:23: warning: variable 'stacked_psr' set but not used [-Wunused-but-set-variable]
/tmp/cc8oKrpj.s: Assembler messages:
+
volatile unsigned int stacked_psr;
/tmp/cc8oKrpj.s:232: Error: cannot honor width suffix -- `mov r1,#255'
+
                      ^
/tmp/cc8oKrpj.s:233: Error: cannot honor width suffix -- `lsl r1,r1,#16'
+
../Source/cr_startup_lpc11.c:347:23: warning: variable 'stacked_pc' set but not used [-Wunused-but-set-variable]
/tmp/cc8oKrpj.s:234: Error: cannot honor width suffix -- `orr r2,r1'
+
volatile unsigned int stacked_pc;
  .
+
                      ^
  .
+
../Source/cr_startup_lpc11.c:346:23: warning: variable 'stacked_lr' set but not used [-Wunused-but-set-variable]
  .
+
volatile unsigned int stacked_lr;
</pre>
+
                      ^
 
+
../Source/cr_startup_lpc11.c:345:23: warning: variable 'stacked_r12' set but not used [-Wunused-but-set-variable]
 
+
volatile unsigned int stacked_r12;
<!-- comment -->
+
                      ^
 
+
../Source/cr_startup_lpc11.c:344:23: warning: variable 'stacked_r3' set but not used [-Wunused-but-set-variable]
=== [[#top|^]] <i>edit point - link time issues</i> ===
+
volatile unsigned int stacked_r3;
 
+
                      ^
2018-07-06 Friday
+
../Source/cr_startup_lpc11.c:343:23: warning: variable 'stacked_r2' set but not used [-Wunused-but-set-variable]
 
+
volatile unsigned int stacked_r2;
Link time issues can come up before all sources have been built. The linker `ld` or similar needs to know where project-related libraries are on the local file system. Here in the next figure / build excerpt are messages showing the linker not finding certain library function definitions:
+
                      ^
 
+
../Source/cr_startup_lpc11.c:342:23: warning: variable 'stacked_r1' set but not used [-Wunused-but-set-variable]
<pre>
+
volatile unsigned int stacked_r1;
$ make -f Makefile
+
                      ^
- Makefile.common - declaring recipes to convert, compile, clean and debug project . . .
+
../Source/cr_startup_lpc11.c:341:23: warning: variable 'stacked_r0' set but not used [-Wunused-but-set-variable]
- Makefile.common - pulling in dependencies of all .o files . . .
+
volatile unsigned int stacked_r0;
- Makefile.common - done.
+
                      ^
zz - Project name set to '',
+
Finished building: ../Source/cr_startup_lpc11.c
zz - additional library paths also set in 'LIBRARY_PATHS' variable,
+
/usr/bin/arm-none-eabi-gcc  -o .elf  ./Source/FreeRTOS_Source/portable/MemMang/heap_1.o  ./Source/FreeRTOS_Source/portable/GCC/ARM_CM0/port.o  ./Source/FreeRTOS_Source/list.o ./Source/FreeRTOS_Source/queue.o ./Source/FreeRTOS_Source/tasks.o ./Source/FreeRTOS_Source/timers../Source/Common_Demo_Tasks/IntQueue.o ./Source/Common_Demo_Tasks/blocktim.o ./Source/Common_Demo_Tasks/countsem.o ./Source/Common_Demo_Tasks/recmutex.o  ./Source/IntQueueTimer.o ./Source/RegTest.o ./Source/cr_startup_lpc11.o ./Source/main-blinky.o ./Source/main-full.o ./Source/main.o 
+
Building file: ../Source/main-blinky.c
/usr/lib/gcc/arm-none-eabi/4.8/../../../arm-none-eabi/lib/libc.a(lib_a-exit.o): In function `exit':
+
Invoking: MCU C Compiler
/home/tin/projects/debian/arm-toolchain/collab-maint/newlib/build/arm-none-eabi/newlib/libc/stdlib/../../../../../newlib/libc/stdlib/exit.c:70: undefined reference to `_exit'
+
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/Downloads/freertos/FreeRTOSv10.0.1/FreeRTOS/Demo/CORTEX_M0_LPC1114_LPCXpresso/RTOSDemo/Source/Common_Demo_Tasks/include" -I"/home/user/Downloads/freertos/FreeRTOSv10.0.1/FreeRTOS/Demo/CORTEX_M0_LPC1114_LPCXpresso/RTOSDemo/Source" -I"/home/user/Downloads/freertos/FreeRTOSv10.0.1/FreeRTOS/Demo/CORTEX_M0_LPC1114_LPCXpresso/RTOSDemo/Source/FreeRTOS_Source/include" -I"/home/user/Downloads/freertos/FreeRTOSv10.0.1/FreeRTOS/Demo/CORTEX_M0_LPC1114_LPCXpresso/RTOSDemo/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/main-blinky.d" -MT"Source/main-blinky.o" -MT"Source/main-blinky.d" -o "Source/main-blinky.o" "../Source/main-blinky.c"
./Source/FreeRTOS_Source/portable/GCC/ARM_CM0/port.o: In function `prvSetupTimerInterrupt':
+
Finished building: ../Source/main-blinky.c
/home/user/projects/nxp/rtos-demo-3/Debug/../Source/FreeRTOS_Source/portable/GCC/ARM_CM0/port.c:360: undefined reference to `SystemCoreClock'
+
./Source/IntQueueTimer.o: In function `vInitialiseTimerForIntQueueTest':
+
Building file: ../Source/main-full.c
/home/user/projects/nxp/rtos-demo-3/Debug/../Source/IntQueueTimer.c:79: undefined reference to `SystemCoreClock'
+
Invoking: MCU C Compiler
./Source/cr_startup_lpc11.o: In function `ResetISR':
+
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/Downloads/freertos/FreeRTOSv10.0.1/FreeRTOS/Demo/CORTEX_M0_LPC1114_LPCXpresso/RTOSDemo/Source/Common_Demo_Tasks/include" -I"/home/user/Downloads/freertos/FreeRTOSv10.0.1/FreeRTOS/Demo/CORTEX_M0_LPC1114_LPCXpresso/RTOSDemo/Source" -I"/home/user/Downloads/freertos/FreeRTOSv10.0.1/FreeRTOS/Demo/CORTEX_M0_LPC1114_LPCXpresso/RTOSDemo/Source/FreeRTOS_Source/include" -I"/home/user/Downloads/freertos/FreeRTOSv10.0.1/FreeRTOS/Demo/CORTEX_M0_LPC1114_LPCXpresso/RTOSDemo/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/main-full.d" -MT"Source/main-full.o" -MT"Source/main-full.d" -o "Source/main-full.o" "../Source/main-full.c"
/home/user/projects/nxp/rtos-demo-3/Debug/../Source/cr_startup_lpc11.c:301: undefined reference to `SystemInit'
+
Finished building: ../Source/main-full.c
/home/user/projects/nxp/rtos-demo-3/Debug/../Source/cr_startup_lpc11.c:313: undefined reference to `__main'
+
/home/user/projects/nxp/rtos-demo-3/Debug/../Source/cr_startup_lpc11.c:313: undefined reference to `__data_section_table'
+
Building file: ../Source/main.c
/home/user/projects/nxp/rtos-demo-3/Debug/../Source/cr_startup_lpc11.c:313: undefined reference to `__data_section_table_end'
+
Invoking: MCU C Compiler
/home/user/projects/nxp/rtos-demo-3/Debug/../Source/cr_startup_lpc11.c:313: undefined reference to `__bss_section_table_end'
+
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/Downloads/freertos/FreeRTOSv10.0.1/FreeRTOS/Demo/CORTEX_M0_LPC1114_LPCXpresso/RTOSDemo/Source/Common_Demo_Tasks/include" -I"/home/user/Downloads/freertos/FreeRTOSv10.0.1/FreeRTOS/Demo/CORTEX_M0_LPC1114_LPCXpresso/RTOSDemo/Source" -I"/home/user/Downloads/freertos/FreeRTOSv10.0.1/FreeRTOS/Demo/CORTEX_M0_LPC1114_LPCXpresso/RTOSDemo/Source/FreeRTOS_Source/include" -I"/home/user/Downloads/freertos/FreeRTOSv10.0.1/FreeRTOS/Demo/CORTEX_M0_LPC1114_LPCXpresso/RTOSDemo/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/main.d" -MT"Source/main.o" -MT"Source/main.d" -o "Source/main.o" "../Source/main.c"
./Source/cr_startup_lpc11.o:(.isr_vector+0x0): undefined reference to `_vStackTop'
+
Finished building: ../Source/main.c
./Source/main.o: In function `prvSetupHardware':
+
/home/user/projects/nxp/rtos-demo-3/Debug/../Source/main.c:162: undefined reference to `_vStackTop'
+
Building target: RTOSDemo.axf
/home/user/projects/nxp/rtos-demo-3/Debug/../Source/main.c:162: undefined reference to `_pvHeapStart'
+
Invoking: MCU Linker
./Source/main.o: In function `vApplicationTickHook':
+
arm-none-eabi-gcc -nostdlib -L"/home/user/Downloads/freertos/FreeRTOSv10.0.1/FreeRTOS/Demo/CORTEX_M0_LPC1114_LPCXpresso/CMSISv2p00_LPC11xx/Debug" -Xlinker -Map=RTOSDemo.map -Xlinker --gc-sections -mcpu=cortex-m0 -mthumb -T "RTOSDemo_Debug.ld" -o "RTOSDemo.axf"  ./Source/FreeRTOS_Source/portable/MemMang/heap_1.o  ./Source/FreeRTOS_Source/portable/GCC/ARM_CM0/port.o  ./Source/FreeRTOS_Source/list.o ./Source/FreeRTOS_Source/queue.o ./Source/FreeRTOS_Source/tasks.o ./Source/FreeRTOS_Source/timers.o  ./Source/Common_Demo_Tasks/IntQueue.o ./Source/Common_Demo_Tasks/blocktim.o ./Source/Common_Demo_Tasks/countsem.o ./Source/Common_Demo_Tasks/recmutex.o  ./Source/IntQueueTimer.o ./Source/RegTest.o ./Source/cr_startup_lpc11.o ./Source/main-blinky.o ./Source/main-full.o ./Source/main.o  -lCMSISv2p00_LPC11xx
/home/user/projects/nxp/rtos-demo-3/Debug/../Source/main.c:226: undefined reference to `_pvHeapStart'
+
Finished building target: RTOSDemo.axf
collect2: error: ld returned 1 exit status
+
../Makefile.common:107: recipe for target '.elf' failed
+
make --no-print-directory post-build
make: *** [.elf] Error 1
+
Performing post-build steps
 +
arm-none-eabi-size RTOSDemo.axf; # arm-none-eabi-objcopy -O binary RTOSDemo.axf RTOSDemo.bin ; checksum -p LPC1114_301 -d RTOSDemo.bin;
 +
  text   data     bss     dec     hex filename
 +
  10568     12   7328   17908   45f4 RTOSDemo.axf
 +
  
$
+
09:52:06 Build Finished (took 3s.868ms)
 
</pre>
 
</pre>
  
From the 'create-directory-structure' script we know that all needed library files are copied into the directory hierarchy of FreeRTOS demo port to LPC1114.  We're going to search for the patterns '_exit' and 'SystemCoreClock' starting at the root directory of this project:
+
<span id="end_of_lpc_build_output"></span>
 
+
[[#start_of_lpc_build_output|^ start of LPC's build output]]
<i>Figure x -</i>
 
 
 
<pre>
 
 
 
$
 
</pre>
 
  
 +
So days further down the road we find that LPC'x build output references source file RegTest.c, but this file is not explicitly copied by the original DOS "set up project dirs" batch file, and so also not copied by the bash script version to set up project dirs, headers and source files.  Yet this C file is getting pulled into the project at build time.  Strange, what's the intent here?  Or
  
 +
QUESTION: &nbsp;is this common to have one or more source files pulled in at build time, while they're not mentioned in any makefile?
  
  
 
<!-- comment -->
 
<!-- comment -->
  
<span id="makefile-generated-by-lpcxpresso"></span>
+
=== [[#top|^]] Build Issues While Developing Makefile ===
  
== [[#top|^]] Makefile Generated By LPCXpresso ==
+
2018-06-15 - One of the first issues we encounter while creating a makefile for the FreeRTOS demo targeting LPC1114 processor is gcc's complaint of not finding the specifications file named redlib.specs.  Gcc.gnu.org talks about specs files at this page:
  
First the reference which told us to look in the project (in this case workspace/RTOSdemo) directory for a makefile:
+
*  https://gcc.gnu.org/onlinedocs/gcc/Spec-Files.html
  
*  https://stackoverflow.com/questions/4331960/where-is-the-makefile-generated-by-the-eclipse-cdt
+
Here is our error message:
 
 
Now the 54 line makefile:
 
  
 
<pre>
 
<pre>
################################################################################
+
$ make
# Automatically-generated file. Do not edit!
+
- ## rtos-demo-with-mods - starting,
################################################################################
+
- ## in makefile project name set to 'rtos-demo-with-mods',
 +
- ## project root directory set to '/home/user/projects/nxp/rtos-demo',
 +
- ## setting compiler flags . . .\n
 +
- rtos-demo-with-mods - including common makefile after all var' assignments and recipe declarations,
 +
- rtos-demo-with-mods - to bring in often shared information which this project too needs . . .
 +
- makefile.common - declaring recipes to convert, compile, clean and debug project . . .
 +
- makefile.common - pulling in dependencies of all .o files . . .
 +
- makefile.common - done.
 +
/usr/bin/arm-none-eabi-gcc -c -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/Downloads/freertos/FreeRTOSv10.0.1/FreeRTOS/Demo/CORTEX_M0_LPC1114_LPCXpresso/RTOSDemo/Source/Common_Demo_Tasks/include" -I"/home/user/Downloads/freertos/FreeRTOSv10.0.1/FreeRTOS/Demo/CORTEX_M0_LPC1114_LPCXpresso/RTOSDemo/Source" -I"/home/user/Downloads/freertos/FreeRTOSv10.0.1/FreeRTOS/Demo/CORTEX_M0_LPC1114_LPCXpresso/RTOSDemo/Source/FreeRTOS_Source/include" -I"/home/user/Downloads/freertos/FreeRTOSv10.0.1/FreeRTOS/Demo/CORTEX_M0_LPC1114_LPCXpresso/RTOSDemo/Source/FreeRTOS_Source/portable/GCC/ARM_CM0" -O0 -g3 -Wall -fmessage-length=0 -fno-builtin -ffunction-sections -fdata-sections -Wextra -mcpu=cortex-m0 -mthumb -D__REDLIB__ -specs=redlib.specs -MMD -MP ./Source/FreeRTOS_Source/portable/MemMang/heap_1.c -o heap_1.o
 +
arm-none-eabi-gcc: error: redlib.specs: No such file or directory
 +
makefile.common:105: recipe for target 'heap_1.o' failed
 +
make: *** [heap_1.o] Error 1
  
-include ../makefile.init
+
$
 +
</pre>
  
RM := rm -rf
 
  
# All of the sources participating in the build are defined here
+
We've solved a couple of simple vpath and -I include path problems, but are running into something maybe more subtle or obscure. Gcc is getting an assembly file and does not know how to compile this assembly:
-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)
+
<i>Figure x - snippet of assembly file confusion . . .</i>
ifneq ($(strip $(C_DEPS)),)
 
-include $(C_DEPS)
 
endif
 
endif
 
  
-include ../makefile.defs
+
<pre>
 
+
  .
# Add inputs and outputs from these tool invocations to the build variables
+
  .
 
+
  .
# All Target
+
/usr/bin/arm-none-eabi-gcc -c -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/Downloads/freertos/FreeRTOSv10.0.1/FreeRTOS/Demo/CORTEX_M0_LPC1114_LPCXpresso/RTOSDemo/Source/Common_Demo_Tasks/include" -I"/home/user/Downloads/freertos/FreeRTOSv10.0.1/FreeRTOS/Demo/CORTEX_M0_LPC1114_LPCXpresso/RTOSDemo/Source" -I"/home/user/Downloads/freertos/FreeRTOSv10.0.1/FreeRTOS/Demo/CORTEX_M0_LPC1114_LPCXpresso/RTOSDemo/Source/FreeRTOS_Source/include" -I"/home/user/Downloads/freertos/FreeRTOSv10.0.1/FreeRTOS/Demo/CORTEX_M0_LPC1114_LPCXpresso/RTOSDemo/Source/FreeRTOS_Source/portable/GCC/ARM_CM0" -I"/opt/nxp/lpcxpresso-8p2p2/lpcxpresso/tools/arm-none-eabi/include" -I"/opt/nxp/lpcxpresso-8p2p2/lpcxpresso/tools/lib/gcc/arm-none-eabi/5.4.1/include" -O0 -g3 -Wall -fmessage-length=0 -fno-builtin -ffunction-sections -fdata-sections -Wextra -mcpu=cortex-m0 -mthumb -D__REDLIB__ -specs=/opt/nxp/lpcxpresso-8p2p2/lpcxpresso/tools/arm-none-eabi/lib/redlib.specs -MMD -MP ./Source/FreeRTOS_Source/portable/GCC/ARM_CM0/port.c -o port.o
all: RTOSDemo.axf
+
/tmp/cc6yN6nv.s: Assembler messages:
 
+
/tmp/cc6yN6nv.s:232: Error: cannot honor width suffix -- `mov r1,#255'
# Tool invocations
+
/tmp/cc6yN6nv.s:233: Error: cannot honor width suffix -- `lsl r1,r1,#16'
RTOSDemo.axf: $(OBJS) $(USER_OBJS)
+
/tmp/cc6yN6nv.s:234: Error: cannot honor width suffix -- `orr r2,r1'
        @echo 'Building target: $@'
+
/tmp/cc6yN6nv.s:240: Error: cannot honor width suffix -- `mov r1,#255'
        @echo 'Invoking: MCU Linker'
+
/tmp/cc6yN6nv.s:241: Error: cannot honor width suffix -- `lsl r1,r1,#24'
        arm-none-eabi-gcc -nostdlib -L"/home/user/Downloads/freertos/FreeRTOSv10.0.1/FreeRTOS/Demo/CORTEX_M0_LPC1114_LPCXpresso/CMSISv2p00_LPC11xx/Debug" -Xlinker -Map=RTOSDemo.map -Xlinker --gc-sections -mcpu=cortex-m0 -mthumb -T "RTOSDemo_Debug.ld" -o "RTOSDemo.axf" $(OBJS) $(USER_OBJS) $(LIBS)
+
/tmp/cc6yN6nv.s:242: Error: cannot honor width suffix -- `orr r2,r1'
        @echo 'Finished building target: $@'
+
/tmp/cc6yN6nv.s:248: Error: cannot honor width suffix -- `mov r2,#0'
        @echo ' '
+
/tmp/cc6yN6nv.s:257: Error: cannot honor width suffix -- `mov r3,#0'
        $(MAKE) --no-print-directory post-build
+
/tmp/cc6yN6nv.s:290: Error: cannot honor width suffix -- `mov r3,#250'
 +
/tmp/cc6yN6nv.s:291: Error: cannot honor width suffix -- `lsl r3,r3,#2'
 +
/tmp/cc6yN6nv.s:331: Error: cannot honor width suffix -- `mov r2,#128'
 +
/tmp/cc6yN6nv.s:332: Error: cannot honor width suffix -- `lsl r2,r2,#21'
 +
/tmp/cc6yN6nv.s:378: Error: lo register required -- `add r2,r3,#1'
 +
/tmp/cc6yN6nv.s:433: Error: lo register required -- `sub r2,r3,#1'
 +
/tmp/cc6yN6nv.s:586: Error: cannot honor width suffix -- `mov r2,#128'
 +
/tmp/cc6yN6nv.s:587: Error: cannot honor width suffix -- `lsl r2,r2,#21'
 +
/tmp/cc6yN6nv.s:626: Error: cannot honor width suffix -- `mov r2,#0'
 +
/tmp/cc6yN6nv.s:630: Error: cannot honor width suffix -- `mov r2,#0'
 +
/tmp/cc6yN6nv.s:637: Error: cannot honor width suffix -- `mov r3,#250'
 +
/tmp/cc6yN6nv.s:638: Error: cannot honor width suffix -- `lsl r1,r3,#2'
 +
/tmp/cc6yN6nv.s:641: Error: lo register required -- `sub r3,r3,#1'
 +
/tmp/cc6yN6nv.s:645: Error: cannot honor width suffix -- `mov r2,#7'
 +
makefile.common:108: recipe for target 'port.o' failed
 +
make: *** [port.o] Error 1
 +
 
 +
</pre>
  
# Other Targets
+
<!-- comment -->
clean:
 
        -$(RM) $(EXECUTABLES)$(OBJS)$(C_DEPS) RTOSDemo.axf
 
        -@echo ' '
 
  
post-build:
+
==== [[#top|^]] <i>arm-none-eabi-as: cannot honor width suffix</i> ====
        -@echo 'Performing post-build steps'
 
        -arm-none-eabi-size RTOSDemo.axf; # arm-none-eabi-objcopy -O binary RTOSDemo.axf RTOSDemo.bin ; checksum -p LPC1114_301 -d RTOSDemo.bin;
 
        -@echo ' '
 
  
.PHONY: all clean dependents
+
*  https://github.com/ARMmbed/mbed-cli/issues/554
.SECONDARY: post-build
 
  
-include ../makefile.targets
 
</pre>
 
  
This makefile alone does not tell us a lot about how LPCXpresso is constructing and using makefiles for project builds.  However, the -include stanzas lead us to some clues.  Specifically many of the -includes reference "child" makefiles in various project sources directories.  These makefiles are all like named 'subdir.mk'.
+
<!-- comment -->
  
Each subdir.mk file amends three make variables: C_SRCS, OBJS and C_DEPS.  This variable amending itself is useful in the primary makefile, when by the time all subdir.mk files have been included the primary makefile now has a list of all project sources.  The problem however is that each subdir.mk file also defines a target and build recipe for a subset of project sources.  These targets are added to the dependency graph built by `make`, and it seems kludgey at best to -- if possible within a GNU makefile -- select and delete certain rules from the dependency graph mid-way through processing a makefile.  By mid-way we're thinking after all -include directive processing and before named rule processing.
+
=== [[#top|^]] <i>edit point - LPCXpresso make output compare GNU make output</i> ===
  
Regarding `make` targets or rules see:
+
Comparing LPCXpresso build console output with GNU make output at command line, the "hand rolled" makefile way, see build output messages captured in figure after this paragraph.  Ted noting also that we now have a better idea why the hand-crafted GNU makefile isn't fully building the project.  This capture doesn't reflect some of the issues we've -- since its taking -- discovered how the subdir.mk files add to the LPC project make rules list, as well as adding tokens to vars C_DEPS, OBJS and C_SRCS.  Here is the comparative build process output:
  
<ul>
+
<pre>
*  https://gist.github.com/pvdb/777954
+
FROM LPCXPRESSO BUILD CONSOLE:
</ul>
 
  
Checking to see whether and how the rules differ among FreeRTOS demo subdir.mk files:
+
make -r all
 
+
Building file: ../Source/FreeRTOS_Source/portable/MemMang/heap_1.c
<i>Figure x -</i>
+
Invoking: MCU C Compiler
 +
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/Downloads/freertos/FreeRTOSv10.0.1/FreeRTOS/Demo/CORTEX_M0_LPC1114_LPCXpresso/RTOSDemo/Source/Common_Demo_Tasks/include" -I"/home/user/Downloads/freertos/FreeRTOSv10.0.1/FreeRTOS/Demo/CORTEX_M0_LPC1114_LPCXpresso/RTOSDemo/Source" -I"/home/user/Downloads/freertos/FreeRTOSv10.0.1/FreeRTOS/Demo/CORTEX_M0_LPC1114_LPCXpresso/RTOSDemo/Source/FreeRTOS_Source/include" -I"/home/user/Downloads/freertos/FreeRTOSv10.0.1/FreeRTOS/Demo/CORTEX_M0_LPC1114_LPCXpresso/RTOSDemo/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
  
<pre>
+
HAND-ROLLED:
FreeRTOS LPC1114 Demo source file directories:
 
  
(1) Source/Common_Demo_Tasks \
+
/usr/bin/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/Downloads/freertos/FreeRTOSv10.0.1/FreeRTOS/Demo/CORTEX_M0_LPC1114_LPCXpresso/RTOSDemo/Source/Common_Demo_Tasks/include" -I"/home/user/Downloads/freertos/FreeRTOSv10.0.1/FreeRTOS/Demo/CORTEX_M0_LPC1114_LPCXpresso/RTOSDemo/Source" -I"/home/user/Downloads/freertos/FreeRTOSv10.0.1/FreeRTOS/Demo/CORTEX_M0_LPC1114_LPCXpresso/RTOSDemo/Source/FreeRTOS_Source/include" -I"/home/user/Downloads/freertos/FreeRTOSv10.0.1/FreeRTOS/Demo/CORTEX_M0_LPC1114_LPCXpresso/RTOSDemo/Source/FreeRTOS_Source/portable/GCC/ARM_CM0" -I"/opt/nxp/lpcxpresso-8p2p2/lpcxpresso/tools/arm-none-eabi/include" -I"/opt/nxp/lpcxpresso-8p2p2/lpcxpresso/tools/lib/gcc/arm-none-eabi/5.4.1/include" -O0 -g3 -Wall -fmessage-length=0 -fno-builtin -ffunction-sections -fdata-sections -Wextra -mcpu=cortex-m0 -mthumb -D__REDLIB__ -specs=/opt/nxp/lpcxpresso-8p2p2/lpcxpresso/tools/arm-none-eabi/lib/redlib.specs -MMD -MP -c ./Source/FreeRTOS_Source/portable/MemMang/heap_1.c -o heap_1.o
(2) Source/FreeRTOS_Source \
 
(3) Source/FreeRTOS_Source/portable/GCC/ARM_CM0 \
 
(4) Source/FreeRTOS_Source/portable/MemMang \
 
(5) Source
 
 
 
 
 
Options to gcc for each rule in give source file directory file named subdir.mk:
 
 
 
(1) 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"$(@:%.o=%.d)" -MT"$(@:%.o=%.o)" -MT"$(@:%.o=%.d)" -o "$@" "$<"
 
(2) 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"$(@:%.o=%.d)" -MT"$(@:%.o=%.o)" -MT"$(@:%.o=%.d)" -o "$@" "$<"
 
(3) 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"$(@:%.o=%.d)" -MT"$(@:%.o=%.o)" -MT"$(@:%.o=%.d)" -o "$@" "$<"
 
(4) 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"$(@:%.o=%.d)" -MT"$(@:%.o=%.o)" -MT"$(@:%.o=%.d)" -o "$@" "$<"
 
(5) 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"$(@:%.o=%.d)" -MT"$(@:%.o=%.o)" -MT"$(@:%.o=%.d)" -o "$@" "$<"
 
(5) 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 -Os -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"$(@:%.o=%.d)" -MT"Source/cr_startup_lpc11.d" -o "$@" "$<"
 
 
</pre>
 
</pre>
  
 +
<span style="id:background-light-green; background-color: #b2f9ba">
 +
<i>TO-DO 2018-06-25:  break out the above two compiler invocations into one option per line, for easier comparison, - TMH</i>
 +
</span>
  
<!-- comment -->
 
 
=== [[#top|^]] <i>edit point - finding and pointing make to .a library files </i> ===
 
 
On Thursday, yesterday, we found a makefile created by LPCXpresso or one of its called tools, in the Debug directory of our RTOSDemo project instance.  Working now with a copy of that makefile in a project we did not import, nor unzip from a zip archive, but started out as a general C/C++ project.  <span id="to-do--2018-06-15--document-lpcxpresso-project-creation"><b>TO DO:</b></span>  Contributor Ted notes here that we must retrace those project creation steps so we know thoroughly how to get a project off the ground in the LPCXpresso IDE.
 
 
There are different types of library files in C and C++ projects, library files which can be linked in to a binary at compile time or loaded at run time.  On the Linux and GCC side it may be necessary to point `make` to dot a archive type library files, by using the -L option . . .
 
  
 
<pre>
 
<pre>
$ locate libcr_c.a
+
arm-none-eabi-gcc                                      /usr/bin/arm-none-eabi-gcc
/opt/nxp/lpcxpresso-8p2p2/lpcxpresso/tools/arm-none-eabi/lib/libcr_c.a
+
-D__REDLIB__                                          -D__REDLIB__
/opt/nxp/lpcxpresso-8p2p2/lpcxpresso/tools/arm-none-eabi/lib/armv6-m/libcr_c.a
+
-DDEBUG                                                -DDEBUG
/opt/nxp/lpcxpresso-8p2p2/lpcxpresso/tools/arm-none-eabi/lib/armv7-m/libcr_c.a
+
-D__CODE_RED                                          -D__CODE_RED
/opt/nxp/lpcxpresso-8p2p2/lpcxpresso/tools/arm-none-eabi/lib/armv7e-m/libcr_c.a
+
-D__USE_CMSIS=CMSISv2p00_LPC11xx                      -D__USE_CMSIS=CMSISv2p00_LPC11xx
/opt/nxp/lpcxpresso-8p2p2/lpcxpresso/tools/arm-none-eabi/lib/armv7e-m/fpu/libcr_c.a
+
( -I options - long lines )                            ( -I options - long lines )
/opt/nxp/lpcxpresso-8p2p2/lpcxpresso/tools/arm-none-eabi/lib/armv7e-m/softfp/libcr_c.a
+
-O0                                                    -O0 
/opt/nxp/lpcxpresso-8p2p2/lpcxpresso/tools/arm-none-eabi/lib/thumb/libcr_c.a
+
-g3                                                    -g3
 
+
-Wall                                                  -Wall
$ ls -l /opt/nxp/lpcxpresso-8p2p2/lpcxpresso/tools/arm-none-eabi/lib/libcr_c.a /opt/nxp/lpcxpresso-8p2p2/lpcxpresso/tools/arm-none-eabi/lib/thumb/libcr_c.a
+
-c
-rwxr-xr-x 1 root root 235420 Jul 21  2016 /opt/nxp/lpcxpresso-8p2p2/lpcxpresso/tools/arm-none-eabi/lib/libcr_c.a
+
-fmessage-length=0                                    -fmessage-length=0
-rwxr-xr-x 1 root root 216552 Jul 21  2016 /opt/nxp/lpcxpresso-8p2p2/lpcxpresso/tools/arm-none-eabi/lib/thumb/libcr_c.a
+
-fno-builtin                                          -fno-builtin
 +
-ffunction-sections                                    -ffunction-sections
 +
-fdata-sections                                        -fdata-sections
 +
-Wextra                                                -Wextra
 +
-mcpu=cortex-m0                                        -mcpu=cortex-m0
 +
-mthumb                                                -mthumb
 +
-D__REDLIB__                                          -D__REDLIB__
 +
-specs=redlib.specs                                    -specs=/opt/nxp/lpcxpresso-8p2p2/lpcxpresso/tools/arm-none-eabi/lib/redlib.specs
 +
-MMD                                                  -MMD      ./Source/FreeRTOS_Source/portable/MemMang/heap_1.c -o heap_1.o
 +
-MP                                                    -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"
 +
                                                      -c
 +
                                                      ./Source/FreeRTOS_Source/portable/MemMang/heap_1.c
 +
                                                      -o
 +
                                                      heap_1.o
 +
 
 +
 
 +
The -I include paths of each captured `make` output:
  
$ locate libcr_eabihelpers.a
+
-I"/home/user/Downloads/freertos/FreeRTOSv10.0.1/FreeRTOS/Demo/CORTEX_M0_LPC1114_LPCXpresso/CMSISv2p00_LPC11xx/inc"                              -I"/home/user/Downloads/freertos/FreeRTOSv10.0.1/FreeRTOS/Demo/CORTEX_M0_LPC1114_LPCXpresso/CMSISv2p00_LPC11xx/inc"
/opt/nxp/lpcxpresso-8p2p2/lpcxpresso/tools/lib/gcc/arm-none-eabi/5.4.1/libcr_eabihelpers.a
+
-I"/home/user/Downloads/freertos/tmp/FreeRTOSv10.0.1/FreeRTOS/Demo/CORTEX_M0_LPC1114_LPCXpresso/CMSISv2p00_LPC11xx/inc"
/opt/nxp/lpcxpresso-8p2p2/lpcxpresso/tools/lib/gcc/arm-none-eabi/5.4.1/armv6-m/libcr_eabihelpers.a
+
-I"../../../Common/include"
/opt/nxp/lpcxpresso-8p2p2/lpcxpresso/tools/lib/gcc/arm-none-eabi/5.4.1/armv7-m/libcr_eabihelpers.a
+
-I"/home/user/Downloads/freertos/FreeRTOSv10.0.1/FreeRTOS/Demo/CORTEX_M0_LPC1114_LPCXpresso/RTOSDemo/Source/Common_Demo_Tasks/include"
/opt/nxp/lpcxpresso-8p2p2/lpcxpresso/tools/lib/gcc/arm-none-eabi/5.4.1/armv7e-m/libcr_eabihelpers.a
+
-I"/home/user/Downloads/freertos/FreeRTOSv10.0.1/FreeRTOS/Demo/CORTEX_M0_LPC1114_LPCXpresso/RTOSDemo/Source"
/opt/nxp/lpcxpresso-8p2p2/lpcxpresso/tools/lib/gcc/arm-none-eabi/5.4.1/armv7e-m/fpu/libcr_eabihelpers.a
+
-I"/home/user/Downloads/freertos/FreeRTOSv10.0.1/FreeRTOS/Demo/CORTEX_M0_LPC1114_LPCXpresso/RTOSDemo/Source/FreeRTOS_Source/include"
/opt/nxp/lpcxpresso-8p2p2/lpcxpresso/tools/lib/gcc/arm-none-eabi/5.4.1/armv7e-m/softfp/libcr_eabihelpers.a
+
-I"/home/user/Downloads/freertos/FreeRTOSv10.0.1/FreeRTOS/Demo/CORTEX_M0_LPC1114_LPCXpresso/RTOSDemo/Source/FreeRTOS_Source/portable/GCC/ARM_CM0"
/opt/nxp/lpcxpresso-8p2p2/lpcxpresso/tools/lib/gcc/arm-none-eabi/5.4.1/thumb/libcr_eabihelpers.a
 
 
 
$
 
 
</pre>
 
</pre>
  
  
=== [[#top|^]] <i>edit point - linker not finding symbol defined in .ld file </i> ===
+
Ok a lot going on here.  Also noting that when gcc given -v option for more verbose output, there are some non-existent paths which gcc mentions, which are expressed in the redlib.specs file.  These don't look like a source of problems.  Also notice there are two identical but differently named instances of the cross-assembler gnu-none-eabi-as:
  
Linker having trouble finding <code>ResetISR</code>, which is defined in a .c file but nowhere defined in any header file . . .
+
<i>Figure x - </i>
  
 
<pre>
 
<pre>
$ grep -nr ResetISR ./*
+
$ diff /usr/bin/arm-none-eabi-as /usr/lib/arm-none-eabi/bin/as
./rtos-demo-with-mods/Debug/RTOSDemo_Debug.ld:14:ENTRY(ResetISR)
+
 
./rtos-demo-with-mods/Debug/RTOSDemo_Debug.ld:110:                                        + (ResetISR + 1)
+
$ file /usr/bin/arm-none-eabi-as
./rtos-demo-with-mods/Debug/RTOSDemo.map:963:                0x00000120                ResetISR
+
/usr/bin/arm-none-eabi-as: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), dynamically linked, interpreter /lib/ld-linux.so.2, for GNU/Linux 2.6.32, BuildID[sha1]=f5a9351dcc0223be42093524a835a2a3dff2b84f, stripped
./rtos-demo-with-mods/Debug/RTOSDemo.map:1393:                [!provide]                PROVIDE (__valid_user_code_checksum, (0x0 - (((_vStackTop + (ResetISR + 0x1)) + (DEFINED (NMI_Handler)?NMI_Handler:M0_NMI_Handler + 0x1)) + (DEFINED (HardFault_Handler)?HardFault_Handler:M0_HardFault_Handler + 0x1))))
+
 
./rtos-demo-with-mods/Source/cr_startup_lpc11.c:66:    void ResetISR(void);
+
$ file /usr/lib/arm-none-eabi/bin/as
./rtos-demo-with-mods/Source/cr_startup_lpc11.c:138:    ResetISR,                               // The reset handler
+
/usr/lib/arm-none-eabi/bin/as: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), dynamically linked, interpreter /lib/ld-linux.so.2, for GNU/Linux 2.6.32, BuildID[sha1]=f5a9351dcc0223be42093524a835a2a3dff2b84f, stripped
./rtos-demo-with-mods/Source/cr_startup_lpc11.c:197:// ResetISR() function in order to cope with MCUs with multiple banks of
 
./rtos-demo-with-mods/Source/cr_startup_lpc11.c:256:ResetISR(void) {
 
./rtosdemo/Debug/RTOSDemo_Debug.ld:14:ENTRY(ResetISR)
 
./rtosdemo/Debug/RTOSDemo_Debug.ld:110:                                        + (ResetISR + 1)
 
./rtosdemo/Debug/RTOSDemo.map:963:                0x00000120                ResetISR
 
./rtosdemo/Debug/RTOSDemo.map:1393:                [!provide]               PROVIDE (__valid_user_code_checksum, (0x0 - (((_vStackTop + (ResetISR + 0x1)) + (DEFINED (NMI_Handler)?NMI_Handler:M0_NMI_Handler + 0x1)) + (DEFINED (HardFault_Handler)?HardFault_Handler:M0_HardFault_Handler + 0x1))))
 
./rtosdemo/Source/cr_startup_lpc11.c:66:    void ResetISR(void);
 
./rtosdemo/Source/cr_startup_lpc11.c:138:    ResetISR,                              // The reset handler
 
./rtosdemo/Source/cr_startup_lpc11.c:197:// ResetISR() function in order to cope with MCUs with multiple banks of
 
./rtosdemo/Source/cr_startup_lpc11.c:256:ResetISR(void) {
 
  
 
$
 
$
 
</pre>
 
</pre>
  
So one thing we see is that symbol <code>ResetISR</code> appears in linker files of type .ld, in .map files and in .c files.  Symbol <code>ResetISR</code> does not appear in any header files of this project.  Where in our rtos-demo-with-mods project makefile do we touch or change references to any .map files? . . .
+
=== [[#top|^]] <i>edit point - gcc 6.3 or newer may be needed</i> ===
  
== [[#top|^]] __bss_start__ ==
+
An obscure error appears now with our call to the GNU assembler, which gives a complaint about width suffixes in one of FreeRTOS demo assembly files.  Per https://sourceforge.net/p/freertos/discussion/382005/thread/8041642a/ we may need a newer version of gcc, e.g. 6.3 over 4.x in order to get past the error:
  
<font color="purple">./lpcxpresso-8p2p2/lpcxpresso/tools/arm-none-eabi/lib/armv7-m/redboot.ld</font><font color="green"><font color="cyan">:</font>161<font color="cyan">:</font></font>  <font color="red">__bss_start__</font> = .;
+
<pre>
<font color="purple">./lpcxpresso-8p2p2/lpcxpresso/tools/arm-none-eabi/lib/armv7-ar/thumb/redboot.ld</font><font color="green"><font color="cyan">:</font>161<font color="cyan">:</font></font>  <font color="red">__bss_start__</font> = .;
+
GNU assembler version 2.25 (arm-none-eabi) using BFD version (2.25-5+5+b1) 2.25
<font color="purple">./lpcxpresso-8p2p2/lpcxpresso/tools/arm-none-eabi/lib/armv7-ar/thumb/fpu/redboot.ld</font><font color="green"><font color="cyan">:</font>161<font color="cyan">:</font></font>  <font color="red">__bss_start__</font> = .;
+
/tmp/cc8oKrpj.s: Assembler messages:
<font color="purple">./lpcxpresso-8p2p2/lpcxpresso/tools/arm-none-eabi/lib/armv7-ar/thumb/softfp/redboot.ld</font><font color="green"><font color="cyan">:</font>161<font color="cyan">:</font></font>  <font color="red">__bss_start__</font> = .;
+
/tmp/cc8oKrpj.s:232: Error: cannot honor width suffix -- `mov r1,#255'
<font color="purple">./lpcxpresso-8p2p2/lpcxpresso/tools/arm-none-eabi/lib/redboot.ld</font><font color="green"><font color="cyan">:</font>161<font color="cyan">:</font></font>  <font color="red">__bss_start__</font> = .;
+
/tmp/cc8oKrpj.s:233: Error: cannot honor width suffix -- `lsl r1,r1,#16'
<font color="purple">./lpcxpresso-8p2p2/lpcxpresso/tools/arm-none-eabi/lib/fpu/redboot.ld</font><font color="green"><font color="cyan">:</font>161<font color="cyan">:</font></font>  <font color="red">__bss_start__</font> = .;
+
/tmp/cc8oKrpj.s:234: Error: cannot honor width suffix -- `orr r2,r1'
<font color="purple">./lpcxpresso-8p2p2/lpcxpresso/tools/arm-none-eabi/lib/armv7e-m/redboot.ld</font><font color="green"><font color="cyan">:</font>161<font color="cyan">:</font></font> <font color="red">__bss_start__</font> = .;
+
  .
<font color="purple">./lpcxpresso-8p2p2/lpcxpresso/tools/arm-none-eabi/lib/armv7e-m/fpu/fpv5-sp-d16/redboot.ld</font><font color="green"><font color="cyan">:</font>161<font color="cyan">:</font></font>  <font color="red">__bss_start__</font> = .;
+
  .
<font color="purple">./lpcxpresso-8p2p2/lpcxpresso/tools/arm-none-eabi/lib/armv7e-m/fpu/redboot.ld</font><font color="green"><font color="cyan">:</font>161<font color="cyan">:</font></font>  <font color="red">__bss_start__</font> = .;
+
  .
<font color="purple">./lpcxpresso-8p2p2/lpcxpresso/tools/arm-none-eabi/lib/armv7e-m/fpu/fpv5-d16/redboot.ld</font><font color="green"><font color="cyan">:</font>161<font color="cyan">:</font></font>  <font color="red">__bss_start__</font> = .;
+
</pre>
<font color="purple">./lpcxpresso-8p2p2/lpcxpresso/tools/arm-none-eabi/lib/armv7e-m/softfp/fpv5-sp-d16/redboot.ld</font><font color="green"><font color="cyan">:</font>161<font color="cyan">:</font></font>  <font color="red">__bss_start__</font> = .;
+
 
  <font color="purple">./lpcxpresso-8p2p2/lpcxpresso/tools/arm-none-eabi/lib/armv7e-m/softfp/redboot.ld</font><font color="green"><font color="cyan">:</font>161<font color="cyan">:</font></font>  <font color="red">__bss_start__</font> = .;
+
 
  <font color="purple">./lpcxpresso-8p2p2/lpcxpresso/tools/arm-none-eabi/lib/armv7e-m/softfp/fpv5-d16/redboot.ld</font><font color="green"><font color="cyan">:</font>161<font color="cyan">:</font></font>  <font color="red">__bss_start__</font> = .;
+
<!-- comment -->
<font color="purple">./lpcxpresso-8p2p2/lpcxpresso/tools/arm-none-eabi/lib/armv8-m.main/redboot.ld</font><font color="green"><font color="cyan">:</font>161<font color="cyan">:</font></font>  <font color="red">__bss_start__</font> = .;
+
 
  <font color="purple">./lpcxpresso-8p2p2/lpcxpresso/tools/arm-none-eabi/lib/armv8-m.main/fpu/fpv5-sp-d16/redboot.ld</font><font color="green"><font color="cyan">:</font>161<font color="cyan">:</font></font>  <font color="red">__bss_start__</font> = .;
+
=== [[#top|^]] <i>edit point - link time issues</i> ===
<font color="purple">./lpcxpresso-8p2p2/lpcxpresso/tools/arm-none-eabi/lib/armv8-m.main/fpu/fpv5-d16/redboot.ld</font><font color="green"><font color="cyan">:</font>161<font color="cyan">:</font></font>  <font color="red">__bss_start__</font> = .;
+
 
  <font color="purple">./lpcxpresso-8p2p2/lpcxpresso/tools/arm-none-eabi/lib/armv8-m.main/softfp/fpv5-sp-d16/redboot.ld</font><font color="green"><font color="cyan">:</font>161<font color="cyan">:</font></font>  <font color="red">__bss_start__</font> = .;
+
2018-07-06 Friday
<font color="purple">./lpcxpresso-8p2p2/lpcxpresso/tools/arm-none-eabi/lib/armv8-m.main/softfp/fpv5-d16/redboot.ld</font><font color="green"><font color="cyan">:</font>161<font color="cyan">:</font></font> <font color="red">__bss_start__</font> = .;
+
 
<font color="purple">./lpcxpresso-8p2p2/lpcxpresso/tools/arm-none-eabi/lib/ldscripts/armelf.xbn</font><font color="green"><font color="cyan">:</font>180<font color="cyan">:</font></font>  <font color="red">__bss_start__</font> = .;
+
Link time issues can come up before all sources have been built.  The linker `ld` or similar needs to know where project-related libraries are on the local file system. Here in the next figure / build excerpt are messages showing the linker not finding certain library function definitions:
<font color="purple">./lpcxpresso-8p2p2/lpcxpresso/tools/arm-none-eabi/lib/ldscripts/armelf.xs</font><font color="green"><font color="cyan">:</font>169<font color="cyan">:</font></font>  <font color="red">__bss_start__</font> = .;
+
 
<font color="purple">./lpcxpresso-8p2p2/lpcxpresso/tools/arm-none-eabi/lib/ldscripts/armelf.x</font><font color="green"><font color="cyan">:</font>180<font color="cyan">:</font></font>  <font color="red">__bss_start__</font> = .;
+
<pre>
<font color="purple">./lpcxpresso-8p2p2/lpcxpresso/tools/arm-none-eabi/lib/ldscripts/armelf.xsc</font><font color="green"><font color="cyan">:</font>168<font color="cyan">:</font></font>  <font color="red">__bss_start__</font> = .;
+
$ make -f Makefile
<font color="purple">./lpcxpresso-8p2p2/lpcxpresso/tools/arm-none-eabi/lib/ldscripts/armelf.xw</font><font color="green"><font color="cyan">:</font>179<font color="cyan">:</font></font>  <font color="red">__bss_start__</font> = .;
+
- Makefile.common - declaring recipes to convert, compile, clean and debug project . . .
<font color="purple">./lpcxpresso-8p2p2/lpcxpresso/tools/arm-none-eabi/lib/ldscripts/armelf.xn</font><font color="green"><font color="cyan">:</font>180<font color="cyan">:</font></font>  <font color="red">__bss_start__</font> = .;
+
- Makefile.common - pulling in dependencies of all .o files . . .
<font color="purple">./lpcxpresso-8p2p2/lpcxpresso/tools/arm-none-eabi/lib/ldscripts/armelf.xsw</font><font color="green"><font color="cyan">:</font>168<font color="cyan">:</font></font>  <font color="red">__bss_start__</font> = .;
+
- Makefile.common - done.
<font color="purple">./lpcxpresso-8p2p2/lpcxpresso/tools/arm-none-eabi/lib/ldscripts/armelf.xc</font><font color="green"><font color="cyan">:</font>179<font color="cyan">:</font></font>  <font color="red">__bss_start__</font> = .;
+
zz - Project name set to '',
<font color="purple">./lpcxpresso-8p2p2/lpcxpresso/tools/arm-none-eabi/lib/armv8-m.base/redboot.ld</font><font color="green"><font color="cyan">:</font>161<font color="cyan">:</font></font>  <font color="red">__bss_start__</font> = .;
+
zz - additional library paths also set in 'LIBRARY_PATHS' variable,
<font color="purple">./lpcxpresso-8p2p2/lpcxpresso/tools/arm-none-eabi/lib/thumb/redboot.ld</font><font color="green"><font color="cyan">:</font>161<font color="cyan">:</font></font>  <font color="red">__bss_start__</font> = .;
+
/usr/bin/arm-none-eabi-gcc  -o .elf  ./Source/FreeRTOS_Source/portable/MemMang/heap_1.o ./Source/FreeRTOS_Source/portable/GCC/ARM_CM0/port.o ./Source/FreeRTOS_Source/list.o ./Source/FreeRTOS_Source/queue.o ./Source/FreeRTOS_Source/tasks.o ./Source/FreeRTOS_Source/timers.o ./Source/Common_Demo_Tasks/IntQueue.o ./Source/Common_Demo_Tasks/blocktim.o ./Source/Common_Demo_Tasks/countsem.o ./Source/Common_Demo_Tasks/recmutex.o ./Source/IntQueueTimer.o ./Source/RegTest.o ./Source/cr_startup_lpc11.o ./Source/main-blinky.o ./Source/main-full.o ./Source/main.o  
<font color="purple">./lpcxpresso-8p2p2/lpcxpresso/tools/arm-none-eabi/lib/armv6-m/redboot.ld</font><font color="green"><font color="cyan">:</font>161<font color="cyan">:</font></font>  <font color="red">__bss_start__</font> = .;
+
/usr/lib/gcc/arm-none-eabi/4.8/../../../arm-none-eabi/lib/libc.a(lib_a-exit.o): In function `exit':
<font color="purple">./lpcxpresso-8p2p2/lpcxpresso/tools/share/gcc-arm-none-eabi/samples/ldscripts/nokeep.ld</font><font color="green"><font color="cyan">:</font>35<font color="cyan">:</font></font> *  <font color="red">__bss_start__</font>
+
/home/tin/projects/debian/arm-toolchain/collab-maint/newlib/build/arm-none-eabi/newlib/libc/stdlib/../../../../../newlib/libc/stdlib/exit.c:70: undefined reference to `_exit'
<font color="purple">./lpcxpresso-8p2p2/lpcxpresso/tools/share/gcc-arm-none-eabi/samples/ldscripts/nokeep.ld</font><font color="green"><font color="cyan">:</font>113<font color="cyan">:</font></font>                LONG (<font color="red">__bss_start__</font>)
+
./Source/FreeRTOS_Source/portable/GCC/ARM_CM0/port.o: In function `prvSetupTimerInterrupt':
<font color="purple">./lpcxpresso-8p2p2/lpcxpresso/tools/share/gcc-arm-none-eabi/samples/ldscripts/nokeep.ld</font><font color="green"><font color="cyan">:</font>114<font color="cyan">:</font></font>                LONG (__bss_end__ - <font color="red">__bss_start__</font>)
+
/home/user/projects/nxp/rtos-demo-3/Debug/../Source/FreeRTOS_Source/portable/GCC/ARM_CM0/port.c:360: undefined reference to `SystemCoreClock'
<font color="purple">./lpcxpresso-8p2p2/lpcxpresso/tools/share/gcc-arm-none-eabi/samples/ldscripts/nokeep.ld</font><font color="green"><font color="cyan">:</font>160<font color="cyan">:</font></font>                <font color="red">__bss_start__</font> = .;
+
./Source/IntQueueTimer.o: In function `vInitialiseTimerForIntQueueTest':
<font color="purple">./lpcxpresso-8p2p2/lpcxpresso/tools/share/gcc-arm-none-eabi/samples/ldscripts/gcc.ld</font><font color="green"><font color="cyan">:</font>35<font color="cyan">:</font></font> *  <font color="red">__bss_start__</font>
+
/home/user/projects/nxp/rtos-demo-3/Debug/../Source/IntQueueTimer.c:79: undefined reference to `SystemCoreClock'
<font color="purple">./lpcxpresso-8p2p2/lpcxpresso/tools/share/gcc-arm-none-eabi/samples/ldscripts/gcc.ld</font><font color="green"><font color="cyan">:</font>113<font color="cyan">:</font></font>          LONG (<font color="red">__bss_start__</font>)
+
./Source/cr_startup_lpc11.o: In function `ResetISR':
<font color="purple">./lpcxpresso-8p2p2/lpcxpresso/tools/share/gcc-arm-none-eabi/samples/ldscripts/gcc.ld</font><font color="green"><font color="cyan">:</font>114<font color="cyan">:</font></font>          LONG (__bss_end__ - <font color="red">__bss_start__</font>)
+
/home/user/projects/nxp/rtos-demo-3/Debug/../Source/cr_startup_lpc11.c:301: undefined reference to `SystemInit'
<font color="purple">./lpcxpresso-8p2p2/lpcxpresso/tools/share/gcc-arm-none-eabi/samples/ldscripts/gcc.ld</font><font color="green"><font color="cyan">:</font>160<font color="cyan">:</font></font>          <font color="red">__bss_start__</font> = .;
+
/home/user/projects/nxp/rtos-demo-3/Debug/../Source/cr_startup_lpc11.c:313: undefined reference to `__main'
<font color="purple">./lpcxpresso-8p2p2/lpcxpresso/tools/share/gcc-arm-none-eabi/samples/ldscripts/multi-ram.ld</font><font color="green"><font color="cyan">:</font>36<font color="cyan">:</font></font> *  <font color="red">__bss_start__</font>
+
/home/user/projects/nxp/rtos-demo-3/Debug/../Source/cr_startup_lpc11.c:313: undefined reference to `__data_section_table'
<font color="purple">./lpcxpresso-8p2p2/lpcxpresso/tools/share/gcc-arm-none-eabi/samples/ldscripts/multi-ram.ld</font><font color="green"><font color="cyan">:</font>111<font color="cyan">:</font></font>            LONG (<font color="red">__bss_start__</font>)
+
/home/user/projects/nxp/rtos-demo-3/Debug/../Source/cr_startup_lpc11.c:313: undefined reference to `__data_section_table_end'
<font color="purple">./lpcxpresso-8p2p2/lpcxpresso/tools/share/gcc-arm-none-eabi/samples/ldscripts/multi-ram.ld</font><font color="green"><font color="cyan">:</font>112<font color="cyan">:</font></font>            LONG (__bss_end__ - <font color="red">__bss_start__</font>)
+
/home/user/projects/nxp/rtos-demo-3/Debug/../Source/cr_startup_lpc11.c:313: undefined reference to `__bss_section_table_end'
<font color="purple">./lpcxpresso-8p2p2/lpcxpresso/tools/share/gcc-arm-none-eabi/samples/ldscripts/multi-ram.ld</font><font color="green"><font color="cyan">:</font>165<font color="cyan">:</font></font>            <font color="red">__bss_start__</font> = .;
+
./Source/cr_startup_lpc11.o:(.isr_vector+0x0): undefined reference to `_vStackTop'
<font color="purple">./lpcxpresso-8p2p2/lpcxpresso/tools/share/gcc-arm-none-eabi/samples/startup/startup_ARMCM3.S</font><font color="green"><font color="cyan">:</font>202<font color="cyan">:</font></font> *    <font color="red">__bss_start__</font><font color="cyan">:</font> start of the BSS section.
+
./Source/main.o: In function `prvSetupHardware':
<font color="purple">./lpcxpresso-8p2p2/lpcxpresso/tools/share/gcc-arm-none-eabi/samples/startup/startup_ARMCM3.S</font><font color="green"><font color="cyan">:</font>207<font color="cyan">:</font></font>  ldr    r1, =<font color="red">__bss_start__</font>
+
/home/user/projects/nxp/rtos-demo-3/Debug/../Source/main.c:162: undefined reference to `_vStackTop'
<font color="purple">./lpcxpresso-8p2p2/lpcxpresso/tools/share/gcc-arm-none-eabi/samples/startup/startup_ARMCM4.S</font><font color="green"><font color="cyan">:</font>202<font color="cyan">:</font></font> *    <font color="red">__bss_start__</font><font color="cyan">:</font> start of the BSS section.
+
/home/user/projects/nxp/rtos-demo-3/Debug/../Source/main.c:162: undefined reference to `_pvHeapStart'
<font color="purple">./lpcxpresso-8p2p2/lpcxpresso/tools/share/gcc-arm-none-eabi/samples/startup/startup_ARMCM4.S</font><font color="green"><font color="cyan">:</font>207<font color="cyan">:</font></font>  ldr    r1, =<font color="red">__bss_start__</font>
+
./Source/main.o: In function `vApplicationTickHook':
<font color="purple">./lpcxpresso-8p2p2/lpcxpresso/tools/share/gcc-arm-none-eabi/samples/startup/startup_ARMCM7.S</font><font color="green"><font color="cyan">:</font>202<font color="cyan">:</font></font> *    <font color="red">__bss_start__</font><font color="cyan">:</font> start of the BSS section.
+
/home/user/projects/nxp/rtos-demo-3/Debug/../Source/main.c:226: undefined reference to `_pvHeapStart'
<font color="purple">./lpcxpresso-8p2p2/lpcxpresso/tools/share/gcc-arm-none-eabi/samples/startup/startup_ARMCM7.S</font><font color="green"><font color="cyan">:</font>207<font color="cyan">:</font></font>  ldr    r1, =<font color="red">__bss_start__</font>
+
collect2: error: ld returned 1 exit status
<font color="purple">./lpcxpresso-8p2p2/lpcxpresso/tools/share/gcc-arm-none-eabi/samples/startup/startup_ARMCM0.S</font><font color="green"><font color="cyan">:</font>208<font color="cyan">:</font></font> *    <font color="red">__bss_start__</font><font color="cyan">:</font> start of the BSS section.
+
../Makefile.common:107: recipe for target '.elf' failed
<font color="purple">./lpcxpresso-8p2p2/lpcxpresso/tools/share/gcc-arm-none-eabi/samples/startup/startup_ARMCM0.S</font><font color="green"><font color="cyan">:</font>213<font color="cyan">:</font></font>  ldr    r1, =<font color="red">__bss_start__</font>
+
make: *** [.elf] Error 1
  
 +
$
 +
</pre>
  
 +
From the 'create-directory-structure' script we know that all needed library files are copied into the directory hierarchy of FreeRTOS demo port to LPC1114.  We're going to search for the patterns '_exit' and 'SystemCoreClock' starting at the root directory of this project:
  
<!-- comment -->
+
<i>Figure x -</i>
  
== [[#top|^]] Linker Script Details ==
+
<pre>
  
Good details on linker scripts here:
+
$
*  https://stackoverflow.com/questions/28825812/update-linker-variables-after-gc-sections
+
</pre>
-Xlinker option and related:
 
*  https://gcc.gnu.org/onlinedocs/gcc/Link-Options.html#Link-Options
 
 
 
. . .
 
  
  
Line 1,168: Line 1,226:
 
<!-- comment -->
 
<!-- comment -->
  
== [[#top|^]] 2018-07-10 - GNU style makefile calls sub-makefiles of LPCXpresso ==
+
<span id="makefile-generated-by-lpcxpresso"></span>
  
- STEP - First try this Tuesday morning, cannot find <stdint.h> . . .
+
=== [[#top|^]] Makefile Generated By LPCXpresso ===
 +
 
 +
First the reference which told us to look in the project (in this case workspace/RTOSdemo) directory for a makefile:
  
<pre>
+
*  https://stackoverflow.com/questions/4331960/where-is-the-makefile-generated-by-the-eclipse-cdt
Building file: ../Source/cr_startup_lpc11.c
 
Invoking: MCU C Compiler
 
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 -Os -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/cr_startup_lpc11.d" -MT"Source/cr_startup_lpc11.d" -o "Source/cr_startup_lpc11.o" "../Source/cr_startup_lpc11.c"
 
In file included from ../Source/cr_startup_lpc11.c:51:0:
 
/home/user/Downloads/freertos/FreeRTOSv10.0.1/FreeRTOS/Demo/CORTEX_M0_LPC1114_LPCXpresso/CMSISv2p00_LPC11xx/inc/system_LPC11xx.h:33:20: fatal error: stdint.h: No such file or directory
 
#include <stdint.h>
 
                    ^
 
compilation terminated.
 
Source/subdir.mk:40: recipe for target 'Source/cr_startup_lpc11.o' failed
 
make: *** [Source/cr_startup_lpc11.o] Error 1
 
</pre>
 
  
Searching for header file stdint.h in /opt/nxp:
+
Now the 54 line makefile:
  
 
<pre>
 
<pre>
/opt/nxp$ find . -name stdint.h
+
################################################################################
./lpcxpresso-8p2p2/lpcxpresso/tools/redlib/include/stdint.h
+
# Automatically-generated file. Do not edit!
./lpcxpresso-8p2p2/lpcxpresso/tools/lib/gcc/arm-none-eabi/5.4.1/include/stdint.h
+
################################################################################
./lpcxpresso-8p2p2/lpcxpresso/tools/arm-none-eabi/include/stdint.h
 
./lpcxpresso-8p2p2/lpcxpresso/tools/arm-none-eabi/include/c++/5.4.1/tr1/stdint.h
 
</pre>
 
  
- STEP - amending include paths with -I . . .
+
-include ../makefile.init
  
Adding needed paths to CFLAGS fails to solve our present modified top-project-level makefile named 'Makefile', which in turn calls LPC-generated sub-makefiles per project source directory.  The cause we think is that those subdir.mk files each express targets whose options to gcc are already expanded and thus fixed.  There is no appearance of $CFLAGS in those target recipes.
+
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
  
<!-- comment -->
+
ifneq ($(MAKECMDGOALS),clean)
 +
ifneq ($(strip $(C_DEPS)),)
 +
-include $(C_DEPS)
 +
endif
 +
endif
  
=== [[#top|^]] <i>Suspicion subdir.mk target recipes lack variables </i> ===
+
-include ../makefile.defs
  
- 2018-07-11 - Tuesday -
+
# Add inputs and outputs from these tool invocations to the build variables
  
Suspicion: &nbsp;subdir.mk target recipes contain no variables to expand, so that amendments to typical makefile variables such as CFLAGS are not applied when make calls programs to execute these targets.
+
# All Target
 +
all: RTOSDemo.axf
  
There are a couple of things going on here as we search for an automatable way to convert LPCXpresso firmware projects into GNU gcc toolchain projects. Have 'make' or a shell script read sub-make files can be helpful in automatically gathering for example all the sources which are part of a project. Parsing "hard coded" build recipes can allow us to assign pre-processor, compiler, assembler and linker options to conventional GNU `make` variables. Achieving these parsings and effectively porting projects from LPCXpresso's makefile way to a GNU type toolchain would give us a lot of insight into the details of project dependencies, and the specific tasks we need `make` to invoke in order to build -- to cross-compile -- a software project for a given target processor.
+
# Tool invocations
 +
RTOSDemo.axf: $(OBJS) $(USER_OBJS)
 +
        @echo 'Building target: $@'
 +
        @echo 'Invoking: MCU Linker'
 +
        arm-none-eabi-gcc -nostdlib -L"/home/user/Downloads/freertos/FreeRTOSv10.0.1/FreeRTOS/Demo/CORTEX_M0_LPC1114_LPCXpresso/CMSISv2p00_LPC11xx/Debug" -Xlinker -Map=RTOSDemo.map -Xlinker --gc-sections -mcpu=cortex-m0 -mthumb -T "RTOSDemo_Debug.ld" -o "RTOSDemo.axf" $(OBJS) $(USER_OBJS) $(LIBS)
 +
        @echo 'Finished building target: $@'
 +
        @echo ' '
 +
        $(MAKE) --no-print-directory post-build
  
Proposed Steps:
+
# Other Targets
 +
clean:
 +
        -$(RM) $(EXECUTABLES)$(OBJS)$(C_DEPS) RTOSDemo.axf
 +
        -@echo ' '
  
- Step 1 -
+
post-build:
<ul>
+
        -@echo 'Performing post-build steps'
A first good step to take is to create a recipe which builds a list of all project sources.
+
        -arm-none-eabi-size RTOSDemo.axf; # arm-none-eabi-objcopy -O binary RTOSDemo.axf RTOSDemo.bin ; checksum -p LPC1114_301 -d RTOSDemo.bin;
</ul>
+
        -@echo ' '
  
- Step 2 -
+
.PHONY: all clean dependents
<ul>
+
.SECONDARY: post-build
A second step to attempt authoring is that of a recipe which builds all sources, whose passed options to gcc are in variable which we assign values manually at firstIf all sources take the same arguments, this will function as desiredOtherwise if recipies differ for one or some sources we can create targets for each set of sources which build in distinct ways.
+
 
</ul>
+
-include ../makefile.targets
 +
</pre>
 +
 
 +
This makefile alone does not tell us a lot about how LPCXpresso is constructing and using makefiles for project builds.  However, the -include stanzas lead us to some clues.  Specifically many of the -includes reference "child" makefiles in various project sources directoriesThese makefiles are all like named 'subdir.mk'.
 +
 
 +
Each subdir.mk file amends three make variables:  C_SRCS, OBJS and C_DEPS.  This variable amending itself is useful in the primary makefile, when by the time all subdir.mk files have been included the primary makefile now has a list of all project sourcesThe problem however is that each subdir.mk file also defines a target and build recipe for a subset of project sources.  These targets are added to the dependency graph built by `make`, and it seems kludgey at best to -- if possible within a GNU makefile -- select and delete certain rules from the dependency graph mid-way through processing a makefile.  By mid-way we're thinking after all -include directive processing and before named rule processing.
 +
 
 +
Regarding `make` targets or rules see:
  
- Step 3 -
 
 
<ul>
 
<ul>
A third step then when we see the project build via our target described in step 2, is to automate that parsing and assigning-to-make-variables the options required to build all project sources.
+
*  https://gist.github.com/pvdb/777954
 
</ul>
 
</ul>
  
 +
Checking to see whether and how the rules differ among FreeRTOS demo subdir.mk files:
  
<!-- comment -->
+
<i>Figure x -</i>
  
=== [[#top|^]] <i>edit point - checking dependencies are correct</i> ===
+
<pre>
 +
FreeRTOS LPC1114 Demo source file directories:
  
We must check that our dependencies are getting figured correctly.  A manual call to `make` on a single source file shows host system library headers getting included, not the ones we need.  Though this is likely for a lack of missing -I{path} options given to gcc:
+
(1) Source/Common_Demo_Tasks \
 +
(2) Source/FreeRTOS_Source \
 +
(3) Source/FreeRTOS_Source/portable/GCC/ARM_CM0 \
 +
(4) Source/FreeRTOS_Source/portable/MemMang \
 +
(5) Source
  
<pre>
 
~/projects/nxp/rtos-demo-4/Source/FreeRTOS_Source$ gcc -I.. -I./include -Iportable/GCC/ARM_CM0 -M list.c
 
  
list.o: list.c /usr/include/stdc-predef.h /usr/include/stdlib.h \
+
Options to gcc for each rule in give source file directory file named subdir.mk:
/usr/include/features.h /usr/include/i386-linux-gnu/sys/cdefs.h \
 
/usr/include/i386-linux-gnu/bits/wordsize.h \
 
/usr/include/i386-linux-gnu/gnu/stubs.h \
 
/usr/include/i386-linux-gnu/gnu/stubs-32.h \
 
/usr/lib/gcc/i586-linux-gnu/4.9/include/stddef.h \
 
/usr/include/i386-linux-gnu/bits/waitflags.h \
 
/usr/include/i386-linux-gnu/bits/waitstatus.h /usr/include/endian.h \
 
/usr/include/i386-linux-gnu/bits/endian.h \
 
/usr/include/i386-linux-gnu/bits/byteswap.h \
 
/usr/include/i386-linux-gnu/bits/types.h \
 
/usr/include/i386-linux-gnu/bits/typesizes.h \
 
/usr/include/i386-linux-gnu/bits/byteswap-16.h \
 
/usr/include/i386-linux-gnu/sys/types.h /usr/include/time.h \
 
/usr/include/i386-linux-gnu/sys/select.h \
 
/usr/include/i386-linux-gnu/bits/select.h \
 
/usr/include/i386-linux-gnu/bits/sigset.h \
 
/usr/include/i386-linux-gnu/bits/time.h \
 
/usr/include/i386-linux-gnu/sys/sysmacros.h \
 
/usr/include/i386-linux-gnu/bits/pthreadtypes.h /usr/include/alloca.h \
 
/usr/include/i386-linux-gnu/bits/stdlib-float.h include/FreeRTOS.h \
 
/usr/lib/gcc/i586-linux-gnu/4.9/include/stdint.h /usr/include/stdint.h \
 
/usr/include/i386-linux-gnu/bits/wchar.h ../FreeRTOSConfig.h \
 
include/projdefs.h include/portable.h include/deprecated_definitions.h \
 
portable/GCC/ARM_CM0/portmacro.h include/mpu_wrappers.h include/list.h
 
  
$
+
(1) 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"$(@:%.o=%.d)" -MT"$(@:%.o=%.o)" -MT"$(@:%.o=%.d)" -o "$@" "$<"
 +
(2) 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"$(@:%.o=%.d)" -MT"$(@:%.o=%.o)" -MT"$(@:%.o=%.d)" -o "$@" "$<"
 +
(3) 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"$(@:%.o=%.d)" -MT"$(@:%.o=%.o)" -MT"$(@:%.o=%.d)" -o "$@" "$<"
 +
(4) 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"$(@:%.o=%.d)" -MT"$(@:%.o=%.o)" -MT"$(@:%.o=%.d)" -o "$@" "$<"
 +
(5) 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"$(@:%.o=%.d)" -MT"$(@:%.o=%.o)" -MT"$(@:%.o=%.d)" -o "$@" "$<"
 +
(5) 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 -Os -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"$(@:%.o=%.d)" -MT"Source/cr_startup_lpc11.d" -o "$@" "$<"
 
</pre>
 
</pre>
  
Line 1,269: Line 1,330:
 
<!-- comment -->
 
<!-- comment -->
  
== [[#top|^]] Second Approach - Single Makefile ==
+
=== [[#top|^]] <i>edit point - finding and pointing make to .a library files </i> ===
  
Understanding better how LPC's build process calls "children" makefiles, plus thinking about how to parse LPC's makefiles, its build output, and or its .cproject and .project files we're trying a more ground up approach by crafting a single makefileThis makefile's output is nearly identical to LPC's build output but ours does not find the needed project header file named stdlib.h. This header file isn't particular to the FreeRTOS demo project.  It is most likely part of LPC / NXP's C library ports to their microcontroller families. Looking in our local installation of lpcxpresso we find four instances of this header file:
+
On Thursday, yesterday, we found a makefile created by LPCXpresso or one of its called tools, in the Debug directory of our RTOSDemo project instance. Working now with a copy of that makefile in a project we did not import, nor unzip from a zip archive, but started out as a general C/C++ project<span id="to-do--2018-06-15--document-lpcxpresso-project-creation"><b>TO DO:</b></span> Contributor Ted notes here that we must retrace those project creation steps so we know thoroughly how to get a project off the ground in the LPCXpresso IDE.
  
<i>Figure x - stdlib.h from NXP</i>
+
There are different types of library files in C and C++ projects, library files which can be linked in to a binary at compile time or loaded at run time.  On the Linux and GCC side it may be necessary to point `make` to dot a archive type library files, by using the -L option . . .
  
 
<pre>
 
<pre>
/opt/nxp/lpcxpresso-8p2p2$ ls -l `find . -name stdlib.h`
+
$ locate libcr_c.a
-rwxr-xr-x 1 root root  1480 Jul 21  2016 ./lpcxpresso/tools/arm-none-eabi/include/c++/5.4.1/tr1/stdlib.h
+
/opt/nxp/lpcxpresso-8p2p2/lpcxpresso/tools/arm-none-eabi/lib/libcr_c.a
-rwxr-xr-x 1 root root  138 Jul 21  2016 ./lpcxpresso/tools/arm-none-eabi/include/machine/stdlib.h
+
/opt/nxp/lpcxpresso-8p2p2/lpcxpresso/tools/arm-none-eabi/lib/armv6-m/libcr_c.a
-rwxr-xr-x 1 root root 11607 Jul 21  2016 ./lpcxpresso/tools/arm-none-eabi/include/stdlib.h
+
/opt/nxp/lpcxpresso-8p2p2/lpcxpresso/tools/arm-none-eabi/lib/armv7-m/libcr_c.a
-rwxr-xr-x 1 root root  3699 Jul 21  2016 ./lpcxpresso/tools/redlib/include/stdlib.h
+
/opt/nxp/lpcxpresso-8p2p2/lpcxpresso/tools/arm-none-eabi/lib/armv7e-m/libcr_c.a
</pre>
+
/opt/nxp/lpcxpresso-8p2p2/lpcxpresso/tools/arm-none-eabi/lib/armv7e-m/fpu/libcr_c.a
 +
/opt/nxp/lpcxpresso-8p2p2/lpcxpresso/tools/arm-none-eabi/lib/armv7e-m/softfp/libcr_c.a
 +
/opt/nxp/lpcxpresso-8p2p2/lpcxpresso/tools/arm-none-eabi/lib/thumb/libcr_c.a
  
QUESTION:  which of these is the file we need to include?  They all differ from one another, and it's likely only one is correct . . .   - TMH
+
$ ls -l /opt/nxp/lpcxpresso-8p2p2/lpcxpresso/tools/arm-none-eabi/lib/libcr_c.a /opt/nxp/lpcxpresso-8p2p2/lpcxpresso/tools/arm-none-eabi/lib/thumb/libcr_c.a
 +
-rwxr-xr-x 1 root root 235420 Jul 21  2016 /opt/nxp/lpcxpresso-8p2p2/lpcxpresso/tools/arm-none-eabi/lib/libcr_c.a
 +
-rwxr-xr-x 1 root root 216552 Jul 21  2016 /opt/nxp/lpcxpresso-8p2p2/lpcxpresso/tools/arm-none-eabi/lib/thumb/libcr_c.a
  
 +
$ locate libcr_eabihelpers.a
 +
/opt/nxp/lpcxpresso-8p2p2/lpcxpresso/tools/lib/gcc/arm-none-eabi/5.4.1/libcr_eabihelpers.a
 +
/opt/nxp/lpcxpresso-8p2p2/lpcxpresso/tools/lib/gcc/arm-none-eabi/5.4.1/armv6-m/libcr_eabihelpers.a
 +
/opt/nxp/lpcxpresso-8p2p2/lpcxpresso/tools/lib/gcc/arm-none-eabi/5.4.1/armv7-m/libcr_eabihelpers.a
 +
/opt/nxp/lpcxpresso-8p2p2/lpcxpresso/tools/lib/gcc/arm-none-eabi/5.4.1/armv7e-m/libcr_eabihelpers.a
 +
/opt/nxp/lpcxpresso-8p2p2/lpcxpresso/tools/lib/gcc/arm-none-eabi/5.4.1/armv7e-m/fpu/libcr_eabihelpers.a
 +
/opt/nxp/lpcxpresso-8p2p2/lpcxpresso/tools/lib/gcc/arm-none-eabi/5.4.1/armv7e-m/softfp/libcr_eabihelpers.a
 +
/opt/nxp/lpcxpresso-8p2p2/lpcxpresso/tools/lib/gcc/arm-none-eabi/5.4.1/thumb/libcr_eabihelpers.a
  
CHECK OUT / REVISIT:  in LPCXpresso IDE:  Project Properties --> C/C++ Build  -->  Settings  -->  MCU Assembler.  There is a string of options shown here which reads "-c -x assembler-with-cpp -D__REDLIB__ -DDEBUG -D__CODE_RED -g3 -mcpu=cortex-m0 -mthumb -D__REDLIB__ -specs=redlib.specs".  QUESTION:  Is our single makefile sending these options at the point of assembly?
+
$
 +
</pre>
  
  
2018-07-18 WED - LPC project properties
+
=== [[#top|^]] <i>edit point - linker not finding symbol defined in .ld file </i> ===
  
Noticing that under LPCXpresso project properties, there are most and perhaps all compiler flags and options available to view here.  In the path <b>Project Properties -->  C/C++ Build  --> Settings  -->  MCU Compiler</b> we find expanded options to the compiler arm-none-eabi-gcc as follows:
+
Linker having trouble finding <code>ResetISR</code>, which is defined in a .c file but nowhere defined in any header file . . .
  
 
<pre>
 
<pre>
-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/FreeRTOSv10.0.1/FreeRTOS/Demo/CORTEX_M0_LPC1114_LPCXpresso/CMSISv2p00_LPC11xx/inc" -I"../../../Common/include" -I"/home/${USER}/projects/nxp/rtos-demo-4/Source/Common_Demo_Tasks/include" -I"/home/${USER}/projects/nxp/rtos-demo-4/Source" -I"/home/${USER}/projects/nxp/rtos-demo-4/Source/FreeRTOS_Source/include" -I"/home/${USER}/projects/nxp/rtos-demo-4/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
+
$ grep -nr ResetISR ./*
</pre>
+
./rtos-demo-with-mods/Debug/RTOSDemo_Debug.ld:14:ENTRY(ResetISR)
 
+
./rtos-demo-with-mods/Debug/RTOSDemo_Debug.ld:110:                                        + (ResetISR + 1)
There is also a list of variables which looks like it could expand to these options. The variables are in a smaller text box titled "Expert Settings":
+
./rtos-demo-with-mods/Debug/RTOSDemo.map:963:                0x00000120                ResetISR
 
+
./rtos-demo-with-mods/Debug/RTOSDemo.map:1393:                [!provide]                PROVIDE (__valid_user_code_checksum, (0x0 - (((_vStackTop + (ResetISR + 0x1)) + (DEFINED (NMI_Handler)?NMI_Handler:M0_NMI_Handler + 0x1)) + (DEFINED (HardFault_Handler)?HardFault_Handler:M0_HardFault_Handler + 0x1))))
<pre>
+
./rtos-demo-with-mods/Source/cr_startup_lpc11.c:66:    void ResetISR(void);
${COMMAND} ${FLAGS} ${OUTPUT_FLAG} ${OUTPUT_PREFIX}${OUTPUT} ${INPUTS}
+
./rtos-demo-with-mods/Source/cr_startup_lpc11.c:138:    ResetISR,                              // The reset handler
 +
./rtos-demo-with-mods/Source/cr_startup_lpc11.c:197:// ResetISR() function in order to cope with MCUs with multiple banks of
 +
./rtos-demo-with-mods/Source/cr_startup_lpc11.c:256:ResetISR(void) {
 +
./rtosdemo/Debug/RTOSDemo_Debug.ld:14:ENTRY(ResetISR)
 +
./rtosdemo/Debug/RTOSDemo_Debug.ld:110:                                        + (ResetISR + 1)
 +
./rtosdemo/Debug/RTOSDemo.map:963:                0x00000120                ResetISR
 +
./rtosdemo/Debug/RTOSDemo.map:1393:                [!provide]                PROVIDE (__valid_user_code_checksum, (0x0 - (((_vStackTop + (ResetISR + 0x1)) + (DEFINED (NMI_Handler)?NMI_Handler:M0_NMI_Handler + 0x1)) + (DEFINED (HardFault_Handler)?HardFault_Handler:M0_HardFault_Handler + 0x1))))
 +
./rtosdemo/Source/cr_startup_lpc11.c:66:    void ResetISR(void);
 +
./rtosdemo/Source/cr_startup_lpc11.c:138:    ResetISR,                              // The reset handler
 +
./rtosdemo/Source/cr_startup_lpc11.c:197:// ResetISR() function in order to cope with MCUs with multiple banks of
 +
./rtosdemo/Source/cr_startup_lpc11.c:256:ResetISR(void) {
 +
 
 +
$
 
</pre>
 
</pre>
  
 +
So one thing we see is that symbol <code>ResetISR</code> appears in linker files of type .ld, in .map files and in .c files.  Symbol <code>ResetISR</code> does not appear in any header files of this project.  Where in our rtos-demo-with-mods project makefile do we touch or change references to any .map files? . . .
  
<!-- comment -->
+
== NXP LPC1xxx Library Routines ==
  
=== [[#top|^]] LPC compiler, assember, linker options ===
+
[[nxp_chip_library_routines|NXP microchip library routines, LPC1xxx routines]]
  
We're close but not quite to the goal of expressing all needed options in our GNU makefile, those options which are present but not obvious in the LPCXpresso FreeRTOS demo project.  As mentioned just above and discovered by Ted yesterday, an LPC project's properties offers among many things settings which include flags and options to compiler, assembler and linker.  To better understand how LPCXPresso manages all this, the following table contains the triplet data sets for each tool / each stage in the build process, minus preprocessing.  Preprocessing is absent from LPC's <b>Project Properties --> C/C++ Build --> Settings</b> dialog box.
 
  
<i>Figure x - LPCXpresso compiler options summary</i>
 
  
*  MCU Compiler
+
<!-- comment -->
<ul>
 
<pre>
 
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/FreeRTOSv10.0.1/FreeRTOS/Demo/CORTEX_M0_LPC1114_LPCXpresso/CMSISv2p00_LPC11xx/inc" -I"../../../Common/include" -I"/home/user/projects/nxp/rtos-demo-4/Source/Common_Demo_Tasks/include" -I"/home/user/projects/nxp/rtos-demo-4/Source" -I"/home/user/projects/nxp/rtos-demo-4/Source/FreeRTOS_Source/include" -I"/home/user/projects/nxp/rtos-demo-4/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
+
== [[#top|^]] __bss_start__ ==
 
 
${COMMAND} ${FLAGS} ${OUTPUT_FLAG} ${OUTPUT_PREFIX}${OUTPUT} ${INPUTS}
 
</pre>
 
</ul>
 
 
 
* MCU Assembler
 
<ul>
 
<pre>
 
arm-none-eabi-gcc
 
 
 
-c -x assembler-with-cpp -D__REDLIB__ -DDEBUG -D__CODE_RED -g3 -mcpu=cortex-m0 -mthumb -D__REDLIB__ -specs=redlib.specs
 
 
 
${COMMAND} ${FLAGS} ${OUTPUT_FLAG} ${OUTPUT_PREFIX}${OUTPUT} ${INPUTS}
 
</pre>
 
</ul>
 
 
 
* MCU Linker
 
<ul>
 
<pre>
 
arm-none-eabi-gcc
 
 
 
-nostdlib -L"/home/${USER}/Downloads/freertos/FreeRTOSv10.0.1/FreeRTOS/Demo/CORTEX_M0_LPC1114_LPCXpresso/CMSISv2p00_LPC11xx/Debug" -Xlinker -Map=rtos-demo-4.map -Xlinker --gc-sections -mcpu=cortex-m0 -mthumb -T "rtos-demo-4-debug.ld"
 
 
 
${COMMAND} ${FLAGS} ${OUTPUT_FLAG} ${OUTPUT_PREFIX}${OUTPUT} ${INPUTS}
 
</pre>
 
</ul>
 
  
 +
<font color="purple">./lpcxpresso-8p2p2/lpcxpresso/tools/arm-none-eabi/lib/armv7-m/redboot.ld</font><font color="green"><font color="cyan">:</font>161<font color="cyan">:</font></font>  <font color="red">__bss_start__</font> = .;
 +
<font color="purple">./lpcxpresso-8p2p2/lpcxpresso/tools/arm-none-eabi/lib/armv7-ar/thumb/redboot.ld</font><font color="green"><font color="cyan">:</font>161<font color="cyan">:</font></font>  <font color="red">__bss_start__</font> = .;
 +
<font color="purple">./lpcxpresso-8p2p2/lpcxpresso/tools/arm-none-eabi/lib/armv7-ar/thumb/fpu/redboot.ld</font><font color="green"><font color="cyan">:</font>161<font color="cyan">:</font></font>  <font color="red">__bss_start__</font> = .;
 +
<font color="purple">./lpcxpresso-8p2p2/lpcxpresso/tools/arm-none-eabi/lib/armv7-ar/thumb/softfp/redboot.ld</font><font color="green"><font color="cyan">:</font>161<font color="cyan">:</font></font>  <font color="red">__bss_start__</font> = .;
 +
<font color="purple">./lpcxpresso-8p2p2/lpcxpresso/tools/arm-none-eabi/lib/redboot.ld</font><font color="green"><font color="cyan">:</font>161<font color="cyan">:</font></font>  <font color="red">__bss_start__</font> = .;
 +
<font color="purple">./lpcxpresso-8p2p2/lpcxpresso/tools/arm-none-eabi/lib/fpu/redboot.ld</font><font color="green"><font color="cyan">:</font>161<font color="cyan">:</font></font>  <font color="red">__bss_start__</font> = .;
 +
<font color="purple">./lpcxpresso-8p2p2/lpcxpresso/tools/arm-none-eabi/lib/armv7e-m/redboot.ld</font><font color="green"><font color="cyan">:</font>161<font color="cyan">:</font></font>  <font color="red">__bss_start__</font> = .;
 +
<font color="purple">./lpcxpresso-8p2p2/lpcxpresso/tools/arm-none-eabi/lib/armv7e-m/fpu/fpv5-sp-d16/redboot.ld</font><font color="green"><font color="cyan">:</font>161<font color="cyan">:</font></font>  <font color="red">__bss_start__</font> = .;
 +
<font color="purple">./lpcxpresso-8p2p2/lpcxpresso/tools/arm-none-eabi/lib/armv7e-m/fpu/redboot.ld</font><font color="green"><font color="cyan">:</font>161<font color="cyan">:</font></font>  <font color="red">__bss_start__</font> = .;
 +
<font color="purple">./lpcxpresso-8p2p2/lpcxpresso/tools/arm-none-eabi/lib/armv7e-m/fpu/fpv5-d16/redboot.ld</font><font color="green"><font color="cyan">:</font>161<font color="cyan">:</font></font>  <font color="red">__bss_start__</font> = .;
 +
<font color="purple">./lpcxpresso-8p2p2/lpcxpresso/tools/arm-none-eabi/lib/armv7e-m/softfp/fpv5-sp-d16/redboot.ld</font><font color="green"><font color="cyan">:</font>161<font color="cyan">:</font></font>  <font color="red">__bss_start__</font> = .;
 +
<font color="purple">./lpcxpresso-8p2p2/lpcxpresso/tools/arm-none-eabi/lib/armv7e-m/softfp/redboot.ld</font><font color="green"><font color="cyan">:</font>161<font color="cyan">:</font></font>  <font color="red">__bss_start__</font> = .;
 +
<font color="purple">./lpcxpresso-8p2p2/lpcxpresso/tools/arm-none-eabi/lib/armv7e-m/softfp/fpv5-d16/redboot.ld</font><font color="green"><font color="cyan">:</font>161<font color="cyan">:</font></font>  <font color="red">__bss_start__</font> = .;
 +
<font color="purple">./lpcxpresso-8p2p2/lpcxpresso/tools/arm-none-eabi/lib/armv8-m.main/redboot.ld</font><font color="green"><font color="cyan">:</font>161<font color="cyan">:</font></font>  <font color="red">__bss_start__</font> = .;
 +
<font color="purple">./lpcxpresso-8p2p2/lpcxpresso/tools/arm-none-eabi/lib/armv8-m.main/fpu/fpv5-sp-d16/redboot.ld</font><font color="green"><font color="cyan">:</font>161<font color="cyan">:</font></font>  <font color="red">__bss_start__</font> = .;
 +
<font color="purple">./lpcxpresso-8p2p2/lpcxpresso/tools/arm-none-eabi/lib/armv8-m.main/fpu/fpv5-d16/redboot.ld</font><font color="green"><font color="cyan">:</font>161<font color="cyan">:</font></font>  <font color="red">__bss_start__</font> = .;
 +
<font color="purple">./lpcxpresso-8p2p2/lpcxpresso/tools/arm-none-eabi/lib/armv8-m.main/softfp/fpv5-sp-d16/redboot.ld</font><font color="green"><font color="cyan">:</font>161<font color="cyan">:</font></font>  <font color="red">__bss_start__</font> = .;
 +
<font color="purple">./lpcxpresso-8p2p2/lpcxpresso/tools/arm-none-eabi/lib/armv8-m.main/softfp/fpv5-d16/redboot.ld</font><font color="green"><font color="cyan">:</font>161<font color="cyan">:</font></font>  <font color="red">__bss_start__</font> = .;
 +
<font color="purple">./lpcxpresso-8p2p2/lpcxpresso/tools/arm-none-eabi/lib/ldscripts/armelf.xbn</font><font color="green"><font color="cyan">:</font>180<font color="cyan">:</font></font>  <font color="red">__bss_start__</font> = .;
 +
<font color="purple">./lpcxpresso-8p2p2/lpcxpresso/tools/arm-none-eabi/lib/ldscripts/armelf.xs</font><font color="green"><font color="cyan">:</font>169<font color="cyan">:</font></font>  <font color="red">__bss_start__</font> = .;
 +
<font color="purple">./lpcxpresso-8p2p2/lpcxpresso/tools/arm-none-eabi/lib/ldscripts/armelf.x</font><font color="green"><font color="cyan">:</font>180<font color="cyan">:</font></font>  <font color="red">__bss_start__</font> = .;
 +
<font color="purple">./lpcxpresso-8p2p2/lpcxpresso/tools/arm-none-eabi/lib/ldscripts/armelf.xsc</font><font color="green"><font color="cyan">:</font>168<font color="cyan">:</font></font>  <font color="red">__bss_start__</font> = .;
 +
<font color="purple">./lpcxpresso-8p2p2/lpcxpresso/tools/arm-none-eabi/lib/ldscripts/armelf.xw</font><font color="green"><font color="cyan">:</font>179<font color="cyan">:</font></font>  <font color="red">__bss_start__</font> = .;
 +
<font color="purple">./lpcxpresso-8p2p2/lpcxpresso/tools/arm-none-eabi/lib/ldscripts/armelf.xn</font><font color="green"><font color="cyan">:</font>180<font color="cyan">:</font></font>  <font color="red">__bss_start__</font> = .;
 +
<font color="purple">./lpcxpresso-8p2p2/lpcxpresso/tools/arm-none-eabi/lib/ldscripts/armelf.xsw</font><font color="green"><font color="cyan">:</font>168<font color="cyan">:</font></font>  <font color="red">__bss_start__</font> = .;
 +
<font color="purple">./lpcxpresso-8p2p2/lpcxpresso/tools/arm-none-eabi/lib/ldscripts/armelf.xc</font><font color="green"><font color="cyan">:</font>179<font color="cyan">:</font></font>  <font color="red">__bss_start__</font> = .;
 +
<font color="purple">./lpcxpresso-8p2p2/lpcxpresso/tools/arm-none-eabi/lib/armv8-m.base/redboot.ld</font><font color="green"><font color="cyan">:</font>161<font color="cyan">:</font></font>  <font color="red">__bss_start__</font> = .;
 +
<font color="purple">./lpcxpresso-8p2p2/lpcxpresso/tools/arm-none-eabi/lib/thumb/redboot.ld</font><font color="green"><font color="cyan">:</font>161<font color="cyan">:</font></font>  <font color="red">__bss_start__</font> = .;
 +
<font color="purple">./lpcxpresso-8p2p2/lpcxpresso/tools/arm-none-eabi/lib/armv6-m/redboot.ld</font><font color="green"><font color="cyan">:</font>161<font color="cyan">:</font></font>  <font color="red">__bss_start__</font> = .;
 +
<font color="purple">./lpcxpresso-8p2p2/lpcxpresso/tools/share/gcc-arm-none-eabi/samples/ldscripts/nokeep.ld</font><font color="green"><font color="cyan">:</font>35<font color="cyan">:</font></font> *  <font color="red">__bss_start__</font>
 +
<font color="purple">./lpcxpresso-8p2p2/lpcxpresso/tools/share/gcc-arm-none-eabi/samples/ldscripts/nokeep.ld</font><font color="green"><font color="cyan">:</font>113<font color="cyan">:</font></font>                LONG (<font color="red">__bss_start__</font>)
 +
<font color="purple">./lpcxpresso-8p2p2/lpcxpresso/tools/share/gcc-arm-none-eabi/samples/ldscripts/nokeep.ld</font><font color="green"><font color="cyan">:</font>114<font color="cyan">:</font></font>                LONG (__bss_end__ - <font color="red">__bss_start__</font>)
 +
<font color="purple">./lpcxpresso-8p2p2/lpcxpresso/tools/share/gcc-arm-none-eabi/samples/ldscripts/nokeep.ld</font><font color="green"><font color="cyan">:</font>160<font color="cyan">:</font></font>                <font color="red">__bss_start__</font> = .;
 +
<font color="purple">./lpcxpresso-8p2p2/lpcxpresso/tools/share/gcc-arm-none-eabi/samples/ldscripts/gcc.ld</font><font color="green"><font color="cyan">:</font>35<font color="cyan">:</font></font> *  <font color="red">__bss_start__</font>
 +
<font color="purple">./lpcxpresso-8p2p2/lpcxpresso/tools/share/gcc-arm-none-eabi/samples/ldscripts/gcc.ld</font><font color="green"><font color="cyan">:</font>113<font color="cyan">:</font></font>          LONG (<font color="red">__bss_start__</font>)
 +
<font color="purple">./lpcxpresso-8p2p2/lpcxpresso/tools/share/gcc-arm-none-eabi/samples/ldscripts/gcc.ld</font><font color="green"><font color="cyan">:</font>114<font color="cyan">:</font></font>          LONG (__bss_end__ - <font color="red">__bss_start__</font>)
 +
<font color="purple">./lpcxpresso-8p2p2/lpcxpresso/tools/share/gcc-arm-none-eabi/samples/ldscripts/gcc.ld</font><font color="green"><font color="cyan">:</font>160<font color="cyan">:</font></font>          <font color="red">__bss_start__</font> = .;
 +
<font color="purple">./lpcxpresso-8p2p2/lpcxpresso/tools/share/gcc-arm-none-eabi/samples/ldscripts/multi-ram.ld</font><font color="green"><font color="cyan">:</font>36<font color="cyan">:</font></font> *  <font color="red">__bss_start__</font>
 +
<font color="purple">./lpcxpresso-8p2p2/lpcxpresso/tools/share/gcc-arm-none-eabi/samples/ldscripts/multi-ram.ld</font><font color="green"><font color="cyan">:</font>111<font color="cyan">:</font></font>            LONG (<font color="red">__bss_start__</font>)
 +
<font color="purple">./lpcxpresso-8p2p2/lpcxpresso/tools/share/gcc-arm-none-eabi/samples/ldscripts/multi-ram.ld</font><font color="green"><font color="cyan">:</font>112<font color="cyan">:</font></font>            LONG (__bss_end__ - <font color="red">__bss_start__</font>)
 +
<font color="purple">./lpcxpresso-8p2p2/lpcxpresso/tools/share/gcc-arm-none-eabi/samples/ldscripts/multi-ram.ld</font><font color="green"><font color="cyan">:</font>165<font color="cyan">:</font></font>            <font color="red">__bss_start__</font> = .;
 +
<font color="purple">./lpcxpresso-8p2p2/lpcxpresso/tools/share/gcc-arm-none-eabi/samples/startup/startup_ARMCM3.S</font><font color="green"><font color="cyan">:</font>202<font color="cyan">:</font></font> *    <font color="red">__bss_start__</font><font color="cyan">:</font> start of the BSS section.
 +
<font color="purple">./lpcxpresso-8p2p2/lpcxpresso/tools/share/gcc-arm-none-eabi/samples/startup/startup_ARMCM3.S</font><font color="green"><font color="cyan">:</font>207<font color="cyan">:</font></font>  ldr    r1, =<font color="red">__bss_start__</font>
 +
<font color="purple">./lpcxpresso-8p2p2/lpcxpresso/tools/share/gcc-arm-none-eabi/samples/startup/startup_ARMCM4.S</font><font color="green"><font color="cyan">:</font>202<font color="cyan">:</font></font> *    <font color="red">__bss_start__</font><font color="cyan">:</font> start of the BSS section.
 +
<font color="purple">./lpcxpresso-8p2p2/lpcxpresso/tools/share/gcc-arm-none-eabi/samples/startup/startup_ARMCM4.S</font><font color="green"><font color="cyan">:</font>207<font color="cyan">:</font></font>  ldr    r1, =<font color="red">__bss_start__</font>
 +
<font color="purple">./lpcxpresso-8p2p2/lpcxpresso/tools/share/gcc-arm-none-eabi/samples/startup/startup_ARMCM7.S</font><font color="green"><font color="cyan">:</font>202<font color="cyan">:</font></font> *    <font color="red">__bss_start__</font><font color="cyan">:</font> start of the BSS section.
 +
<font color="purple">./lpcxpresso-8p2p2/lpcxpresso/tools/share/gcc-arm-none-eabi/samples/startup/startup_ARMCM7.S</font><font color="green"><font color="cyan">:</font>207<font color="cyan">:</font></font>  ldr    r1, =<font color="red">__bss_start__</font>
 +
<font color="purple">./lpcxpresso-8p2p2/lpcxpresso/tools/share/gcc-arm-none-eabi/samples/startup/startup_ARMCM0.S</font><font color="green"><font color="cyan">:</font>208<font color="cyan">:</font></font> *    <font color="red">__bss_start__</font><font color="cyan">:</font> start of the BSS section.
 +
<font color="purple">./lpcxpresso-8p2p2/lpcxpresso/tools/share/gcc-arm-none-eabi/samples/startup/startup_ARMCM0.S</font><font color="green"><font color="cyan">:</font>213<font color="cyan">:</font></font>  ldr    r1, =<font color="red">__bss_start__</font>
  
<b>Analysis:</b>  we see MCU compiler options in each of LPC's subdir.mk files, in the targets / recipes which build .o files from .c files.  There is in this process the step of converting from C source to ARM assembly, that is .c to .s.  But we don't see in any of LPC project makefiles some of the options passed to the MCU assember, e.r. "-x assembler-with-cpp".  We dont' have this optoin in our GNU version makefile at all, so could this be why we're running into assebler errors of the forms "/tmp/ccYl1ldJ.s:232: Error: cannot honor width suffix -- `mov r1,#255'" and "/tmp/ccYl1ldJ.s:378: Error: lo register required -- `add r2,r3,#1'"?  - TMH
 
  
In the LPC project here is what a text pattern search shows regarding patterns "x assembler-with-cpp" and "Map=rtos-demo-4.map", which are options passed respectively to the assembler and linker:
 
  
<pre>
+
<!-- comment -->
~/projects/nxp/rtos-demo-4$ grep -nr 'x assembler-with-cpp' ./*
 
  
./Debug/Makefile:241: arm-none-eabi-gcc -c -x assembler-with-cpp -D__REDLIB__ -DDEBUG -D__CODE_RED -g3 -mcpu=cortex-m0 -mthumb -D__REDLIB__ -specs=redlib.specs $< -o $@
+
== [[#top|^]] Linker Script Details ==
  
~/projects/nxp/rtos-demo-4$
+
Good details on linker scripts here:
~/projects/nxp/rtos-demo-4$ ./Debug/set-aside/makefile:36: arm-none-eabi-gcc -nostdlib -L"/home/${USER}/Downloads/freertos/FreeRTOSv10.0.1/FreeRTOS/Demo/CORTEX_M0_LPC1114_LPCXpresso/CMSISv2p00_LPC11xx/Debug" -Xlinker -Map=rtos-demo-4.map -Xlinker --gc-sections -mcpu=cortex-m0 -mthumb -T "rtos-demo-4-debug.ld" -o "rtos-demo-4.axf" $(OBJS) $(USER_OBJS) $(LIBS)
+
*  https://stackoverflow.com/questions/28825812/update-linker-variables-after-gc-sections
 +
-Xlinker option and related:
 +
*  https://gcc.gnu.org/onlinedocs/gcc/Link-Options.html#Link-Options
  
</pre>
+
. . .
  
  
The MCU assembler options don't seem to appear in any file of the LPC project.  . . .
 
  
  
 
<!-- comment -->
 
<!-- comment -->
  
=== [[#top|^]] Single makefile first attempt end point ===
+
== [[#top|^]] 2018-07-10 - GNU style makefile calls sub-makefiles of LPCXpresso ==
  
Much work with single makefile got us compiling all FreeRTOS demo sources except the file cr_startup_lpc11.c, which contains assembly code. Here at this point we reached an error reported by the GCC ARM assembler, regarding non-aligned data or variables. An example message reads as follows:
+
- STEP - First try this Tuesday morning, cannot find <stdint.h> . . .
  
 
<pre>
 
<pre>
/tmp/ccnCOBAj.s: Assembler messages:
+
Building file: ../Source/cr_startup_lpc11.c
/tmp/ccnCOBAj.s:421: Error: invalid offset, target not word aligned (0x00000116)
+
Invoking: MCU C Compiler
/tmp/ccnCOBAj.s:421: Error: invalid offset, value too big (0x00000002)
+
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 -Os -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/cr_startup_lpc11.d" -MT"Source/cr_startup_lpc11.d" -o "Source/cr_startup_lpc11.o" "../Source/cr_startup_lpc11.c"
Makefile:344: recipe for target 'Source/lpc-startup-code/cr_startup_lpc11.o' failed
+
In file included from ../Source/cr_startup_lpc11.c:51:0:
make: *** [Source/lpc-startup-code/cr_startup_lpc11.o] Error 1
+
/home/user/Downloads/freertos/FreeRTOSv10.0.1/FreeRTOS/Demo/CORTEX_M0_LPC1114_LPCXpresso/CMSISv2p00_LPC11xx/inc/system_LPC11xx.h:33:20: fatal error: stdint.h: No such file or directory
</pre>
+
#include <stdint.h>
 +
                    ^
 +
compilation terminated.
 +
Source/subdir.mk:40: recipe for target 'Source/cr_startup_lpc11.o' failed
 +
make: *** [Source/cr_startup_lpc11.o] Error 1
 +
</pre>
 +
 
 +
Searching for header file stdint.h in /opt/nxp:
  
In these builds we began using the compiler and toolchain provided by Debian package <code>binutils-arm-none-eabi</code>. Eventually forum posts on this error led us to try switching to the toolchain which installed as part of LPCXpresso 8p2p2 which are located in <code>/opt/nxp/lpcxpresso-8p2p2/lpcxpresso/tools/bin</code>. These also failed to assemble a small amount of assembly code in the file cr_startup_lpc11.c. We next tried downloading and building GNU GCC 8.1.0, but turns out this is a compiler for desktop and server class processors, and not the wide range of embedded focused processor families.
+
<pre>
 +
/opt/nxp$ find . -name stdint.h
 +
./lpcxpresso-8p2p2/lpcxpresso/tools/redlib/include/stdint.h
 +
./lpcxpresso-8p2p2/lpcxpresso/tools/lib/gcc/arm-none-eabi/5.4.1/include/stdint.h
 +
./lpcxpresso-8p2p2/lpcxpresso/tools/arm-none-eabi/include/stdint.h
 +
./lpcxpresso-8p2p2/lpcxpresso/tools/arm-none-eabi/include/c++/5.4.1/tr1/stdint.h
 +
</pre>
 +
 
 +
- STEP - amending include paths with -I . . .
  
LPC compiler toolchain is installed on the localhost at <code>/opt/nxp/lpcxpresso-8p2p2/lpcxpresso/tools/bin</code>.
+
Adding needed paths to CFLAGS fails to solve our present modified top-project-level makefile named 'Makefile', which in turn calls LPC-generated sub-makefiles per project source directory.  The cause we think is that those subdir.mk files each express targets whose options to gcc are already expanded and thus fixed.  There is no appearance of $CFLAGS in those target recipes.
  
  
 
<!-- comment -->
 
<!-- comment -->
  
== [[#top|^]] rtos demo 5 - Attempting project build without LPC 8p2p2 ==
+
=== [[#top|^]] <i>Suspicion subdir.mk target recipes lack variables </i> ===
  
LPCXpresso FreeRTOS demo project copies have worked twice to product projects which import into LPC 8p2p2 as existing projects, and build there to a compilable, editable and executable form which runs on an LPC1114 dev board.  Each project copying effort involved running the shell'ized version of the FreeRTOS demo port's "copy dirs and files" DOS batch file.  There were a few amendments to make to that batch file's commands, to account for DOS' case insentive behavior where Unix/Linux command line environments care about case.  There also appeared to be some missed project header files, such as IntQueue.h and FreeRTOSConfig.h.  These were hand-added to the [[Create_project_directory_structure_version_1|create-project-directory-structure.sh]] scripts, of which there are three versions.  Version here are very similar.
+
- 2018-07-11 - Tuesday -
  
At this point as of 2017-07-26 Thursday we observe that there's a change in the project .map file generated by the toolchain. Our history of FreeRTOS demo project experiments to port project to GCC toolchain runs rtos-demo-3, rtos-demo-4, rtos-demo-5.  In experiments 3 and 4 their .map files define the assembly-wise label 'ResetISR'.  In rtos-demo-5 this label is missing from a section of the .map file around line range 940..964.  Ted suspects errors in the .cproject and possibly .project files, which are not yet fully understood . . .
+
Suspicion: &nbsp;subdir.mk target recipes contain no variables to expand, so that amendments to typical makefile variables such as CFLAGS are not applied when make calls programs to execute these targets.
  
 +
There are a couple of things going on here as we search for an automatable way to convert LPCXpresso firmware projects into GNU gcc toolchain projects.  Have 'make' or a shell script read sub-make files can be helpful in automatically gathering for example all the sources which are part of a project.  Parsing "hard coded" build recipes can allow us to assign pre-processor, compiler, assembler and linker options to conventional GNU `make` variables.  Achieving these parsings and effectively porting projects from LPCXpresso's makefile way to a GNU type toolchain would give us a lot of insight into the details of project dependencies, and the specific tasks we need `make` to invoke in order to build -- to cross-compile -- a software project for a given target processor.
  
<!-- comment -->
+
Proposed Steps:
  
== [[#top|^]] Questions ==
+
- Step 1 -
 +
<ul>
 +
A first good step to take is to create a recipe which builds a list of all project sources.
 +
</ul>
  
Question: what are these two "boot link" related files, part of LPCXpresso 8p2p2 about? . . .
+
- Step 2 -
 +
<ul>
 +
A second step to attempt authoring is that of a recipe which builds all sources, whose passed options to gcc are in variable which we assign values manually at first. If all sources take the same arguments, this will function as desired.  Otherwise if recipies differ for one or some sources we can create targets for each set of sources which build in distinct ways.
 +
</ul>
  
 +
- Step 3 -
 
<ul>
 
<ul>
<pre>
+
A third step then when we see the project build via our target described in step 2, is to automate that parsing and assigning-to-make-variables the options required to build all project sources.
user@localhost:/opt/nxp/lpcxpresso-8p2p2/lpcxpresso/bin$ file ./boot_link{1,2}
 
./boot_link1: Bourne-Again shell script, ASCII text executable
 
./boot_link2: Bourne-Again shell script, ASCII text executable
 
 
 
user@localhost:/opt/nxp/lpcxpresso-8p2p2/lpcxpresso/bin$
 
</pre>
 
 
</ul>
 
</ul>
 
== - - - - - &nbsp; - - - - - &nbsp; - - - - - &nbsp; - - - - - &nbsp; - - - - - &nbsp; - - - - - &nbsp; - - - - - &nbsp; - - - - - &nbsp; - - - - - &nbsp; - - - - - &nbsp; - - - - - &nbsp; - - - - - &nbsp; - - - - - &nbsp; - - - - - &nbsp; - - - - - &nbsp; - - - - - &nbsp; - - - - - ==
 
 
  
  
 
<!-- comment -->
 
<!-- comment -->
  
== [[#top|^]] FreeRTOS Demonstration Project For LPC1114 ==
+
=== [[#top|^]] <i>edit point - checking dependencies are correct</i> ===
  
Key points in FreeRTOS demonstration project for LPC1114:
+
We must check that our dependencies are getting figured correctly.  A manual call to `make` on a single source file shows host system library headers getting included, not the ones we need.  Though this is likely for a lack of missing -I{path} options given to gcc:
  
*  choose between blink demo and full in main.c, by defining mainCREATE_SIMPLE_BLINKY_DEMO_ONLY to be (1),
+
<pre>
 +
~/projects/nxp/rtos-demo-4/Source/FreeRTOS_Source$ gcc -I.. -I./include -Iportable/GCC/ARM_CM0 -M list.c
  
Simpler LED blink demo has its period of blinking set by delay in prvQueueSendTask() function, as explained in excerpt from file main-blinky.c:
+
list.o: list.c /usr/include/stdc-predef.h /usr/include/stdlib.h \
 
+
/usr/include/features.h /usr/include/i386-linux-gnu/sys/cdefs.h \
<i>
+
/usr/include/i386-linux-gnu/bits/wordsize.h \
    43 * The Queue Send Task:
+
  /usr/include/i386-linux-gnu/gnu/stubs.h \
    44 * The queue send task is implemented by the prvQueueSendTask() function in
+
  /usr/include/i386-linux-gnu/gnu/stubs-32.h \
    45 * this fileprvQueueSendTask() sits in a loop that causes it to repeatedly
+
  /usr/lib/gcc/i586-linux-gnu/4.9/include/stddef.h \
    46 * block for 200 milliseconds, before sending the value 100 to the queue that
+
  /usr/include/i386-linux-gnu/bits/waitflags.h \
    47 * was created within main_blinky()Once the value is sent, the task loops
+
  /usr/include/i386-linux-gnu/bits/waitstatus.h /usr/include/endian.h \
    48 * back around to block for another 200 milliseconds.
+
  /usr/include/i386-linux-gnu/bits/endian.h \
</i>
+
  /usr/include/i386-linux-gnu/bits/byteswap.h \
 
+
  /usr/include/i386-linux-gnu/bits/types.h \
This time period is puond defined on about line 79 in main-blinky.c:
+
/usr/include/i386-linux-gnu/bits/typesizes.h \
 +
/usr/include/i386-linux-gnu/bits/byteswap-16.h \
 +
/usr/include/i386-linux-gnu/sys/types.h /usr/include/time.h \
 +
/usr/include/i386-linux-gnu/sys/select.h \
 +
/usr/include/i386-linux-gnu/bits/select.h \
 +
/usr/include/i386-linux-gnu/bits/sigset.h \
 +
/usr/include/i386-linux-gnu/bits/time.h \
 +
/usr/include/i386-linux-gnu/sys/sysmacros.h \
 +
/usr/include/i386-linux-gnu/bits/pthreadtypes.h /usr/include/alloca.h \
 +
/usr/include/i386-linux-gnu/bits/stdlib-float.h include/FreeRTOS.h \
 +
/usr/lib/gcc/i586-linux-gnu/4.9/include/stdint.h /usr/include/stdint.h \
 +
/usr/include/i386-linux-gnu/bits/wchar.h ../FreeRTOSConfig.h \
 +
include/projdefs.h include/portable.h include/deprecated_definitions.h \
 +
portable/GCC/ARM_CM0/portmacro.h include/mpu_wrappers.h include/list.h
  
  #define mainQUEUE_SEND_FREQUENCY_MS            ( 200 / portTICK_PERIOD_MS )
+
$
 +
</pre>
  
  
<!--
+
<!-- comment -->
Notes:
 
  
In main_full.c:  ". . .  mainCREATE_SIMPLE_BLINKY_DEMO_ONLY setting in main.c . . ."
+
== [[#top|^]] Second Approach - Single Makefile ==
  
  In main.c line 118:   void vMainToggleLED( void )
+
Understanding better how LPC's build process calls "children" makefiles, plus thinking about how to parse LPC's makefiles, its build output, and or its .cproject and .project files we're trying a more ground up approach by crafting a single makefile. This makefile's output is nearly identical to LPC's build output but ours does not find the needed project header file named stdlib.h.  This header file isn't particular to the FreeRTOS demo project.  It is most likely part of LPC / NXP's C library ports to their microcontroller families.  Looking in our local installation of lpcxpresso we find four instances of this header file:
-->
 
  
 +
<i>Figure x - stdlib.h from NXP</i>
  
2018-08-02
+
<pre>
Question of compiler instance called by LPCXpresso . . . -Os option to compiler calls for optimizing for code size:
+
/opt/nxp/lpcxpresso-8p2p2$ ls -l `find . -name stdlib.h`
 +
-rwxr-xr-x 1 root root  1480 Jul 21  2016 ./lpcxpresso/tools/arm-none-eabi/include/c++/5.4.1/tr1/stdlib.h
 +
-rwxr-xr-x 1 root root  138 Jul 21  2016 ./lpcxpresso/tools/arm-none-eabi/include/machine/stdlib.h
 +
-rwxr-xr-x 1 root root 11607 Jul 21  2016 ./lpcxpresso/tools/arm-none-eabi/include/stdlib.h
 +
-rwxr-xr-x 1 root root  3699 Jul 21  2016 ./lpcxpresso/tools/redlib/include/stdlib.h
 +
</pre>
 +
 
 +
QUESTION:  which of these is the file we need to include?  They all differ from one another, and it's likely only one is correct . . .  - TMH
 +
 
 +
 
 +
CHECK OUT / REVISIT:  in LPCXpresso IDE:  Project Properties -->  C/C++ Build  -->  Settings  -->  MCU Assembler. There is a string of options shown here which reads "-c -x assembler-with-cpp -D__REDLIB__ -DDEBUG -D__CODE_RED -g3 -mcpu=cortex-m0 -mthumb -D__REDLIB__ -specs=redlib.specs". QUESTION:  Is our single makefile sending these options at the point of assembly?
 +
 
 +
 
 +
2018-07-18 WED - LPC project properties
 +
 
 +
Noticing that under LPCXpresso project properties, there are most and perhaps all compiler flags and options available to view here.  In the path <b>Project Properties -->  C/C++ Build  -->  Settings  -->  MCU Compiler</b> we find expanded options to the compiler arm-none-eabi-gcc as follows:
  
 
<pre>
 
<pre>
/usr/lib/distcc$ ls -l
+
-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/FreeRTOSv10.0.1/FreeRTOS/Demo/CORTEX_M0_LPC1114_LPCXpresso/CMSISv2p00_LPC11xx/inc" -I"../../../Common/include" -I"/home/${USER}/projects/nxp/rtos-demo-4/Source/Common_Demo_Tasks/include" -I"/home/${USER}/projects/nxp/rtos-demo-4/Source" -I"/home/${USER}/projects/nxp/rtos-demo-4/Source/FreeRTOS_Source/include" -I"/home/${USER}/projects/nxp/rtos-demo-4/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
total 0
+
</pre>
lrwxrwxrwx 1 root root 16 Apr 18 15:52 arm-none-eabi-g++ -> ../../bin/distcc
+
 
lrwxrwxrwx 1 root root 16 Apr 18 15:52 arm-none-eabi-gcc -> ../../bin/distcc
+
There is also a list of variables which looks like it could expand to these options.  The variables are in a smaller text box titled "Expert Settings":
lrwxrwxrwx 1 root root 16 Apr 18 15:52 arm-none-eabi-gcc-4.8 -> ../../bin/distcc
+
 
lrwxrwxrwx 1 root root 16 Mar 10 10:30 avr-g++ -> ../../bin/distcc
 
lrwxrwxrwx 1 root root 16 Mar 10 10:30 avr-gcc -> ../../bin/distcc
 
lrwxrwxrwx 1 root root 16 Mar 10 10:30 avr-gcc-4.8.1 -> ../../bin/distcc
 
lrwxrwxrwx 1 root root 16 Oct 11  2017 c++ -> ../../bin/distcc
 
lrwxrwxrwx 1 root root 16 Oct 11  2017 c89-gcc -> ../../bin/distcc
 
lrwxrwxrwx 1 root root 16 Oct 11  2017 c99-gcc -> ../../bin/distcc
 
lrwxrwxrwx 1 root root 16 Oct 11  2017 cc -> ../../bin/distcc
 
lrwxrwxrwx 1 root root 16 Oct 11  2017 g++ -> ../../bin/distcc
 
lrwxrwxrwx 1 root root 16 Oct 11  2017 g++-4.9 -> ../../bin/distcc
 
lrwxrwxrwx 1 root root 16 Oct 11  2017 gcc -> ../../bin/distcc
 
lrwxrwxrwx 1 root root 16 Oct 11  2017 gcc-4.9 -> ../../bin/distcc
 
lrwxrwxrwx 1 root root 16 Oct 11  2017 i586-linux-gnu-g++ -> ../../bin/distcc
 
lrwxrwxrwx 1 root root 16 Oct 11  2017 i586-linux-gnu-g++-4.9 -> ../../bin/distcc
 
lrwxrwxrwx 1 root root 16 Oct 11  2017 i586-linux-gnu-gcc -> ../../bin/distcc
 
lrwxrwxrwx 1 root root 16 Oct 11  2017 i586-linux-gnu-gcc-4.9 -> ../../bin/distcc
 
</pre>
 
 
 
And cd'ing and then into 'bin' directory:
 
 
 
 
<pre>
 
<pre>
/usr/bin$ ls -l dist*
+
${COMMAND} ${FLAGS} ${OUTPUT_FLAG} ${OUTPUT_PREFIX}${OUTPUT} ${INPUTS}
-rwxr-xr-x 1 root root 120248 Nov  2  2014 distcc
 
-rwxr-xr-x 1 root root 128632 Nov  2  2014 distccd
 
-rwxr-xr-x 1 root root  42252 Nov  2  2014 distccmon-text
 
 
</pre>
 
</pre>
  
  
 +
<!-- comment -->
  
 +
=== [[#top|^]] LPC compiler, assember, linker options ===
  
<!-- comment -->
+
We're close but not quite to the goal of expressing all needed options in our GNU makefile, those options which are present but not obvious in the LPCXpresso FreeRTOS demo project.  As mentioned just above and discovered by Ted yesterday, an LPC project's properties offers among many things settings which include flags and options to compiler, assembler and linker.  To better understand how LPCXPresso manages all this, the following table contains the triplet data sets for each tool / each stage in the build process, minus preprocessing.  Preprocessing is absent from LPC's <b>Project Properties --> C/C++ Build --> Settings</b> dialog box.
  
== [[#top|^]] LPC1114 Serial Port Configuration ==
+
<i>Figure x - LPCXpresso compiler options summary</i>
  
Initial search and exercises of LPC1114 serial port . . .
+
*  MCU Compiler
 +
<ul>
 +
<pre>
 +
arm-none-eabi-gcc
  
*  https://www.nxp.com/docs/en/application-note/AN10955.pdf
+
-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/FreeRTOSv10.0.1/FreeRTOS/Demo/CORTEX_M0_LPC1114_LPCXpresso/CMSISv2p00_LPC11xx/inc" -I"../../../Common/include" -I"/home/user/projects/nxp/rtos-demo-4/Source/Common_Demo_Tasks/include" -I"/home/user/projects/nxp/rtos-demo-4/Source" -I"/home/user/projects/nxp/rtos-demo-4/Source/FreeRTOS_Source/include" -I"/home/user/projects/nxp/rtos-demo-4/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
  
In this PDF file named AN10955.pdf there's mention of a more primary starting point for UART software implementations in LPC11xx and LPC13xx parts,
+
${COMMAND} ${FLAGS} ${OUTPUT_FLAG} ${OUTPUT_PREFIX}${OUTPUT} ${INPUTS}
 +
</pre>
 +
</ul>
  
 +
* MCU Assembler
 
<ul>
 
<ul>
<i>"For the principle of software UART implementation, please refer to AN10689 . . ."</i>
+
<pre>
</ul>
+
arm-none-eabi-gcc
  
 +
-c -x assembler-with-cpp -D__REDLIB__ -DDEBUG -D__CODE_RED -g3 -mcpu=cortex-m0 -mthumb -D__REDLIB__ -specs=redlib.specs
  
 +
${COMMAND} ${FLAGS} ${OUTPUT_FLAG} ${OUTPUT_PREFIX}${OUTPUT} ${INPUTS}
 +
</pre>
 +
</ul>
  
<!-- comment -->
+
* MCU Linker
 +
<ul>
 +
<pre>
 +
arm-none-eabi-gcc
 +
 
 +
-nostdlib -L"/home/${USER}/Downloads/freertos/FreeRTOSv10.0.1/FreeRTOS/Demo/CORTEX_M0_LPC1114_LPCXpresso/CMSISv2p00_LPC11xx/Debug" -Xlinker -Map=rtos-demo-4.map -Xlinker --gc-sections -mcpu=cortex-m0 -mthumb -T "rtos-demo-4-debug.ld"
 +
 
 +
${COMMAND} ${FLAGS} ${OUTPUT_FLAG} ${OUTPUT_PREFIX}${OUTPUT} ${INPUTS}
 +
</pre>
 +
</ul>
  
== - - - - - &nbsp; - - - - - &nbsp; - - - - - &nbsp; - - - - - &nbsp; - - - - - &nbsp; - - - - - &nbsp; - - - - - &nbsp; - - - - - &nbsp; - - - - - &nbsp; - - - - - &nbsp; - - - - - &nbsp; - - - - - &nbsp; - - - - - &nbsp; - - - - - &nbsp; - - - - - &nbsp; - - - - - &nbsp; - - - - - ==
 
  
 +
<b>Analysis:</b>  we see MCU compiler options in each of LPC's subdir.mk files, in the targets / recipes which build .o files from .c files.  There is in this process the step of converting from C source to ARM assembly, that is .c to .s.  But we don't see in any of LPC project makefiles some of the options passed to the MCU assember, e.r. "-x assembler-with-cpp".  We dont' have this optoin in our GNU version makefile at all, so could this be why we're running into assebler errors of the forms "/tmp/ccYl1ldJ.s:232: Error: cannot honor width suffix -- `mov r1,#255'" and "/tmp/ccYl1ldJ.s:378: Error: lo register required -- `add r2,r3,#1'"?  - TMH
  
 +
In the LPC project here is what a text pattern search shows regarding patterns "x assembler-with-cpp" and "Map=rtos-demo-4.map", which are options passed respectively to the assembler and linker:
  
<!-- comment -->
+
<pre>
 +
~/projects/nxp/rtos-demo-4$ grep -nr 'x assembler-with-cpp' ./*
  
== [[#top|^]] Appendix A - CMSISv2p00 library files ==
+
./Debug/Makefile:241: arm-none-eabi-gcc -c -x assembler-with-cpp -D__REDLIB__ -DDEBUG -D__CODE_RED -g3 -mcpu=cortex-m0 -mthumb -D__REDLIB__ -specs=redlib.specs $< -o $@
  
2018-04-18
+
~/projects/nxp/rtos-demo-4$
 +
~/projects/nxp/rtos-demo-4$ ./Debug/set-aside/makefile:36: arm-none-eabi-gcc -nostdlib -L"/home/${USER}/Downloads/freertos/FreeRTOSv10.0.1/FreeRTOS/Demo/CORTEX_M0_LPC1114_LPCXpresso/CMSISv2p00_LPC11xx/Debug" -Xlinker -Map=rtos-demo-4.map -Xlinker --gc-sections -mcpu=cortex-m0 -mthumb -T "rtos-demo-4-debug.ld" -o "rtos-demo-4.axf" $(OBJS) $(USER_OBJS) $(LIBS)
  
CMSISv2p00 library files noted during installation:
+
</pre>
  
<ul>
 
*  [[cmsisv2p00_library_files|CMSIS V2p00 Library Files]]
 
</ul>
 
  
 +
The MCU assembler options don't seem to appear in any file of the LPC project.  . . .
  
  
 
<!-- comment -->
 
<!-- comment -->
  
== [[#top|^]] References ==
+
=== [[#top|^]] Single makefile first attempt end point ===
  
- - - NEED MOVE THESE FIRST REFERENCES TO STM32F NOTES - TMH - - -
+
Much work with single makefile got us compiling all FreeRTOS demo sources except the file cr_startup_lpc11.c, which contains assembly code.  Here at this point we reached an error reported by the GCC ARM assembler, regarding non-aligned data or variables.  An example message reads as follows:
  
*  https://www.cs.indiana.edu/~geobrown/book.pdf . . . In-depth STM32F development book by Geoffry Brown of Indiana State University
+
<pre>
**  git://github.com/geoffreymbrown/STM32-Template.git . . . Linux-based STM32 project template
+
/tmp/ccnCOBAj.s: Assembler messages:
*  http://www.st.com/content/st_com/en/support/learning/stm32-education/text-books.html . . . Geoffry Brown and other STM32 books
+
/tmp/ccnCOBAj.s:421: Error: invalid offset, target not word aligned (0x00000116)
This reference could also be in the above section on building STM32 projects with GNU make:
+
/tmp/ccnCOBAj.s:421: Error: invalid offset, value too big (0x00000002)
* http://scottmcpeak.com/autodepend/autodepend.html
+
Makefile:344: recipe for target 'Source/lpc-startup-code/cr_startup_lpc11.o' failed
 +
make: *** [Source/lpc-startup-code/cr_startup_lpc11.o] Error 1
 +
</pre>
  
- - - ^ MOVE TO STM32F NOTES ^ - - -
+
In these builds we began using the compiler and toolchain provided by Debian package <code>binutils-arm-none-eabi</code>.  Eventually forum posts on this error led us to try switching to the toolchain which installed as part of LPCXpresso 8p2p2 which are located in <code>/opt/nxp/lpcxpresso-8p2p2/lpcxpresso/tools/bin</code>.  These also failed to assemble a small amount of assembly code in the file cr_startup_lpc11.c.  We next tried downloading and building GNU GCC 8.1.0, but turns out this is a compiler for desktop and server class processors, and not the wide range of embedded focused processor families.
  
 +
LPC compiler toolchain is installed on the localhost at <code>/opt/nxp/lpcxpresso-8p2p2/lpcxpresso/tools/bin</code>.
  
*  https://batchloaf.wordpress.com/2013/11/29/simple-arm-example-for-lpc1114/
 
*  http://eleceng.dit.ie/frank/arm/index.html . . . part of Frank Duignan 's web page with microcontroller projects
 
**  http://eleceng.dit.ie/frank/arm/BareMetalLPC1114/display/index.html . . . pin signaling to put LPC111x into programming mode
 
  
 +
<!-- comment -->
  
LPCXpresso LPC1343 development board . . .
+
== [[#top|^]] rtos demo 5 - Attempting project build without LPC 8p2p2 ==
*  https://www.embeddedartists.com/products/lpcxpresso/lpc1343_xpr.php
 
*  https://www.embeddedartists.com/sites/default/files/docs/schematics/LPCXpressoLPC1343revA.pdf . . . schematic of board - NOT COMPLETE!  LPC1343 micro missing!
 
*  https://www.nxp.com/downloads/en/schematics/LPCXpresso-LPC1104-schematic-RevA.pdf . . . better schematic
 
  
* http://docs.lpcware.com/lpc800um/RegisterMaps/ispapi/r-SetBaudRateISP.html
+
LPCXpresso FreeRTOS demo project copies have worked twice to product projects which import into LPC 8p2p2 as existing projects, and build there to a compilable, editable and executable form which runs on an LPC1114 dev board. Each project copying effort involved running the shell'ized version of the FreeRTOS demo port's "copy dirs and files" DOS batch file.  There were a few amendments to make to that batch file's commands, to account for DOS' case insentive behavior where Unix/Linux command line environments care about case.  There also appeared to be some missed project header files, such as IntQueue.h and FreeRTOSConfig.h. These were hand-added to the [[Create_project_directory_structure_version_1|create-project-directory-structure.sh]] scripts, of which there are three versions.  Version here are very similar.
  
* https://www.nxp.com/downloads/en/design-support/LPCXpresso_Getting_Started_User_Guide.pdf
+
At this point as of 2017-07-26 Thursday we observe that there's a change in the project .map file generated by the toolchain.  Our history of FreeRTOS demo project experiments to port project to GCC toolchain runs rtos-demo-3, rtos-demo-4, rtos-demo-5. In experiments 3 and 4 their .map files define the assembly-wise label 'ResetISR'. In rtos-demo-5 this label is missing from a section of the .map file around line range 940..964.  Ted suspects errors in the .cproject and possibly .project files, which are not yet fully understood . . .
  
  
Looking further for necessary FTDI cable to board wiring . . .
+
<!-- comment -->
*  https://diyprojects.io/how-to-install-armbian-on-orange-pi-without-screen-or-keyboard-with-ftdi-cable/
 
  
* http://dangerousprototypes.com/docs/LPC_ARM_quick_start
+
== [[#top|^]] Questions ==
 +
 
 +
Question: what are these two "boot link" related files, part of LPCXpresso 8p2p2 about? . . .
 +
 
 +
<ul>
 +
<pre>
 +
user@localhost:/opt/nxp/lpcxpresso-8p2p2/lpcxpresso/bin$ file ./boot_link{1,2}
 +
./boot_link1: Bourne-Again shell script, ASCII text executable
 +
./boot_link2: Bourne-Again shell script, ASCII text executable
 +
 
 +
user@localhost:/opt/nxp/lpcxpresso-8p2p2/lpcxpresso/bin$
 +
</pre>
 +
</ul>
 +
 
 +
== - - - - - &nbsp; - - - - - &nbsp; - - - - - &nbsp; - - - - - &nbsp; - - - - - &nbsp; - - - - - &nbsp; - - - - - &nbsp; - - - - - &nbsp; - - - - - &nbsp; - - - - - &nbsp; - - - - - &nbsp; - - - - - &nbsp; - - - - - &nbsp; - - - - - &nbsp; - - - - - &nbsp; - - - - - &nbsp; - - - - - ==
 +
 
 +
 
 +
 
 +
<!-- comment -->
 +
 
 +
== [[#top|^]] FreeRTOS Demonstration Project For LPC1114 ==
 +
 
 +
Key points in FreeRTOS demonstration project for LPC1114:
 +
 
 +
*  choose between blink demo and full in main.c, by defining mainCREATE_SIMPLE_BLINKY_DEMO_ONLY to be (1),
 +
 
 +
Simpler LED blink demo has its period of blinking set by delay in prvQueueSendTask() function, as explained in excerpt from file main-blinky.c:
  
*  http://www.lpctools.com/lpc1343.lpcxpresso.aspx
+
<i>
**  https://www.nxp.com/docs/en/user-guide/UM10375.pdf
+
    43  * The Queue Send Task:
 
+
    44  * The queue send task is implemented by the prvQueueSendTask() function in
 
+
    45  * this file.  prvQueueSendTask() sits in a loop that causes it to repeatedly
=== [[#top|^]] <i>edit point . . .</i> ===
+
    46  * block for 200 milliseconds, before sending the value 100 to the queue that
 
+
    47  * was created within main_blinky().  Once the value is sent, the task loops
GNU gcc as toolchain
+
    48  * back around to block for another 200 milliseconds.
*  http://www.linuxfromscratch.org/lfs/view/6.2/chapter05/adjusting.html  . . . mention of libraries linked, specs files
+
</i>
 
+
 
*  https://stackoverflow.com/questions/8835108/how-to-specify-non-default-shared-library-path-in-gcc-linux-getting-error-whil
+
This time period is puond defined on about line 79 in main-blinky.c:
 
+
 
*  https://gist.github.com/pvdb/777954  . . . `sed` based shell script to list makefile rules recursively
+
  #define mainQUEUE_SEND_FREQUENCY_MS            ( 200 / portTICK_PERIOD_MS )
 +
 
 +
 
 +
<!--
 +
Notes:
 +
 
 +
In main_full.c:  ". . .  mainCREATE_SIMPLE_BLINKY_DEMO_ONLY setting in main.c . . ."
 +
 
 +
In main.c line 118:  void vMainToggleLED( void )
 +
-->
 +
 
 +
 
 +
2018-08-02
 +
Question of compiler instance called by LPCXpresso . . . -Os option to compiler calls for optimizing for code size:
 +
 
 +
<pre>
 +
/usr/lib/distcc$ ls -l
 +
total 0
 +
lrwxrwxrwx 1 root root 16 Apr 18 15:52 arm-none-eabi-g++ -> ../../bin/distcc
 +
lrwxrwxrwx 1 root root 16 Apr 18 15:52 arm-none-eabi-gcc -> ../../bin/distcc
 +
lrwxrwxrwx 1 root root 16 Apr 18 15:52 arm-none-eabi-gcc-4.8 -> ../../bin/distcc
 +
lrwxrwxrwx 1 root root 16 Mar 10 10:30 avr-g++ -> ../../bin/distcc
 +
lrwxrwxrwx 1 root root 16 Mar 10 10:30 avr-gcc -> ../../bin/distcc
 +
lrwxrwxrwx 1 root root 16 Mar 10 10:30 avr-gcc-4.8.1 -> ../../bin/distcc
 +
lrwxrwxrwx 1 root root 16 Oct 11  2017 c++ -> ../../bin/distcc
 +
lrwxrwxrwx 1 root root 16 Oct 11  2017 c89-gcc -> ../../bin/distcc
 +
lrwxrwxrwx 1 root root 16 Oct 11  2017 c99-gcc -> ../../bin/distcc
 +
lrwxrwxrwx 1 root root 16 Oct 11  2017 cc -> ../../bin/distcc
 +
lrwxrwxrwx 1 root root 16 Oct 11  2017 g++ -> ../../bin/distcc
 +
lrwxrwxrwx 1 root root 16 Oct 11  2017 g++-4.9 -> ../../bin/distcc
 +
lrwxrwxrwx 1 root root 16 Oct 11  2017 gcc -> ../../bin/distcc
 +
lrwxrwxrwx 1 root root 16 Oct 11  2017 gcc-4.9 -> ../../bin/distcc
 +
lrwxrwxrwx 1 root root 16 Oct 11  2017 i586-linux-gnu-g++ -> ../../bin/distcc
 +
lrwxrwxrwx 1 root root 16 Oct 11  2017 i586-linux-gnu-g++-4.9 -> ../../bin/distcc
 +
lrwxrwxrwx 1 root root 16 Oct 11  2017 i586-linux-gnu-gcc -> ../../bin/distcc
 +
lrwxrwxrwx 1 root root 16 Oct 11  2017 i586-linux-gnu-gcc-4.9 -> ../../bin/distcc
 +
</pre>
 +
 
 +
And cd'ing and then into 'bin' directory:
 +
 
 +
<pre>
 +
/usr/bin$ ls -l dist*
 +
-rwxr-xr-x 1 root root 120248 Nov  2  2014 distcc
 +
-rwxr-xr-x 1 root root 128632 Nov  2  2014 distccd
 +
-rwxr-xr-x 1 root root  42252 Nov  2  2014 distccmon-text
 +
</pre>
 +
 
 +
 
 +
 
 +
 
 +
<!-- comment -->
 +
 
 +
== [[#top|^]] LPC1114 Serial Port Configuration ==
 +
 
 +
Initial search and exercises of LPC1114 serial port . . .
 +
 
 +
*  https://www.nxp.com/docs/en/application-note/AN10955.pdf
 +
 
 +
In this PDF file named AN10955.pdf there's mention of a more primary starting point for UART software implementations in LPC11xx and LPC13xx parts,
 +
 
 +
<ul>
 +
<i>"For the principle of software UART implementation, please refer to AN10689 . . ."</i>
 +
</ul>
 +
 
 +
 
 +
2018-10-29 MON
 +
 
 +
 
 +
- STEP 1 -
 +
 
 +
In an IAR project context in which a given LPC1114 firmware project seems to rely less on the CMSIS libraries, a first or early reference to setting up the 1114 UART has to do with dividing the system clock.  Find following lines in routine <code>SystemInit()</code> which runs:
 +
 
 +
<pre>
 +
#if ENA_UART != 0^M
 +
  LPC_SYSCON->UARTCLKDIV    = UART_CLK_DIV;        // Set the UART clock^M
 +
#endif^M
 +
</pre>
 +
 
 +
- STEP 2 -
 +
 
 +
References to UART in routine IO_Configure() which does not presently run relate only to PIO1_6 Rx and PIO1_7 Tx:
 +
 
 +
<pre>
 +
$ grep -n 1_6 ./*.c
 +
./io_conf_lqfp48.c:79:    LPC_IOCON->PIO1_6 = P1_6_CONFIG | GPIO_RESERVED;
 +
./io_conf_lqfp48.c:165:            (P1_6_DIR << 6) | (P1_7_DIR << 7) |
 +
./io_conf_lqfp48.c:198:            (P1_6_DEFAULT << 6) | (P1_7_DEFAULT << 7) |
 +
./io_conf_lqfp48.c:250:            (GPIO_IS(P1_6_INT) << 6) | (GPIO_IS(P1_7_INT) << 7) |
 +
./io_conf_lqfp48.c:258:            (GPIO_IBE(P1_6_INT) << 6) | (GPIO_IBE(P1_7_INT) << 7) |
 +
./io_conf_lqfp48.c:266:            (GPIO_IEV(P1_6_INT) << 6) | (GPIO_IEV(P1_7_INT) << 7) |
 +
</pre>
 +
 
 +
Configuration details of each pin are important, e.g. function, direction, interrupt settings.  Here are the further pound defined labels:
 +
 
 +
<pre>
 +
#define P1_6_CONFIG    IO_CONFIG(P1_6, FUNC_RXD, MODE_PU, HYST_DIS)
 +
 
 +
#define P1_6_DIR        DIR_OUTPUT
 +
 
 +
#define P1_6_DEFAULT    0
 +
 
 +
#define P1_6_INT        SENSE_HIGH
 +
</pre>
 +
 
 +
- STEP 3 -
 +
 
 +
In routine <code>main</code> which we'll rewrite, we'll initially copy the existing way and initialize the UART per AP reference notes, calling a routine which also seems to serve as UART reset routine:
 +
 
 +
    IO_UART_Reset();    // Init UART I/O driver
 +
 
 +
. . .
 +
 
 +
 
 +
<!-- comment -->
 +
 
 +
== - - - - - &nbsp; - - - - - &nbsp; - - - - - &nbsp; - - - - - &nbsp; - - - - - &nbsp; - - - - - &nbsp; - - - - - &nbsp; - - - - - &nbsp; - - - - - &nbsp; - - - - - &nbsp; - - - - - &nbsp; - - - - - &nbsp; - - - - - &nbsp; - - - - - &nbsp; - - - - - &nbsp; - - - - - &nbsp; - - - - - ==
 +
<font color="white">
 +
.
 +
.
 +
</font>
 +
 
 +
<!-- comment -->
 +
 
 +
== [[#top|^]] Appendix A - CMSISv2p00 library files ==
 +
 
 +
2018-04-18
 +
 
 +
CMSISv2p00 library files noted during installation:
 +
 
 +
<ul>
 +
*  [[cmsisv2p00_library_files|CMSIS V2p00 Library Files]]
 +
</ul>
 +
 
 +
 
 +
 
 +
<!-- comment -->
 +
 
 +
== [[#top|^]] References ==
 +
 
 +
- - - NEED MOVE THESE FIRST REFERENCES TO STM32F NOTES - TMH - - -
 +
<ul>
 +
<ul>
 +
*  https://www.cs.indiana.edu/~geobrown/book.pdf  . . . In-depth STM32F development book by Geoffry Brown of Indiana State University
 +
**  git://github.com/geoffreymbrown/STM32-Template.git  . . . Linux-based STM32 project template
 +
*  http://www.st.com/content/st_com/en/support/learning/stm32-education/text-books.html . . . Geoffry Brown and other STM32 books
 +
This reference could also be in the above section on building STM32 projects with GNU make:
 +
*  http://scottmcpeak.com/autodepend/autodepend.html
 +
</ul>
 +
</ul>
 +
- - - ^ MOVE TO STM32F NOTES ^ - - -
 +
 
 +
LPC project build issues . . .
 +
*  http://67.222.144.123/lpcopen/v1.03/chip__11xx_2chip_8h_source.html  . . . need to define CORE_M0 . . .
 +
*  https://homepages.inf.ed.ac.uk/imurray2/compnotes/library_linking.txt
 +
*  http://ftp.iar.se/WWWfiles/arm/webic/doc/EWARM_MigrationGuide.ENU.pdf  _STD_BEGIN and _STD_END no longer used in IAR framework or libraries
 +
 
 +
 
 +
Some assorted lpc1114 projects . . .
 +
*  http://www.pittnerovi.com/jiri/hobby/electronics/lpc1114/
 +
*  https://batchloaf.wordpress.com/2013/11/29/simple-arm-example-for-lpc1114/
 +
*  http://eleceng.dit.ie/frank/arm/index.html  . . . part of Frank Duignan 's web page with microcontroller projects
 +
**  http://eleceng.dit.ie/frank/arm/BareMetalLPC1114/display/index.html  . . . pin signaling to put LPC111x into programming mode
 +
**  http://eleceng.dit.ie/frank/arm/BareMetalLPC1114/
 +
 
 +
*  https://www.embeddedrelated.com/showarticle/101.php?articleid=101-  . . . Wouter van Ooijen microcontroller tutorials
 +
 
 +
 
 +
LPCXpresso LPC1343 development board . . .
 +
*  https://www.embeddedartists.com/products/lpcxpresso/lpc1343_xpr.php
 +
* https://www.embeddedartists.com/sites/default/files/docs/schematics/LPCXpressoLPC1343revA.pdf  . . . schematic of board - NOT COMPLETE!  LPC1343 micro missing!
 +
*  https://www.embeddedartists.com/sites/default/files/docs/schematics/LPCXpressoLPC1114revA.pdf
 +
*  https://www.nxp.com/downloads/en/schematics/LPCXpresso-LPC1104-schematic-RevA.pdf  . . . better schematic
 +
 
 +
*  http://docs.lpcware.com/lpc800um/RegisterMaps/ispapi/r-SetBaudRateISP.html
 +
 
 +
*  https://www.nxp.com/downloads/en/design-support/LPCXpresso_Getting_Started_User_Guide.pdf
 +
 
 +
 
 +
=== [[#top|^]] <i>lpc21isp edit point . . .</i> ===
 +
 
 +
lpc21isp for programming . . .
 +
*  https://github.com/UnifiedEngineering/T-962-improvements/wiki/Flashing-the-LPC21xx-controller
 +
*  https://www.embeddedrelated.com/showthread/lpc2000/36858-1.php
 +
 
 +
lpc1114 read out firmware dump firmware
 +
*  https://wiki.newae.com/Tutorial_A9_Bypassing_LPC1114_Read_Protect
 +
 
 +
 
 +
Looking further for necessary FTDI cable to board wiring . . .
 +
*  https://diyprojects.io/how-to-install-armbian-on-orange-pi-without-screen-or-keyboard-with-ftdi-cable/
 +
 
 +
*  http://dangerousprototypes.com/docs/LPC_ARM_quick_start
 +
 
 +
*  http://www.lpctools.com/lpc1343.lpcxpresso.aspx
 +
**  https://www.nxp.com/docs/en/user-guide/UM10375.pdf
 +
 
 +
 
 +
GNU gcc as toolchain
 +
*  http://www.linuxfromscratch.org/lfs/view/6.2/chapter05/adjusting.html  . . . mention of libraries linked, specs files
 +
 
 +
*  https://stackoverflow.com/questions/8835108/how-to-specify-non-default-shared-library-path-in-gcc-linux-getting-error-whil
 +
 
 +
*  https://gist.github.com/pvdb/777954  . . . `sed` based shell script to list makefile rules recursively
 +
 
 +
 
 +
LPC1114 software UART software serial port
 +
*  https://community.nxp.com/thread/426583
 +
*  https://github.com/tacowars/LPC1114-sandbox/blob/master/drivers/swuart/src/swuart_main.c
 +
This may be a better link, many drivers here:
 +
*  https://github.com/tacowars/LPC1114-sandbox/tree/master/drivers
 +
 
 +
This looks interesting also, lpcxpresso project template file . . .
 +
*  https://github.com/tacowars/LPC1114-sandbox/blob/master/drivers/template/template_readme.txt
 +
 
 +
 
 +
2018-10-08 MON
 +
*  https://www.digikey.com/eewiki/display/microcontroller/Getting+Started+with+NXP%27s+LPC11XX+Cortex-M0+ARM+Microcontrollers . .. LPC1114 UART example code at DigiKey
 +
 
 +
2018-10-09 TUE
 +
*  https://www.mouser.com/pdfdocs/LPCXpresso_IDE_User_Guide.pdf
 +
 
 +
 
 +
2018-10-23 TUE
 +
*  http://supp.iar.com/FilesPublic/UPDINFO/007222/InfoCenter/ExampleProjects_en.html . . . IAR Workbench Example Projects , twelve boards mentioned
 +
 
 +
=== [[#top|^]] <i>port configurations edit point . . .</i> ===
 +
 
 +
GPIO Port configurations . . .
 +
*  http://techmasterplus.com/tutorials/arm-gpio.php
 +
 
 +
*  http://socialledge.com/sjsu/index.php/Bitmasking_Tutorial
 +
 
 +
 
 +
<!-- comment -->
 +
 
 +
=== [[#top|^]] <i>A2D configuration</i> ===
 +
 
 +
<ul>
 +
*  https://github.com/tacowars/LPC1114-sandbox/blob/master/drivers/ssp/driver/adc.c
 +
*  http://eleceng.dit.ie/frank/arm/BareMetalLPC1114/
 +
</ul>
  
 
LPC1114 software UART software serial port
 
*  https://community.nxp.com/thread/426583
 
*  https://github.com/tacowars/LPC1114-sandbox/blob/master/drivers/swuart/src/swuart_main.c
 
This may be a better link, many drivers here:
 
*  https://github.com/tacowars/LPC1114-sandbox/tree/master/drivers
 
 
This looks interesting also, lpcxpresso project template file . . .
 
*  https://github.com/tacowars/LPC1114-sandbox/blob/master/drivers/template/template_readme.txt
 
 
 
2018-10-08 MON
 
*  https://www.digikey.com/eewiki/display/microcontroller/Getting+Started+with+NXP%27s+LPC11XX+Cortex-M0+ARM+Microcontrollers . .. LPC1114 UART example code at DigiKey
 
  
 
<!-- comment -->
 
<!-- comment -->
 
 
 
  
 
<center>
 
<center>

Latest revision as of 21:07, 11 March 2019

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


Contents

OVERVIEW

This nn article to hold notes on LPCXpresso Integrated Development Environment and NXP microcontroller programming methods. Author Ted expects the IDE to include or call on tools such as gcc, g++, as, ld, objcopy and related others. Programming methods expected to include FTDI cable based programming employed with FlashMagic and lpc21isp.

As of 2018 Q2 article contributor Ted using LPCXpresso v8.2.2 [Build 650] [2016-09-09].

In addition to some initial notes on NXP parts, also this article contains some notes and references on STMicro's STM32F100 family micro-controllers. This controller is different enough that it deserves an STM32F100 article of its own . . .


^ Quick reference

lpc21isp programming utility

  $ lpc21isp -detectonly /dev/ttyUSB0 9600 12000

  $ lpc21isp -bin ./RTOSDemo.bin /dev/ttyUSB0 9600 8000000


Per following NXP forum post it looks like LPC1114 internal oscillator runs at 12MHz +/-1% . . .


^ LPC1114 LPC1343 Development Board Pinout

2018-04-24 Tuesday


Ted noting LPCXpresso target board pin layout with respect to LPC1343 pins:

  GND             3V3
+5VIN             [ ]
  [ ]             [ ]
  RST             [ ]
 MOSI             [ ]
 MISO             [ ]
  SCK             [ ]
 SSEL             [ ]
  TXD             [ ]/USB_DM

  RXD             [ ]/USB_DP
 P0.7             P0.1/USB_FTOGGLE
 P2.0             P0.3/USB_VBUS
 P2.1             I2C_SDA
 P2.2             I2C_SDL
  AD0             P1.9
  AD1             P1.10
  AD2             P1.11
  AD3             P2.3

  AD4             P2.4
  AD5             P2.5
 P1.5             P2.6
 P1.8             P2.7
 P0.6             P2.8
P0.10             P2.9
 P3.0             P2.10
 P3.1             P3.3
 P3.2             GND


Figure x - expanded ASCII drawing of LPCXpresso dev board pin out:

                       GND             3V3
                     +5VIN             [ ]
                       [ ]             [ ]
                       RST             [ ]
                      MOSI             [ ]
                      MISO             [ ]
                       SCK             [ ]
                      SSEL             [ ]
                    {  TXD             [ ]/USB_DM
 serial port here --{ 
                    {  RXD             [ ]/USB_DP
                      P0.7             P0.1/USB_FTOGGLE   <-- These two pins FTOGGLE and VBUS must be
                      P2.0             P0.3/USB_VBUS      <-- + grounded to put board into programming mode
                      P2.1             I2C_SDA
                      P2.2             I2C_SDL
                       AD0             P1.9
                       AD1             P1.10
                       AD2             P1.11
                       AD3             P2.3

                       AD4             P2.4
                       AD5             P2.5
                      P1.5             P2.6
                      P1.8             P2.7
                      P0.6             P2.8
                     P0.10             P2.9
                      P3.0             P2.10
                      P3.1             P3.3
                      P3.2             GND

In summary the pins to grab for programming an LPC1114 in 48-pin package are:

VDD     . . . pins 8, 44
GND     . . . pins 5, 41
TXD     . . . pin 47
RXD     . . . pin 46
P0.1    . . . pin 4       (also called 'FT' or 'FTOGGLE')
P0.3    . . . pin 14      (also called 'USB-VBUS')


^ Talking With and Programming LPC1114 Dev Board

This article section talks about two pins on the LPC1114 LPC1343 dev board which need be pulled low to put the target chip into programming mode. This article section also talks about the Unix and Linux based command line utility `lpc21isp` which can communitcate serially with the target MCU, and also has a not-very-documented terminal mode, for receiving and sending bytes over the same serial lines once firmware is running on the MCU.

To begin we power down the dev board, ground pins P0.1 and P0.3, then power up and and issue part signature read command:

$ lpc21isp -detectonly /dev/ttyUSB0 9600 12000
lpc21isp version 1.97
Synchronizing (ESC to abort). OK
Read bootcode version: 1
5
Read part ID: LPC1343, 32 kiB FLASH / 8 kiB SRAM (0x3D00002B)

$


Invoking lpc21isp to program a device:

$ lpc21isp -bin ./RTOSDemo.bin /dev/ttyUSB0 9600 8000000
lpc21isp version 1.97
File ./RTOSDemo.bin:
	loaded...
	image size : 18768
Image size : 18768
Synchronizing (ESC to abort). OK
Read bootcode version: 1
5
Read part ID: LPC1343, 32 kiB FLASH / 8 kiB SRAM (0x3D00002B)
Will start programming at Sector 1 if possible, and conclude with Sector 0 to ensure that checksum is written last.
Erasing sector 0 first, to invalidate checksum. OK 
Sector 1: ...............................................................................................
Sector 2: ...............................................................................................
Sector 3: ...............................................................................................
Sector 4: ...........................................................
Sector 0: ..............................................................................................
Download Finished... taking 30 seconds
Now launching the brand new code


In searching for information about lpc21isp's terminal mode we find:


^ General Programming Connections Using SWCLK SWDIO and ISP

Is it possible to use an FTDI cable or similar to program an LPC11xx microcontroller in circuit, whose SWCLK, SWDIO, RESET and ISP pins are available? On Google performing search "LPC1114 program using ISP SWDIO pins" . . .


- - - - -   - - - - -   - - - - -   - - - - -   - - - - -   - - - - -   - - - - -   - - - - -   - - - - -   - - - - -   - - - - -   - - - - -   - - - - -   - - - - -   - - - - -   - - - - -   - - - - -

.

^ LPCXPRESSO C/C++ DEVELOPMENT TOOLKIT [CDT]

^ Views and Perspectives

Found in 'Help - LPCXpresso IDE User Guide' . . .

"Views in the C/C++ perspective

The C/C++ views are panels that help you perform the tasks involved in creating C/C++ programs. The C/C++ perspective displays these panels in a single Eclipse window.

Changing Views:
You can add views to a perspective. From the menu bar choose Window > Show View > Other and select a new view from the Show View dialog.
To reset the current perspective to its original layout, from the menu bar choose Window > Reset Perspective."



- - - - -   - - - - -   - - - - -   - - - - -   - - - - -   - - - - -   - - - - -   - - - - -   - - - - -   - - - - -   - - - - -   - - - - -   - - - - -   - - - - -   - - - - -   - - - - -   - - - - -

.

^ DEMOS AND APPLICATIONS

This section of LPCExpresso wiki article dedicated to notes and references on various LPC1114 and related code topics and projects. As of 2018-11-02 Friday microcontroller and uC peripheral topics include #I2C, #PWM and #FreeRTOS. Over time more topics will be added here. The topic on #FreeRTOS includes a lot of subsections, which partially detail wiki contributor Ted's efforts to port the LPCXpresso FreeRTOS demo to the command lined based GCC toolchain as run under a cerca 2017 stable Debian release. In this effort Ted got as far as compiling the sources, but the "Xpresso to GCC port" version fails at an assembly stage, which arm-none-eabi-as complaining that it "cannot honor width suffix". This error may be misleading, as in the case where the format of assembly code may be for a different assembler from a different toolchain. Have yet to resolve this question . . . - TMH

A few places which may be good startig points, pick-up-again points include these following pages. These mention that the issue may be one of a compiler generating thumb or thumb1 type assembly code, when the assembler then expects non-thumb assembly code:


^ I2C References And Notes

- 2018-11-19 Monday -


Looking for 'ACK' signal specification in i2c context . . .

ACK_ERROR occurs in routine I2c_WriteByte(), which in turn calls I2C_WriteBit() with a value and a timeout value. The timeout value is assigned in main.c:

 ./main.c:64:    SCD30_Init(0x61, 10); // SCD30 listens on address 0x61 with 10ms I2c timeout

Sensirion I2C and USART capable sensor:


2018-11-08 Thursday

Looking for demo code to show I2C functionality using an LPC1114 micro:

~/Downloads/nxp/lpcopen$ grep -nr BOARD_NXP_XPRESSO_ ./*
./nxp_lpcxpresso_11u14_board_lib/inc/board.h:42:/** @defgroup BOARD_NXP_XPRESSO_11U14 NXP LPC11U14 LPCXpresso board support software API functions
./nxp_lpcxpresso_11u14_board_lib/inc/board.h:50:/** @defgroup BOARD_NXP_XPRESSO_11U14_OPTIONS BOARD: NXP LPC11U14 LPCXpresso board build options 
./nxp_lpcxpresso_11u14_board_lib/inc/board.h:78:#define BOARD_NXP_XPRESSO_11U14
./nxp_lpcxpresso_11u14_periph_adc/example/src/adc_11xx.c:53:#if (defined(BOARD_NXP_XPRESSO_11U14) || defined(BOARD_NGX_BLUEBOARD_11U24))
./nxp_lpcxpresso_11u14_periph_adc/example/src/adc_11xx.c:55:#elif defined(BOARD_NXP_XPRESSO_11C24)
./nxp_lpcxpresso_11u14_periph_clkout/example/src/clkout.c:51:#if (defined(BOARD_NXP_XPRESSO_11U14) || defined(BOARD_NGX_BLUEBOARD_11U24))
./nxp_lpcxpresso_11u14_periph_clkout/example/src/clkout.c:54:#elif defined(BOARD_NXP_XPRESSO_11C24)
./nxp_lpcxpresso_11u14_periph_i2c/example/src/i2c.c:95:#if (defined(BOARD_NXP_XPRESSO_11U14) || defined(BOARD_NGX_BLUEBOARD_11U24))
./nxp_lpcxpresso_11u14_periph_i2c/example/src/i2c.c:99:#elif (defined(BOARD_NXP_XPRESSO_11C24) || defined(BOARD_MCORE48_1125))
./nxp_lpcxpresso_11u14_periph_pinint/example/src/pinint.c:38:#if defined (BOARD_NXP_XPRESSO_11U14)
./nxp_lpcxpresso_11u14_periph_pinint/example/src/pinint.c:45:#endif /* defined (BOARD_NXP_XPRESSO_11U14) */
./nxp_lpcxpresso_11u14_periph_pinint/example/src/pinint.c:47:#if defined (BOARD_NXP_XPRESSO_11C24)
./nxp_lpcxpresso_11u14_periph_pinint/example/src/pinint.c:54:#endif /* defined (BOARD_NXP_XPRESSO_11C24) */
./nxp_lpcxpresso_11u14_periph_pinint/example/src/pinint.c:109:#if defined (BOARD_NXP_XPRESSO_11U14)
./nxp_lpcxpresso_11u14_periph_pinint/example/src/pinint.c:128:#if defined (BOARD_NXP_XPRESSO_11C24)
./nxp_lpcxpresso_11u14_periph_pinint/example/src/pinint.c:153:#if defined (BOARD_NXP_XPRESSO_11C24)
./nxp_lpcxpresso_11u14_periph_ssp/example/src/ssp.c:76:#if (defined(BOARD_NXP_XPRESSO_11U14) || defined(BOARD_NGX_BLUEBOARD_11U24))
./nxp_lpcxpresso_11u14_periph_ssp/example/src/ssp.c:82:#elif defined(BOARD_NXP_XPRESSO_11C24)
./nxp_lpcxpresso_11u14_periph_uart/example/src/uart.c:63:#if (defined(BOARD_NXP_XPRESSO_11U14) || defined(BOARD_NGX_BLUEBOARD_11U24))
./nxp_lpcxpresso_11u14_periph_uart/example/src/uart.c:66:#elif (defined(BOARD_NXP_XPRESSO_11C24) || defined(BOARD_MCORE48_1125))
./nxp_lpcxpresso_11u14_usbd_lib_cdc_uart/example/src/cdc_uart.c:81:#if (defined(BOARD_NXP_XPRESSO_11U14) || defined(BOARD_NGX_BLUEBOARD_11U24))

Looks like line 78 is the key line above, in file named board.h.

^ missing clock signal in AP I2C code output

2018-11-20 TUE - So we have an issue where, initially it looked like there was no I2C clock signal on SCL, and no data signal, just a brief blip on SCL. This was Last Friday evening, and Monday. Now Tuesday we see a normal pulse train of nine low-to-high-to-low clock transitions. These occur in just under 200 microseconds. Prior to this there is an I2C start condition, where SDA goes high to low followed by SCL going high to low. Then both SCL and SDA are low for about 13 milliseconds, a very long time! After 13 milliseconds SCL begins its train pulse. After the second high to low SCL, the data line SDA goes high four the next four clock pulses, then low for a pulse then high.

QUESTION 3: why takes SCL so long to start its pulse train after the I2C start condition appears?


-- mark 1 -- 1 - 
milliamp PWM at percent duty cycle of:  0x38
sending I2C message to SCD30 sensor asking for serial number . . .
io_i2c.c:  StartNewJob() executing,
io_i2c.c:  ISR_State_SendCommand() called,
io_i2c.c:  ISR_State_ReadString() called,
status of I2C read command to query sensor for serial number: 00 00 00 00
io_i2c.c:  I2C_Stop() called,
io_i2c.c:  StartNewJob() executing,
back from sending I2C command, scd30_buffer holds:


2018-11-21 WED

Hi,

Regarding my I2C trouble-shooting, I observed a normal clock signal on SCL starting yesterday, but there are some unexpected delays on the order of 12 or 13 milliseconds. There is also almost no data. Only one byte of data observed as a train of nine clock pulses at about 25 microseconds per pulse occur. Specifically what appears to be happening is a valid I2C start condition, where SDA goes low and SCL follows likewise going low within a few microseconds. Then both SCL and SDA are low for about 13 milliseconds, then a single byte worth of clocking and data. SDA then returns to high. SCL stays low for about 37 milliseconds longer. Except for nine clock pulses on SCL that clock line is low for about 52 milliseconds in total after each call to IO_I2C_SendCommand(). Nothing else happening on the I2C lines.

Prior to sending any commands my code calls IO_I2C_Reset(). Any ideas what would cause this initial delay before SCL clock pulses, and the longer "SCL low" time afterward?

Your code project uses the I2C hardware module in the LPC1114, so that you need not bit bang things like the shifting of bytes into bits, and the toggling of SCL to create needed clock signals on the I2C bus. To the I2C part of your project I am able to make a comparison with a demo program I adapted a few months back, a demo in which there is a bit-banged single master implemented I2C driver. In that driver I see that in order for the demo to read back a string of bytes from a sensor, it calls the following routines by their names in the demo:

  error = SCD30_StartWriteAccess();
  error = SCD30_WriteCommand(CMD_READ_SERIALNBR);
  SCD30_StopAccess();
  error = SCD30_StartReadAccess();
  SCD30_StopAccess();

I notice that your project's ISR_State_SendCommand() routine supports I2C write, read and ping type commands. So is my understanding and code use correct, that my client code may call IO_I2C_SendCommand() with a buffer containing the command for the slave device? Ahh but wait, I only get one pointer to character (or uint8_t) buffer in this routine's parameter list. So in calling IO_I2C_SendCommand() how can I read back data from an I2C slave device? I think I'm missing a basic understanding of how to use your I2C driver . . .

- Ted


^ SCD30 data and CRC bytes three at a time

Bit-banged routine from Sensirion to read n bytes from sensor, reads them three at a time:

etError SCD30_ReadAndRemoveCrc(u8t data[], u32t noOfBytesToRead)^M
{^M
  etError error = NO_ERROR; // error code^M
  u16t word;^M 
  u32t byteCounter = 0;^M
  u32t writeIndex = 0;^M
  noOfBytesToRead = (noOfBytesToRead+1)/2*3; // must be multiple of two plus one byte crc per word^M
  ^M
  ^M
  while(byteCounter<noOfBytesToRead)^M
  {^M
    if (byteCounter <noOfBytesToRead-3) ^M
      error = SCD30_Read2BytesAndCrc(&word, ACK, _timeoutI2c);^M
    else^M  
      error = SCD30_Read2BytesAndCrc(&word,NACK, _timeoutI2c); // send nack for last byte^M
    ^M
    data[writeIndex++] = (u8t)((word >> 8) & 0x00FF);^M
    data[writeIndex++] = (u8t)(word & 0x00FF);^M
   ^M
    byteCounter += 3;^M 
  }^M
   ^M
  return error;^M
}

The routine to read two bytes and a single byte CRC is implemented this way:

static etError SCD30_Read2BytesAndCrc(u16t* data, etI2cAck finaleAckNack,^M
                                      u8t timeout)^M
{^M
  etError error;    // error code^M
  u8t     bytes[2]; // read data array^M 
  u8t     checksum; // checksum byte^M
 ^M
  // read two data bytes and one checksum byte^M
                        error = I2c_ReadByte(&bytes[0], ACK, timeout);^M
  if(error == NO_ERROR) error = I2c_ReadByte(&bytes[1], ACK, timeout);^M
  if(error == NO_ERROR) error = I2c_ReadByte(&checksum, finaleAckNack, timeout);^M
  ^M
  // verify checksum^M
  if(error == NO_ERROR) error = SCD30_CheckCrc(bytes, 2, checksum);^M
  ^M
  // combine the two bytes to a 16-bit value^M 
  *data = (bytes[0] << 8) | bytes[1];^M
  ^M
  return error;^M
}

The routine SCD30_Read2BytesAndCrc() in turn reads one byte at a time by calling the following routine:

etError I2c_ReadByte(u8t* byte, etI2cAck ack, u32t timeout)^M
{^M
  etError error = NO_ERROR;^M
  u8t mask;^M 
  u8t bit;^M
  *byte = 0;^M
  ^M
  for (mask = 0; mask < 8; mask++) ^M
  {^M
    error = I2c_ReadBit(&bit, timeout);^M
    if (error != NO_ERROR)^M
      break;^M
    ^M
    *byte =  *byte | (bit << (7-mask));^M
  }^M
  error = I2c_WriteBit(ack == NACK, timeout);^M
^M
  return error;^M
}


^ SCD30 article code

#define SCD30_I2C_ADDR                  0xc2

#define SCD30_CMMD_STRT_CONT_MEAS       0x0010
#define SCD30_CMMD_STOP_CONT_MEAS       0x0104
#define SCD30_CMMD_SET_MEAS_INTVL       0x4600
#define SCD30_CMMD_GET_READY_STAT       0x0202
#define SCD30_CMMD_READ_MEAS            0x0300
#define SCD30_CMMD_D_A_SELF_CALIB       0x5306
#define SCD30_CMMD_FORCE_CALIB_VAL      0x5204
#define SCD30_CMMD_SET_TEMP_OFFS        0x5403
#define SCD30_CMMD_SET_ALT_COMP         0x5102
#define SCD30_CMMD_SOFT_RESET           0xd304

#define SCD30_CMMD_READ_SERIALNBR       0xD033
#define SCD30_CMMD_READ_ARTICLECODE     0xD025
#define SCD30_CMMD_START_SINGLE_MEAS    0x0006
    
#define SCD30_POLYNOMIAL                0x131   // P(x) = x^8 + x^5 + x^4 + 1 = 100110001
#define SCD30_CRC_INIT                  0xff

#define SCD30_SN_SIZE                   33      //size of the s/n ascii string + CRC values


Alright couple things to check 2018-12-14: make sure I2C_Stop() is getting called, and review and follow to code the comment block in I2C source file lines 307..310 in original code. This is a comment above and to describe the void i2c-stop(void) function . . .




- - - - -   - - - - -   - - - - -   - - - - -   - - - - -   - - - - -   - - - - -   - - - - -   - - - - -   - - - - -   - - - - -   - - - - -   - - - - -   - - - - -   - - - - -   - - - - -   - - - - - .
- - - - -   - - - - -   - - - - -   - - - - -   - - - - -   - - - - -   - - - - -   - - - - -   - - - - -   - - - - -   - - - - -   - - - - -   - - - - -   - - - - -   - - - - -   - - - - -   - - - - - .
- - - - -   - - - - -   - - - - -   - - - - -   - - - - -   - - - - -   - - - - -   - - - - -   - - - - -   - - - - -   - - - - -   - - - - -   - - - - -   - - - - -   - - - - -   - - - - -   - - - - - .

- - - -

.
.
.



^ Pulse Width Modulation PWM in LPC1114 mC

2018-11-02 - Reading up on LPX1114 timer configuration and uses:


^ LPCXpresso 1114 board and FreeRTOS

In order to get started with the FreeRTOS port demo project to the LPC1114 board, a batch file (or shell script) need be run to create a particular directory structure and copy files into some project-expected places. There is mention on the ported NXP project page on FreeRTOS site that LPCXpresso IDE can provide makefile based projects, and "managed make" projects. The managed make projects require all sources on which a given project depends to be located within given project's top level directory.

There is mention of a batch file which on our Linux box appears to be ~/Downloads/freertos/FreeRTOSv10.0.1/FreeRTOS/Demo/CORTEX_M0_LPC1114_LPCXpresso/RTOSDemo/CreateProjectDirectoryStructure.bat.


Getting close but having trouble setting up and fully compiling LPC1114 FreeRTOS demo . . . build fails for not finding header file IntQueue.h, as included by file IntQueue.c in the same directory:

user@localhost:~/LPCXpresso/workspace$ ls -l ./FreeRTOS/Demo/CORTEX_M0_LPC1114_LPCXpresso/RTOSDemo/Source
total 84
drwxr-xr-x 3 user user  4096 May 14 13:07 Common_Demo_Tasks
-rw-r--r-- 1 user user  4364 May 14 13:12 FreeRTOSConfig.h
drwxr-xr-x 4 user user  4096 May 14 12:22 FreeRTOS_Source
-rw-r--r-- 1 user user  3587 Dec 18 14:36 IntQueueTimer.c
-rw-r--r-- 1 user user  1496 Dec 18 14:36 IntQueueTimer.h
-rw-r--r-- 1 user user  5925 Dec 18 14:36 RegTest.c
-rw-r--r-- 1 user user 16008 Nov 16  2016 cr_startup_lpc11.c
-rw-r--r-- 1 user user  8416 Dec 18 14:36 main-blinky.c
-rw-r--r-- 1 user user 11663 Dec 18 14:36 main-full.c
-rw-r--r-- 1 user user 10694 Dec 18 14:36 main.c

user@localhost:~/LPCXpresso/workspace$


LPCXpresso project linked resources

...Trouble uploading screen capture in .PNG format! MediaWiki error message:

" Action failed

Could not open lock file for "mwstore://local-backend/local-public/3/33/Linked-resources.png".

Return to Main Page. "

Textual data from screen whose image capture failed to upload:

# Properties for RTOSDemo
# v  Resource
#        Linked Resource       
# Path Variables
#
# ECLIPSE_HOME     /opt/nxp/lpcxpresso-8p2p2/lpcxpresso/
# PARENT_LOC       /home/user/LPCXpresso/workspace
# PROJECT_LOC      /home/user/Downloads/freertos/FreeRTOSv10.0.1/FreeRTOS/Demo/CORTEX_M0_LPC1114_LPCXpresso/RTOSDemo
# WORKSPACE_LOC    /home/user/LPCXpresso/workspace


ISSUE - case insensitive Windows filename of needed header file needs attention, symbolic linking one fix:




^ Copying FreeRTOS Demo Project To Begin New Project

- 2018-06-13 TUE -
Today's goal is to copy the FreeRTOS demo which runs on an LPCXpresso development board, and to bring this copy of the project up as a second or additional project in LPC IDE's workspace. From here then next step is to add one-way then bidirectional UART communications to the project.

A separate second goal is to craft a GNU makefile to build this same demo project.

Looking at project properties by means of right clicking the top level folder in LPCXpresso's project navigation pane, the project's location on the file system is:


 localhost:/home/${USER}/Downloads/freertos/FreeRTOSv10.0.1/FreeRTOS/Demo/CORTEX_M0_LPC1114_LPCXpresso/RTOSDemo


This path also matches the result we get when searching for a unique-to-project port header file named IntQueue.h, invoking `locate IntQueue.h | grep 1114`. The path is a directory longer due to the location of this header file in the port's dir structure, but the narrowed search result path agrees with the path shown in LPC's project location.

The readily visible, top level contents of this directory are:

 ~/Downloads/freertos/FreeRTOSv10.0.1/FreeRTOS/Demo/CORTEX_M0_LPC1114_LPCXpresso/RTOSDemo$ ls
 CreateProjectDirectoryStructure.bat  Source
 Debug                                create-project-directory-structure.sh

There are a couple of hidden project files here, created and or used by LPCXpresso:

 $ ls -a
 .   .cproject  .settings                            Debug   create-project-directory-structure.sh
 ..  .project   CreateProjectDirectoryStructure.bat  Source

Note:  in the LPCXpresso managed product directory there are hidden files named .cproject and .project . . .

Both files .cproject and .project are XML files. The file .cproject is longer among these two files and includes details of the compiler used in a given project, plus options passed to this compiler, plus at least one project include path. The file named .project contains in the first few lines a line expressing the project name as LPCXpresso IDE knows it. This project name must be unique among projects imported to a given LPCXpresso workspace. This workspace on Unix and Linux-like systems defaults to the directory ${HOME}/LPCXpresso.

The make dir and copying commands which can be invoked after creating project directory structure is:

  $ mkdir -pv ~/projects/nxp/rtos-demo-4
  $ cp -prv ./* ./.[cp]* ~/projects/nxp/rtos-demo-4



The name of the project we're attempting to copy and start as a new and editable project is 'RTOSDemo', a patterm which appears several times in file .cproject:

Figure x -

$ grep -n RTOSDemo ../.cproject 
 
23:							<builder arguments="-r" buildPath="${workspace_loc:/RTOSDemo/Debug}" command="make" id="com.crt.advproject.builder.exe.debug.1260101970" keepEnvironmentInBuildfile="true" managedBuildOn="true" name="Gnu Make Builder" superClass="com.crt.advproject.builder.exe.debug"/>
40:									<listOptionValue builtIn="false" value=""${workspace_loc:/FreeRTOS/Demo/CORTEX_M0_LPC1114_LPCXpresso/RTOSDemo/Source}""/>
61:								<option id="com.crt.advproject.link.script.1758870530" name="Linker script" superClass="com.crt.advproject.link.script" value=""RTOSDemo_Debug.ld"" valueType="string"/>
118:							<builder buildPath="${workspace_loc:/RTOSDemo/Release}" id="com.crt.advproject.builder.exe.release.1281961847" keepEnvironmentInBuildfile="false" managedBuildOn="true" name="Gnu Make Builder" superClass="com.crt.advproject.builder.exe.release"/>
149:								<option id="com.crt.advproject.link.script.1856833348" name="Linker script" superClass="com.crt.advproject.link.script" value=""RTOSDemo_Release.ld"" valueType="string"/>
182:		<project id="RTOSDemo.com.crt.advproject.projecttype.exe.777175218" name="Executable" projectType="com.crt.advproject.projecttype.exe"/>
343:			<resource resourceType="PROJECT" workspacePath="/RTOSDemo"/>
346:			<resource resourceType="PROJECT" workspacePath="/RTOSDemo"/>
 
$

Unfortunately the LPC1114 FreeRTOS demo project name is used in two or three different ways in the file named .cproject. Most of the time it is used as the project's name, but a couple of times this text pattern appears in the filenames of linker scripts. In another instance it's part of a host system directory path to the project. The places where pattern 'RTOSDemo' most closely relates to LPCXpresso project are where it appears on lines which refer to ${workspace_loc}. Given this it looks like we want to change the project name RTOSDemo to a new project name on lines 23, 118, 343 and 346, where this name stands for a project name, rather than part of a path or part of a linker script filename.



QUESTION: to what does the pattern RTOSDemo.com.crt.advproject.projecttype.exe.777175218 refer? Is this a reference to or name of an executable file? Or exe file plus project configuration? - TMH


LPCXpresso file .project contains two references to the pattern RTOSDemo:

$ grep -n RTOSDemo ../.project 
3:	<name>RTOSDemo</name>
35:					<value>${workspace_loc:/RTOSDemo/Debug}</value>


^ edit point - create directory structure script

A file worth noting here is a shell script which Ted adapted from a DOS batch file which ships with the RTOS demo. The original batch file and the adapted shell script create a directory structure and copy FreeRTOS header and source files to these directories, placing all sources in the local copy of the project. While the following script does the copying job for a project in one particular path relative to the FreeRTOS download path, Ted amended this script further to put relative source path elements into variables. This makes the script more adjustable to be executed in different locations. As of 2018-07-09 Monday that improved script not posted here on this wiki article yet . . .

2018-07-13 NOTE: with one or both versions of this script there may be an error where IntQueue.h and three other FreeRTOS header files do not get copied to the new local project instance. It may be necessary until a fix found to manually copy these files as follows:

    $ cp -p blocktim.h recmutex.h countsem.h IntQueue.h /home/user/projects/nxp/rtos-demo-4/Source/Common_Demo_Tasks/Include


Before and after running `make clean` from the IDE:

Figure x - FreeRTOS demo directories and size of build time files:

$ du -k .
280	./Debug/Source/Common_Demo_Tasks
68	./Debug/Source/FreeRTOS_Source/portable/GCC/ARM_CM0
72	./Debug/Source/FreeRTOS_Source/portable/GCC
64	./Debug/Source/FreeRTOS_Source/portable/MemMang
140	./Debug/Source/FreeRTOS_Source/portable
472	./Debug/Source/FreeRTOS_Source
1112	./Debug/Source
1408	./Debug
4	./Source/Common_Demo_Tasks/Include
88	./Source/Common_Demo_Tasks
28	./Source/FreeRTOS_Source/portable/GCC/ARM_CM0
32	./Source/FreeRTOS_Source/portable/GCC
12	./Source/FreeRTOS_Source/portable/MemMang
48	./Source/FreeRTOS_Source/portable
540	./Source/FreeRTOS_Source/include
900	./Source/FreeRTOS_Source
1068	./Source
8	./.settings
2548	.

$ du -k .
8	./Debug/Source/Common_Demo_Tasks
8	./Debug/Source/FreeRTOS_Source/portable/GCC/ARM_CM0
12	./Debug/Source/FreeRTOS_Source/portable/GCC
8	./Debug/Source/FreeRTOS_Source/portable/MemMang
24	./Debug/Source/FreeRTOS_Source/portable
32	./Debug/Source/FreeRTOS_Source
48	./Debug/Source
192	./Debug
4	./Source/Common_Demo_Tasks/Include
88	./Source/Common_Demo_Tasks
28	./Source/FreeRTOS_Source/portable/GCC/ARM_CM0
32	./Source/FreeRTOS_Source/portable/GCC
12	./Source/FreeRTOS_Source/portable/MemMang
48	./Source/FreeRTOS_Source/portable
540	./Source/FreeRTOS_Source/include
900	./Source/FreeRTOS_Source
1068	./Source
8	./.settings
1332	.

The above figure is a verbose way of showing approximate size of combined build time files such as object files. But this snippet also shows project directories and directory structure. This structure is largely created by the DOS batch file on Windows hosts, and in this case created by the shell script which mimics those same steps. Manually copying this project with these directories then, there should be no need to run the batch file . . .


^ Makefile Clues - Deriving A Working Makefile From LPCXpresso Projects

NOTE: This section on makefile derivation / porting not yet well organized. Work here underway - TMH

It's really frustrating to understand how LPCXpresso builds software projects. LPCXpresso automatically generates a makefile, and child makefiles in additional subdirectories of its imported and created projects. For example, LPCXpresso creates child makefiles in each directory which contains project sources. These child makefiles are read by the `make` utility recursively, as LPCXpresso calls its choice of `make` with the -r option.

Some options which would normally be encapsulated in the makefile are held in some other settings space or stored files of LPCXpresso and passed to the call to make at build time. This makes it harder to see all the details of the project build recipe, because they're spread out over multiple files, and some options do not even appear to be stored in files.

According to an NXP Community thread, LPCXpresso supports command line based project builds . . .


Despite possible command line based builds we have not yet learned how to set this up, and are presently stuck with LPCXpresso's default build process. This build process includes a utility or option called CDT builder, which appears next to a checkbox in one of the dialog boxes under a given project's properties:

  Properties --> Builders

image 800x600 px

A couple of supporting lpcxpresso project makefiles include makefile.init and subdir.mk. These files contain respectively:

Figure x - example makefile.init file:

      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 ---

Hmm this one looks hand-crafted by Ted . . . here's another from the FreeRTOS demo project:

Figure x - example makefile.init file:

      1 ################################################################################^M
      2 # Automatically-generated file. Do not edit!^M
      3 ################################################################################^M
      4 ^M
      5 PATH := $(PATH):C:\PROGRA~2\KPIT\GNUARM~1.02-\ARM-NO~1\ARM-NO~1\bin;C:\PROGRA~2\KPIT\GNUARM~1.02-\ARM-NO~1\ARM-NO~1\libexec\gcc\arm-none-eabi\4.9-GNUARM-NONE_v14.02

Figure x - example subdir.mk file:


      1 ################################################################################
      2 # Automatically-generated file. Do not edit!
      3 ################################################################################
      4 
      5 # Add inputs and outputs from these tool invocations to the build variables
      6 C_SRCS += \
      7 ../Source/IntQueueTimer.c \
      8 ../Source/RegTest.c \
      9 ../Source/cr_startup_lpc11.c \
     10 ../Source/main-blinky.c \
     11 ../Source/main-full.c \
     12 ../Source/main.c
     13 
     14 OBJS += \
     15 ./Source/IntQueueTimer.o \
     16 ./Source/RegTest.o \
     17 ./Source/cr_startup_lpc11.o \
     18 ./Source/main-blinky.o \
     19 ./Source/main-full.o \
     20 ./Source/main.o
     21 
     22 C_DEPS += \
     23 ./Source/IntQueueTimer.d \
     24 ./Source/RegTest.d \
     25 ./Source/cr_startup_lpc11.d \
     26 ./Source/main-blinky.d \
     27 ./Source/main-full.d \
     28 ./Source/main.d
     29 
     30 
     31 # Each subdirectory must supply rules for building sources it contributes
     32 Source/%.o: ../Source/%.c
     33         @echo 'Building file: $<'
     34         @echo 'Invoking: MCU C Compiler'
     35         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/Downloads/freertos/FreeRTOSv10.0.1/FreeRTOS/Demo/CORTEX_M0_LPC1114_LPCXpresso/RTOSDemo/Source/Common_Demo_Tasks/include" -I"/home/user/Downloads/freertos/FreeRTOSv10.0.1/FreeRTOS/Demo/CORTEX_M0_LPC1114_LPCXpresso/RTOSDemo/Source" -I"/home/user/Downloads/freertos/FreeRTOSv10.0.1/FreeRTOS/Demo/CORTEX_M0_LPC1114_LPCXpresso/RTOSDemo/Source/FreeRTOS_Source/include" -I"/home/user/Downloads/freertos/FreeRTOSv10.0.1/FreeRTOS/Demo/CORTEX_M0_LPC1114_LPCXpresso/RTOSDemo/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"$(@:%.o=%.d)" -MT"$(@:%.o=%.o)" -MT"$(@:%.o=%.d)" -o "$@" "$<"
     36         @echo 'Finished building: $<'
     37         @echo ' '
     38 
     39 Source/cr_startup_lpc11.o: ../Source/cr_startup_lpc11.c
     40         @echo 'Building file: $<'
     41         @echo 'Invoking: MCU C Compiler'
     42         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/Downloads/freertos/FreeRTOSv10.0.1/FreeRTOS/Demo/CORTEX_M0_LPC1114_LPCXpresso/RTOSDemo/Source/Common_Demo_Tasks/include" -I"/home/user/Downloads/freertos/FreeRTOSv10.0.1/FreeRTOS/Demo/CORTEX_M0_LPC1114_LPCXpresso/RTOSDemo/Source" -I"/home/user/Downloads/freertos/FreeRTOSv10.0.1/FreeRTOS/Demo/CORTEX_M0_LPC1114_LPCXpresso/RTOSDemo/Source/FreeRTOS_Source/include" -I"/home/user/Downloads/freertos/FreeRTOSv10.0.1/FreeRTOS/Demo/CORTEX_M0_LPC1114_LPCXpresso/RTOSDemo/Source/FreeRTOS_Source/portable/GCC/ARM_CM0" -O0 -Os -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"$(@:%.o=%.d)" -MT"Source/cr_startup_lpc11.d" -o "$@" "$<"
     43         @echo 'Finished building: $<'
     44         @echo ' '
     45 
     46 


- 2018-07-12 -

And here is an interesting line from the .cproject file:

      23    <builder arguments="-r" buildPath="${workspace_loc:/rtos-demo-3/Debug}" command="make" id="com.crt.advproject.builder.exe.debug.1260101970" keepEnvironmentInBuildfile="false" managedBuildOn="true" name="Gnu Make Builder" superClass="com.crt.advproject.builder.exe.debug"/>^M


^ What we know about LPCXpresso project makefiles

What we know so far about LPCXpresso project makefiles: LPCXPresso projects typically use multiple makefiles, including a "top level" makefile which includes several other makefiles. The called makefiles include:

 *  makefile.init
 *  makefile.deps
 *  sources.mk
 *  objects.mk

and one of the following subdir makefiles for each project directory which holds sources:

 *  subdir.mk

It looks also as though these files come pre-built and bundled with the FreeRTOS demo, which includes a port to LPC1114 family microcontrollers. Since they're already present in the downloadable project / port from FreeRTOS dot org, we can't as easily know or find out how these files are or were originally created. All of the makefiles begin with a comment block which warns "DO NOT EDIT":

      1 ################################################################################
      2 # Automatically-generated file. Do not edit!
      3 ################################################################################


Here are the instances of subdir makefiles:

$ locate subdir.mk | grep Downloads | grep subdir.mk /home/${USER}/Downloads/freertos/FreeRTOSv10.0.1/FreeRTOS/Demo/CORTEX_M0_LPC1114_LPCXpresso/CMSISv2p00_LPC11xx/Debug/src/subdir.mk /home/${USER}/Downloads/freertos/FreeRTOSv10.0.1/FreeRTOS/Demo/CORTEX_M0_LPC1114_LPCXpresso/RTOSDemo/Debug/Source/subdir.mk /home/${USER}/Downloads/freertos/FreeRTOSv10.0.1/FreeRTOS/Demo/CORTEX_M0_LPC1114_LPCXpresso/RTOSDemo/Debug/Source/Common_Demo_Tasks/subdir.mk /home/${USER}/Downloads/freertos/FreeRTOSv10.0.1/FreeRTOS/Demo/CORTEX_M0_LPC1114_LPCXpresso/RTOSDemo/Debug/Source/FreeRTOS_Source/subdir.mk /home/${USER}/Downloads/freertos/FreeRTOSv10.0.1/FreeRTOS/Demo/CORTEX_M0_LPC1114_LPCXpresso/RTOSDemo/Debug/Source/FreeRTOS_Source/portable/GCC/ARM_CM0/subdir.mk /home/${USER}/Downloads/freertos/FreeRTOSv10.0.1/FreeRTOS/Demo/CORTEX_M0_LPC1114_LPCXpresso/RTOSDemo/Debug/Source/FreeRTOS_Source/portable/MemMang/subdir.mk



^ LPC build messages

Build messages from LPCXpresso 8p2p2 CDT builder here on wiki page 'rtos-demo-3 build messages'. Next figure or excerpt ahead shows a complete capture of a FreeRTOS demo firmware build as built by LPCXpresso's calls to make.

Article contributor Ted noting here that these build messages tell a lot about the build process but also leave a lot of the recipe's details out. For example, it's not obvious from these compiler messages that the build process is described by multiple makefiles. It's also not always obvious what environment variable settings the 'make' utility -- in this case LPCXpresso -- and its called commands enjoy as they run. One clue to this effect is how LPC's build messages show a specifications file option -specs=redlib.specs which names an extent file but not its full path. How does the compiler know where to look for this file? There must be a search path variable somewhere. Unfortunately GNU GCC's web documentation doesn't go into any detail about the way in which gcc searched for specs files.

2018-07-16 NOTE: lines of the build messages excerpted below contain -MT and -MF compiler options. In the excerpts these are followed by specific source files, but in the subdir.mk makefiles these are followed by pattern substitution rules.

2018-07-26 NOTE: following line from .cproject file hints at variable which holds path to the Redlib specs files:

   315         <runAction arguments="-c 'gcc -E -P -v -dD "${plugin_state_location}/${specs_file}"'" command="sh" useDefault="true"/>

All the same here is the LPCXpresso output of a successful build of FreeRTOS demo program targeted for the LPC1114 Cortex-M0 processor:


v end of LPC's build output Figure x - Build output from LPCXpresso console:

09:52:03 **** Build of configuration Debug for project RTOSDemo ****
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/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/Downloads/freertos/FreeRTOSv10.0.1/FreeRTOS/Demo/CORTEX_M0_LPC1114_LPCXpresso/RTOSDemo/Source/Common_Demo_Tasks/include" -I"/home/user/Downloads/freertos/FreeRTOSv10.0.1/FreeRTOS/Demo/CORTEX_M0_LPC1114_LPCXpresso/RTOSDemo/Source" -I"/home/user/Downloads/freertos/FreeRTOSv10.0.1/FreeRTOS/Demo/CORTEX_M0_LPC1114_LPCXpresso/RTOSDemo/Source/FreeRTOS_Source/include" -I"/home/user/Downloads/freertos/FreeRTOSv10.0.1/FreeRTOS/Demo/CORTEX_M0_LPC1114_LPCXpresso/RTOSDemo/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
 
Building file: ../Source/FreeRTOS_Source/portable/GCC/ARM_CM0/port.c
Invoking: MCU C Compiler
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/Downloads/freertos/FreeRTOSv10.0.1/FreeRTOS/Demo/CORTEX_M0_LPC1114_LPCXpresso/RTOSDemo/Source/Common_Demo_Tasks/include" -I"/home/user/Downloads/freertos/FreeRTOSv10.0.1/FreeRTOS/Demo/CORTEX_M0_LPC1114_LPCXpresso/RTOSDemo/Source" -I"/home/user/Downloads/freertos/FreeRTOSv10.0.1/FreeRTOS/Demo/CORTEX_M0_LPC1114_LPCXpresso/RTOSDemo/Source/FreeRTOS_Source/include" -I"/home/user/Downloads/freertos/FreeRTOSv10.0.1/FreeRTOS/Demo/CORTEX_M0_LPC1114_LPCXpresso/RTOSDemo/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/GCC/ARM_CM0/port.d" -MT"Source/FreeRTOS_Source/portable/GCC/ARM_CM0/port.o" -MT"Source/FreeRTOS_Source/portable/GCC/ARM_CM0/port.d" -o "Source/FreeRTOS_Source/portable/GCC/ARM_CM0/port.o" "../Source/FreeRTOS_Source/portable/GCC/ARM_CM0/port.c"
Finished building: ../Source/FreeRTOS_Source/portable/GCC/ARM_CM0/port.c
 
Building file: ../Source/FreeRTOS_Source/list.c
Invoking: MCU C Compiler
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/Downloads/freertos/FreeRTOSv10.0.1/FreeRTOS/Demo/CORTEX_M0_LPC1114_LPCXpresso/RTOSDemo/Source/Common_Demo_Tasks/include" -I"/home/user/Downloads/freertos/FreeRTOSv10.0.1/FreeRTOS/Demo/CORTEX_M0_LPC1114_LPCXpresso/RTOSDemo/Source" -I"/home/user/Downloads/freertos/FreeRTOSv10.0.1/FreeRTOS/Demo/CORTEX_M0_LPC1114_LPCXpresso/RTOSDemo/Source/FreeRTOS_Source/include" -I"/home/user/Downloads/freertos/FreeRTOSv10.0.1/FreeRTOS/Demo/CORTEX_M0_LPC1114_LPCXpresso/RTOSDemo/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/list.d" -MT"Source/FreeRTOS_Source/list.o" -MT"Source/FreeRTOS_Source/list.d" -o "Source/FreeRTOS_Source/list.o" "../Source/FreeRTOS_Source/list.c"
Finished building: ../Source/FreeRTOS_Source/list.c
 
Building file: ../Source/FreeRTOS_Source/queue.c
Invoking: MCU C Compiler
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/Downloads/freertos/FreeRTOSv10.0.1/FreeRTOS/Demo/CORTEX_M0_LPC1114_LPCXpresso/RTOSDemo/Source/Common_Demo_Tasks/include" -I"/home/user/Downloads/freertos/FreeRTOSv10.0.1/FreeRTOS/Demo/CORTEX_M0_LPC1114_LPCXpresso/RTOSDemo/Source" -I"/home/user/Downloads/freertos/FreeRTOSv10.0.1/FreeRTOS/Demo/CORTEX_M0_LPC1114_LPCXpresso/RTOSDemo/Source/FreeRTOS_Source/include" -I"/home/user/Downloads/freertos/FreeRTOSv10.0.1/FreeRTOS/Demo/CORTEX_M0_LPC1114_LPCXpresso/RTOSDemo/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/queue.d" -MT"Source/FreeRTOS_Source/queue.o" -MT"Source/FreeRTOS_Source/queue.d" -o "Source/FreeRTOS_Source/queue.o" "../Source/FreeRTOS_Source/queue.c"
Finished building: ../Source/FreeRTOS_Source/queue.c
 
Building file: ../Source/FreeRTOS_Source/tasks.c
Invoking: MCU C Compiler
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/Downloads/freertos/FreeRTOSv10.0.1/FreeRTOS/Demo/CORTEX_M0_LPC1114_LPCXpresso/RTOSDemo/Source/Common_Demo_Tasks/include" -I"/home/user/Downloads/freertos/FreeRTOSv10.0.1/FreeRTOS/Demo/CORTEX_M0_LPC1114_LPCXpresso/RTOSDemo/Source" -I"/home/user/Downloads/freertos/FreeRTOSv10.0.1/FreeRTOS/Demo/CORTEX_M0_LPC1114_LPCXpresso/RTOSDemo/Source/FreeRTOS_Source/include" -I"/home/user/Downloads/freertos/FreeRTOSv10.0.1/FreeRTOS/Demo/CORTEX_M0_LPC1114_LPCXpresso/RTOSDemo/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/tasks.d" -MT"Source/FreeRTOS_Source/tasks.o" -MT"Source/FreeRTOS_Source/tasks.d" -o "Source/FreeRTOS_Source/tasks.o" "../Source/FreeRTOS_Source/tasks.c"
Finished building: ../Source/FreeRTOS_Source/tasks.c
 
Building file: ../Source/FreeRTOS_Source/timers.c
Invoking: MCU C Compiler
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/Downloads/freertos/FreeRTOSv10.0.1/FreeRTOS/Demo/CORTEX_M0_LPC1114_LPCXpresso/RTOSDemo/Source/Common_Demo_Tasks/include" -I"/home/user/Downloads/freertos/FreeRTOSv10.0.1/FreeRTOS/Demo/CORTEX_M0_LPC1114_LPCXpresso/RTOSDemo/Source" -I"/home/user/Downloads/freertos/FreeRTOSv10.0.1/FreeRTOS/Demo/CORTEX_M0_LPC1114_LPCXpresso/RTOSDemo/Source/FreeRTOS_Source/include" -I"/home/user/Downloads/freertos/FreeRTOSv10.0.1/FreeRTOS/Demo/CORTEX_M0_LPC1114_LPCXpresso/RTOSDemo/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/timers.d" -MT"Source/FreeRTOS_Source/timers.o" -MT"Source/FreeRTOS_Source/timers.d" -o "Source/FreeRTOS_Source/timers.o" "../Source/FreeRTOS_Source/timers.c"
Finished building: ../Source/FreeRTOS_Source/timers.c
 
Building file: ../Source/Common_Demo_Tasks/IntQueue.c
Invoking: MCU C Compiler
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/Downloads/freertos/FreeRTOSv10.0.1/FreeRTOS/Demo/CORTEX_M0_LPC1114_LPCXpresso/RTOSDemo/Source/Common_Demo_Tasks/include" -I"/home/user/Downloads/freertos/FreeRTOSv10.0.1/FreeRTOS/Demo/CORTEX_M0_LPC1114_LPCXpresso/RTOSDemo/Source" -I"/home/user/Downloads/freertos/FreeRTOSv10.0.1/FreeRTOS/Demo/CORTEX_M0_LPC1114_LPCXpresso/RTOSDemo/Source/FreeRTOS_Source/include" -I"/home/user/Downloads/freertos/FreeRTOSv10.0.1/FreeRTOS/Demo/CORTEX_M0_LPC1114_LPCXpresso/RTOSDemo/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/Common_Demo_Tasks/IntQueue.d" -MT"Source/Common_Demo_Tasks/IntQueue.o" -MT"Source/Common_Demo_Tasks/IntQueue.d" -o "Source/Common_Demo_Tasks/IntQueue.o" "../Source/Common_Demo_Tasks/IntQueue.c"
Finished building: ../Source/Common_Demo_Tasks/IntQueue.c
 
Building file: ../Source/Common_Demo_Tasks/blocktim.c
Invoking: MCU C Compiler
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/Downloads/freertos/FreeRTOSv10.0.1/FreeRTOS/Demo/CORTEX_M0_LPC1114_LPCXpresso/RTOSDemo/Source/Common_Demo_Tasks/include" -I"/home/user/Downloads/freertos/FreeRTOSv10.0.1/FreeRTOS/Demo/CORTEX_M0_LPC1114_LPCXpresso/RTOSDemo/Source" -I"/home/user/Downloads/freertos/FreeRTOSv10.0.1/FreeRTOS/Demo/CORTEX_M0_LPC1114_LPCXpresso/RTOSDemo/Source/FreeRTOS_Source/include" -I"/home/user/Downloads/freertos/FreeRTOSv10.0.1/FreeRTOS/Demo/CORTEX_M0_LPC1114_LPCXpresso/RTOSDemo/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/Common_Demo_Tasks/blocktim.d" -MT"Source/Common_Demo_Tasks/blocktim.o" -MT"Source/Common_Demo_Tasks/blocktim.d" -o "Source/Common_Demo_Tasks/blocktim.o" "../Source/Common_Demo_Tasks/blocktim.c"
Finished building: ../Source/Common_Demo_Tasks/blocktim.c
 
Building file: ../Source/Common_Demo_Tasks/countsem.c
Invoking: MCU C Compiler
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/Downloads/freertos/FreeRTOSv10.0.1/FreeRTOS/Demo/CORTEX_M0_LPC1114_LPCXpresso/RTOSDemo/Source/Common_Demo_Tasks/include" -I"/home/user/Downloads/freertos/FreeRTOSv10.0.1/FreeRTOS/Demo/CORTEX_M0_LPC1114_LPCXpresso/RTOSDemo/Source" -I"/home/user/Downloads/freertos/FreeRTOSv10.0.1/FreeRTOS/Demo/CORTEX_M0_LPC1114_LPCXpresso/RTOSDemo/Source/FreeRTOS_Source/include" -I"/home/user/Downloads/freertos/FreeRTOSv10.0.1/FreeRTOS/Demo/CORTEX_M0_LPC1114_LPCXpresso/RTOSDemo/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/Common_Demo_Tasks/countsem.d" -MT"Source/Common_Demo_Tasks/countsem.o" -MT"Source/Common_Demo_Tasks/countsem.d" -o "Source/Common_Demo_Tasks/countsem.o" "../Source/Common_Demo_Tasks/countsem.c"
Finished building: ../Source/Common_Demo_Tasks/countsem.c
 
Building file: ../Source/Common_Demo_Tasks/recmutex.c
Invoking: MCU C Compiler
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/Downloads/freertos/FreeRTOSv10.0.1/FreeRTOS/Demo/CORTEX_M0_LPC1114_LPCXpresso/RTOSDemo/Source/Common_Demo_Tasks/include" -I"/home/user/Downloads/freertos/FreeRTOSv10.0.1/FreeRTOS/Demo/CORTEX_M0_LPC1114_LPCXpresso/RTOSDemo/Source" -I"/home/user/Downloads/freertos/FreeRTOSv10.0.1/FreeRTOS/Demo/CORTEX_M0_LPC1114_LPCXpresso/RTOSDemo/Source/FreeRTOS_Source/include" -I"/home/user/Downloads/freertos/FreeRTOSv10.0.1/FreeRTOS/Demo/CORTEX_M0_LPC1114_LPCXpresso/RTOSDemo/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/Common_Demo_Tasks/recmutex.d" -MT"Source/Common_Demo_Tasks/recmutex.o" -MT"Source/Common_Demo_Tasks/recmutex.d" -o "Source/Common_Demo_Tasks/recmutex.o" "../Source/Common_Demo_Tasks/recmutex.c"
Finished building: ../Source/Common_Demo_Tasks/recmutex.c
 
Building file: ../Source/IntQueueTimer.c
Invoking: MCU C Compiler
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/Downloads/freertos/FreeRTOSv10.0.1/FreeRTOS/Demo/CORTEX_M0_LPC1114_LPCXpresso/RTOSDemo/Source/Common_Demo_Tasks/include" -I"/home/user/Downloads/freertos/FreeRTOSv10.0.1/FreeRTOS/Demo/CORTEX_M0_LPC1114_LPCXpresso/RTOSDemo/Source" -I"/home/user/Downloads/freertos/FreeRTOSv10.0.1/FreeRTOS/Demo/CORTEX_M0_LPC1114_LPCXpresso/RTOSDemo/Source/FreeRTOS_Source/include" -I"/home/user/Downloads/freertos/FreeRTOSv10.0.1/FreeRTOS/Demo/CORTEX_M0_LPC1114_LPCXpresso/RTOSDemo/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/IntQueueTimer.d" -MT"Source/IntQueueTimer.o" -MT"Source/IntQueueTimer.d" -o "Source/IntQueueTimer.o" "../Source/IntQueueTimer.c"
Finished building: ../Source/IntQueueTimer.c
 
Building file: ../Source/RegTest.c
Invoking: MCU C Compiler
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/Downloads/freertos/FreeRTOSv10.0.1/FreeRTOS/Demo/CORTEX_M0_LPC1114_LPCXpresso/RTOSDemo/Source/Common_Demo_Tasks/include" -I"/home/user/Downloads/freertos/FreeRTOSv10.0.1/FreeRTOS/Demo/CORTEX_M0_LPC1114_LPCXpresso/RTOSDemo/Source" -I"/home/user/Downloads/freertos/FreeRTOSv10.0.1/FreeRTOS/Demo/CORTEX_M0_LPC1114_LPCXpresso/RTOSDemo/Source/FreeRTOS_Source/include" -I"/home/user/Downloads/freertos/FreeRTOSv10.0.1/FreeRTOS/Demo/CORTEX_M0_LPC1114_LPCXpresso/RTOSDemo/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/RegTest.d" -MT"Source/RegTest.o" -MT"Source/RegTest.d" -o "Source/RegTest.o" "../Source/RegTest.c"
Finished building: ../Source/RegTest.c
 
Building file: ../Source/cr_startup_lpc11.c
Invoking: MCU C Compiler
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/Downloads/freertos/FreeRTOSv10.0.1/FreeRTOS/Demo/CORTEX_M0_LPC1114_LPCXpresso/RTOSDemo/Source/Common_Demo_Tasks/include" -I"/home/user/Downloads/freertos/FreeRTOSv10.0.1/FreeRTOS/Demo/CORTEX_M0_LPC1114_LPCXpresso/RTOSDemo/Source" -I"/home/user/Downloads/freertos/FreeRTOSv10.0.1/FreeRTOS/Demo/CORTEX_M0_LPC1114_LPCXpresso/RTOSDemo/Source/FreeRTOS_Source/include" -I"/home/user/Downloads/freertos/FreeRTOSv10.0.1/FreeRTOS/Demo/CORTEX_M0_LPC1114_LPCXpresso/RTOSDemo/Source/FreeRTOS_Source/portable/GCC/ARM_CM0" -O0 -Os -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/cr_startup_lpc11.d" -MT"Source/cr_startup_lpc11.d" -o "Source/cr_startup_lpc11.o" "../Source/cr_startup_lpc11.c"
../Source/cr_startup_lpc11.c: In function 'pop_registers_from_fault_stack':
../Source/cr_startup_lpc11.c:348:23: warning: variable 'stacked_psr' set but not used [-Wunused-but-set-variable]
 volatile unsigned int stacked_psr;
                       ^
../Source/cr_startup_lpc11.c:347:23: warning: variable 'stacked_pc' set but not used [-Wunused-but-set-variable]
 volatile unsigned int stacked_pc;
                       ^
../Source/cr_startup_lpc11.c:346:23: warning: variable 'stacked_lr' set but not used [-Wunused-but-set-variable]
 volatile unsigned int stacked_lr;
                       ^
../Source/cr_startup_lpc11.c:345:23: warning: variable 'stacked_r12' set but not used [-Wunused-but-set-variable]
 volatile unsigned int stacked_r12;
                       ^
../Source/cr_startup_lpc11.c:344:23: warning: variable 'stacked_r3' set but not used [-Wunused-but-set-variable]
 volatile unsigned int stacked_r3;
                       ^
../Source/cr_startup_lpc11.c:343:23: warning: variable 'stacked_r2' set but not used [-Wunused-but-set-variable]
 volatile unsigned int stacked_r2;
                       ^
../Source/cr_startup_lpc11.c:342:23: warning: variable 'stacked_r1' set but not used [-Wunused-but-set-variable]
 volatile unsigned int stacked_r1;
                       ^
../Source/cr_startup_lpc11.c:341:23: warning: variable 'stacked_r0' set but not used [-Wunused-but-set-variable]
 volatile unsigned int stacked_r0;
                       ^
Finished building: ../Source/cr_startup_lpc11.c
 
Building file: ../Source/main-blinky.c
Invoking: MCU C Compiler
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/Downloads/freertos/FreeRTOSv10.0.1/FreeRTOS/Demo/CORTEX_M0_LPC1114_LPCXpresso/RTOSDemo/Source/Common_Demo_Tasks/include" -I"/home/user/Downloads/freertos/FreeRTOSv10.0.1/FreeRTOS/Demo/CORTEX_M0_LPC1114_LPCXpresso/RTOSDemo/Source" -I"/home/user/Downloads/freertos/FreeRTOSv10.0.1/FreeRTOS/Demo/CORTEX_M0_LPC1114_LPCXpresso/RTOSDemo/Source/FreeRTOS_Source/include" -I"/home/user/Downloads/freertos/FreeRTOSv10.0.1/FreeRTOS/Demo/CORTEX_M0_LPC1114_LPCXpresso/RTOSDemo/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/main-blinky.d" -MT"Source/main-blinky.o" -MT"Source/main-blinky.d" -o "Source/main-blinky.o" "../Source/main-blinky.c"
Finished building: ../Source/main-blinky.c
 
Building file: ../Source/main-full.c
Invoking: MCU C Compiler
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/Downloads/freertos/FreeRTOSv10.0.1/FreeRTOS/Demo/CORTEX_M0_LPC1114_LPCXpresso/RTOSDemo/Source/Common_Demo_Tasks/include" -I"/home/user/Downloads/freertos/FreeRTOSv10.0.1/FreeRTOS/Demo/CORTEX_M0_LPC1114_LPCXpresso/RTOSDemo/Source" -I"/home/user/Downloads/freertos/FreeRTOSv10.0.1/FreeRTOS/Demo/CORTEX_M0_LPC1114_LPCXpresso/RTOSDemo/Source/FreeRTOS_Source/include" -I"/home/user/Downloads/freertos/FreeRTOSv10.0.1/FreeRTOS/Demo/CORTEX_M0_LPC1114_LPCXpresso/RTOSDemo/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/main-full.d" -MT"Source/main-full.o" -MT"Source/main-full.d" -o "Source/main-full.o" "../Source/main-full.c"
Finished building: ../Source/main-full.c
 
Building file: ../Source/main.c
Invoking: MCU C Compiler
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/Downloads/freertos/FreeRTOSv10.0.1/FreeRTOS/Demo/CORTEX_M0_LPC1114_LPCXpresso/RTOSDemo/Source/Common_Demo_Tasks/include" -I"/home/user/Downloads/freertos/FreeRTOSv10.0.1/FreeRTOS/Demo/CORTEX_M0_LPC1114_LPCXpresso/RTOSDemo/Source" -I"/home/user/Downloads/freertos/FreeRTOSv10.0.1/FreeRTOS/Demo/CORTEX_M0_LPC1114_LPCXpresso/RTOSDemo/Source/FreeRTOS_Source/include" -I"/home/user/Downloads/freertos/FreeRTOSv10.0.1/FreeRTOS/Demo/CORTEX_M0_LPC1114_LPCXpresso/RTOSDemo/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/main.d" -MT"Source/main.o" -MT"Source/main.d" -o "Source/main.o" "../Source/main.c"
Finished building: ../Source/main.c
 
Building target: RTOSDemo.axf
Invoking: MCU Linker
arm-none-eabi-gcc -nostdlib -L"/home/user/Downloads/freertos/FreeRTOSv10.0.1/FreeRTOS/Demo/CORTEX_M0_LPC1114_LPCXpresso/CMSISv2p00_LPC11xx/Debug" -Xlinker -Map=RTOSDemo.map -Xlinker --gc-sections -mcpu=cortex-m0 -mthumb -T "RTOSDemo_Debug.ld" -o "RTOSDemo.axf"  ./Source/FreeRTOS_Source/portable/MemMang/heap_1.o  ./Source/FreeRTOS_Source/portable/GCC/ARM_CM0/port.o  ./Source/FreeRTOS_Source/list.o ./Source/FreeRTOS_Source/queue.o ./Source/FreeRTOS_Source/tasks.o ./Source/FreeRTOS_Source/timers.o  ./Source/Common_Demo_Tasks/IntQueue.o ./Source/Common_Demo_Tasks/blocktim.o ./Source/Common_Demo_Tasks/countsem.o ./Source/Common_Demo_Tasks/recmutex.o  ./Source/IntQueueTimer.o ./Source/RegTest.o ./Source/cr_startup_lpc11.o ./Source/main-blinky.o ./Source/main-full.o ./Source/main.o   -lCMSISv2p00_LPC11xx
Finished building target: RTOSDemo.axf
 
make --no-print-directory post-build
Performing post-build steps
arm-none-eabi-size RTOSDemo.axf; # arm-none-eabi-objcopy -O binary RTOSDemo.axf RTOSDemo.bin ; checksum -p LPC1114_301 -d RTOSDemo.bin;
   text	   data	    bss	    dec	    hex	filename
  10568	     12	   7328	  17908	   45f4	RTOSDemo.axf
 

09:52:06 Build Finished (took 3s.868ms)

^ start of LPC's build output

So days further down the road we find that LPC'x build output references source file RegTest.c, but this file is not explicitly copied by the original DOS "set up project dirs" batch file, and so also not copied by the bash script version to set up project dirs, headers and source files. Yet this C file is getting pulled into the project at build time. Strange, what's the intent here? Or

QUESTION:  is this common to have one or more source files pulled in at build time, while they're not mentioned in any makefile?


^ Build Issues While Developing Makefile

2018-06-15 - One of the first issues we encounter while creating a makefile for the FreeRTOS demo targeting LPC1114 processor is gcc's complaint of not finding the specifications file named redlib.specs. Gcc.gnu.org talks about specs files at this page:

Here is our error message:

$ make
- ## rtos-demo-with-mods - starting,
- ## in makefile project name set to 'rtos-demo-with-mods',
- ## project root directory set to '/home/user/projects/nxp/rtos-demo',
- ## setting compiler flags . . .\n
- rtos-demo-with-mods - including common makefile after all var' assignments and recipe declarations,
- rtos-demo-with-mods - to bring in often shared information which this project too needs . . .
- makefile.common - declaring recipes to convert, compile, clean and debug project . . .
- makefile.common - pulling in dependencies of all .o files . . .
- makefile.common - done.
/usr/bin/arm-none-eabi-gcc -c -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/Downloads/freertos/FreeRTOSv10.0.1/FreeRTOS/Demo/CORTEX_M0_LPC1114_LPCXpresso/RTOSDemo/Source/Common_Demo_Tasks/include" -I"/home/user/Downloads/freertos/FreeRTOSv10.0.1/FreeRTOS/Demo/CORTEX_M0_LPC1114_LPCXpresso/RTOSDemo/Source" -I"/home/user/Downloads/freertos/FreeRTOSv10.0.1/FreeRTOS/Demo/CORTEX_M0_LPC1114_LPCXpresso/RTOSDemo/Source/FreeRTOS_Source/include" -I"/home/user/Downloads/freertos/FreeRTOSv10.0.1/FreeRTOS/Demo/CORTEX_M0_LPC1114_LPCXpresso/RTOSDemo/Source/FreeRTOS_Source/portable/GCC/ARM_CM0" -O0 -g3 -Wall -fmessage-length=0 -fno-builtin -ffunction-sections -fdata-sections -Wextra -mcpu=cortex-m0 -mthumb -D__REDLIB__ -specs=redlib.specs -MMD -MP ./Source/FreeRTOS_Source/portable/MemMang/heap_1.c -o heap_1.o
arm-none-eabi-gcc: error: redlib.specs: No such file or directory
makefile.common:105: recipe for target 'heap_1.o' failed
make: *** [heap_1.o] Error 1

$


We've solved a couple of simple vpath and -I include path problems, but are running into something maybe more subtle or obscure. Gcc is getting an assembly file and does not know how to compile this assembly:

Figure x - snippet of assembly file confusion . . .

   .
   .
   .
/usr/bin/arm-none-eabi-gcc -c -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/Downloads/freertos/FreeRTOSv10.0.1/FreeRTOS/Demo/CORTEX_M0_LPC1114_LPCXpresso/RTOSDemo/Source/Common_Demo_Tasks/include" -I"/home/user/Downloads/freertos/FreeRTOSv10.0.1/FreeRTOS/Demo/CORTEX_M0_LPC1114_LPCXpresso/RTOSDemo/Source" -I"/home/user/Downloads/freertos/FreeRTOSv10.0.1/FreeRTOS/Demo/CORTEX_M0_LPC1114_LPCXpresso/RTOSDemo/Source/FreeRTOS_Source/include" -I"/home/user/Downloads/freertos/FreeRTOSv10.0.1/FreeRTOS/Demo/CORTEX_M0_LPC1114_LPCXpresso/RTOSDemo/Source/FreeRTOS_Source/portable/GCC/ARM_CM0" -I"/opt/nxp/lpcxpresso-8p2p2/lpcxpresso/tools/arm-none-eabi/include" -I"/opt/nxp/lpcxpresso-8p2p2/lpcxpresso/tools/lib/gcc/arm-none-eabi/5.4.1/include" -O0 -g3 -Wall -fmessage-length=0 -fno-builtin -ffunction-sections -fdata-sections -Wextra -mcpu=cortex-m0 -mthumb -D__REDLIB__ -specs=/opt/nxp/lpcxpresso-8p2p2/lpcxpresso/tools/arm-none-eabi/lib/redlib.specs -MMD -MP ./Source/FreeRTOS_Source/portable/GCC/ARM_CM0/port.c -o port.o
/tmp/cc6yN6nv.s: Assembler messages:
/tmp/cc6yN6nv.s:232: Error: cannot honor width suffix -- `mov r1,#255'
/tmp/cc6yN6nv.s:233: Error: cannot honor width suffix -- `lsl r1,r1,#16'
/tmp/cc6yN6nv.s:234: Error: cannot honor width suffix -- `orr r2,r1'
/tmp/cc6yN6nv.s:240: Error: cannot honor width suffix -- `mov r1,#255'
/tmp/cc6yN6nv.s:241: Error: cannot honor width suffix -- `lsl r1,r1,#24'
/tmp/cc6yN6nv.s:242: Error: cannot honor width suffix -- `orr r2,r1'
/tmp/cc6yN6nv.s:248: Error: cannot honor width suffix -- `mov r2,#0'
/tmp/cc6yN6nv.s:257: Error: cannot honor width suffix -- `mov r3,#0'
/tmp/cc6yN6nv.s:290: Error: cannot honor width suffix -- `mov r3,#250'
/tmp/cc6yN6nv.s:291: Error: cannot honor width suffix -- `lsl r3,r3,#2'
/tmp/cc6yN6nv.s:331: Error: cannot honor width suffix -- `mov r2,#128'
/tmp/cc6yN6nv.s:332: Error: cannot honor width suffix -- `lsl r2,r2,#21'
/tmp/cc6yN6nv.s:378: Error: lo register required -- `add r2,r3,#1'
/tmp/cc6yN6nv.s:433: Error: lo register required -- `sub r2,r3,#1'
/tmp/cc6yN6nv.s:586: Error: cannot honor width suffix -- `mov r2,#128'
/tmp/cc6yN6nv.s:587: Error: cannot honor width suffix -- `lsl r2,r2,#21'
/tmp/cc6yN6nv.s:626: Error: cannot honor width suffix -- `mov r2,#0'
/tmp/cc6yN6nv.s:630: Error: cannot honor width suffix -- `mov r2,#0'
/tmp/cc6yN6nv.s:637: Error: cannot honor width suffix -- `mov r3,#250'
/tmp/cc6yN6nv.s:638: Error: cannot honor width suffix -- `lsl r1,r3,#2'
/tmp/cc6yN6nv.s:641: Error: lo register required -- `sub r3,r3,#1'
/tmp/cc6yN6nv.s:645: Error: cannot honor width suffix -- `mov r2,#7'
makefile.common:108: recipe for target 'port.o' failed
make: *** [port.o] Error 1


^ arm-none-eabi-as: cannot honor width suffix


^ edit point - LPCXpresso make output compare GNU make output

Comparing LPCXpresso build console output with GNU make output at command line, the "hand rolled" makefile way, see build output messages captured in figure after this paragraph. Ted noting also that we now have a better idea why the hand-crafted GNU makefile isn't fully building the project. This capture doesn't reflect some of the issues we've -- since its taking -- discovered how the subdir.mk files add to the LPC project make rules list, as well as adding tokens to vars C_DEPS, OBJS and C_SRCS. Here is the comparative build process output:

FROM LPCXPRESSO BUILD CONSOLE:

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/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/Downloads/freertos/FreeRTOSv10.0.1/FreeRTOS/Demo/CORTEX_M0_LPC1114_LPCXpresso/RTOSDemo/Source/Common_Demo_Tasks/include" -I"/home/user/Downloads/freertos/FreeRTOSv10.0.1/FreeRTOS/Demo/CORTEX_M0_LPC1114_LPCXpresso/RTOSDemo/Source" -I"/home/user/Downloads/freertos/FreeRTOSv10.0.1/FreeRTOS/Demo/CORTEX_M0_LPC1114_LPCXpresso/RTOSDemo/Source/FreeRTOS_Source/include" -I"/home/user/Downloads/freertos/FreeRTOSv10.0.1/FreeRTOS/Demo/CORTEX_M0_LPC1114_LPCXpresso/RTOSDemo/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

HAND-ROLLED:

/usr/bin/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/Downloads/freertos/FreeRTOSv10.0.1/FreeRTOS/Demo/CORTEX_M0_LPC1114_LPCXpresso/RTOSDemo/Source/Common_Demo_Tasks/include" -I"/home/user/Downloads/freertos/FreeRTOSv10.0.1/FreeRTOS/Demo/CORTEX_M0_LPC1114_LPCXpresso/RTOSDemo/Source" -I"/home/user/Downloads/freertos/FreeRTOSv10.0.1/FreeRTOS/Demo/CORTEX_M0_LPC1114_LPCXpresso/RTOSDemo/Source/FreeRTOS_Source/include" -I"/home/user/Downloads/freertos/FreeRTOSv10.0.1/FreeRTOS/Demo/CORTEX_M0_LPC1114_LPCXpresso/RTOSDemo/Source/FreeRTOS_Source/portable/GCC/ARM_CM0" -I"/opt/nxp/lpcxpresso-8p2p2/lpcxpresso/tools/arm-none-eabi/include" -I"/opt/nxp/lpcxpresso-8p2p2/lpcxpresso/tools/lib/gcc/arm-none-eabi/5.4.1/include" -O0 -g3 -Wall -fmessage-length=0 -fno-builtin -ffunction-sections -fdata-sections -Wextra -mcpu=cortex-m0 -mthumb -D__REDLIB__ -specs=/opt/nxp/lpcxpresso-8p2p2/lpcxpresso/tools/arm-none-eabi/lib/redlib.specs -MMD -MP -c ./Source/FreeRTOS_Source/portable/MemMang/heap_1.c -o heap_1.o

TO-DO 2018-06-25: break out the above two compiler invocations into one option per line, for easier comparison, - TMH


arm-none-eabi-gcc                                       /usr/bin/arm-none-eabi-gcc
-D__REDLIB__                                           -D__REDLIB__
-DDEBUG                                                -DDEBUG
-D__CODE_RED                                           -D__CODE_RED
-D__USE_CMSIS=CMSISv2p00_LPC11xx                       -D__USE_CMSIS=CMSISv2p00_LPC11xx
 ( -I options - long lines )                             ( -I options - long lines )
-O0                                                    -O0  
-g3                                                    -g3
-Wall                                                  -Wall
-c
-fmessage-length=0                                     -fmessage-length=0
-fno-builtin                                           -fno-builtin
-ffunction-sections                                    -ffunction-sections
-fdata-sections                                        -fdata-sections
-Wextra                                                -Wextra
-mcpu=cortex-m0                                        -mcpu=cortex-m0
-mthumb                                                -mthumb
-D__REDLIB__                                           -D__REDLIB__
-specs=redlib.specs                                    -specs=/opt/nxp/lpcxpresso-8p2p2/lpcxpresso/tools/arm-none-eabi/lib/redlib.specs
-MMD                                                   -MMD      ./Source/FreeRTOS_Source/portable/MemMang/heap_1.c -o heap_1.o
-MP                                                    -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"
                                                       -c
                                                       ./Source/FreeRTOS_Source/portable/MemMang/heap_1.c
                                                       -o
                                                       heap_1.o


The -I include paths of each captured `make` output:

-I"/home/user/Downloads/freertos/FreeRTOSv10.0.1/FreeRTOS/Demo/CORTEX_M0_LPC1114_LPCXpresso/CMSISv2p00_LPC11xx/inc"                               -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/Downloads/freertos/FreeRTOSv10.0.1/FreeRTOS/Demo/CORTEX_M0_LPC1114_LPCXpresso/RTOSDemo/Source/Common_Demo_Tasks/include"
-I"/home/user/Downloads/freertos/FreeRTOSv10.0.1/FreeRTOS/Demo/CORTEX_M0_LPC1114_LPCXpresso/RTOSDemo/Source"
-I"/home/user/Downloads/freertos/FreeRTOSv10.0.1/FreeRTOS/Demo/CORTEX_M0_LPC1114_LPCXpresso/RTOSDemo/Source/FreeRTOS_Source/include"
-I"/home/user/Downloads/freertos/FreeRTOSv10.0.1/FreeRTOS/Demo/CORTEX_M0_LPC1114_LPCXpresso/RTOSDemo/Source/FreeRTOS_Source/portable/GCC/ARM_CM0"


Ok a lot going on here. Also noting that when gcc given -v option for more verbose output, there are some non-existent paths which gcc mentions, which are expressed in the redlib.specs file. These don't look like a source of problems. Also notice there are two identical but differently named instances of the cross-assembler gnu-none-eabi-as:

Figure x -

$ diff /usr/bin/arm-none-eabi-as /usr/lib/arm-none-eabi/bin/as

$ file /usr/bin/arm-none-eabi-as
/usr/bin/arm-none-eabi-as: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), dynamically linked, interpreter /lib/ld-linux.so.2, for GNU/Linux 2.6.32, BuildID[sha1]=f5a9351dcc0223be42093524a835a2a3dff2b84f, stripped

$ file /usr/lib/arm-none-eabi/bin/as
/usr/lib/arm-none-eabi/bin/as: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), dynamically linked, interpreter /lib/ld-linux.so.2, for GNU/Linux 2.6.32, BuildID[sha1]=f5a9351dcc0223be42093524a835a2a3dff2b84f, stripped

$

^ edit point - gcc 6.3 or newer may be needed

An obscure error appears now with our call to the GNU assembler, which gives a complaint about width suffixes in one of FreeRTOS demo assembly files. Per https://sourceforge.net/p/freertos/discussion/382005/thread/8041642a/ we may need a newer version of gcc, e.g. 6.3 over 4.x in order to get past the error:

GNU assembler version 2.25 (arm-none-eabi) using BFD version (2.25-5+5+b1) 2.25
/tmp/cc8oKrpj.s: Assembler messages:
/tmp/cc8oKrpj.s:232: Error: cannot honor width suffix -- `mov r1,#255'
/tmp/cc8oKrpj.s:233: Error: cannot honor width suffix -- `lsl r1,r1,#16'
/tmp/cc8oKrpj.s:234: Error: cannot honor width suffix -- `orr r2,r1'
   .
   .
   .


^ edit point - link time issues

2018-07-06 Friday

Link time issues can come up before all sources have been built. The linker `ld` or similar needs to know where project-related libraries are on the local file system. Here in the next figure / build excerpt are messages showing the linker not finding certain library function definitions:

$ make -f Makefile
- Makefile.common - declaring recipes to convert, compile, clean and debug project . . .
- Makefile.common - pulling in dependencies of all .o files . . .
- Makefile.common - done.
zz - Project name set to '',
zz - additional library paths also set in 'LIBRARY_PATHS' variable,
/usr/bin/arm-none-eabi-gcc  -o .elf  ./Source/FreeRTOS_Source/portable/MemMang/heap_1.o  ./Source/FreeRTOS_Source/portable/GCC/ARM_CM0/port.o  ./Source/FreeRTOS_Source/list.o ./Source/FreeRTOS_Source/queue.o ./Source/FreeRTOS_Source/tasks.o ./Source/FreeRTOS_Source/timers.o  ./Source/Common_Demo_Tasks/IntQueue.o ./Source/Common_Demo_Tasks/blocktim.o ./Source/Common_Demo_Tasks/countsem.o ./Source/Common_Demo_Tasks/recmutex.o  ./Source/IntQueueTimer.o ./Source/RegTest.o ./Source/cr_startup_lpc11.o ./Source/main-blinky.o ./Source/main-full.o ./Source/main.o  
/usr/lib/gcc/arm-none-eabi/4.8/../../../arm-none-eabi/lib/libc.a(lib_a-exit.o): In function `exit':
/home/tin/projects/debian/arm-toolchain/collab-maint/newlib/build/arm-none-eabi/newlib/libc/stdlib/../../../../../newlib/libc/stdlib/exit.c:70: undefined reference to `_exit'
./Source/FreeRTOS_Source/portable/GCC/ARM_CM0/port.o: In function `prvSetupTimerInterrupt':
/home/user/projects/nxp/rtos-demo-3/Debug/../Source/FreeRTOS_Source/portable/GCC/ARM_CM0/port.c:360: undefined reference to `SystemCoreClock'
./Source/IntQueueTimer.o: In function `vInitialiseTimerForIntQueueTest':
/home/user/projects/nxp/rtos-demo-3/Debug/../Source/IntQueueTimer.c:79: undefined reference to `SystemCoreClock'
./Source/cr_startup_lpc11.o: In function `ResetISR':
/home/user/projects/nxp/rtos-demo-3/Debug/../Source/cr_startup_lpc11.c:301: undefined reference to `SystemInit'
/home/user/projects/nxp/rtos-demo-3/Debug/../Source/cr_startup_lpc11.c:313: undefined reference to `__main'
/home/user/projects/nxp/rtos-demo-3/Debug/../Source/cr_startup_lpc11.c:313: undefined reference to `__data_section_table'
/home/user/projects/nxp/rtos-demo-3/Debug/../Source/cr_startup_lpc11.c:313: undefined reference to `__data_section_table_end'
/home/user/projects/nxp/rtos-demo-3/Debug/../Source/cr_startup_lpc11.c:313: undefined reference to `__bss_section_table_end'
./Source/cr_startup_lpc11.o:(.isr_vector+0x0): undefined reference to `_vStackTop'
./Source/main.o: In function `prvSetupHardware':
/home/user/projects/nxp/rtos-demo-3/Debug/../Source/main.c:162: undefined reference to `_vStackTop'
/home/user/projects/nxp/rtos-demo-3/Debug/../Source/main.c:162: undefined reference to `_pvHeapStart'
./Source/main.o: In function `vApplicationTickHook':
/home/user/projects/nxp/rtos-demo-3/Debug/../Source/main.c:226: undefined reference to `_pvHeapStart'
collect2: error: ld returned 1 exit status
../Makefile.common:107: recipe for target '.elf' failed
make: *** [.elf] Error 1

$

From the 'create-directory-structure' script we know that all needed library files are copied into the directory hierarchy of FreeRTOS demo port to LPC1114. We're going to search for the patterns '_exit' and 'SystemCoreClock' starting at the root directory of this project:

Figure x -


$



^ Makefile Generated By LPCXpresso

First the reference which told us to look in the project (in this case workspace/RTOSdemo) directory for a makefile:

Now the 54 line makefile:

################################################################################
# Automatically-generated file. Do not edit!
################################################################################

-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

# Add inputs and outputs from these tool invocations to the build variables 

# All Target
all: RTOSDemo.axf

# Tool invocations
RTOSDemo.axf: $(OBJS) $(USER_OBJS)
        @echo 'Building target: $@'
        @echo 'Invoking: MCU Linker' 
        arm-none-eabi-gcc -nostdlib -L"/home/user/Downloads/freertos/FreeRTOSv10.0.1/FreeRTOS/Demo/CORTEX_M0_LPC1114_LPCXpresso/CMSISv2p00_LPC11xx/Debug" -Xlinker -Map=RTOSDemo.map -Xlinker --gc-sections -mcpu=cortex-m0 -mthumb -T "RTOSDemo_Debug.ld" -o "RTOSDemo.axf" $(OBJS) $(USER_OBJS) $(LIBS) 
        @echo 'Finished building target: $@'
        @echo ' '
        $(MAKE) --no-print-directory post-build

# Other Targets 
clean:
        -$(RM) $(EXECUTABLES)$(OBJS)$(C_DEPS) RTOSDemo.axf
        -@echo ' '

post-build:
        -@echo 'Performing post-build steps'
        -arm-none-eabi-size RTOSDemo.axf; # arm-none-eabi-objcopy -O binary RTOSDemo.axf RTOSDemo.bin ; checksum -p LPC1114_301 -d RTOSDemo.bin;
        -@echo ' '

.PHONY: all clean dependents
.SECONDARY: post-build

-include ../makefile.targets

This makefile alone does not tell us a lot about how LPCXpresso is constructing and using makefiles for project builds. However, the -include stanzas lead us to some clues. Specifically many of the -includes reference "child" makefiles in various project sources directories. These makefiles are all like named 'subdir.mk'.

Each subdir.mk file amends three make variables: C_SRCS, OBJS and C_DEPS. This variable amending itself is useful in the primary makefile, when by the time all subdir.mk files have been included the primary makefile now has a list of all project sources. The problem however is that each subdir.mk file also defines a target and build recipe for a subset of project sources. These targets are added to the dependency graph built by `make`, and it seems kludgey at best to -- if possible within a GNU makefile -- select and delete certain rules from the dependency graph mid-way through processing a makefile. By mid-way we're thinking after all -include directive processing and before named rule processing.

Regarding `make` targets or rules see:

Checking to see whether and how the rules differ among FreeRTOS demo subdir.mk files:

Figure x -

FreeRTOS LPC1114 Demo source file directories:

(1) Source/Common_Demo_Tasks \
(2) Source/FreeRTOS_Source \
(3) Source/FreeRTOS_Source/portable/GCC/ARM_CM0 \
(4) Source/FreeRTOS_Source/portable/MemMang \
(5) Source


Options to gcc for each rule in give source file directory file named subdir.mk:

(1) 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"$(@:%.o=%.d)" -MT"$(@:%.o=%.o)" -MT"$(@:%.o=%.d)" -o "$@" "$<"
(2) 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"$(@:%.o=%.d)" -MT"$(@:%.o=%.o)" -MT"$(@:%.o=%.d)" -o "$@" "$<"
(3) 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"$(@:%.o=%.d)" -MT"$(@:%.o=%.o)" -MT"$(@:%.o=%.d)" -o "$@" "$<"
(4) 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"$(@:%.o=%.d)" -MT"$(@:%.o=%.o)" -MT"$(@:%.o=%.d)" -o "$@" "$<"
(5) 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"$(@:%.o=%.d)" -MT"$(@:%.o=%.o)" -MT"$(@:%.o=%.d)" -o "$@" "$<"
(5) 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 -Os -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"$(@:%.o=%.d)" -MT"Source/cr_startup_lpc11.d" -o "$@" "$<"


^ edit point - finding and pointing make to .a library files

On Thursday, yesterday, we found a makefile created by LPCXpresso or one of its called tools, in the Debug directory of our RTOSDemo project instance. Working now with a copy of that makefile in a project we did not import, nor unzip from a zip archive, but started out as a general C/C++ project. TO DO: Contributor Ted notes here that we must retrace those project creation steps so we know thoroughly how to get a project off the ground in the LPCXpresso IDE.

There are different types of library files in C and C++ projects, library files which can be linked in to a binary at compile time or loaded at run time. On the Linux and GCC side it may be necessary to point `make` to dot a archive type library files, by using the -L option . . .

$ locate libcr_c.a
/opt/nxp/lpcxpresso-8p2p2/lpcxpresso/tools/arm-none-eabi/lib/libcr_c.a
/opt/nxp/lpcxpresso-8p2p2/lpcxpresso/tools/arm-none-eabi/lib/armv6-m/libcr_c.a
/opt/nxp/lpcxpresso-8p2p2/lpcxpresso/tools/arm-none-eabi/lib/armv7-m/libcr_c.a
/opt/nxp/lpcxpresso-8p2p2/lpcxpresso/tools/arm-none-eabi/lib/armv7e-m/libcr_c.a
/opt/nxp/lpcxpresso-8p2p2/lpcxpresso/tools/arm-none-eabi/lib/armv7e-m/fpu/libcr_c.a
/opt/nxp/lpcxpresso-8p2p2/lpcxpresso/tools/arm-none-eabi/lib/armv7e-m/softfp/libcr_c.a
/opt/nxp/lpcxpresso-8p2p2/lpcxpresso/tools/arm-none-eabi/lib/thumb/libcr_c.a

$ ls -l /opt/nxp/lpcxpresso-8p2p2/lpcxpresso/tools/arm-none-eabi/lib/libcr_c.a /opt/nxp/lpcxpresso-8p2p2/lpcxpresso/tools/arm-none-eabi/lib/thumb/libcr_c.a
-rwxr-xr-x 1 root root 235420 Jul 21  2016 /opt/nxp/lpcxpresso-8p2p2/lpcxpresso/tools/arm-none-eabi/lib/libcr_c.a
-rwxr-xr-x 1 root root 216552 Jul 21  2016 /opt/nxp/lpcxpresso-8p2p2/lpcxpresso/tools/arm-none-eabi/lib/thumb/libcr_c.a

$ locate libcr_eabihelpers.a
/opt/nxp/lpcxpresso-8p2p2/lpcxpresso/tools/lib/gcc/arm-none-eabi/5.4.1/libcr_eabihelpers.a
/opt/nxp/lpcxpresso-8p2p2/lpcxpresso/tools/lib/gcc/arm-none-eabi/5.4.1/armv6-m/libcr_eabihelpers.a
/opt/nxp/lpcxpresso-8p2p2/lpcxpresso/tools/lib/gcc/arm-none-eabi/5.4.1/armv7-m/libcr_eabihelpers.a
/opt/nxp/lpcxpresso-8p2p2/lpcxpresso/tools/lib/gcc/arm-none-eabi/5.4.1/armv7e-m/libcr_eabihelpers.a
/opt/nxp/lpcxpresso-8p2p2/lpcxpresso/tools/lib/gcc/arm-none-eabi/5.4.1/armv7e-m/fpu/libcr_eabihelpers.a
/opt/nxp/lpcxpresso-8p2p2/lpcxpresso/tools/lib/gcc/arm-none-eabi/5.4.1/armv7e-m/softfp/libcr_eabihelpers.a
/opt/nxp/lpcxpresso-8p2p2/lpcxpresso/tools/lib/gcc/arm-none-eabi/5.4.1/thumb/libcr_eabihelpers.a

$


^ edit point - linker not finding symbol defined in .ld file

Linker having trouble finding ResetISR, which is defined in a .c file but nowhere defined in any header file . . .

$ grep -nr ResetISR ./*
./rtos-demo-with-mods/Debug/RTOSDemo_Debug.ld:14:ENTRY(ResetISR)
./rtos-demo-with-mods/Debug/RTOSDemo_Debug.ld:110:                                         + (ResetISR + 1) 
./rtos-demo-with-mods/Debug/RTOSDemo.map:963:                0x00000120                ResetISR
./rtos-demo-with-mods/Debug/RTOSDemo.map:1393:                [!provide]                PROVIDE (__valid_user_code_checksum, (0x0 - (((_vStackTop + (ResetISR + 0x1)) + (DEFINED (NMI_Handler)?NMI_Handler:M0_NMI_Handler + 0x1)) + (DEFINED (HardFault_Handler)?HardFault_Handler:M0_HardFault_Handler + 0x1))))
./rtos-demo-with-mods/Source/cr_startup_lpc11.c:66:     void ResetISR(void);
./rtos-demo-with-mods/Source/cr_startup_lpc11.c:138:    ResetISR,                               // The reset handler
./rtos-demo-with-mods/Source/cr_startup_lpc11.c:197:// ResetISR() function in order to cope with MCUs with multiple banks of
./rtos-demo-with-mods/Source/cr_startup_lpc11.c:256:ResetISR(void) {
./rtosdemo/Debug/RTOSDemo_Debug.ld:14:ENTRY(ResetISR)
./rtosdemo/Debug/RTOSDemo_Debug.ld:110:                                         + (ResetISR + 1) 
./rtosdemo/Debug/RTOSDemo.map:963:                0x00000120                ResetISR
./rtosdemo/Debug/RTOSDemo.map:1393:                [!provide]                PROVIDE (__valid_user_code_checksum, (0x0 - (((_vStackTop + (ResetISR + 0x1)) + (DEFINED (NMI_Handler)?NMI_Handler:M0_NMI_Handler + 0x1)) + (DEFINED (HardFault_Handler)?HardFault_Handler:M0_HardFault_Handler + 0x1))))
./rtosdemo/Source/cr_startup_lpc11.c:66:     void ResetISR(void);
./rtosdemo/Source/cr_startup_lpc11.c:138:    ResetISR,                               // The reset handler
./rtosdemo/Source/cr_startup_lpc11.c:197:// ResetISR() function in order to cope with MCUs with multiple banks of
./rtosdemo/Source/cr_startup_lpc11.c:256:ResetISR(void) {

$

So one thing we see is that symbol ResetISR appears in linker files of type .ld, in .map files and in .c files. Symbol ResetISR does not appear in any header files of this project. Where in our rtos-demo-with-mods project makefile do we touch or change references to any .map files? . . .

NXP LPC1xxx Library Routines

NXP microchip library routines, LPC1xxx routines



^ __bss_start__

./lpcxpresso-8p2p2/lpcxpresso/tools/arm-none-eabi/lib/armv7-m/redboot.ld:161:  __bss_start__ = .;
./lpcxpresso-8p2p2/lpcxpresso/tools/arm-none-eabi/lib/armv7-ar/thumb/redboot.ld:161:  __bss_start__ = .;
./lpcxpresso-8p2p2/lpcxpresso/tools/arm-none-eabi/lib/armv7-ar/thumb/fpu/redboot.ld:161:  __bss_start__ = .;
./lpcxpresso-8p2p2/lpcxpresso/tools/arm-none-eabi/lib/armv7-ar/thumb/softfp/redboot.ld:161:  __bss_start__ = .;
./lpcxpresso-8p2p2/lpcxpresso/tools/arm-none-eabi/lib/redboot.ld:161:  __bss_start__ = .;
./lpcxpresso-8p2p2/lpcxpresso/tools/arm-none-eabi/lib/fpu/redboot.ld:161:  __bss_start__ = .;
./lpcxpresso-8p2p2/lpcxpresso/tools/arm-none-eabi/lib/armv7e-m/redboot.ld:161:  __bss_start__ = .;
./lpcxpresso-8p2p2/lpcxpresso/tools/arm-none-eabi/lib/armv7e-m/fpu/fpv5-sp-d16/redboot.ld:161:  __bss_start__ = .;
./lpcxpresso-8p2p2/lpcxpresso/tools/arm-none-eabi/lib/armv7e-m/fpu/redboot.ld:161:  __bss_start__ = .;
./lpcxpresso-8p2p2/lpcxpresso/tools/arm-none-eabi/lib/armv7e-m/fpu/fpv5-d16/redboot.ld:161:  __bss_start__ = .;
./lpcxpresso-8p2p2/lpcxpresso/tools/arm-none-eabi/lib/armv7e-m/softfp/fpv5-sp-d16/redboot.ld:161:  __bss_start__ = .;
./lpcxpresso-8p2p2/lpcxpresso/tools/arm-none-eabi/lib/armv7e-m/softfp/redboot.ld:161:  __bss_start__ = .;
./lpcxpresso-8p2p2/lpcxpresso/tools/arm-none-eabi/lib/armv7e-m/softfp/fpv5-d16/redboot.ld:161:  __bss_start__ = .;
./lpcxpresso-8p2p2/lpcxpresso/tools/arm-none-eabi/lib/armv8-m.main/redboot.ld:161:  __bss_start__ = .;
./lpcxpresso-8p2p2/lpcxpresso/tools/arm-none-eabi/lib/armv8-m.main/fpu/fpv5-sp-d16/redboot.ld:161:  __bss_start__ = .;
./lpcxpresso-8p2p2/lpcxpresso/tools/arm-none-eabi/lib/armv8-m.main/fpu/fpv5-d16/redboot.ld:161:  __bss_start__ = .;
./lpcxpresso-8p2p2/lpcxpresso/tools/arm-none-eabi/lib/armv8-m.main/softfp/fpv5-sp-d16/redboot.ld:161:  __bss_start__ = .;
./lpcxpresso-8p2p2/lpcxpresso/tools/arm-none-eabi/lib/armv8-m.main/softfp/fpv5-d16/redboot.ld:161:  __bss_start__ = .;
./lpcxpresso-8p2p2/lpcxpresso/tools/arm-none-eabi/lib/ldscripts/armelf.xbn:180:  __bss_start__ = .;
./lpcxpresso-8p2p2/lpcxpresso/tools/arm-none-eabi/lib/ldscripts/armelf.xs:169:  __bss_start__ = .;
./lpcxpresso-8p2p2/lpcxpresso/tools/arm-none-eabi/lib/ldscripts/armelf.x:180:  __bss_start__ = .;
./lpcxpresso-8p2p2/lpcxpresso/tools/arm-none-eabi/lib/ldscripts/armelf.xsc:168:  __bss_start__ = .;
./lpcxpresso-8p2p2/lpcxpresso/tools/arm-none-eabi/lib/ldscripts/armelf.xw:179:  __bss_start__ = .;
./lpcxpresso-8p2p2/lpcxpresso/tools/arm-none-eabi/lib/ldscripts/armelf.xn:180:  __bss_start__ = .;
./lpcxpresso-8p2p2/lpcxpresso/tools/arm-none-eabi/lib/ldscripts/armelf.xsw:168:  __bss_start__ = .;
./lpcxpresso-8p2p2/lpcxpresso/tools/arm-none-eabi/lib/ldscripts/armelf.xc:179:  __bss_start__ = .;
./lpcxpresso-8p2p2/lpcxpresso/tools/arm-none-eabi/lib/armv8-m.base/redboot.ld:161:  __bss_start__ = .;
./lpcxpresso-8p2p2/lpcxpresso/tools/arm-none-eabi/lib/thumb/redboot.ld:161:  __bss_start__ = .;
./lpcxpresso-8p2p2/lpcxpresso/tools/arm-none-eabi/lib/armv6-m/redboot.ld:161:  __bss_start__ = .;
./lpcxpresso-8p2p2/lpcxpresso/tools/share/gcc-arm-none-eabi/samples/ldscripts/nokeep.ld:35: *   __bss_start__
./lpcxpresso-8p2p2/lpcxpresso/tools/share/gcc-arm-none-eabi/samples/ldscripts/nokeep.ld:113:                LONG (__bss_start__)
./lpcxpresso-8p2p2/lpcxpresso/tools/share/gcc-arm-none-eabi/samples/ldscripts/nokeep.ld:114:                LONG (__bss_end__ - __bss_start__)
./lpcxpresso-8p2p2/lpcxpresso/tools/share/gcc-arm-none-eabi/samples/ldscripts/nokeep.ld:160:                __bss_start__ = .;
./lpcxpresso-8p2p2/lpcxpresso/tools/share/gcc-arm-none-eabi/samples/ldscripts/gcc.ld:35: *   __bss_start__
./lpcxpresso-8p2p2/lpcxpresso/tools/share/gcc-arm-none-eabi/samples/ldscripts/gcc.ld:113:           LONG (__bss_start__)
./lpcxpresso-8p2p2/lpcxpresso/tools/share/gcc-arm-none-eabi/samples/ldscripts/gcc.ld:114:           LONG (__bss_end__ - __bss_start__)
./lpcxpresso-8p2p2/lpcxpresso/tools/share/gcc-arm-none-eabi/samples/ldscripts/gcc.ld:160:           __bss_start__ = .;
./lpcxpresso-8p2p2/lpcxpresso/tools/share/gcc-arm-none-eabi/samples/ldscripts/multi-ram.ld:36: *   __bss_start__
./lpcxpresso-8p2p2/lpcxpresso/tools/share/gcc-arm-none-eabi/samples/ldscripts/multi-ram.ld:111:             LONG (__bss_start__)
./lpcxpresso-8p2p2/lpcxpresso/tools/share/gcc-arm-none-eabi/samples/ldscripts/multi-ram.ld:112:             LONG (__bss_end__ - __bss_start__)
./lpcxpresso-8p2p2/lpcxpresso/tools/share/gcc-arm-none-eabi/samples/ldscripts/multi-ram.ld:165:             __bss_start__ = .;
./lpcxpresso-8p2p2/lpcxpresso/tools/share/gcc-arm-none-eabi/samples/startup/startup_ARMCM3.S:202: *    __bss_start__: start of the BSS section.
./lpcxpresso-8p2p2/lpcxpresso/tools/share/gcc-arm-none-eabi/samples/startup/startup_ARMCM3.S:207:   ldr     r1, =__bss_start__
./lpcxpresso-8p2p2/lpcxpresso/tools/share/gcc-arm-none-eabi/samples/startup/startup_ARMCM4.S:202: *    __bss_start__: start of the BSS section.
./lpcxpresso-8p2p2/lpcxpresso/tools/share/gcc-arm-none-eabi/samples/startup/startup_ARMCM4.S:207:   ldr     r1, =__bss_start__
./lpcxpresso-8p2p2/lpcxpresso/tools/share/gcc-arm-none-eabi/samples/startup/startup_ARMCM7.S:202: *    __bss_start__: start of the BSS section.
./lpcxpresso-8p2p2/lpcxpresso/tools/share/gcc-arm-none-eabi/samples/startup/startup_ARMCM7.S:207:   ldr     r1, =__bss_start__
./lpcxpresso-8p2p2/lpcxpresso/tools/share/gcc-arm-none-eabi/samples/startup/startup_ARMCM0.S:208: *    __bss_start__: start of the BSS section.
./lpcxpresso-8p2p2/lpcxpresso/tools/share/gcc-arm-none-eabi/samples/startup/startup_ARMCM0.S:213:   ldr     r1, =__bss_start__



^ Linker Script Details

Good details on linker scripts here:

-Xlinker option and related:

. . .



^ 2018-07-10 - GNU style makefile calls sub-makefiles of LPCXpresso

- STEP - First try this Tuesday morning, cannot find <stdint.h> . . .

Building file: ../Source/cr_startup_lpc11.c
Invoking: MCU C Compiler
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 -Os -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/cr_startup_lpc11.d" -MT"Source/cr_startup_lpc11.d" -o "Source/cr_startup_lpc11.o" "../Source/cr_startup_lpc11.c"
In file included from ../Source/cr_startup_lpc11.c:51:0:
/home/user/Downloads/freertos/FreeRTOSv10.0.1/FreeRTOS/Demo/CORTEX_M0_LPC1114_LPCXpresso/CMSISv2p00_LPC11xx/inc/system_LPC11xx.h:33:20: fatal error: stdint.h: No such file or directory
 #include <stdint.h>
                    ^
compilation terminated.
Source/subdir.mk:40: recipe for target 'Source/cr_startup_lpc11.o' failed
make: *** [Source/cr_startup_lpc11.o] Error 1

Searching for header file stdint.h in /opt/nxp:

/opt/nxp$ find . -name stdint.h
./lpcxpresso-8p2p2/lpcxpresso/tools/redlib/include/stdint.h
./lpcxpresso-8p2p2/lpcxpresso/tools/lib/gcc/arm-none-eabi/5.4.1/include/stdint.h
./lpcxpresso-8p2p2/lpcxpresso/tools/arm-none-eabi/include/stdint.h
./lpcxpresso-8p2p2/lpcxpresso/tools/arm-none-eabi/include/c++/5.4.1/tr1/stdint.h

- STEP - amending include paths with -I . . .

Adding needed paths to CFLAGS fails to solve our present modified top-project-level makefile named 'Makefile', which in turn calls LPC-generated sub-makefiles per project source directory. The cause we think is that those subdir.mk files each express targets whose options to gcc are already expanded and thus fixed. There is no appearance of $CFLAGS in those target recipes.


^ Suspicion subdir.mk target recipes lack variables

- 2018-07-11 - Tuesday -

Suspicion:  subdir.mk target recipes contain no variables to expand, so that amendments to typical makefile variables such as CFLAGS are not applied when make calls programs to execute these targets.

There are a couple of things going on here as we search for an automatable way to convert LPCXpresso firmware projects into GNU gcc toolchain projects. Have 'make' or a shell script read sub-make files can be helpful in automatically gathering for example all the sources which are part of a project. Parsing "hard coded" build recipes can allow us to assign pre-processor, compiler, assembler and linker options to conventional GNU `make` variables. Achieving these parsings and effectively porting projects from LPCXpresso's makefile way to a GNU type toolchain would give us a lot of insight into the details of project dependencies, and the specific tasks we need `make` to invoke in order to build -- to cross-compile -- a software project for a given target processor.

Proposed Steps:

- Step 1 -

    A first good step to take is to create a recipe which builds a list of all project sources.

- Step 2 -

    A second step to attempt authoring is that of a recipe which builds all sources, whose passed options to gcc are in variable which we assign values manually at first. If all sources take the same arguments, this will function as desired. Otherwise if recipies differ for one or some sources we can create targets for each set of sources which build in distinct ways.

- Step 3 -

    A third step then when we see the project build via our target described in step 2, is to automate that parsing and assigning-to-make-variables the options required to build all project sources.


^ edit point - checking dependencies are correct

We must check that our dependencies are getting figured correctly. A manual call to `make` on a single source file shows host system library headers getting included, not the ones we need. Though this is likely for a lack of missing -I{path} options given to gcc:

~/projects/nxp/rtos-demo-4/Source/FreeRTOS_Source$ gcc -I.. -I./include -Iportable/GCC/ARM_CM0 -M list.c

list.o: list.c /usr/include/stdc-predef.h /usr/include/stdlib.h \
 /usr/include/features.h /usr/include/i386-linux-gnu/sys/cdefs.h \
 /usr/include/i386-linux-gnu/bits/wordsize.h \
 /usr/include/i386-linux-gnu/gnu/stubs.h \
 /usr/include/i386-linux-gnu/gnu/stubs-32.h \
 /usr/lib/gcc/i586-linux-gnu/4.9/include/stddef.h \
 /usr/include/i386-linux-gnu/bits/waitflags.h \
 /usr/include/i386-linux-gnu/bits/waitstatus.h /usr/include/endian.h \
 /usr/include/i386-linux-gnu/bits/endian.h \
 /usr/include/i386-linux-gnu/bits/byteswap.h \
 /usr/include/i386-linux-gnu/bits/types.h \
 /usr/include/i386-linux-gnu/bits/typesizes.h \
 /usr/include/i386-linux-gnu/bits/byteswap-16.h \
 /usr/include/i386-linux-gnu/sys/types.h /usr/include/time.h \
 /usr/include/i386-linux-gnu/sys/select.h \
 /usr/include/i386-linux-gnu/bits/select.h \
 /usr/include/i386-linux-gnu/bits/sigset.h \
 /usr/include/i386-linux-gnu/bits/time.h \
 /usr/include/i386-linux-gnu/sys/sysmacros.h \
 /usr/include/i386-linux-gnu/bits/pthreadtypes.h /usr/include/alloca.h \
 /usr/include/i386-linux-gnu/bits/stdlib-float.h include/FreeRTOS.h \
 /usr/lib/gcc/i586-linux-gnu/4.9/include/stdint.h /usr/include/stdint.h \
 /usr/include/i386-linux-gnu/bits/wchar.h ../FreeRTOSConfig.h \
 include/projdefs.h include/portable.h include/deprecated_definitions.h \
 portable/GCC/ARM_CM0/portmacro.h include/mpu_wrappers.h include/list.h

$


^ Second Approach - Single Makefile

Understanding better how LPC's build process calls "children" makefiles, plus thinking about how to parse LPC's makefiles, its build output, and or its .cproject and .project files we're trying a more ground up approach by crafting a single makefile. This makefile's output is nearly identical to LPC's build output but ours does not find the needed project header file named stdlib.h. This header file isn't particular to the FreeRTOS demo project. It is most likely part of LPC / NXP's C library ports to their microcontroller families. Looking in our local installation of lpcxpresso we find four instances of this header file:

Figure x - stdlib.h from NXP

/opt/nxp/lpcxpresso-8p2p2$ ls -l `find . -name stdlib.h`
-rwxr-xr-x 1 root root  1480 Jul 21  2016 ./lpcxpresso/tools/arm-none-eabi/include/c++/5.4.1/tr1/stdlib.h
-rwxr-xr-x 1 root root   138 Jul 21  2016 ./lpcxpresso/tools/arm-none-eabi/include/machine/stdlib.h
-rwxr-xr-x 1 root root 11607 Jul 21  2016 ./lpcxpresso/tools/arm-none-eabi/include/stdlib.h
-rwxr-xr-x 1 root root  3699 Jul 21  2016 ./lpcxpresso/tools/redlib/include/stdlib.h

QUESTION: which of these is the file we need to include? They all differ from one another, and it's likely only one is correct . . . - TMH


CHECK OUT / REVISIT: in LPCXpresso IDE: Project Properties --> C/C++ Build --> Settings --> MCU Assembler. There is a string of options shown here which reads "-c -x assembler-with-cpp -D__REDLIB__ -DDEBUG -D__CODE_RED -g3 -mcpu=cortex-m0 -mthumb -D__REDLIB__ -specs=redlib.specs". QUESTION: Is our single makefile sending these options at the point of assembly?


2018-07-18 WED - LPC project properties

Noticing that under LPCXpresso project properties, there are most and perhaps all compiler flags and options available to view here. In the path Project Properties --> C/C++ Build --> Settings --> MCU Compiler we find expanded options to the compiler arm-none-eabi-gcc as follows:

-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/FreeRTOSv10.0.1/FreeRTOS/Demo/CORTEX_M0_LPC1114_LPCXpresso/CMSISv2p00_LPC11xx/inc" -I"../../../Common/include" -I"/home/${USER}/projects/nxp/rtos-demo-4/Source/Common_Demo_Tasks/include" -I"/home/${USER}/projects/nxp/rtos-demo-4/Source" -I"/home/${USER}/projects/nxp/rtos-demo-4/Source/FreeRTOS_Source/include" -I"/home/${USER}/projects/nxp/rtos-demo-4/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

There is also a list of variables which looks like it could expand to these options. The variables are in a smaller text box titled "Expert Settings":

${COMMAND} ${FLAGS} ${OUTPUT_FLAG} ${OUTPUT_PREFIX}${OUTPUT} ${INPUTS}


^ LPC compiler, assember, linker options

We're close but not quite to the goal of expressing all needed options in our GNU makefile, those options which are present but not obvious in the LPCXpresso FreeRTOS demo project. As mentioned just above and discovered by Ted yesterday, an LPC project's properties offers among many things settings which include flags and options to compiler, assembler and linker. To better understand how LPCXPresso manages all this, the following table contains the triplet data sets for each tool / each stage in the build process, minus preprocessing. Preprocessing is absent from LPC's Project Properties --> C/C++ Build --> Settings dialog box.

Figure x - LPCXpresso compiler options summary

  • MCU Compiler
    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/FreeRTOSv10.0.1/FreeRTOS/Demo/CORTEX_M0_LPC1114_LPCXpresso/CMSISv2p00_LPC11xx/inc" -I"../../../Common/include" -I"/home/user/projects/nxp/rtos-demo-4/Source/Common_Demo_Tasks/include" -I"/home/user/projects/nxp/rtos-demo-4/Source" -I"/home/user/projects/nxp/rtos-demo-4/Source/FreeRTOS_Source/include" -I"/home/user/projects/nxp/rtos-demo-4/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
    
    ${COMMAND} ${FLAGS} ${OUTPUT_FLAG} ${OUTPUT_PREFIX}${OUTPUT} ${INPUTS}
    
  • MCU Assembler
    arm-none-eabi-gcc
    
    -c -x assembler-with-cpp -D__REDLIB__ -DDEBUG -D__CODE_RED -g3 -mcpu=cortex-m0 -mthumb -D__REDLIB__ -specs=redlib.specs
    
    ${COMMAND} ${FLAGS} ${OUTPUT_FLAG} ${OUTPUT_PREFIX}${OUTPUT} ${INPUTS}
    
  • MCU Linker
    arm-none-eabi-gcc
    
    -nostdlib -L"/home/${USER}/Downloads/freertos/FreeRTOSv10.0.1/FreeRTOS/Demo/CORTEX_M0_LPC1114_LPCXpresso/CMSISv2p00_LPC11xx/Debug" -Xlinker -Map=rtos-demo-4.map -Xlinker --gc-sections -mcpu=cortex-m0 -mthumb -T "rtos-demo-4-debug.ld"
    
    ${COMMAND} ${FLAGS} ${OUTPUT_FLAG} ${OUTPUT_PREFIX}${OUTPUT} ${INPUTS}
    


Analysis: we see MCU compiler options in each of LPC's subdir.mk files, in the targets / recipes which build .o files from .c files. There is in this process the step of converting from C source to ARM assembly, that is .c to .s. But we don't see in any of LPC project makefiles some of the options passed to the MCU assember, e.r. "-x assembler-with-cpp". We dont' have this optoin in our GNU version makefile at all, so could this be why we're running into assebler errors of the forms "/tmp/ccYl1ldJ.s:232: Error: cannot honor width suffix -- `mov r1,#255'" and "/tmp/ccYl1ldJ.s:378: Error: lo register required -- `add r2,r3,#1'"? - TMH

In the LPC project here is what a text pattern search shows regarding patterns "x assembler-with-cpp" and "Map=rtos-demo-4.map", which are options passed respectively to the assembler and linker:

~/projects/nxp/rtos-demo-4$ grep -nr 'x assembler-with-cpp' ./*

./Debug/Makefile:241:	arm-none-eabi-gcc -c -x assembler-with-cpp -D__REDLIB__ -DDEBUG -D__CODE_RED -g3 -mcpu=cortex-m0 -mthumb -D__REDLIB__ -specs=redlib.specs $< -o $@

~/projects/nxp/rtos-demo-4$
~/projects/nxp/rtos-demo-4$ ./Debug/set-aside/makefile:36:	arm-none-eabi-gcc -nostdlib -L"/home/${USER}/Downloads/freertos/FreeRTOSv10.0.1/FreeRTOS/Demo/CORTEX_M0_LPC1114_LPCXpresso/CMSISv2p00_LPC11xx/Debug" -Xlinker -Map=rtos-demo-4.map -Xlinker --gc-sections -mcpu=cortex-m0 -mthumb -T "rtos-demo-4-debug.ld" -o "rtos-demo-4.axf" $(OBJS) $(USER_OBJS) $(LIBS)


The MCU assembler options don't seem to appear in any file of the LPC project. . . .


^ Single makefile first attempt end point

Much work with single makefile got us compiling all FreeRTOS demo sources except the file cr_startup_lpc11.c, which contains assembly code. Here at this point we reached an error reported by the GCC ARM assembler, regarding non-aligned data or variables. An example message reads as follows:

/tmp/ccnCOBAj.s: Assembler messages:
/tmp/ccnCOBAj.s:421: Error: invalid offset, target not word aligned (0x00000116)
/tmp/ccnCOBAj.s:421: Error: invalid offset, value too big (0x00000002)
Makefile:344: recipe for target 'Source/lpc-startup-code/cr_startup_lpc11.o' failed
make: *** [Source/lpc-startup-code/cr_startup_lpc11.o] Error 1

In these builds we began using the compiler and toolchain provided by Debian package binutils-arm-none-eabi. Eventually forum posts on this error led us to try switching to the toolchain which installed as part of LPCXpresso 8p2p2 which are located in /opt/nxp/lpcxpresso-8p2p2/lpcxpresso/tools/bin. These also failed to assemble a small amount of assembly code in the file cr_startup_lpc11.c. We next tried downloading and building GNU GCC 8.1.0, but turns out this is a compiler for desktop and server class processors, and not the wide range of embedded focused processor families.

LPC compiler toolchain is installed on the localhost at /opt/nxp/lpcxpresso-8p2p2/lpcxpresso/tools/bin.


^ rtos demo 5 - Attempting project build without LPC 8p2p2

LPCXpresso FreeRTOS demo project copies have worked twice to product projects which import into LPC 8p2p2 as existing projects, and build there to a compilable, editable and executable form which runs on an LPC1114 dev board. Each project copying effort involved running the shell'ized version of the FreeRTOS demo port's "copy dirs and files" DOS batch file. There were a few amendments to make to that batch file's commands, to account for DOS' case insentive behavior where Unix/Linux command line environments care about case. There also appeared to be some missed project header files, such as IntQueue.h and FreeRTOSConfig.h. These were hand-added to the create-project-directory-structure.sh scripts, of which there are three versions. Version here are very similar.

At this point as of 2017-07-26 Thursday we observe that there's a change in the project .map file generated by the toolchain. Our history of FreeRTOS demo project experiments to port project to GCC toolchain runs rtos-demo-3, rtos-demo-4, rtos-demo-5. In experiments 3 and 4 their .map files define the assembly-wise label 'ResetISR'. In rtos-demo-5 this label is missing from a section of the .map file around line range 940..964. Ted suspects errors in the .cproject and possibly .project files, which are not yet fully understood . . .


^ Questions

Question: what are these two "boot link" related files, part of LPCXpresso 8p2p2 about? . . .

    user@localhost:/opt/nxp/lpcxpresso-8p2p2/lpcxpresso/bin$ file ./boot_link{1,2}
    ./boot_link1: Bourne-Again shell script, ASCII text executable
    ./boot_link2: Bourne-Again shell script, ASCII text executable
    
    user@localhost:/opt/nxp/lpcxpresso-8p2p2/lpcxpresso/bin$
    

- - - - -   - - - - -   - - - - -   - - - - -   - - - - -   - - - - -   - - - - -   - - - - -   - - - - -   - - - - -   - - - - -   - - - - -   - - - - -   - - - - -   - - - - -   - - - - -   - - - - -

^ FreeRTOS Demonstration Project For LPC1114

Key points in FreeRTOS demonstration project for LPC1114:

  • choose between blink demo and full in main.c, by defining mainCREATE_SIMPLE_BLINKY_DEMO_ONLY to be (1),

Simpler LED blink demo has its period of blinking set by delay in prvQueueSendTask() function, as explained in excerpt from file main-blinky.c:

    43  * The Queue Send Task:
    44  * The queue send task is implemented by the prvQueueSendTask() function in
    45  * this file.  prvQueueSendTask() sits in a loop that causes it to repeatedly
    46  * block for 200 milliseconds, before sending the value 100 to the queue that
    47  * was created within main_blinky().  Once the value is sent, the task loops
    48  * back around to block for another 200 milliseconds.

This time period is puond defined on about line 79 in main-blinky.c:

 #define mainQUEUE_SEND_FREQUENCY_MS            ( 200 / portTICK_PERIOD_MS )



2018-08-02 Question of compiler instance called by LPCXpresso . . . -Os option to compiler calls for optimizing for code size:

/usr/lib/distcc$ ls -l
total 0
lrwxrwxrwx 1 root root 16 Apr 18 15:52 arm-none-eabi-g++ -> ../../bin/distcc
lrwxrwxrwx 1 root root 16 Apr 18 15:52 arm-none-eabi-gcc -> ../../bin/distcc
lrwxrwxrwx 1 root root 16 Apr 18 15:52 arm-none-eabi-gcc-4.8 -> ../../bin/distcc
lrwxrwxrwx 1 root root 16 Mar 10 10:30 avr-g++ -> ../../bin/distcc
lrwxrwxrwx 1 root root 16 Mar 10 10:30 avr-gcc -> ../../bin/distcc
lrwxrwxrwx 1 root root 16 Mar 10 10:30 avr-gcc-4.8.1 -> ../../bin/distcc
lrwxrwxrwx 1 root root 16 Oct 11  2017 c++ -> ../../bin/distcc
lrwxrwxrwx 1 root root 16 Oct 11  2017 c89-gcc -> ../../bin/distcc
lrwxrwxrwx 1 root root 16 Oct 11  2017 c99-gcc -> ../../bin/distcc
lrwxrwxrwx 1 root root 16 Oct 11  2017 cc -> ../../bin/distcc
lrwxrwxrwx 1 root root 16 Oct 11  2017 g++ -> ../../bin/distcc
lrwxrwxrwx 1 root root 16 Oct 11  2017 g++-4.9 -> ../../bin/distcc
lrwxrwxrwx 1 root root 16 Oct 11  2017 gcc -> ../../bin/distcc
lrwxrwxrwx 1 root root 16 Oct 11  2017 gcc-4.9 -> ../../bin/distcc
lrwxrwxrwx 1 root root 16 Oct 11  2017 i586-linux-gnu-g++ -> ../../bin/distcc
lrwxrwxrwx 1 root root 16 Oct 11  2017 i586-linux-gnu-g++-4.9 -> ../../bin/distcc
lrwxrwxrwx 1 root root 16 Oct 11  2017 i586-linux-gnu-gcc -> ../../bin/distcc
lrwxrwxrwx 1 root root 16 Oct 11  2017 i586-linux-gnu-gcc-4.9 -> ../../bin/distcc

And cd'ing and then into 'bin' directory:

/usr/bin$ ls -l dist*
-rwxr-xr-x 1 root root 120248 Nov  2  2014 distcc
-rwxr-xr-x 1 root root 128632 Nov  2  2014 distccd
-rwxr-xr-x 1 root root  42252 Nov  2  2014 distccmon-text



^ LPC1114 Serial Port Configuration

Initial search and exercises of LPC1114 serial port . . .

In this PDF file named AN10955.pdf there's mention of a more primary starting point for UART software implementations in LPC11xx and LPC13xx parts,

    "For the principle of software UART implementation, please refer to AN10689 . . ."


2018-10-29 MON


- STEP 1 -

In an IAR project context in which a given LPC1114 firmware project seems to rely less on the CMSIS libraries, a first or early reference to setting up the 1114 UART has to do with dividing the system clock. Find following lines in routine SystemInit() which runs:

#if ENA_UART != 0^M
  LPC_SYSCON->UARTCLKDIV    = UART_CLK_DIV;         // Set the UART clock^M 
#endif^M

- STEP 2 -

References to UART in routine IO_Configure() which does not presently run relate only to PIO1_6 Rx and PIO1_7 Tx:

$ grep -n 1_6 ./*.c
./io_conf_lqfp48.c:79:    LPC_IOCON->PIO1_6 = P1_6_CONFIG | GPIO_RESERVED;
./io_conf_lqfp48.c:165:            (P1_6_DIR << 6) | (P1_7_DIR << 7) |
./io_conf_lqfp48.c:198:            (P1_6_DEFAULT << 6) | (P1_7_DEFAULT << 7) |
./io_conf_lqfp48.c:250:            (GPIO_IS(P1_6_INT) << 6) | (GPIO_IS(P1_7_INT) << 7) |
./io_conf_lqfp48.c:258:            (GPIO_IBE(P1_6_INT) << 6) | (GPIO_IBE(P1_7_INT) << 7) |
./io_conf_lqfp48.c:266:            (GPIO_IEV(P1_6_INT) << 6) | (GPIO_IEV(P1_7_INT) << 7) |

Configuration details of each pin are important, e.g. function, direction, interrupt settings. Here are the further pound defined labels:

#define P1_6_CONFIG     IO_CONFIG(P1_6, FUNC_RXD, MODE_PU, HYST_DIS) 

#define P1_6_DIR        DIR_OUTPUT

#define P1_6_DEFAULT    0

#define P1_6_INT        SENSE_HIGH

- STEP 3 -

In routine main which we'll rewrite, we'll initially copy the existing way and initialize the UART per AP reference notes, calling a routine which also seems to serve as UART reset routine:

   IO_UART_Reset();    // Init UART I/O driver

. . .


- - - - -   - - - - -   - - - - -   - - - - -   - - - - -   - - - - -   - - - - -   - - - - -   - - - - -   - - - - -   - - - - -   - - - - -   - - - - -   - - - - -   - - - - -   - - - - -   - - - - -

. .


^ Appendix A - CMSISv2p00 library files

2018-04-18

CMSISv2p00 library files noted during installation:



^ References

- - - NEED MOVE THESE FIRST REFERENCES TO STM32F NOTES - TMH - - -

- - - ^ MOVE TO STM32F NOTES ^ - - -

LPC project build issues . . .


Some assorted lpc1114 projects . . .


LPCXpresso LPC1343 development board . . .


^ lpc21isp edit point . . .

lpc21isp for programming . . .

lpc1114 read out firmware dump firmware


Looking further for necessary FTDI cable to board wiring . . .


GNU gcc as toolchain


LPC1114 software UART software serial port

This may be a better link, many drivers here:

This looks interesting also, lpcxpresso project template file . . .


2018-10-08 MON

2018-10-09 TUE


2018-10-23 TUE

^ port configurations edit point . . .

GPIO Port configurations . . .


^ A2D configuration


- - - top of page - - -