众所周知,.icf是IAR的配置文件。该文件可以将不同的文件编译出的目标文件,放入到指定位置。
如果一个单片机的FLASH分为低速和高速,我们可以将大量使用的代码放入高速flash,将使用频率少的(比如:查找表)放入低速FLASH。
其中一种方式是配置.icf文件,例如将lvgl放入到快速FLASH中的代码如下:
/*###ICF### Section handled by ICF editor, don't touch! ****/
/*-Editor annotation file-*/
/* IcfEditorFile="$TOOLKIT_DIR$\config\ide\IcfEditor\cortex_v1_0.xml" */
/*-Specials-*/
define symbol __ICFEDIT_intvec_start__ = 0x08000000;
/*-Memory Regions-*/
define symbol __ICFEDIT_region_ROM_start__ = 0x08000000;
define symbol __ICFEDIT_region_ROM_end__ = 0x080ffFFF;
define symbol __ICFEDIT_region_RAM_start__ = 0x20000000;
define symbol __ICFEDIT_region_RAM_end__ = 0x20037FFF;
define symbol __ICFEDIT_region_FAST_ROM_start = 0x08000000;
define symbol __ICFEDIT_region_FAST_ROM_end = 0x0803ffff;
define symbol __ICFEDIT_region_SLOW_ROM_start = 0x08040000;
define symbol __ICFEDIT_region_SLOW_ROM_end = 0x080fffff;
/*-Sizes-*/
define symbol __ICFEDIT_size_cstack__ = 0x3f00;
define symbol __ICFEDIT_size_heap__ = 0x1f00;
/**** End of ICF editor section. ###ICF###*/
define memory mem with size = 4G;
define region ROM_region = mem:[from __ICFEDIT_region_ROM_start__ to __ICFEDIT_region_ROM_end__];
//define region SLOW_ROM_region = mem:[from __ICFEDIT_region_SLOW_ROM_start to __ICFEDIT_region_SLOW_ROM_end];
define region FAST_ROM_region = mem:[from __ICFEDIT_region_FAST_ROM_start to __ICFEDIT_region_FAST_ROM_end];
define region RAM_region = mem:[from __ICFEDIT_region_RAM_start__ to __ICFEDIT_region_RAM_end__];
define block CSTACK with alignment = 8, size = __ICFEDIT_size_cstack__ { };
define block HEAP with alignment = 8, size = __ICFEDIT_size_heap__ { };
initialize by copy { readwrite };
do not initialize { section .noinit };
place at address mem:__ICFEDIT_intvec_start__ { readonly section .intvec };
place in ROM_region { readonly };
place in RAM_region { readwrite,
block CSTACK, block HEAP };
place in FAST_ROM_region {
readonly object lv_anim.o ,
readonly object lv_animimg.o ,
readonly object lv_arc.o ,
readonly object lv_area.o ,
readonly object lv_async.o ,
readonly object lv_bar.o ,
readonly object lv_bidi.o ,
readonly object lv_btn.o ,
readonly object lv_btnmatrix.o ,
readonly object lv_calendar.o ,
readonly object lv_calendar_header_arrow.o ,
readonly object lv_calendar_header_dropdown.o ,
readonly object lv_canvas.o ,
readonly object lv_chart.o ,
readonly object lv_checkbox.o ,
readonly object lv_color.o ,
readonly object lv_colorwheel.o ,
readonly object lv_disp.o ,
readonly object lv_draw_arc.o ,
readonly object lv_draw_blend.o ,
readonly object lv_draw_img.o ,
readonly object lv_draw_label.o ,
readonly object lv_draw_line.o ,
readonly object lv_draw_mask.o ,
readonly object lv_draw_rect.o ,
readonly object lv_draw_triangle.o ,
readonly object lv_dropdown.o ,
readonly object lv_event.o ,
readonly object lv_extra.o ,
readonly object lv_flex.o ,
readonly object lv_font.o ,
readonly object lv_font_dejavu_16_persian_hebrew.o ,
readonly object lv_font_fmt_txt.o ,
readonly object lv_font_loader.o ,
readonly object lv_font_montserrat_10.o ,
readonly object lv_font_montserrat_12.o ,
readonly object lv_font_montserrat_12_subpx.o ,
readonly object lv_font_montserrat_14.o ,
readonly object lv_font_montserrat_16.o ,
readonly object lv_font_montserrat_18.o ,
readonly object lv_font_montserrat_20.o ,
readonly object lv_font_montserrat_22.o ,
readonly object lv_font_montserrat_24.o ,
readonly object lv_font_montserrat_26.o ,
readonly object lv_font_montserrat_28.o ,
readonly object lv_font_montserrat_28_compressed.o ,
readonly object lv_font_montserrat_30.o ,
readonly object lv_font_montserrat_32.o ,
readonly object lv_font_montserrat_34.o ,
readonly object lv_font_montserrat_36.o ,
readonly object lv_font_montserrat_38.o ,
readonly object lv_font_montserrat_40.o ,
readonly object lv_font_montserrat_42.o ,
readonly object lv_font_montserrat_44.o ,
readonly object lv_font_montserrat_46.o ,
readonly object lv_font_montserrat_48.o ,
readonly object lv_font_montserrat_8.o ,
readonly object lv_font_simsun_16_cjk.o ,
readonly object lv_font_unscii_16.o ,
readonly object lv_font_unscii_8.o ,
readonly object lv_fs.o ,
readonly object lv_gc.o ,
readonly object lv_gpu_nxp_pxp.o ,
readonly object lv_gpu_nxp_pxp_osa.o ,
readonly object lv_gpu_nxp_vglite.o ,
readonly object lv_gpu_stm32_dma2d.o ,
readonly object lv_grid.o ,
readonly object lv_group.o ,
readonly object lv_hal_disp.o ,
readonly object lv_hal_indev.o ,
readonly object lv_hal_tick.o ,
readonly object lv_img.o ,
readonly object lv_imgbtn.o ,
readonly object lv_img_buf.o ,
readonly object lv_img_cache.o ,
readonly object lv_img_decoder.o ,
readonly object lv_indev.o ,
readonly object lv_indev_scroll.o ,
readonly object lv_keyboard.o ,
readonly object lv_label.o ,
readonly object lv_led.o ,
readonly object lv_line.o ,
readonly object lv_list.o ,
readonly object lv_ll.o ,
readonly object lv_log.o ,
readonly object lv_math.o ,
readonly object lv_mem.o ,
readonly object lv_meter.o ,
readonly object lv_msgbox.o ,
readonly object lv_obj.o ,
readonly object lv_objx_templ.o ,
readonly object lv_obj_class.o ,
readonly object lv_obj_draw.o ,
readonly object lv_obj_pos.o ,
readonly object lv_obj_scroll.o ,
readonly object lv_obj_style.o ,
readonly object lv_obj_style_gen.o ,
readonly object lv_obj_tree.o ,
readonly object lv_port_disp.o ,
readonly object lv_port_fs_template.o ,
readonly object lv_port_indev_template.o ,
readonly object lv_printf.o ,
readonly object lv_refr.o ,
readonly object lv_roller.o ,
readonly object lv_slider.o ,
readonly object lv_span.o ,
readonly object lv_spinbox.o ,
readonly object lv_spinner.o ,
readonly object lv_style.o ,
readonly object lv_style_gen.o ,
readonly object lv_switch.o ,
readonly object lv_table.o ,
readonly object lv_tabview.o ,
readonly object lv_templ.o ,
readonly object lv_textarea.o ,
readonly object lv_theme.o ,
readonly object lv_theme_basic.o ,
readonly object lv_theme_default.o ,
readonly object lv_theme_mono.o ,
readonly object lv_tileview.o ,
readonly object lv_timer.o ,
readonly object lv_tlsf.o ,
readonly object lv_txt.o ,
readonly object lv_txt_ap.o ,
readonly object lv_utils.o ,
readonly object lv_win.o ,
};