博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
PowerPC-MPC56xx Flash模式代码启动过程
阅读量:7063 次
发布时间:2019-06-28

本文共 1578 字,大约阅读时间需要 5 分钟。

 
参考第5章
 
In order for the e200z4d core to be able to access memory, a valid MMU TLB entry has to be created. TheSSCM does this automatically by reading the reset vector and modifying TLB entry 0 to create a 4 KBpage containing the reset vector address. The MMU VLE bit is set depending on the status of the VLE bitwithin the RCHW. The 4 KB MMU page must be 4 KB aligned. This means that the most efficient placeto put the application code is immediately after the boot sector. The 4 KB block provides sufficient spaceto:• Add MMU entries for SRAM and peripherals• Perform standard system initialisation tasks (initialise the SRAM, setup stack, copy constant data)• Transfer execution to RAM, re-define the flash memory MMU entry and transfer execution back to flash memory.Finally, the SSCM sets the e200z4d core instruction pointer to the reset vector address and starts the corerunning.
 
SSCM从boot vector读取到reset vector address之后,即跳转到该位置开始执行代码。
 
一. 一般情况下启动代码的任务
  1. 从语言上看,最开始执行汇编代码,之后执行C语言代码;C语言执行函数调用需要栈,所以需要配置栈指针寄存器;堆只需要一个malloc引用起始位置即可,无需特别配置;
  1. 需要将带初值的数据从flash拷贝到内存中,将BSS区清0;
 
二. PowerPC MPC56xx的情况
这段代码要做的初始化动作依次如下:
  1. 为内存、Flash还有其他地址区间,添加MMU entry。防止引用到的地址无法访问。
  1. 根据ABI配置栈指针寄存器SP,指向SDA区的寄存器,指向SDA2区的寄存器;
  1. 初始化RAM内容,全部置零;
  1. 拷贝.data区,.bss区清0;
然后就可以调到main函数执行了。
 
三. 配置Flash控制寄存器
 
如果需要配置Flash控制寄存器,则需要特别操作。因为最开始执行的代码地址reset vector address指向flash,也就是说CPU从Flash中开始执行代码,CPU的PC指向flash。如果此时直接配置Flash控制寄存器,则会导致无法访问Flash中的代码。
变通的方法是把配置Flash控制器的代码,先拷贝到RAM中,然后跳转到RAM,即CPU的PC指向RAM中的Flash配置代码。配置完毕之后,再跳转回之前Flash中的代码,继续执行。
当然,如果有两块Flash,并且他们的控制器是分开的,也可以分别交替配置。

 

转载于:https://www.cnblogs.com/wjcdx/p/9245780.html

你可能感兴趣的文章
中译英5
查看>>
常用的前端相关chrome插件
查看>>
JAVA学习AWT绘图
查看>>
深入理解DOM事件类型系列第二篇——键盘事件
查看>>
自定义的cell中如果存在着UIButton,那如何将点击事件传递出去呢?
查看>>
poj1087
查看>>
继承,转型
查看>>
内部存储到外部存储
查看>>
SSH注解整合
查看>>
爬取全部的校园新闻
查看>>
开通自己的github
查看>>
共轭方向法、共轭梯度法
查看>>
余数专题
查看>>
洛谷2764:[网络流24题]最小路径覆盖问题——题解
查看>>
Spring Data JPA在Spring Boot中的应用
查看>>
分布式服务框架 Zookeeper -- 管理分布式环境中的数据
查看>>
使用WebClient 或者 HttpWebRequest均报:"The Remote name can't be solved"
查看>>
hibernate---一对一单向外键关联--XML
查看>>
用openssl生成含有中文信息的证书
查看>>
常用开源框架中设计模式使用分析
查看>>