硬汉嵌入式论坛

 找回密码
 立即注册
查看: 330|回复: 4
收起左侧

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

[复制链接]

1

主题

2

回帖

5

积分

新手上路

积分
5
发表于 2024-1-12 13:56:29 | 显示全部楼层 |阅读模式


/*###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:[from __ICFEDIT_region_ROM_start__   to __ICFEDIT_region_ROM_end__];
define region AAA_ROM_region   = mem:[from __ICFEDIT_region_AAA_ROM_start__   to __ICFEDIT_region_AAA_ROM_end__];
define region RAM_region   = mem:[from __ICFEDIT_region_RAM_start__   to __ICFEDIT_region_RAM_end__];

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     0x2fc  AAA.o [1]
    .rodata            const     0x809'0000       0x4  AAA.o [1]
    .rodata            const     0x809'0004       0x4  AAA.o [1]
    .rodata            const     0x809'0008       0x4  AAA.o [1]
    .rodata            const     0x809'000c       0x4  AAA.o [1]
    .rodata            const     0x809'0010       0x4  AAA.o [1]
    .rodata            const     0x809'0014       0x4  AAA.o [1]
    .rodata            const     0x809'0018       0x4  AAA.o [1]
    .rodata            const     0x809'001c       0x4  AAA.o [1]
    .rodata            const     0x809'0020       0x4  AAA.o [1]
    .rodata            const     0x809'0024       0x4  AAA.o [1]
    .rodata            const     0x809'0028       0x4  AAA.o [1]
    .rodata            const     0x809'002c       0x4  AAA.o [1]
    .rodata            const     0x809'0030      0x48  AAA.o [1]
    .rodata            const     0x809'0078      0x30  AAA.o [1]
回复

使用道具 举报

11

主题

26

回帖

59

积分

初级会员

积分
59
发表于 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:[from __ICFEDIT_region_ROM_start__   to __ICFEDIT_region_ROM_end__];
define region ITCMRAM_region  = mem:[from __ICFEDIT_region_ITCMRAM_start__ to __ICFEDIT_region_ITCMRAM_end__];
define region DTCMRAM_region  = mem:[from __ICFEDIT_region_DTCM_start__ to __ICFEDIT_region_DTCM_end__];
define region QSPI_region = mem:[from __ICFEDIT_region_QSPI_start__   to __ICFEDIT_region_QSPI_end__];
define region AXISRAM_region = mem:[from __ICFEDIT_region_RAM_start__   to __ICFEDIT_region_RAM_end__];
define region CANVAS_region = mem:[from __ICFEDIT_region_CANVAS_start__   to __ICFEDIT_region_CANVAS_end__];
define region DISPLAY_region = mem:[from __ICFEDIT_region_DISPLAY_start__   to __ICFEDIT_region_DISPLAY_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 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 };
回复

使用道具 举报

1

主题

2

回帖

5

积分

新手上路

积分
5
 楼主| 发表于 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 函数都没有变化更新到新位置
回复

使用道具 举报

8

主题

19

回帖

43

积分

新手上路

积分
43
发表于 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 };
回复

使用道具 举报

1

主题

2

回帖

5

积分

新手上路

积分
5
 楼主| 发表于 2024-1-16 15:15:38 | 显示全部楼层
yzvip7 发表于 2024-1-15 21:42
/////////
define region USER_region = mem:[ from 0x8020000 to 0x0803FFFF ];

不行呢,此过程只放了rodata的数据,没有移动.text 函数
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

QQ|小黑屋|Archiver|手机版|硬汉嵌入式论坛

GMT+8, 2024-4-28 01:52 , Processed in 0.161739 second(s), 25 queries .

Powered by Discuz! X3.4 Licensed

Copyright © 2001-2023, Tencent Cloud.

快速回复 返回顶部 返回列表