I was based KL05-SC.zip sample package development , here is my rewrite ICF file, the system reported an error stack pointer .
/*###ICF### Section handled by ICF editor, don't touch! ****/
/*-Editor annotation file-*/
/* IcfEditorFile="$TOOLKIT_DIR$\config\ide\IcfEditor\cortex_v1_0.xml" */
/*-Memory Regions-*/
define symbol __ICFEDIT_region_ROM_start__ = 0x00000410;//0x00000000;
define symbol __ICFEDIT_region_ROM_end__ = 0x00003FFF;//********
define symbol __ICFEDIT_region_RAM_end__ = 0x200005FF;
define symbol __ICFEDIT_region_RAM_start__ =0x20000210;//__ICFEDIT_region_RAM_end__ - (2*1024)/4 + 0x410;//********
/*-Specials-*/
define symbol __ICFEDIT_intvec_start__ = 0;
/*-Sizes-*/
define symbol __ICFEDIT_size_cstack__ = (1024);//********
define symbol __ICFEDIT_size_heap__ = (1024);//********
/**** End of ICF editor section. ###ICF###*/
//define symbol __region_RAM2_start__ = 0x20000000;
//define symbol __region_RAM2_end__ = 0x200005FF;//__region_RAM2_start__ + ((2*1024)*3)/4 - 1;//********
define exported symbol __VECTOR_TABLE = 0x00000000;//__ICFEDIT_region_ROM_start__;
define exported symbol __VECTOR_RAM = __ICFEDIT_region_RAM_start__ - 0x410;
define exported symbol __BOOT_STACK_ADDRESS = __ICFEDIT_region_RAM_end__ - 8;//__region_RAM2_end__ - 8;
define symbol __code_start__ = __ICFEDIT_region_ROM_start__;//__ICFEDIT_region_ROM_start__ + 0x410;//********
define memory mem with size = 4G;
define region ROM_region = mem:[from __ICFEDIT_region_ROM_start__ to __ICFEDIT_region_ROM_end__];// | mem:[from __region_FlexNVM_start__ to __region_FlexNVM_end__];//********
define region RAM_region = mem:[from __ICFEDIT_region_RAM_start__ to __ICFEDIT_region_RAM_end__];//mem:[from __ICFEDIT_region_RAM_start__ to __region_RAM2_end__];// | mem:[from __region_RAM2_start__ to __region_RAM2_end__];
define block CSTACK with alignment = 8, size = __ICFEDIT_size_cstack__ { };
define block HEAP with alignment = 8, size = __ICFEDIT_size_heap__ { };
initialize manually { readwrite };
initialize manually { section .data};
initialize manually { section .textrw };
do not initialize { section .noinit };
define block CodeRelocate { section .textrw_init };
define block CodeRelocateRam { section .textrw };
place at address mem:__ICFEDIT_intvec_start__ { readonly section .intvec };
place at address mem:__code_start__ { readonly section .noinit };
place in ROM_region { readonly, block CodeRelocate};
place in RAM_region { readwrite, block CodeRelocateRam,
block CSTACK, block HEAP };
Hi Thooman,
Thank you very much for your focus on Freescale Kinetis product. I'm glad to provide serevice for you.
I think you needn't to complicate migrate the demo code from KL05-SC.exe sample package to KL02 with rewrite ICF file and what you should do is use KL02 head file to replace KL05.
That's all.
I'd like to suggest that you can download KL02_SC.exe sample package and use these demo codes to implement directly.
More information about FRDM-KL02 as follwow:
http://www.freescale.com/webapp/sps/site/prod_summary.jsp?code=FRDM-KL02Z&uc=true&lang_cd=en
Have a great day,
Ping
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------
Hi Jeremyzhou,
Thanks you reply,
The above example is I rewrite the ICF files, and the K02_ SC.exe in the routine use of my written ICF files
Hi Thooman,
Thanks for you reply,
Sorry, I was confused about your reply. So I was wondering if you could you explain again.
Have a nice day!
Ping
I use Freescale official routines (kl02sc.exe) 32KB _ Pflash.ICF file rewrite to 16K_Pflash.ICF file, the 16k_Pflash.ICF content is:
/*###ICF### Section handled by ICF editor, don't touch! ****/
/*-Editor annotation file-*/
/* IcfEditorFile="$TOOLKIT_DIR$\config\ide\IcfEditor\cortex_v1_0.xml" */
/*-Memory Regions-*/
define symbol __ICFEDIT_region_ROM_start__ = 0x00000410;//0x00000000;
define symbol __ICFEDIT_region_ROM_end__ = 0x00003FFF;//********
define symbol __ICFEDIT_region_RAM_end__ = 0x200005FF;
define symbol __ICFEDIT_region_RAM_start__ =0x20000210;//__ICFEDIT_region_RAM_end__ - (2*1024)/4 + 0x410;//********
/*-Specials-*/
define symbol __ICFEDIT_intvec_start__ = 0;
/*-Sizes-*/
define symbol __ICFEDIT_size_cstack__ = (1024);//********
define symbol __ICFEDIT_size_heap__ = (1024);//********
/**** End of ICF editor section. ###ICF###*/
//define symbol __region_RAM2_start__ = 0x20000000;
//define symbol __region_RAM2_end__ = 0x200005FF;//__region_RAM2_start__ + ((2*1024)*3)/4 - 1;//********
define exported symbol __VECTOR_TABLE = 0x00000000;//__ICFEDIT_region_ROM_start__;
define exported symbol __VECTOR_RAM = __ICFEDIT_region_RAM_start__ - 0x410;
define exported symbol __BOOT_STACK_ADDRESS = __ICFEDIT_region_RAM_end__ - 8;//__region_RAM2_end__ - 8;
define symbol __code_start__ = __ICFEDIT_region_ROM_start__;//__ICFEDIT_region_ROM_start__ + 0x410;//********
define memory mem with size = 4G;
define region ROM_region = mem:[from __ICFEDIT_region_ROM_start__ to __ICFEDIT_region_ROM_end__];// | mem:[from __region_FlexNVM_start__ to __region_FlexNVM_end__];//********
define region RAM_region = mem:[from __ICFEDIT_region_RAM_start__ to __ICFEDIT_region_RAM_end__];//mem:[from __ICFEDIT_region_RAM_start__ to __region_RAM2_end__];// | mem:[from __region_RAM2_start__ to __region_RAM2_end__];
define block CSTACK with alignment = 8, size = __ICFEDIT_size_cstack__ { };
define block HEAP with alignment = 8, size = __ICFEDIT_size_heap__ { };
initialize manually { readwrite };
initialize manually { section .data};
initialize manually { section .textrw };
do not initialize { section .noinit };
define block CodeRelocate { section .textrw_init };
define block CodeRelocateRam { section .textrw };
place at address mem:__ICFEDIT_intvec_start__ { readonly section .intvec };
place at address mem:__code_start__ { readonly section .noinit };
place in ROM_region { readonly, block CodeRelocate};
place in RAM_region { readwrite, block CodeRelocateRam,
block CSTACK, block HEAP };
Hi Thooman,
Thanks for your reply. I've corrected your ICF file and you could give a shot.
/*###ICF### Section handled by ICF editor, don't touch! ****/
/*-Editor annotation file-*/
/* IcfEditorFile="$TOOLKIT_DIR$\config\ide\IcfEditor\cortex_v1_0.xml" */
/*-Memory Regions-*/
define symbol __ICFEDIT_region_ROM_start__ = 0;
//define symbol __ICFEDIT_region_ROM_start__ = 0x1400;
define symbol __ICFEDIT_region_ROM_end__ = (16*1024);//********
define symbol __ICFEDIT_region_RAM_end__ = 0x20000000;
define symbol __ICFEDIT_region_RAM_start__ =__ICFEDIT_region_RAM_end__ - (2*1024)/4 + 0x410;//********
/*-Specials-*/
define symbol __ICFEDIT_intvec_start__ = 0;
/*-Sizes-*/
define symbol __ICFEDIT_size_cstack__ = (1*512);//********
define symbol __ICFEDIT_size_heap__ = (1*512);//********
/**** End of ICF editor section. ###ICF###*/
define symbol __region_RAM2_start__ = 0x20000000;
define symbol __region_RAM2_end__ = __region_RAM2_start__ + ((2*1024)*3)/4;//********
define exported symbol __VECTOR_TABLE = __ICFEDIT_region_ROM_start__;
define exported symbol __VECTOR_RAM = __ICFEDIT_region_RAM_start__ - 0x410;
define exported symbol __BOOT_STACK_ADDRESS = __region_RAM2_end__ - 8;
define symbol __code_start__ = __ICFEDIT_region_ROM_start__ + 0x410;//********
define memory mem with size = 4G;
define region ROM_region = mem:[from __ICFEDIT_region_ROM_start__ to __ICFEDIT_region_ROM_end__];// | mem:[from __region_FlexNVM_start__ to __region_FlexNVM_end__];//********
define region RAM_region = mem:[from __ICFEDIT_region_RAM_start__ to __region_RAM2_end__];// | mem:[from __region_RAM2_start__ to __region_RAM2_end__];
define block CSTACK with alignment = 8, size = __ICFEDIT_size_cstack__ { };
define block HEAP with alignment = 8, size = __ICFEDIT_size_heap__ { };
initialize manually { readwrite };
initialize manually { section .data};
initialize manually { section .textrw };
do not initialize { section .noinit };
define block CodeRelocate { section .textrw_init };
define block CodeRelocateRam { section .textrw };
place at address mem:__ICFEDIT_intvec_start__ { readonly section .intvec };
place at address mem:__code_start__ { readonly section .noinit };
place in ROM_region { readonly, block CodeRelocate};
place in RAM_region { readwrite, block CodeRelocateRam,
block CSTACK, block HEAP };
Have a great day,
Ping
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------
It has been tested, the error persists
Hi Thooman,
Thanks for your reply.
Was that a same error like before?
I was wondering if you could proved the error screenshot?
Have a nice day!
Ping
I have also tried it, and found that there was no longer an error, of the reasons for that define the symbol __CFEDIT_region_RAM_Start__ = 0X0; I is defined as 0X1 FFFFE00, if you give me the file, and then define exported symbol __ VECTOR RAM =__ICFEDIT_region_RAM_start - 0x410, will certainly be wrong, and I am of the program is not implemented.
define symbol __ICFEDIT_region_ROM_start__ = 0;
//define symbol __ICFEDIT_region_ROM_start__ = 0x1400;
define symbol __ICFEDIT_region_ROM_end__ = (16*1024); //********
define symbol __ICFEDIT_region_RAM_end__ = 0x20000000;
define symbol __ICFEDIT_region_RAM_start__ = 0x0;
/*-Specials-*/
define symbol __ICFEDIT_intvec_start__ = 0;
/*-Sizes-*/
define symbol __ICFEDIT_size_cstack__ = (1*512); //********
define symbol __ICFEDIT_size_heap__ = (1*512); //********
/**** End of ICF editor section. ###ICF###*/
define symbol __region_RAM2_start__ = 0x20000000;
define symbol __region_RAM2_end__ = __region_RAM2_start__ + ((2*1024)*3)/4;//********
define exported symbol __VECTOR_TABLE = __ICFEDIT_region_ROM_start__;
define exported symbol __VECTOR_RAM = __ICFEDIT_region_RAM_start__ - 0x410;
define exported symbol __BOOT_STACK_ADDRESS = __region_RAM2_end__ - 8;
define symbol __code_start__ = __ICFEDIT_region_ROM_start__ + 0x410;//********
Have a nice day!
Thooman
Hi Thooman,
Thanks for your reply.
I‘m afraid that MCU couldn't work normally after you corrected define symbol __ICFEDIT_region_RAM_start__ = 0x0;
I've corrected the ICF again which show as follow. And you also need to make the instructions which are used for copy the vector table to RAM don't operate in common_startup(void) function.
Please give a shout and update me instantly when you get result.
/*###ICF### Section handled by ICF editor, don't touch! ****/
/*-Editor annotation file-*/
/* IcfEditorFile="$TOOLKIT_DIR$\config\ide\IcfEditor\cortex_v1_0.xml" */
/*-Memory Regions-*/
define symbol __ICFEDIT_region_ROM_start__ = 0;
//define symbol __ICFEDIT_region_ROM_start__ = 0x1400;
define symbol __ICFEDIT_region_ROM_end__ = (16*1024);//********
define symbol __ICFEDIT_region_RAM_end__ = 0x20000000;
define symbol __ICFEDIT_region_RAM_start__ =__ICFEDIT_region_RAM_end__ - (2*1024)/4 ;//********
/*-Specials-*/
define symbol __ICFEDIT_intvec_start__ = 0;
/*-Sizes-*/
define symbol __ICFEDIT_size_cstack__ = (1*512);//********
define symbol __ICFEDIT_size_heap__ = (1*512);//********
/**** End of ICF editor section. ###ICF###*/
define symbol __region_RAM2_start__ = 0x20000000;
define symbol __region_RAM2_end__ = __region_RAM2_start__ + ((2*1024)*3)/4;//********
define exported symbol __VECTOR_TABLE = __ICFEDIT_region_ROM_start__;
define exported symbol __VECTOR_RAM = __ICFEDIT_region_RAM_start__ ;
define exported symbol __BOOT_STACK_ADDRESS = __region_RAM2_end__ - 8;
define symbol __code_start__ = __ICFEDIT_region_ROM_start__ + 0x410;//********
define memory mem with size = 4G;
define region ROM_region = mem:[from __ICFEDIT_region_ROM_start__ to __ICFEDIT_region_ROM_end__];// | mem:[from __region_FlexNVM_start__ to __region_FlexNVM_end__];//********
define region RAM_region = mem:[from __ICFEDIT_region_RAM_start__ to __region_RAM2_end__];// | mem:[from __region_RAM2_start__ to __region_RAM2_end__];
define block CSTACK with alignment = 8, size = __ICFEDIT_size_cstack__ { };
define block HEAP with alignment = 8, size = __ICFEDIT_size_heap__ { };
initialize manually { readwrite };
initialize manually { section .data};
initialize manually { section .textrw };
do not initialize { section .noinit };
define block CodeRelocate { section .textrw_init };
define block CodeRelocateRam { section .textrw };
place at address mem:__ICFEDIT_intvec_start__ { readonly section .intvec };
place at address mem:__code_start__ { readonly section .noinit };
place in ROM_region { readonly, block CodeRelocate};
place in RAM_region { readwrite, block CodeRelocateRam,
block CSTACK, block HEAP };
Have a great day,
Ping
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------