以下是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!
[此贴子已经被作者于2006-8-4 15:41:38编辑过]
欢迎光临 电子技术论坛_中国专业的电子工程师学习交流社区-中电网技术论坛 (http://bbs.eccn.com/) | Powered by Discuz! 7.0.0 |