首页 | 新闻 | 新品 | 文库 | 方案 | 视频 | 下载 | 商城 | 开发板 | 数据中心 | 座谈新版 | 培训 | 工具 | 博客 | 论坛 | 百科 | GEC | 活动 | 主题月 | 电子展
返回列表 回复 发帖

檫除flash代码拷贝到RAM里执行的事例(Freescale提供)

檫除flash代码拷贝到RAM里执行的事例(Freescale提供)

以下是freescale给我的回信:但例程我不知道在这里如何上传供大家下载。


In reply to your Service Request SR 1-307227501 (see details below):

I have prepared an example (attached DP256B - FCNTinInRAM - Banked MM-CW31) which presents how functions from flash are copied to RAM then pointers to these functions in RAM are crated and functions are called from flash code.

Notes:
1) In order to simplify example I placed flash functions (to be copied) into flash 4000 - non-banked flash. In this case the functions have 16bit addresses because page addressing is not used.
The case when flash functions (to be copied) are placed inside banked flash is more complicated.
2) Inside the PRM file I have split memory segment ROM_4000 (4000~7FFF) into two segments:
a) ROM_4000 (4500~7FFF)
b) ROM_4000_PIC (4000~44FF)

The segment ROM_4000_PIC is used to store function which will be copied to RAM. The segment is inside the code defined as PIC (position independent code) in order to remove absolute addresses. For more information please see compiler manual of Code Warrior.
3) Inside the PRM file I have split memory segment RAM (1000~3FFF) into two segments:
a) RAM (1500~3FFF)
b) RAM_FUNCTIONS (1000~14FF)

The segment RAM_FUNCTIONS is used only to store copied function. This reservation is made to remove this part of RAM from memory space in order to not be affected or used by other variables.

3) The functions are copied from flash to RAM from beginning of memory space "RAM_FUNCTIONS". It is defined in main.c as definition of #define RAM_CODE_START 0x1000. They are copied as entire block.

4) The pointers to functions in RAM are then created as the address to the first function in RAM plus (distance between first function in flash minus given function in flash)

The code was prepared under CodeWarrior v3.1.
If you do not understand something do not hesitate to ask.

If this does not answer your question(s), or I have forgotten something, or if you need more assistance, please contact me again.

PS. This issue will auto close in 7 days upon no reply.

Best Regards, Ladislav

Thank you for your interest in Freescale Semiconductor products and for the opportunity to serve you.

Should you need to contact us with regard to this message, please see the notes below.

Best Regards,
Ladislav
Technical Support
Freescale Semiconductor

---------------------------------------------------------------------
This message is in reply to the following service request:
SR Number: 1-307227501
Date Opened: 8/2/2006 07:47:22 AM
Subject: MC9S12DP256B
Description:
I copy the code segment from the Flash area to the Ram area, could you please tell me how to run it ?
I use to edit collected materials two instructions of the instruction Jmp/ Jsr to jump to turn my Ram area purpose address directly, adjusting to try, all discover to point the needle to jump the Ram area, can't jump a Ram area.If have the solid example and datas of this part, please send to me, thanks!

              非学无以广才,非志无以成学;              
把FSL提供的例子压缩成zip或者rar,在你发贴的地方有一个附件上传,粘帖进来就可以把代码传上来了

檫除flash代码拷贝到RAM里执行的事例(Freescale提供)

代码里感觉有点问题,欢迎讨论MSN:shlzjlzj@hotmail.com 也可通过邮件与我联系:shlzjlzj@163.com

[此贴子已经被作者于2006-8-4 15:41:38编辑过]

              非学无以广才,非志无以成学;              

檫除与编程flash例子

http://bbs.eccn.com/uploadImages/DP256B - FCNTinInRAM - Banked MM-CW31.rar
请大家以后不要向我发邮件索取,自己到这里下栽,请互相转告.另外,如果大家使用的MCU是S12,也不必把檫除\编程函数拷贝到RAM里去执行,只要把檫除\编程函数放在一个block里就可以檫除其他的block了.这样更简单,因为s12里128Kflash以上的MCU都有多个block.8位的可能就只好拷贝到RAM里了,听说还有其他办法,我不知道,请咨询Freescale的工程师.
              非学无以广才,非志无以成学;              
例子没了,谁能给我发一份阿,renweimin365@163.com,谢谢。
good good study,day day up.
返回列表