在线时间3 小时
UID423742
注册时间2013-3-28
NXP金币0
该用户从未签到
注册会员

- 积分
- 159
- 最后登录
- 1970-1-1
|
发表于 2013-4-2 16:20:43
|
显示全部楼层
回复:如何产生在RAM执行的程序?在CW10.3中怎么设置?(正解)
回复第 9 楼 于2013-04-02 16:00:04发表:
Hi
一般来讲,我们推荐客户将代码放在program flash而不是RAM中,在flash中执行和在RAM中之行一样快。但是,当客户需要在代码将变量或常数写入program flash中,就需要将写program flash的一小段代码从program flash拷贝到RAM中,且在RAM中执行。
请看附件,其中有如何写program flash. 而且,要看MC56F84789_Internal_PFlash_LDM.cmd
#pragma define_section RAW_PROG_FLASH_section ".RAW_PROG_FLASH" RX
#pragma section RAW_PROG_FLASH_section begin
/*lint -save -e586 Disable MISRA rule (2.1) checking. */
static asm void Run_and_wait_in_prog_flash(void)
{
move.l #0x0001C780,R0
move.w #0x80,A
move.bp A1,X R0) /* Launch the command */
wait:
move.l #0x0001C780,R0
moveu.bp X R0),A
zxt.b A,A
bftstl #0x80,A1
bcs wait /* Wait to command complete */
nop
nop
rts
}
/*lint -restore Enable MISRA rule (2.1) checking. */
#pragma section RAW_PROG_FLASH_section end
/*
** ===================================================================
** Method : Run_and_wait_in_RAM (component IntFLASH)
**
** Description :
** This method runs programming or erasing process end waits
** until it ends. This routine is placed in RAM.
** This method is internal. It is used by Processor Expert only.
** ===================================================================
*/
#pragma define_section RAW_RAM_section ".RAW_RAM" RWX
#pragma section RAW_RAM_section begin
/*lint -save -e586 Disable MISRA rule (2.1) checking. */
static asm void Run_and_wait_in_RAM(void)
{
move.l #0x0001C780,R0
move.w #0x80,A
move.bp A1,X R0) /* Launch the command */
wait:
move.l #0x0001C780,R0
moveu.bp X R0),A
zxt.b A,A
bftstl #0x80,A1
bcs wait /* Wait to command complete */
nop
nop
rts
}
/*lint -restore Enable MISRA rule (2.1) checking. */
#pragma section RAW_RAM_section end |
|