FreeRTOS: Installation in the LPC5410x Environment
CROSSWORKS/FREERTOS CONFIGURATION AND VALIDATION
--------------------------------------------------
These are instructions for configuring and validating Rowley Crossworks for ARM and FreeRTOS
in the NXP LPC5410x MPU environment, and in particular, the NXP OM13077 development board.
NOTE: A portion of the instructions are specfic to using the Segger JLink debugger and should
be ignored if a different debugger is being used.
It has the following sections, each of which corresponds to a necessary step. The steps are listed
in the order in which they should be performed.
* HARDWARE SETUP
* SEGGER JLINK PREQUISITE INSTALLATION
* CROSSWORKS INSTALLATION
* CROSSWORKS LICENSING
* BASIC CROSSWORKS CONFIGURATION AND VALIDATION
* NXP CONFIGURATION
* FREERTOS CONFIGURATION AND VALIDATION
HARDWARE SETUP
----------------
Two PC USB ports need to be connected to your system as follows.
1) A normal USB cable is attached between a system USB port and the JLink.
2) A USB cable with a mini type-B connector on one end is attached between a system USB port and connector J4
on the development board.
In addition, the SEGGER JLink 9 pin Cortex Adapter Cable is attached to the JLink on end and P1,
the 9/10 pin SWD connector of the development board, on the other. (The barely visible white orientation mark
of the cable connector should be oriented towards the edge of the board with the USB mini ports.)
NOTE: J4 and P1 are described in Table 1 of the NXP User Manual for the OM130177 development board--UM10855,
by table 1 of section 2.1.
SEGGER JLINK PERQUISITE INSTALLATION
------------------------------------
Before Crossworks for ARM can be used with the SEGGER JLink debugger/programmer, the JLink libraries and utilities
must be installed on your system. The following URL lists the download files for 32 and 64 bit systems for the
common OS(es) in the "J-Link Software and Documentation Pack" category.
https://www.segger.com/downloads/jlink/#J-LinkSoftwareAndDocumentationPack
* For most modem Linux systems--including Ubuntu, the 64 bit DEB installer v6.32c download is appropriate.
* For virtually all Windows systems, the Windows pack is appropriate.
Once you have downloaded the appropriate version, you can install it on your OS in the normal way.
CROSSWORKS INSTALLATION
-----------------------
You can download version 4.2.0 of Crossworks for ARM from the following URL.
https://www.rowley.co.uk/arm/index.htm
Download the version which is appropriate for your OS.
* For most modern Linux systems--including Ubuntu, the Linux(x64) version is appropriate.
* For most modern Windows systems, the Windows(x64) version is appropriate.
Once you have downloaded the appropriate version in a SAFE directory, install it according the Rowley instructions
on the website. You can also download the reference manual from the same web page.
This should create a directory called .rowley_associates_limited in your home directory which is subsequently
referred to as $(ROWLEY_ROOT). Eventually the files you need most will have the following path.
$(ROWLEY_ROOT)/CrossWorks for ARM/v4/packages/targets/LPC54000
In particular the LPC5410x MPU low level macros, utilities, and definitions reside in the following subdirectory.
lpc5410x/chip_5410x
CROSSWORKS LICENSING
---------------------
* Start Crossworks and select tools/License Manager from the top menu bar and the "Evaluate Crossworks" from the
displayed sub-window. Then follow the instructions for obtaining an evaluation key. You should receive the evaluation
key via E-Mail in a few minutes.
* When Crossworks is up, select tools/License Manager again. Then select "Activate Crossworks" from the displayed
sub-window. Paste the key, received via E-Mail, according to the instructions.
BASIC CROSSWORKS CONFIGURATION AND VALIDATION
---------------------------------------------
* Start Crossworks and make sure the Welcome window is selected in the little sub-window in the right-hand
upper corner of the top menu bar.
* Select tools/Package Manger from the top menu bar.
* Select and install the following packages from the Crossworks section.
ARM CPU Support Package Version 1.3
ARM CPU Support Package Version 3.2
ARM Simulator Memory Interface Files Version 1.1
CMSIS 4 CMSIS-CORE Support Package Version 4.31
CMSIS 4 CMSIS-DSP Support Package Version 1.4.7
CMSIS 4 Documentation Package Version 4.5.0
CrossWorks CoreBASIC Library Package Version 3.1
CrossWorks Device Library Package Version 3.3
CrossWorks Examples Package Version 3.2
CrossWorks Platform Library Package Version 3.7
Crossworks Task Library Package Version 3.3
FreeRTOS Library Package Version 3.0
* Select and install the following packages from the NXP section.
LPC54000 CPU Support Package Version 3.2
* Once the packages are installed select tools/Show Installed Packages
Find the LPC54000 CPU Support Package in the list and click on it. You should see an "LPC5410x Sample Solutions" box
whose first entry is "LPC5410x Samples Solution"
* Click on it and will take you to the "Standard" menu.
SANITY TEST #1
* Highlight Project "Hello World" in the "Project Items" box.
* Select Build/Build Hello World from the top menu bar.
This should compile and link the Blink program correctly.
* Select Target/Connect/SEGGER J-Link from the top menu bar. This should form a connection through the SEGGER
JLink between your system and the development board.
* Now select Debug/Go from the top menu bar and the Hello World program should start running, and select
the Debug Window from the Output sub-window by clicking on the gear icon. You should see the the Hello World
message displayed if everything is right.
SANITY TEST #2
* Highlight Project "Blink" in the "Project Items" box
* Select Build/Build BLink from the top menu bar.
This should compile and link the Blink program correctly.
* Select Target/Connect/SEGGER J-Link from the top menu bar. This should form a connection through the SEGGER
JLink between your system and the development board.
* Now select Debug/Go from the top menu bar and the Blinky program should start running. You should see the
LED on the development board flash about once every second if everything is right.
NXP CONFIGURATION
-----------------
Create a root directory for the NXP software etc. which will subsequently be referred to as $(NXP_ROOT).
(In my case I called it lpc5410x_root.) In addition you should create a subdirectory called reference which
will be explained later.
* The NXP SDK for the MCU and development board must be downloaded starting at the following URL.
https://mcuxpresso.nxp.com/en/welcome
However, you need to create an NXP account and login before accessing it at the following URL.
https://www.nxp.com/security/login?service=https%3A%2F%2Fmcuxpresso.nxp.com%2Flogin%2F
Once you are logged in you should be able to access the first URL mentioned above.
* Actuate the "Select Development Board" button. Then select boards/LPC/LPCXpresso54102 and
actuate the "Build MCUXpresso SDK" button.
To "build the SDK package you must select the following items.
1) HostOs
2) ToolChain/IDE - IMPORTANT - Select "All toolchains"
3) Under "Add Software Components", make sure FreeRTOS is included.
* Then hit the "Request Build" button which will build the SDK package.
* Once the build is complete, select LCPXpresso54102 and download the SDC Archive and Documentation.
* Unzip the downloaded files in the $(NXP_ROOT) directory.
Copy the attached file fsl_debug_console.h to the following directory under $(NXP_ROOT).
devices/LPC54102/utilities/
NOTE: It is a good idea to save the file in fsl_debug_console.h.original for reference.
* Now download the LCPOpen library source for LPC5410x platform from the following ULR.
https://www.nxp.com/downloads/en/software/lpc5410x_xpresso54102_lpcxpresso.zip
NOTE: This is only for reference rather than for building software.
Unzip it in the reference/ sub-directory.
FREERTOS CONFIGURATION AND VALIDATION
------------------------------------
Each of the the following test projects contains a separate copy of FreeRTOSConfig.h.
That file for configuring the important FreeRTOS behavior options and attributes such as the stack and heap size.
SANITY TEST #1
First start Crossworks and import the FreeRTOS "Hello World" project as follows.
* Select File/Import Project/Import IAR EWARM Project from top menu bar.
* Navigate to $(NXP_ROOT)/boards/lpcexpresso54102/rtos_examples/freertos_hello/cm4/iar and open
freertos_hello.ewp as an LPC5410x_EXE project. This should bring up the Standard window.
* In the "Project Explorer" box navigate to Project freertos_hello/System Files/system_LPC54xxx.c.
The right click on it and select "Exclude from Build".
* Highlight Project freertos_hello in the "Project Items" box and select Build/Build freetos_hello
from the top menu bar. This should compile and link the program.
* Select Target/Connect/SEGGER J-Link from the top menu bar. This should form a connection through the SEGGER
JLink between your system and the development board.
* Select Debug/Go from the top menu bar to start the program, and select the Debug Window from the Output
sub-window by clicking on the gear icon. You should see the the Hello World message now.
If this works, it means FreeRTOS is basically functional.
SANITY TEST #2
First start Crossworks and import the FreeRTOS Software Timer project as follows.
* Select File/Import Project/Import IAR EWARM Project from top menu bar.
* Navigate to $(NXP_ROOT)/boards/lpcexpresso54102/rtos_examples/freertos_swtimer/cm4/iar and open
freertos_swtimer.ewp as an LPC5410x_EXE project. This should bring up the Standard window.
* In the "Project Explorer" box navigate to Project freertos_swtimer/System Files/system_LPC54xxx.c.
The right click on it and select "Exclude from Build".
* Highlight Project freertos_swtimer in the "Project Items" box and select Build/Build freetos_swtimer
from the top menu bar. This should compile and link the program.
* Select Target/Connect/SEGGER J-Link from the top menu bar. This should form a connection through the SEGGER
JLink between your system and the development board.
* Select Debug/Go from the top menu bar to start the program, and select the Debug Window from the Output
sub-window by clicking on the gear icon. Now, the message "tick." should be periodically displayed.
If this works, it means FreeRTOS timers are working correctly.
SANITY TEST #3
First start Crossworks and import the FreeRTOS Mutex project as follows.
* Select File/Import Project/Import IAR EWARM Project from top menu bar.
* Navigate to $(NXP_ROOT)/boards/lpcexpresso54102/rtos_examples/freertos_mutex/cm4/iar and open
freertos_mutex.ewp as an LPC5410x_EXE project. This should bring up the Standard window.
* In the "Project Explorer" box navigate to Project freertos_mutex/System Files/system_LPC54xxx.c.
The right click on it and select "Exclude from Build".
* Highlight Project freertos_mutex in the "Project Items" box and select Build/Build freetos_mutex
from the top menu bar. This should compile and link the program.
* Select Target/Connect/SEGGER J-Link from the top menu bar. This should form a connection through the SEGGER
JLink between your system and the development board.
* Select Debug/Go from the top menu bar to start the program, and select the Debug Window from the Output
sub-window by clicking on the gear icon. The following pattern should be continuously displayed.
1234 | 5678
ABCD | EFGH
1234 | 5678
ABCD | EFGH
1234 | 5678
ABCD | EFGH
1234 | 5678
ABCD | EFGH
If this works, it means the FreeRTOS Mutex(es) are working correctly.
SANITY TEST #3
First start Crossworks and import the FreeRTOS Tickless project as follows.
* Select File/Import Project/Import IAR EWARM Project from top menu bar.
* Navigate to $(NXP_ROOT)/boards/lpcexpresso54102/rtos_examples/freertos_tickless/cm4/iar and open
freertos_tickless.ewp as an LPC5410x_EXE project. This should bring up the Standard window.
* In the "Project Explorer" box navigate to Project freertos_tickless/System Files/system_LPC54xxx.c.
The right click on it and select "Exclude from Build".
* Highlight Project freertos_tickless in the "Project Items" box and select Build/Build freetos_tickless
from the top menu bar. This should compile and link the program.
* Select Target/Connect/SEGGER J-Link from the top menu bar. This should form a connection through the SEGGER
JLink between your system and the development board.
* Select Debug/Go from the top menu bar to start the program, and select the Debug Window from the Output
sub-window by clicking on the gear icon. Now the tick count should be periodically displayed.
If this works, it means FreeRTOS interrupt handlers are working correctly and, incidentally, that tickless mode
is functional. Most importantly, if you put a break point on RTC_IRQHandler() in the file freertos_tickless.c,
you should hit it when an interrupt occurs. Note that RTC_IRQHandler() is the default interrupt handler for a
Cortex M4 and it is a nasty trick to make it call vPortRTCIsr() which is our FreeRTOS interrupt handler.
(This means the RTC_IRQHander symbol is mapped to the implementation in freertos_tickless.c !)
Please sign in to leave a comment.
Comments
0 comments