在线时间0 小时
UID252261
注册时间2010-12-6
NXP金币0
该用户从未签到
新手上路

- 积分
- 34
- 最后登录
- 1970-1-1
|
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 */
}
|
|