aa8342771 发表于 2024-1-12 13:56:29

IAR ICF 增加了一个ROM region,为什么没办法把具体某一个.o 的代码放到指定区域,老是被readonly 指定



/*###ICF### Section handled by ICF editor, don't touch! ****/
/*-Editor annotation file-*/
/* IcfEditorFile="$TOOLKIT_DIR$\config\ide\IcfEditor\cortex_v1_0.xml" */
/* Version 4.1.1 */

/*-Memory Regions*/
define   symbol AAA_ADDR = 0x8090000;
define symbol __ICFEDIT_region_ROM_start__ = 0x8006000;
define symbol __ICFEDIT_region_ROM_end__   = (AAA_ADDR-1);
   define symbol __ICFEDIT_region_AAA_ROM_start__   = (AAA_ADDR);
define symbol __ICFEDIT_region_AAA_ROM_end__   = (0x80100000-1);

define symbol __ICFEDIT_region_RAM_start__ = 0x20000000;
define symbol __ICFEDIT_region_RAM_end__   = (0x20000000+0x10000-1);


/**** End of ICF editor section. ###ICF###*/

define memory mem with size = 4G;
define region ROM_region   = mem:;
define region AAA_ROM_region   = mem:;
define region RAM_region   = mem:;

define block CSTACK with alignment = 8
{
section .stack
};

define block HEAP with alignment = 8
{
section .heap
};

//define block header with alignment = 8
//{
//section AAT
//};

define block nvm with alignment = 8192
{
section SIMEE,
};
keep { block nvm };

define block storage with alignment = 8192
{
section INTERNAL_STORAGE,
};
keep { block storage };

define block application with fixed order
{
readonly section .intvec,
   readonly,
};

define block application_AAA with fixed order
{
        object AAA.o,
};

define block application_ram with fixed order
{
block CSTACK,
readwrite,
block HEAP
};

initialize by copy { readwrite };

do not initialize
{
section .noinit,
section .stack,
section .heap
};

keep { section .intvec };
//keep { block application_AAA };

"application_AAA":
place in AAA_ROM_region { first block application_AAA };

"application":
place in ROM_region { last block application };





"storage_regions":
place at end of AAA_ROM_region {
block storage,

block nvm,
};

"application_ram":
place at start of RAM_region { block application_ram };



最后map 生成的结果
      .text            ro code   0x805'15c8   0x2fcAAA.o
    .rodata            const   0x809'0000       0x4AAA.o
    .rodata            const   0x809'0004       0x4AAA.o
    .rodata            const   0x809'0008       0x4AAA.o
    .rodata            const   0x809'000c       0x4AAA.o
    .rodata            const   0x809'0010       0x4AAA.o
    .rodata            const   0x809'0014       0x4AAA.o
    .rodata            const   0x809'0018       0x4AAA.o
    .rodata            const   0x809'001c       0x4AAA.o
    .rodata            const   0x809'0020       0x4AAA.o
    .rodata            const   0x809'0024       0x4AAA.o
    .rodata            const   0x809'0028       0x4AAA.o
    .rodata            const   0x809'002c       0x4AAA.o
    .rodata            const   0x809'0030      0x48AAA.o
    .rodata            const   0x809'0078      0x30AAA.o

solarjjl 发表于 2024-1-12 22:13:25

/*###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__ = 0x08040000;
/*-Memory Regions-*/
define symbol __ICFEDIT_region_ROM_start__ = 0x08040000;
define symbol __ICFEDIT_region_ROM_end__   = 0x081FFFFF;

define symbol __ICFEDIT_region_DTCM_start__    = 0x20000000;
define symbol __ICFEDIT_region_DTCM_end__      = 0x2001FFFF;
define symbol __ICFEDIT_region_ITCMRAM_start__ = 0x00000000;
define symbol __ICFEDIT_region_ITCMRAM_end__   = 0x0000FFFF;

define symbol __ICFEDIT_region_QSPI_start__ = 0x90000000;
define symbol __ICFEDIT_region_QSPI_end__   = 0x907FFFFF;

define symbol __ICFEDIT_region_RAM_start__   = 0x24000000;
define symbol __ICFEDIT_region_RAM_end__       = 0x2403FFFF;
define symbol __ICFEDIT_region_CANVAS_start__= 0x30000000;
define symbol __ICFEDIT_region_CANVAS_end__    = 0x300383FF;
define symbol __ICFEDIT_region_DISPLAY_start__ = 0X24040000;
define symbol __ICFEDIT_region_DISPLAY_end__   = 0x240783FF;

/*-Sizes-*/
define symbol __ICFEDIT_size_cstack__ = 0x1000;
define symbol __ICFEDIT_size_heap__   = 0x8000;
/**** End of ICF editor section. ###ICF###*/


define memory mem with size = 4G;
define region ROM_region      = mem:;
define region ITCMRAM_region= mem:;
define region DTCMRAM_region= mem:;
define region QSPI_region = mem:;
define region AXISRAM_region = mem:;
define region CANVAS_region = mem:;
define region DISPLAY_region = mem:;

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 AXISRAM_region   { readwrite,
                        block CSTACK, block HEAP };
place in DTCMRAM_region   { readwrite section DTCM };
place in QSPI_region   { section .rodata object HarmonyOS_Sans_SC.o, object 43438A1_bin.o};
place in CANVAS_region{ readwrite section CanvasSection };
place in DISPLAY_region{ readwrite section DisplaySection };

aa8342771 发表于 2024-1-15 16:25:53

solarjjl 发表于 2024-1-12 22:13
/*###ICF### Section handled by ICF editor, don't touch! ****/
/*-Editor annotation file-*/
/* IcfE ...

code 函数都没有变化更新到新位置

yzvip7 发表于 2024-1-15 21:42:20

/////////
define region USER_region = mem:[ from 0x8020000 to 0x0803FFFF ];

place in USER_region { readonly object stm32f4xx_hal_rcc.o };
place in USER_region { readonly object stm32f4xx_hal_gpio.o };
place in USER_region { readonly object stm32f4xx_hal_tim.o };
place in USER_region { readonly object stm32f4xx_hal_uart.o };
place in USER_region { readonly object stm32f4xx_hal_dma.o };
place in USER_region { readonly object stm32f4xx_hal_flash.o };
place in USER_region { readonly object stm32f4xx_hal_flash_ex.o };

aa8342771 发表于 2024-1-16 15:15:38

yzvip7 发表于 2024-1-15 21:42
/////////
define region USER_region = mem:[ from 0x8020000 to 0x0803FFFF ];



不行呢,此过程只放了rodata的数据,没有移动.text 函数
页: [1]
查看完整版本: IAR ICF 增加了一个ROM region,为什么没办法把具体某一个.o 的代码放到指定区域,老是被readonly 指定