3590|10

862

帖子

2

TA的资源

纯净的硅(初级)

楼主
 

[LPC54100]LPC5410x Cortex-M4 / M0+ Multicore Applications [复制链接]

本帖最后由 wo4fisher 于 2015-3-10 16:50 编辑

LPC5410x Cortex-M4 / M0+ Multicore Applications LPC5410x 双核开发应用文档
网址:http://www.lpcware.com/content/faq/lpcxpresso/lpc541xx-multicore-apps
    简介
     通过文档得知,Cortex M4 Master plus Cortex M0+ Slave 也就是M4&M0+ 双核组合有两个型号:分别是LPC54102J256和LPC54102J512   这次活动板子上是LPC54102J512
      After a power-on or Reset, the Master and Slave cores both boot, but the slave core is then immediately put to sleep. The Master core is then responsible for releasing 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.
LPCXpresso IDE v7.5.0  (and later) provides highly flexible support for creating and debugging LPC5410x applications, for both single core and multicore systems. This FAQ provides details the process of creating and debugging such multicore applications.
LPCXpresso IDE v7.5.0对双核的开发有很好的支持
   Overview of creating a master / slave project pair
   A multicore application in LPCXpresso consists of two linked projects - one project containing the slave code, and the other project containing the master code. The 'Master' project will also contain a link to the 'Slave' project which will cause the output image from the 'Slave' to be included into the 'Master' image.  The following steps detail how such a pair of projects can be created and linked.
Note:
It is currently only possible to create and build LPC5410x multicore projects which are linked to LPCOpen. Thus before you follow the below sequence, please ensure that you have imported the chip and (optionally) the board library projects (for both the M4 and M0+)  from an LPCOpen package for the LPC5410x family.
Step 1 - Create slave project
Go to Quickstart -> New project -> LPC5410x -> LPC5410x Multicore (M0+ slave):图

Select required project type (e.g LPCOpen - C Project) and click Next.
Enter project name (for example, mc_slave) and click Next.
Select the required target MCU, say LPC54102J512-M0, and click Next.
On the LPCOpen Library Project Selection page, select the LPC5410x chip library for the M0+, lpc_chip_5410x_m0, and then the appropriate board library, for example lpc_board_lpcxpresso_54102_m0, and click Next.
Click next through CMSIS DSP Library selection
On 'Other options', ensure Code Read Protect (CRP) is unticked
On the Memory Configuration Editor page, you should see the various memory blocks defined by default for the target MCU:图145612


We need to modify the default memory map to only use the memory that will be used by the Cortex-M0+ (rather than the Cortex-M4).
Highlight the “MFlash512/ Flash” line in the table and click on the 'Delete' button.
Highlight the “Ram0_64/RAM” line in the table and click on the 'Delete' button.
Highlight the "Ram2_8/RAM2" line in the table and click on the 'Delete' button.
‘把不需要的删掉
This should leave just the “Ram1_32/RAM2” line. This is the memory block that the Cortex-M0+ slave image will be executed from.图145748
’保留一个需要的


Then click through until you can click 'Finish'.
Step 2 - Create master project
Go to Quickstart -> New project -> LPC5410x -> LPC5410x Multicore (M4 master):图145911


Select required project type (e.g LPCOpen - C Project) and click Next.
Enter project name, say mc_master, and click Next.
Select the required target MCU, say LPC54102J512, and click Next.
On the LPCOpen Library Project Selection page, select the LPC5410x chip library for the M4, lpc_chip_5410x, and then the appropriate board library, for example lpc_board_lpcxpresso_54102, and click Next.
Click next through CMSIS DSP Library selection and Part specific options pages. On 'Other options', ensure Code Read Protect (CRP) is ticked.
On ‘Memory Configuration Editor’ leave the memory definitions as per the default.
On 'Multicore Project Setup' page, use the 'Browse' button in the Multicore Slave Project selection box to select the Multicore M0+ project that you created previously:图150100
‘此处有区别,选择slave project


Then click Next, then Finish.
If you now select the master project in the Project Properties view, then select the Build option in the Quickstart view, this should trigger a build of the slave project, followed by the master project (and if necessary also the LPCOpen library projects). Note that a copy of the executable generated by the Slave project will actually be embedded into the Master project executable.
’此处有点意思,建立M/S工程后,编译主工程会触发编译从工程,并且主从工程(包含lib)通过编译后,会生成一个文件,这就是双核同事下载的一个小秘密吧...

Overview of debugging a master / slave project pair
‘双核调试步骤
Note: LPC5410x debugging is only supported via LPC-Link2. Multicore debugging is also only possible using "redlink" firmware, not CMSIS-DAP.
Start a debug session for Master project using the Debug option in the Quickstart view.

When prompted, select SWD target to connect to, which in this case is the one labeled in the ‘Details’ column as ‘Cortex-M4’:图150749


Note that this setting will get stored in the project’s debug launch configuration, and so should be remembered between debug sessions.
Having selected the appropriate core, LPCXpresso should download the executable containing both the Master and Slave images into the target MCU flash memory.
Once the connection has been made, you should hit the default breakpoint at the start of main() in the Master executable :图150916


At this point, select the Slave project in the Project Explorer view, then use the Quickstart view Debug option to start a second debug connection.
Select SWD target to connect to. Note that as long as you have already connected to the M4, then the M0 slave should be selected automatically...图151022


LPCXpresso should detect that this is a Slave project and make an ‘attach only’ connection (and hence not download code and leaving the slave image 'executing').图151100


Now step over the boot_multicore_slave() function in the master image, and the slave core will begin to execute, hitting the default breakpoint on it’s main():图151137


You can now debug both cores in parallel, selecting which core to step, resume, suspend, etc by switching between them in the Debug View.
’可以同步调试双核了...
Note: Although there is no debug logic synchronising debug operations on the two cores, you can select both applications at the same time in the Debug View (typically by using CTRL-Click) and operations like step, resume, suspend, etc will then be carried out on both cores by the debugger in parallel.
The currently selected core will be the one used for displaying many of the debug related views, such as Registers and Locals. It is also possible to create copies of many of the debug related views, and lock each copy to a particular core.
For example, to create two register views, one for the M4 and one for the M0+ ...
First of all, use the “Open New view” button in the Registers view to create a second Registers view:图151613
‘同步查看两个核的寄存器步骤  


Now pin the original view to the core currently selected in the Debug, using the “Pin to Debug context” button :图151705
Now select the other core in the Debug view, and go to the second Register view. Use this view’s “Pin to Debug Context” button to lock this second Registers view to the selected core:图151921


Note that when you have finished debugging, you can use “Terminate/Disconnect All” button on the icon bar to disconnect the debug connections to both the Master and Slave cores at the same time:图152021

Multicore projects – additional information
Defines
A number of compiler defines are automatically created for LPC5410x projects to allow conditional compilation of certain blocks of code depending upon whether a specific project is configured to be a slave, a master or neither.
__MULTICORE_MASTER
Defined automatically by LPCXpresso for a project that has been configured to be a Master project
__MULTICORE_MASTER_SLAVE_M0SLAVE
Defined automatically by LPCXpresso for a project that has been configured to be a Master project and has had a Slave project associated with it (hence indicating to the Master project which cpu type the Slave project is for).
__MULTICORE_M0SLAVE
​Appropriate one defined automatically by LPCXpresso for a project that has been configured to be a slave project
__MULTICORE_NONE
Defined automatically by LPCXpresso for a project which has not been configured as either a slave or master project
Note: The multicore support within LPCXpresso IDE is highlighly flexible and provides functionality beyond that required for the LPC5410x family. Thus thesymbols __MULTICORE_MASTER_SLAVE_M4SLAVE and __MULTICORE_M4SLAVE are also provided for completeness, but are not required for any existing parts.
Slave boot Code  ‘从核启动代码
boot_multicore_slave() is called by the Master project code created directly by the LPCXpresso project wizard to release the Slave core from sleep. This calls functions from LPCOpen package for LPC5410x which are supplied in pre-built library form. This means that it is currently only possible to create and build LPC5410x multicore projects which are linked to LPCOpen.
Note that the source files containing this function will be included in all LPC5410x projects, but will be conditionally compiled so that it is included only when required. This has been done to allow projects originally created, for example, as a slave project, to be reconfigured (via the project properties – linker multicore tab) as a master project.
Be aware that if you look at the multicore projects provided within the LPC5410x LPCOpen package, the slave boot code is incorporated directly into the main function. However this carries out the same initialisation as the code generated by the LPCXpresso wizards.
Reset Handler code
When configured as a master project, the LPC5410x startup file will be built with additional (assembler) code at the beginning of the reset handler, ResetISR(), with the ‘standard ‘ reset handler code moved to ResetISR2().
This additional code is required in order to allow correct booting of both the Master and Slave cores. It is written in assembler in order to force it to be ‘Thumb1’ code, and hence runnable by both cores.

2015-03-10_151705.jpg (25.32 KB, 下载次数: 0)

2015-03-10_151705.jpg
此帖出自NXP MCU论坛

最新回复

我也考虑装官方的   详情 回复 发表于 2015-3-12 16:58

赞赏

1

查看全部赞赏

点赞 关注
个人签名水不撩不知深浅 人不拼怎知输赢
 

回复
举报

1297

帖子

2

TA的资源

纯净的硅(中级)

沙发
 
太高科技了!!
此帖出自NXP MCU论坛
 
 
 

回复

1291

帖子

0

TA的资源

纯净的硅(中级)

板凳
 
你用的是官方的编译器??
此帖出自NXP MCU论坛

点评

Keil, lpc都装了…官方的不怎么会用,还在学习  详情 回复 发表于 2015-3-11 07:54
 
 
 

回复

2057

帖子

0

TA的资源

五彩晶圆(初级)

4
 
很好的资料
此帖出自NXP MCU论坛

点评

对于双核设计,是基础资料,官方的工具确实有优势…  详情 回复 发表于 2015-3-11 07:55
 
 
 

回复

862

帖子

2

TA的资源

纯净的硅(初级)

5
 
强仔00001 发表于 2015-3-10 20:36
你用的是官方的编译器??


Keil, lpc都装了…官方的不怎么会用,还在学习

此帖出自NXP MCU论坛

点评

我也考虑装官方的  详情 回复 发表于 2015-3-12 16:58
 
个人签名水不撩不知深浅 人不拼怎知输赢
 
 

回复

862

帖子

2

TA的资源

纯净的硅(初级)

6
 
对于双核设计,是基础资料,官方的工具确实有优势…



此帖出自NXP MCU论坛
 
个人签名水不撩不知深浅 人不拼怎知输赢
 
 

回复

862

帖子

2

TA的资源

纯净的硅(初级)

7
 
打开LPC,导入54100包的样子
此帖出自NXP MCU论坛
 
个人签名水不撩不知深浅 人不拼怎知输赢
 
 

回复

3416

帖子

0

TA的资源

纯净的硅(高级)

8
 
好资料啊,自己摸索半天才勉强跑起。真该早点看到这贴
此帖出自NXP MCU论坛

点评

是啊,有了这些,事半功倍。主要是官网没有把这些资料放一块...需要跟琢磨板子一样琢磨...  详情 回复 发表于 2015-3-12 13:44
 
 
 

回复

4996

帖子

19

TA的资源

裸片初长成(初级)

9
 
全英文的
此帖出自NXP MCU论坛
 
个人签名我的博客
 
 

回复

862

帖子

2

TA的资源

纯净的硅(初级)

10
 
ljj3166 发表于 2015-3-12 10:06
好资料啊,自己摸索半天才勉强跑起。真该早点看到这贴
是啊,有了这些,事半功倍。主要是官网没有把这些资料放一块...需要跟琢磨板子一样琢磨...


此帖出自NXP MCU论坛
 
个人签名水不撩不知深浅 人不拼怎知输赢
 
 

回复

1291

帖子

0

TA的资源

纯净的硅(中级)

11
 
wo4fisher 发表于 2015-3-11 07:54
Keil, lpc都装了…官方的不怎么会用,还在学习

我也考虑装官方的


此帖出自NXP MCU论坛
 
 
 

回复
您需要登录后才可以回帖 登录 | 注册

随便看看
查找数据手册?

EEWorld Datasheet 技术支持

相关文章 更多>>
关闭
站长推荐上一条 1/6 下一条

 
EEWorld订阅号

 
EEWorld服务号

 
汽车开发圈

About Us 关于我们 客户服务 联系方式 器件索引 网站地图 最新更新 手机版

站点相关: 国产芯 安防电子 汽车电子 手机便携 工业控制 家用电子 医疗电子 测试测量 网络通信 物联网

北京市海淀区中关村大街18号B座15层1530室 电话:(010)82350740 邮编:100190

电子工程世界版权所有 京B2-20211791 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号 Copyright © 2005-2025 EEWORLD.com.cn, Inc. All rights reserved
快速回复 返回顶部 返回列表