**** Advance Notice ****

This site will be closed on 31 December 2015,

Important Information for users of NXP LPCXpresso

This site is for users of Code Red branded products.

NXP LPCXpresso users should visit the LPCXpresso FAQ's for up-to-date information relevant to that product.

LPC43xx Cortex-M4 / M0 Multicore Applications

Notes

Basic principles

The LPC43xx family of MCUs contain a Cortex-M4 ‘Master’ core and a Cortex-M0 ‘Slave’ core. After a power-on or Reset, the Master core boots and is then responsible for booting the Slave core; hence the names Master and Slave. In reality Master and Slave only applies to the booting process; after boot, your application may treat any of the cores as the Master or Slave.

Starting with v5.2, support for Multicore MCUs has been much improved so as to allow for the easy creation of 'linked’ projects that support the targeting of Multicore MCU including the LPC43xx family. The principle is that the Slave application must be completely self contained and built into an application image (axf file). The Slave application is then converted and included within the Master application, resulting in a single application image containing the Master and Slave application.

Projects

To create a Multicore application, a project for each core must be created. Each project should be self-contained and complete, so must include a vector table and a main() routine. Additionally, the project for the Master core will also include code to boot the Slave and should (optionally, but usually) include the Slave application code.

Note that although possible, sharing of code between the Master and Slave is not recommended for the following reasons:

LPC43xx Project Wizards

The Project Wizard mechanism now contains a number of sets of LPC43xx related project wizards:

When creating a multicore application, you should first of all create the projects for the M0 slave, then create the M4 master project. This will then allow you to associate the slave application with the master, as you run through the project wizard to create the master application.

Slave Memory Location

The large number of different blocks of memory available on LPC43xx parts (including parts with and without internal flash) means that there a wide number of possibilities as to where the master and slave application code may be placed within the overall MCU memory map. But the key point is that the slave memory setting in the master (M4) project should match how the slave project itself was built.

If you have not set up the master and slave projects such that the address that the master locates the slave code into does not match the location that the slave project was built for, then you will see the corresponding build error message below:

M0APP execute address differs from address provided in source image

You will then need to modify your project settings for either the slave or master project, as detailed below, so that the slave code is placed into the same memory by both projects.

In order to keep things simple within the project wizards, the following memory defaults are used when creating multicore projects:

Slave Projects

By default, the memory setup for a slave project will match the default memory setup for the selected part. This will normally need to be modified, either by selecting an appropriate memory configuration file as you run through the wizard, or by manually editing the memory configuration in the MCU setting of Project Properties after the project has been created.

Note - the supplied LPC43x7-M0_BankB.xml can be used when creating M0APP projects so as to cause the M0APP code into bank B of the internal flash of LPC43x7 parts. This can be found within the product install at <install_dir>\<ide_name>\Wizards\MemConfigs\NXP.

For more information on memory configuration editing please see the Red Suite 5 Getting Started guide.

Master Projects

By default, the M0APP slave image will be placed in the 2nd RAM block of the master (M4) project's memory map. The multicore M4 project wizards also allow you to reconfigure the project to automatically use the 2nd flash block in dual bank flash MCU. Thus for example with an LPC43x7 part, the M4 application can be placed in bank A (at 0x1a000000) and the M0APP application can be placed in bank B (at 0x1b000000).

What else do the multicore wizards do ?

First of all, appropriate startup code will be created in the project for the master / slave the project was generated for.

In addition the M4 master project includes files containing functions to release M0 slaves from reset:

Finally, the main() function generated by the M4 master wizard contains code to conditionally call functions to release M0 slaves from reset. This is done conditionally using defines that are created, based on which slaves are linked to the master when running through the project wizard.

        // Start M0APP slave processor
#if defined (LPC43_MULTICORE_M0APP)
        cr_start_m0(SLAVE_M0APP,&__core_m0app_START__);
#endif

Multicore settings in Project Properties

The following settings are provided in project properties in relation to multicore projects. If you create your multicore master and slave projects using the multicore project wizards, then these settings will be configured automatically for you, with appropriate default values. However you may still need to modify these if the defaults are not appropriate for your application (for example the memory blocks used for the slave images), or if you want to configure a project generated using the "basic" LPC43xx project wizards for multicore use.

Slave applications

The Slave application must be completely self contained and linked to run at the appropriate location with the Slaves memory map. To support inclusion with the Master application image, a new option has been added to the MCU Linker/Target tab. This option allows selection of the type of Slave:

multicore_slave.png

These options will only be present when the project is configured to use a Multicore MCU.

When this option is used, a new object file (project.axf.o) is created in the same directory as the application image. This object file contains just the binary image data of the application and is used to link with the Master application (see below).

Master application

The Master application is responsible for loading the Slave code into the appropriate location in the Memory map and for booting the Slave.

To support creation of a single application image containing code for Master and Slaves, a new option has been added to the MCU Linker/Target tab.

multicore_master.png

Debugging

When debugging an LPC43xx based system using Red Probe+ or LPC-Link, it is only possible to debug either the Cortex-M4 master or (one of) the Cortex-M0 slave(s).

However whichever CPU is to be debugged, the actual image must be download to the system via the Cortex-M4 master project (so that the master can then release the slaves from reset). The launch configuration for any M0 slave applications will have the "Attach Only" option set to "True" by default, which will prevent any attempt to download code direct to the M0 target.

First of all launch a debug session for the **M4** project to download the combined M4/M0 image into flash. When you make this connection you need to make sure that you actually connect to the correct core within the MCU.

The first time you start an M4 debug session, you will receive a pop up dialog offering you a choice on two cores on the LPC43xx . Ensure that you select the device which has the TAP Id = 0x4ba00477 - which is the M4. This selection is then stored in the *.jtag file that will be placed in the Debug/Release directory. Note that you can cause the pop up dialog to reappear again by deleting the *.jtag file.

Having connected to the M4, close down the debug session.

Now launch a debug session for the **M0** project. The first time you start an M0 debug session, you will receive the JTAG selection pop up dialog again . Ensure that you select the device which has the TAP Id = 0x0ba01477 - which is the M0.

LPC43MultiCoreProjects (last edited 2013-04-30 14:56:22 by CrSupportAb)