|
В XCL файле:
//************************************************
// __ramfunc code copied to and executed from RAM.
//************************************************
-Z(DATA)CODE_I=0x20000000-0x200000500
//************************************************
// ICCARM produces code for __ramfunc functions in
// CODE_I segments. The -Q XLINK command line
// option redirects XLINK to emit the code in the
// CODE_ID segment instead, but to keep symbol and
// debug information associated with the CODE_I
// segment, where the code will execute.
//************************************************
-QCODE_I=CODE_ID
'C' процедуры нужно декларировать как:
__ramfunc void ProcedureName();
В начале файла с main() нужно разместить:
#pragma segment="CODE_ID"
#pragma segment="CODE_I"
В самом начале main() поместить:
memcpy(__segment_begin("CODE_I"),__segment_begin("CODE_ID"),((INT32U)__segment_end("CODE_ID") - (INT32U)__segment_begin("CODE_ID")));
Это перекопирует все __ramfunc функции из флэша в отведённое для них место в ОЗУ. Дальше они просто выполняются, т.к. линкер о них уже был предупреждён заранее (CODE_ID).
E-mail: info@telesys.ru