# LPC488(Cortext MR) FreeRTOS Port Under Crossworks for ARM

**URL:** <https://forums.freertos.org/t/lpc488-cortext-mr-freertos-port-under-crossworks-for-arm/3810>\
**Category:** Kernel\
**Created:** [April 6, 2015, 9:38pm UTC](https://forums.freertos.org/t/lpc488-cortext-mr-freertos-port-under-crossworks-for-arm/3810 "2015-04-06T21:38:58Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![system](https://d2v6vdsk2p900z.cloudfront.net/original/1X/7fc8fdb729c645aab5b20282bbe34e57cb407be6.jpeg) [@system](https://forums.freertos.org/u/system)\
**Post date:** [April 6, 2015, 9:38pm UTC](https://forums.freertos.org/t/lpc488-cortext-mr-freertos-port-under-crossworks-for-arm/3810/1 "2015-04-06T21:38:58Z")

</div>

**[paulromero](https://sourceforge.net/u/paulromero/)** wrote on [Monday, April 06, 2015](https://sourceforge.net/p/freertos/discussion/382005/thread/a73b69f5/#e03e):

Hi Folks:

I suceeded in creating a functional, but incomplete, FreeRTOS port for the LPC4088  
in the Crossworks for ARM environment, which was tested on the Embedded Artists  
LPC4088-32 Developer’s Kit board.

Most of the incomplete aspects are related to Crossworks system components.  
The details follow. Please let me know if you see something which is wrong,  
can be automated, or done in a better way. (i.e. Look for TBD for comments  
on the incomplete aspects.)

Best Regards,

Paul R.

## Platform

Embedded Artists LPC4088-32 Developer’s Kit (Eval. Board.)

## Major Component Versions

FreeRTOS: V8.01  
Crossworks for ARM: V3.2  
LPC Open Library: V2.10 (Xpresso version)

## Prerequisite Crossworks Packages

The following are important Crossworks packages and should be downloaded. Note  
that this list is not definitive or necessarily complete.

- Crossworks: ARM CPU Support Package, CMSIS 3 Support Package, Tasking Library Package,  
FreeRTOS Library Package.
- Embedded Artists: LPC4088 OEM Board Support Package.
- NXP: LPC1000 CPU Support Package, NXP4300 CPU Support Package.
- STM: STM32 CPU Support Package, STM32 Discovery Board Support Package.

TBD: Currently, it appears Rowley does not recommend or require a Cortex M4  
specific or floating point support package. The STM packages should be replaced  
by equivalent NXP packages–but such packages with the requisite FreeRTOS  
components may not be currently available. It is believed the LPC1000 CPU  
package contains the correct LPC4088 components.

## Crossworks Project Properties Configuration

Use the Crossworks GUI to create a project a starting point by selecting  
“File-\>New Project-\>Executable for LPC OEM EA”. Be sure to select a sensible project  
name and project directory. (i.e. For example, $(Home\_FreeRTOS)/FreeRTOS\_LPC4088)

The following project attributes must be configured as follows:

- Preprocessor Definitions: CORE\_M4
- ARM FPU Type: FPv4-SP-D16
- ARM FP ABI Type: Softfp or Hard.

## Suggested Overall Code Organization

```
           $(Home_FreeRTOS_LPC4088) $(HomeCrossworks)
               | | |
             FreeRTOS LPC_Open Packages
                                                    |
                                                  targets

```

## FreeRTOS Source Code Organization

The overall FreeRTOS directory structure will be something like this.  
(i.e. The names used are generally suggestions.)

```
                        $(Home_FreeRTOS)
                               |
                         FreeRTOS_LPC4088
                            | |
                         Example Source
                                  | |
                             include portable
                                | |
                               GCC MemMang
                                |
                             ARM_CM4F

```

Obtain the FreeRTOS V8.01 source code from the FreeRTOS website or download it from  
Crossworks and put it in the “Source” subdirectory. The organization of the FreeRTOS  
code should already be the same or very close to directory structure shown above.

TBD: It is believed that threads\_CMF4.js script is needed under Crossworks and not  
supplied with the generic FreeRTOS source code. Rowley must be consulted to determine  
the origin of the file and how to install it.

Put the attached versions of main.c and main\_blinky.c in the “Example” subdirectory.  
They are slightly modified versions of the source code from the generic FreeRTOS V8.01  
and NXP LPC Open V2.10 blinky example for the LPC4088.

In the Crossworks GUI and project, the “Example” directory is labeled as “Source Files”  
by default. Make sure it exists and is pointing at “Example” and includes main.c and  
main\_blinky.c.

Add a “Source” directory to the project with the Crossworks GUI. You should  
do this recursively.

## Rowley Source Code Organization

The overall directory structure of the Crossworks system software is as follows.  
(i.e. These are the currently available generic Crossworks components and  
should automatically be installed under the project “System Files” subdirectory  
in the Crossworks GUI.)

```
                          $(Home_CrossWorks)
                                  |
                               packages
                                  |
                               targets
                                  |
    ________________________________________________________
   | | | |
CMSIS_3 EA_LPC4088_OEM LPC1000 STM32
                     | |
                   ______________
                  | | | |
                 inc src include LPC407x_8x
                                   |
                                 CMSIS

```

The following items should be put in EA\_LPC4088\_OEM. (i.e. There is a directory named  
“Systems Files/lpc4088 open bsp” directory in the Crossworks project GUI. Verify  
that it points at EA\_LPC4088\_OEM.)

- FreeRTOSConfig.h
- FreeRTOS\_board.c

Also, confirm the following definitions in FreeRTOSConfig.h.

#define configMINIMAL\_STACK\_SIZE ( ( unsigned short ) 256 )  
#define configTOTAL\_HEAP\_SIZE ( ( size\_t ) ( 10 \* 1024 ) )

For timer functionality, add the following definitions.

//  
// This must be done to enable timers.  
// The timer task should be highest or close to the highest  
// priority task. The queue size may need to be configured.  
//  
#define configUSE\_TIMERS 1  
#define configTIMER\_TASK\_PRIORITY (configMAX\_PRIORITIES - 1)  
#define configTIMER\_TASK\_STACK\_DEPTH configMINIMAL\_STACK\_SIZE  
#define configTIMER\_QUEUE\_LENGTH 10

TBD: These files are very close to the versions in the STM32F4DISCOVERY subdirectory  
supplied by Rowley. It is’t believed currently Rowley has LPC4088 specific versions  
of these files. It is likely the generic FreeRTOS release has almost identical  
versions for LPC17xx family member or an actual LPC4088 version.

Note that following files under LPC1000 are particularly important.

LPC1000: LPC4078\* and LPC407x\_8x\*  
LPC1000/include: LPC4088.h  
LPC1000/include/CMSIS: system\_407x\_8x\_177x\_8x.\* and LPC407x\_8x\_177x\_8x.\*

TBD: The LPC1000 and LPC100/CMSIS directories contain as least partially compatible LPC4088  
system files. It is believed that they are completely compatible with some LPC17xx family  
member. It isn’t known if this is the final or official Rowley solution for LPC4088  
functionality.

TBD: STM32 contains the memory map and interrupt vector definition files. As an interim  
measure, the STM32F4 versions for the STMF4DISCOVERY board are being used as they are almost  
identical to how they are used for for the Cortex M4 on the LPC4088 board. However, there  
is probably another more appropriate Rowley directory.

## NXP LPC Open Source Code Organization

The overall directory structure of the LPC Open Library is as follows.

```
                           $(Home_LPC_Open)
                                  |
                          ______________________
                         | |
              lpc_board_ea_devkit_4088 lpc_chip_40xx
                  | | | | |
                 inc src inc libs src

```

The entire lpc\_board\_ea\_devkit\_4088 and lpc\_chip\_40xx subdirectories  
should be put under $(Home\_LPC\_Open).

In the file lpc\_chip\_40xx/src/chip\_17xx\_40xx.c the variable declaration for  
SystemCoreClock and the routine SystemCoreClockUpdate() must be commented  
out as they are supplied by the generic Crossworks system files.

## Crossworks Configuration

The following paths need to be included in the Crosworks GUI project “User Include Directories”.

$(TargetsDir)/LPC1000/include/CMSIS  
$(TargetsDir)/CMSIS\_3/CMSIS/Include  
$(TargetsDir)/LPC1000/include  
$(TargetsDir)/EA\_LPC4088\_OEM  
$(ProjectDir)/FreeRTOS/Source/include  
$(ProjectDir)/FreeRTOS/Source/portable/GCC/ARM\_CM4F  
$(ProjectDir)/LPC\_Open/lpc\_chip\_40xx/inc  
$(ProjectDir)/LPC\_Open/lpc\_board\_ea\_devkit\_4088/inc

TBD: Verify configuration of $(ProjectDir) with Rowley.

The following minimum sizes are recommended:

Heap Size: 8192  
Main Stack Size: 512

---

<div class="post-metadata">

**Author:** ![rtel](https://d3iykfbgfh8zhg.cloudfront.net/user_avatar/forums.freertos.org/rtel/32/31_2.png) [@rtel](https://forums.freertos.org/u/rtel)\
**Post date:** [April 7, 2015, 9:40am UTC](https://forums.freertos.org/t/lpc488-cortext-mr-freertos-port-under-crossworks-for-arm/3810/2 "2015-04-07T09:40:19Z")

</div>

**[rtel](https://sourceforge.net/u/rtel/)** wrote on [Tuesday, April 07, 2015](https://sourceforge.net/p/freertos/discussion/382005/thread/a73b69f5/#7a13):

Hi - this is quite a long post - does it contain a question? If not, but it is instead posting a port, I would suggest posting to the FreeRTOS Interactive site instead: [http://interactive.freertos.org](http://interactive.freertos.org)

Regards.
