4724|10

2143

帖子

3

TA的资源

五彩晶圆(中级)

楼主
 

【LPC54100】+ 初识Dual Core [复制链接]

拿到板子也蛮多时间的了,一直没时间写点什么东西, 话说也是第一次弄NXP的U,挺新鲜的。基本开发环境搭建OK,官方资源熟悉也差不多了,看了一下dual core的examlpe。写个帖子说说自己对LPC541000的一些认识吧。






可以看到一些比较新的东西,core单元有两个内核,算是最大的特点了,双核嘛。简单理解,两个IC封装到一起了,该干嘛还是该干嘛,做了一些两个IC之间通信的机制也就是这里的mailbox咯。不过对于这种封装到一起的双核而言,他们的外设是共享的,就是说本来我有个SPI,你有个I2C,封装到一起了嘛,那好,资源共享咯。共享资源是可以的,要商量好,那么自然需要一种机制提供服务管理,也就是所谓的mutex互斥锁,从dual core的例子的readme中可以看出,这算是个硬件的锁,可控的,提供一些用户接口罢了。



恩,在说说ROM这个地方,也是老手段了,不过也算是NXP的惯用手段,之前了解过NXP的LPC1114C系列内置canopen协议栈,也算是和蔼亲切了,搞过canopen的或者看过canopen协议的应该能明白NXP的用心良苦。这里ROM主要提供两个服务,low-power API和drivers,恩也蛮真实的,不能都open出来,别的IC厂家眼红着呢,玩点神秘也是好的,可惜稍微懂点U的人,看看就知道了,没啥玄机。归根就低还是需要熟悉了解某一款U的启动过程,比较真实的,贴切的认识的那种,保证你在N核的时候都不紧张。



接着说说,这些个dual core是如何来run的,太简单了。就是两个IC,如何run随你啦,也就是是00/01/10/11的组合嘛,可惜有内置在ROM中的原始引导程序,起码在power-on的时候有个起始位置就行了。哦,那行了,随意让一个先起来吧,NXP选择采用M4先起来,然后嘛,继续运行M0也是随你的了。RAM和FLASH嘛,这玩意还是和LD有关系,不懂的就没得说了,可以理解每个IC都有自己的RAM和FLASH,然后嘛封装在一起这些个RAM和FLASH也合并一下嘛,只不过是在LD的时候分别指定自己的memory空间就噢了,画了个小图,简单看下。





这个LD嘛,拿比较熟悉的IAR说事情,也就是ICF文件咯,分别看一下multicore中的M4和M0的ICF文件



\lpcopen_2_14_1_keil_iar_lpcxpresso_54102\applications\lpc5410x\examples\multicore\m4master_blinky\LPC540xx_m4_map.icf

  1. define symbol __ICFEDIT_intvec_start__ = 0x00000000;
  2. /*-Memory Regions-*/
  3. define symbol __ICFEDIT_region_ROM_start__ = 0x00000000;
  4. define symbol __ICFEDIT_region_ROM_end__   = 0x0001FFFF;
  5. define symbol __ICFEDIT_region_RAM_start__ = 0x02000000;
  6. define symbol __ICFEDIT_region_RAM_end__   = 0x02007FFF;
复制代码




\lpcopen_2_14_1_keil_iar_lpcxpresso_54102\applications\lpc5410x\examples\multicore\m0slave_blinky\LPC540xx_m0_map.icf

  1. define symbol __ICFEDIT_intvec_start__ = 0x00020000;
  2. /*-Memory Regions-*/
  3. define symbol __ICFEDIT_region_ROM_start__ = 0x00020000;
  4. define symbol __ICFEDIT_region_ROM_end__   = 0x0003FFFF;
  5. define symbol __ICFEDIT_region_RAM_start__ = 0x02008000;
  6. define symbol __ICFEDIT_region_RAM_end__   = 0x0200FFFF;
复制代码



恩,其实你可以随意的,不过需要注意一点就是M4的ROMstart地址需要是0x00000000,哎这货还没太注意,直接是0的位置,那么他应该不内置BL咯,挺好的会自由很多。





最后我们细心的看一下官方的文字吧,最喜欢这种txt文档,说道理不含糊,喜欢老外的做事风格,记录的这么细。要是换做是国产IC你别指望这么细咯。



\lpcopen_2_14_1_keil_iar_lpcxpresso_54102\applications\lpc5410x\examples\multicore\m4master_blinky\readme.txt

  1. Multicore blinky example (M4 core as master, M0 as slave)
  2. =========================================================

  3. Example description
  4. -------------------
  5. This multicore example sets up the M4 core as the MCU master that communicates with
  6. the M0 core running as a slave. This project is meant to work with the m0slave_blinky
  7. project as the slave and the m4master_blinky project as the master.

  8. When this example works correctly and both cores are running, board LEDs 0 and 1
  9. will toggle at about 1Hz. When one LED is on, the other LED is off.

  10. What this example does: m4master_blinky
  11. - Sets up the system via SystemInit() and initializes the board layer via Board_Init()
  12. The M0 slave does not repeat this step.
  13. - Shares a 32-bit value bewteen both cores that contains LED on/off state for board
  14. LEDs 0 and 1 in bit position 0 for the master and bit position 1 for the slave. A
  15. 0 or 1 in these bit locations indicates the LED off(0) or on(1) state for board
  16. LEDs 0 or 1, respectively.
  17. - Sets up the mailbox and hardware mutex. This is only performed once by the master
  18. core. Enables the mailbox interrupt.
  19. - Initializes the M0 slave core boot entry address and stack pointer. The startup
  20. code for both the M0 and M4 cores is shared with the M0 core being placed into a
  21. safe, low power state. Once the master sets up the necessary addresses, the M0
  22. slave core is reset and boots with the address and stack given by the master.
  23. Note the shared M0/M4 startup code handles this part of the boot sequence.
  24. - Grabs the hardware mutex for the shared LED state value.
  25. - Sets up a periodic system tick event which toggles the LED0 state value at about
  26. 1Hz. This doesn't yet toggle board LED0 yet, only the state value.
  27. - Triggers a mailbox event to the M0 slave core with the address of the shared LED
  28. state value.
  29. - Returns the hardware mutex for the shared LED state value.
  30. There might be a small overlap period where both cores attempt to access the
  31. hardware mutex. The core attempted to get the mutex will keep trying until the
  32. mutex is available.
  33. - At some point, the mailbox will be triggered from the slave core. When this
  34. happens, a mailbox interrupt is generated and both of the board LED states are
  35. updated from the shared LED state value.
  36. - The mailbox interrupt is cleared.
  37. - The master MCU sleeps while not performing any other tasks.

  38. What this example does: m0slave_blinky
  39. - Uses a special version of the startup code that bypasses SystemInit().
  40. - Does not link agains tthe board library (M4 does board init)
  41. - Enables the mailbox interrupt.
  42. - At some point, the mailbox will be triggered from the master core. When this
  43. happens, a mailbox interrupt is generated. The mailbox contains an addrsss that
  44. points to the M4's shared LED state value.
  45. - Grabs the hardware mutex for the shared LED state value.
  46. - The LED1 state value is toggled in the shared LED state value. This doesn't yet
  47. toggle board LED1 yet, only the state value.
  48. - Returns the hardware mutex for the shared LED state value.
  49. - The mailbox interrupt is cleared.
  50. - Triggers a mailbox event to the M4 master core that the M0 slave side is done.
  51. - The slave MCU sleeps while not performing any other tasks.
复制代码




从文字中发现有所谓的hardware mutex算是个好东西,后面再写个帖子分析他还有比较主线的mailbox,这里一句话说明他的作用,一个内置的硬件/软件通道用于两颗封装在一起的U进行通信和交流,挺好的。整体思路就是别把他当双核看,你就会了,分别烧程序应该也不是问题。NXP默认的工具会把生成的两个独立的文件合并之后下载进去,还牵扯一个叫Code Red Technologies Ltd.的公司,有兴趣的可以了解一下。将来相信NXP会开放更多的dual core的细节,当然现在提供的资料完全不影响我们使用它,而且你会用的很好,就是两颗IC,想他们多交流多看mutex和mbox吧,无他。
此帖出自NXP MCU论坛

最新回复

一直没机会玩NXP的“双核”,经过楼主的介绍总算是大致了解了,还真是挺特别的  详情 回复 发表于 2015-3-13 08:58
点赞 关注
个人签名电工
 

回复
举报

2143

帖子

3

TA的资源

五彩晶圆(中级)

沙发
 
wps画的图挺好看的,学了一门手艺。。,,
此帖出自NXP MCU论坛
 
个人签名电工
 
 

回复

3416

帖子

0

TA的资源

纯净的硅(高级)

板凳
 
分析得很有道理
mailbox基本上就是内核的通信工具了
互斥锁mutex觉着像管理优先级的玩意儿
越看越像嵌入式操作系统了
只不过都硬件实现
此帖出自NXP MCU论坛

点评

搞反了吧,互斥本来就是hardware层面的东西,只不过这里换了个名字,又暴露的比较明显。  详情 回复 发表于 2015-3-12 21:59
是啊,没啥东西,就是两个IC,多了那两个玩意。  详情 回复 发表于 2015-3-12 21:28
 
个人签名

So TM what......?

 

 

回复

3416

帖子

0

TA的资源

纯净的硅(高级)

4
 
Code Red好像就是开发LPCexpresso环境的公司吧
此帖出自NXP MCU论坛

点评

额,这个不太清楚哦,可能性很大。我在想弄点啥有意思的,看了下nuttx,想弄上去  详情 回复 发表于 2015-3-12 21:29
 
个人签名

So TM what......?

 

 

回复

2143

帖子

3

TA的资源

五彩晶圆(中级)

5
 
ljj3166 发表于 2015-3-12 21:26
分析得很有道理
mailbox基本上就是内核的通信工具了
互斥锁mutex觉着像管理优先级的玩意儿
越看越像嵌入式操作系统了
只不过都硬件实现

是啊,没啥东西,就是两个IC,多了那两个玩意。


此帖出自NXP MCU论坛
 
个人签名电工
 
 

回复

2143

帖子

3

TA的资源

五彩晶圆(中级)

6
 
ljj3166 发表于 2015-3-12 21:26
Code Red好像就是开发LPCexpresso环境的公司吧



额,这个不太清楚哦,可能性很大。我在想弄点啥有意思的,看了下nuttx,想弄上去
此帖出自NXP MCU论坛
 
个人签名电工
 
 

回复

7794

帖子

2

TA的资源

五彩晶圆(高级)

7
 
查看本帖全部讨论,请登录或者注册
此帖出自NXP MCU论坛
 
个人签名

默认摸鱼,再摸鱼。2022、9、28

 
 

回复

2143

帖子

3

TA的资源

五彩晶圆(中级)

8
 
查看本帖全部讨论,请登录或者注册
此帖出自NXP MCU论坛

点评

哦,“从dual core的例子的readme中可以看出,这算是个硬件的锁,可控的,提供一些用户接口罢了”,我还以为能用软件的锁 oO__O  详情 回复 发表于 2015-3-12 22:33
 
个人签名电工
 
 

回复

7794

帖子

2

TA的资源

五彩晶圆(高级)

9
 
查看本帖全部讨论,请登录或者注册
此帖出自NXP MCU论坛

点评

结尾部分直接使用hardware mutex描述 “从文字中发现有所谓的hardware mutex算是个好东西,后面再写个帖子分析他还有比较主线的mailbox,这里一句话说明他的作用,一个内置的硬件/软件通道用于两颗封装在一起  详情 回复 发表于 2015-3-13 08:39
 
个人签名

默认摸鱼,再摸鱼。2022、9、28

 
 

回复

2143

帖子

3

TA的资源

五彩晶圆(中级)

10
 
查看本帖全部讨论,请登录或者注册
此帖出自NXP MCU论坛
 
个人签名电工
 
 

回复

403

帖子

6

TA的资源

纯净的硅(中级)

11
 
查看本帖全部讨论,请登录或者注册
此帖出自NXP MCU论坛
 
个人签名如果天空是黑暗的,那就摸黑生存;如果发出声音是危险的,那就保持沉默...但不要习惯了黑暗就为黑暗辩护;不要为自己的苟且而得意;不要嘲讽那些比自己更勇敢热情的人们。人可以卑微如尘土,不可扭曲如蛆虫。
 
 

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

随便看看
查找数据手册?

EEWorld Datasheet 技术支持

相关文章 更多>>
关闭
站长推荐上一条 1/10 下一条
报名赢【小米双肩包、contigo水杯】 | TI MSPM0 系列 MCU 再添新成员
了解TI 前沿新品——高性能与高性价比的优秀组合 MSPM0G351x / MSPM0L111x,4月24日(周四)上午10:00直播~

查看 »

 
EEWorld订阅号

 
EEWorld服务号

 
汽车开发圈

 
机器人开发圈

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

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

北京市海淀区中关村大街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
快速回复 返回顶部 返回列表