查看: 2842|回复: 0

[MPC] MPC5634M

[复制链接]

该用户从未签到

4

主题

7

帖子

0

新手上路

Rank: 1

积分
34
最后登录
1970-1-1
发表于 2018-6-4 14:17:33 | 显示全部楼层 |阅读模式
MPC5634M  如何将数据写到内部flash中,用官方的程序修改了  写MCR LMLR 都写不进去   哪位朋友指点一下?


int main(void) {

  uint32_t i=0; /* Dummy idle counter */
  
  uint32_t mem_write_code [] = {
    0x90640000, /* stw r3,(0)r4 machine code; writes r3 contents to addr in r4 */
    0x7C0006AC, /* mbar machine code: ensure prior store completed */
    0x4E800020  /* blr machine code: branches to return address in link register */
   };

  typedef void (*mem_write_code_ptr_t)(uint32_t, uint32_t);
          /* create a new type def: a func pointer called mem_write_code_ptr_t */
          /* which does not return a value (void) */
          /* and will pass two 32 bit unsigned integer values */
          /* (per EABI, the first parameter will be in r3, the second r4) */

  (*((mem_write_code_ptr_t)mem_write_code))     /* cast mem_write_code as func ptr*/
                                 /* * de-references func ptr, i.e. converts to func*/
     (FLASH_CONFIG_DATA_LMLR_R,            /* which passes integer (in r3) */
      (uint32_t)&FLASH_CONFIG_REG_LMLR); /* and address to write integer (in r4) */
  enable_accel_BTB();            /* Enable branch accel., branch target buffers */

  while(1) {i++;}                /* Wait forever */
}






我知道答案 目前已有0人回答
回复

使用道具 举报

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

本版积分规则

关闭

站长推荐上一条 /3 下一条

Archiver|手机版|小黑屋|恩智浦技术社区

GMT+8, 2025-9-12 01:49 , Processed in 0.099981 second(s), 21 queries , MemCache On.

Powered by Discuz! X3.4

Copyright © 2001-2024, Tencent Cloud.

快速回复 返回顶部 返回列表