how to create dualcore project for lpc4357

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

how to create dualcore project for lpc4357

787 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by nirvana_xun on Wed Sep 25 08:55:53 MST 2013
i want to create dualcore project for lpc4357 using keil, but i have problems configure the memory layout. though there are dualcore demos in lpcopen and mcb4300, i have looked at these projects, the configuration method seems still ambiguous to me. whether to use user scatter file or the target configuration dialog, how to generate M0 image, how load M0 image and why shoud the code to be written like this. any one got some idea to solve this out? thanks
Labels (1)
0 Kudos
4 Replies

536 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by bavarian on Mon Jan 26 06:01:53 MST 2015
The flash utility is just used to download a binary into flash. It has nothing to do with M0 or M4.
Using the M4 to manage this download is a logical choice, because this core is active after a chip reset and can be directly used to manage the flash programming.
The M0 is held in reset state after a chip reset, therefore you can't use it directly for managing the download and programming.

The binaries you program for the M4 and M0 are of course going to different ROM locations, these are different binaries dedicated to these cores with their specific instruction sets.
The M4 and M0 programs of course also use different RAM resources, otherwise M4 and M0 will destroy each others variables in RAM.

Regards,
NXP Support Team
0 Kudos

536 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by shankaranarayana on Wed Jan 21 04:31:57 MST 2015
sir,
why flash utility settings for cortex M0 and M4 are same. Is it not necessary to be different? But in target settings, ROM and RAM addresses are different. why? and little bit confused about include files. Please clarify my doubt.
0 Kudos

536 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by bavarian on Fri Sep 27 08:59:00 MST 2013
The dual core project in the µVision installation is a good starting point:

.\Keil\ARM\Boards\Keil\MCB4300\DualCore

However, if you want to create a project on your own just follow this guideline:

1. Create a µVision project for a Cortex-M0
   - use an ARM Cortex-M0 as target and not the LPC4357 from the list of NXP devices (Cortex-M0_TargetSettings.png)
   - the code for the M0 can be located anywhere in memory, the easiest setup is one of the flash internal flash banks (here in bank #B)
   - allocate some RAM for the M0 code (any area works)
   - make some settings for output folder etc etc
   - make the correct setting for the debugger and the flash utility (Cortex-M0_DebugSettings.png , Cortex-M0_FlashUtilitySettings.png)
   - write your code(startup.s for the M0 in the LPC4300 + any other files), compile, download to flash. Maybe just reconstruct the project from KEIL, but now running from flash instead of RAM

2. Create another µVision project for an LPC4357
   - use the LPC4357 from the list of NXP devices (Cortex-M4_TargetSettings.png)
   - the code for the M4 can be located anywhere in memory, the easiest setup is one of the flash internal flash banks (here in bank #A)
   - allocate some RAM for the M4 code, take care that it doesn't conflict with the area for the M0
   - make some settings for output folder etc etc
   - make the correct setting for the debugger and the flash utility (Cortex-M4_DebugSettings.png , Cortex-M4_FlashUtilitySettings.png)
   - take also attention to the user settings (Cortex-M4_UserSettings.png), the M4 code for the internal flash needs to have a signature, done with the tool ELFDWT.EXE
   - write your code (startup.s for the M4 in the LPC4300 + any other files), compile, download to flash. Maybe just reconstruct the project from KEIL.

So far no real problem right?
Now you need to know that the chip comes out of the bootloader process with the Cortex-M4, the M0 is held in reset.
Whenever you would like this to happen in your M4 code, you need to make two settings for the Cortex-M0 to start it:

// The M0a has no Vector Table Offset Register. From the M0a point of view the vector table is fixed at 0x00000000.
// So the M0a memory map starts at 0x00000000, but the shadow pointer must point to the physical memory in which
// the M0a code resides.
LPC_CREG->M0APPMEMMAP = 0x1B000000;// Set M0a shadow pointer to flash bank #B.

// Release M0a from reset by clearing bit 24 in register RESET_CTRL1

while(!(u32REG & (1u << 24)))
{
  u32Val = (~(u32REG) & (~(1 << 24)));
  LPC_RGU->RESET_CTRL1 = u32Val;
  u32REG = LPC_RGU->RESET_ACTIVE_STATUS1;
}

Then you have both the Cortex-M4 and the Cortex-M0 running. There are a lot of nitty-gritty details now how to do things best, how to communicate between the two cores, how to do dual core debugging (if this is really needed) etc. But here it's best to look into the dual core examples in the LPCopen software package.

Hope it helps a little bit,
NXP Support

0 Kudos

536 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by starblue on Fri Sep 27 06:31:51 MST 2013
You need two Keil projects, one for the M4 and one for the M0.
0 Kudos