Add Dynamic heap support to IAR

Two new block properties available in linker configuration files:
"expanding size" and "minimum size" for IAR 8.11.2 and above

Sample:
define block HEAP with expanding size, minimum size = 16K, alignment = 8 {};

This block will expand to consume all remaining available space in
the range where it is placed. If several such blocks end up in the same
range, they will share the remaining space.
Cannot place a block with expanding size inside another block with
expanding size, inside a block with maximum size, or inside an overlay.
pull/9811/head
Deepika 2018-12-27 11:44:50 -06:00 committed by Martin Kojtal
parent 5501947197
commit e54be4aeff
35 changed files with 38 additions and 35 deletions

View File

@ -63,7 +63,7 @@ initialize by copy { readwrite };
do not initialize { section .noinit };
define block CSTACK with alignment = 8, size = __ICFEDIT_size_cstack__ { };
define block HEAP with alignment = 8, size = __ICFEDIT_size_heap__ { };
define block HEAP with expanding size, minimum size = __ICFEDIT_size_heap__, alignment = 8 { };
place at address mem:__ICFEDIT_intvec_start__ { readonly section .intvec };
place in ROM_region { readonly };

View File

@ -63,7 +63,7 @@ initialize by copy { readwrite };
do not initialize { section .noinit };
define block CSTACK with alignment = 8, size = __ICFEDIT_size_cstack__ { };
define block HEAP with alignment = 8, size = __ICFEDIT_size_heap__ { };
define block HEAP with expanding size, minimum size = __ICFEDIT_size_heap__, alignment = 8 { };
place at address mem:__ICFEDIT_intvec_start__ { readonly section .intvec };
place in ROM_region { readonly };

View File

@ -63,7 +63,7 @@ initialize by copy { readwrite };
do not initialize { section .noinit };
define block CSTACK with alignment = 8, size = __ICFEDIT_size_cstack__ { };
define block HEAP with alignment = 8, size = __ICFEDIT_size_heap__ { };
define block HEAP with expanding size, minimum size = __ICFEDIT_size_heap__, alignment = 8 { };
place at address mem:__ICFEDIT_intvec_start__ { readonly section .intvec };
place in ROM_region { readonly };

View File

@ -63,7 +63,7 @@ initialize by copy { readwrite };
do not initialize { section .noinit };
define block CSTACK with alignment = 8, size = __ICFEDIT_size_cstack__ { };
define block HEAP with alignment = 8, size = __ICFEDIT_size_heap__ { };
define block HEAP with expanding size, minimum size = __ICFEDIT_size_heap__, alignment = 8 { };
place at address mem:__ICFEDIT_intvec_start__ { readonly section .intvec };
place in ROM_region { readonly };

View File

@ -63,7 +63,7 @@ initialize by copy { readwrite };
do not initialize { section .noinit };
define block CSTACK with alignment = 8, size = __ICFEDIT_size_cstack__ { };
define block HEAP with alignment = 8, size = __ICFEDIT_size_heap__ { };
define block HEAP with expanding size, minimum size = __ICFEDIT_size_heap__, alignment = 8 { };
place at address mem:__ICFEDIT_intvec_start__ { readonly section .intvec };
place in ROM_region { readonly };

View File

@ -54,7 +54,8 @@ define region RAM_bank1_region = mem:[from 0x20000200 size 0x00003E00
define region RAM_bank2_region = mem:[from 0x20004000 size 0x00004000]
| mem:[from 0x20040000 size 0x00007000];
define block CSTACK with alignment = 16, size = MBED_BOOT_STACK_SIZE { };
define block HEAP with alignment = 16, size = 0x2000 { };
define block HEAP with expanding size, minimum size = 0x2000, alignment = 16 { };
do not initialize { section .noinit };
initialize by copy { rw };
place at start of ROM_PAGE0_INTVEC { ro section .vectors };

View File

@ -53,8 +53,10 @@ define region ROM_REGION = mem:[from MBED_APP_START+ADUCM_SECTO
define region RAM_bank1_region = mem:[from 0x20040000 size 0x00008000];
define region RAM_bank2_region = mem:[from 0x20000200 size 0x00006E00]
| mem:[from 0x20048000 size 0x00010000];
define block CSTACK with alignment = 16, size = MBED_BOOT_STACK_SIZE { };
define block HEAP with alignment = 16, size = 0x6000 { };
define block HEAP with expanding size, minimum size = 0x6000, alignment = 16 { };
do not initialize { section .noinit };
initialize by copy { rw };
place at start of ROM_PAGE0_INTVEC { ro section .vectors };

View File

@ -148,7 +148,7 @@ define region IRAM1_region = mem:[from __ICFEDIT_region_IRAM1_start__ to __ICFED
define block CSTACK with alignment = 8, size = __ICFEDIT_size_cstack__ { };
define block PROC_STACK with alignment = 8, size = __ICFEDIT_size_proc_stack__ { };
define block HEAP with alignment = 8, size = __ICFEDIT_size_heap__ { };
define block HEAP with expanding size, minimum size = __ICFEDIT_size_heap__, alignment = 8 { };
define block HSTACK {block HEAP, block PROC_STACK, last block CSTACK};
define block RO {first section .intvec, readonly};

View File

@ -148,7 +148,7 @@ define region IRAM1_region = mem:[from __ICFEDIT_region_IRAM1_start__ to __ICFED
define block CSTACK with alignment = 8, size = __ICFEDIT_size_cstack__ { };
define block PROC_STACK with alignment = 8, size = __ICFEDIT_size_proc_stack__ { };
define block HEAP with alignment = 8, size = __ICFEDIT_size_heap__ { };
define block HEAP with expanding size, minimum size = __ICFEDIT_size_heap__, alignment = 8 { };
define block HSTACK {block HEAP, block PROC_STACK, last block CSTACK};
define block RO {first section .intvec, readonly};

View File

@ -27,7 +27,7 @@ define region ROM_region = mem:[from __ICFEDIT_region_ROM_start__ to __ICFED
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__ { };
define block HEAP with expanding size, minimum size = __ICFEDIT_size_heap__, alignment = 8 { };
initialize by copy { readwrite };
do not initialize { section .noinit };

View File

@ -22,7 +22,7 @@ if (!isdefinedsymbol(MBED_BOOT_STACK_SIZE)) {
define symbol __size_cstack__ = MBED_BOOT_STACK_SIZE;
define symbol __size_heap__ = 0xF000;
define block CSTACK with alignment = 8, size = __size_cstack__ { };
define block HEAP with alignment = 8, size = __size_heap__ { };
define block HEAP with expanding size, minimum size = __size_heap__, alignment = 8 { };
initialize by copy { readwrite };
do not initialize { section .noinit };

View File

@ -29,7 +29,7 @@ if (!isdefinedsymbol(MBED_BOOT_STACK_SIZE)) {
define symbol __size_cstack__ = MBED_BOOT_STACK_SIZE;
define symbol __size_heap__ = 0xA000;
define block CSTACK with alignment = 8, size = __size_cstack__ { };
define block HEAP with alignment = 8, size = __size_heap__ { };
define block HEAP with expanding size, minimum size = __size_heap__, alignment = 8 { };
initialize by copy { readwrite };
do not initialize { section .noinit };

View File

@ -56,7 +56,7 @@ define region ROM_region = mem:[from __ICFEDIT_region_ROM_start__ to __ICFED
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__ { };
define block HEAP with expanding size, minimum size = __ICFEDIT_size_heap__, alignment = 8 { };
initialize by copy { readwrite };
do not initialize { section .nvictable };

View File

@ -60,7 +60,7 @@ define region ROM_region = mem:[from __ICFEDIT_region_ROM_start__ to __ICFED
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__ { };
define block HEAP with expanding size, minimum size = __ICFEDIT_size_heap__, alignment = 8 { };
initialize by copy { readwrite };
do not initialize { section .nvictable };

View File

@ -107,7 +107,7 @@ define region ROM_region = mem:[from __ICFEDIT_region_ROM_start__ to __ICFED
define region IRAM_region = mem:[from __ICFEDIT_region_IRAM_start__ to __ICFEDIT_region_IRAM_end__];
define block CSTACK with alignment = 8, size = __ICFEDIT_size_cstack__ { };
define block HEAP with alignment = 8, size = __ICFEDIT_size_heap__ { };
define block HEAP with expanding size, minimum size = __ICFEDIT_size_heap__, alignment = 8 { };
/* NOTE: Vector table base requires to be aligned to the power of vector table size. Give a safe value here. */
define block IRAMVEC with alignment = 1024, size = 4 * (16 + 102) { };

View File

@ -95,7 +95,7 @@ define region CSTACK_region = mem:[from m_data_end-__size_cstack__+1 to m_data_e
define region m_interrupts_ram_region = mem:[from m_interrupts_ram_start to m_interrupts_ram_end];
define block CSTACK with alignment = 8, size = __size_cstack__ { };
define block HEAP with alignment = 8, size = __size_heap__ { };
define block HEAP with expanding size, minimum size = __size_heap__, alignment = 8 { };
define block RW { readwrite };
define block ZI { zi };

View File

@ -125,7 +125,7 @@ define region NCACHE_region = mem:[from m_ncache_start to m_ncache_end];
define region m_interrupts_ram_region = mem:[from m_interrupts_ram_start to m_interrupts_ram_end];
define block CSTACK with alignment = 8, size = __size_cstack__ { };
define block HEAP with alignment = 8, size = __size_heap__ { };
define block HEAP with expanding size, minimum size = __size_heap__, alignment = 8 { };
define block RW { first readwrite, section m_usb_dma_init_data };
define block ZI with alignment = 32 { first zi, section m_usb_dma_noninit_data };
define block NCACHE_VAR with size = 0x200000 , alignment = 0x100000 { section NonCacheable , section NonCacheable.init };

View File

@ -52,7 +52,7 @@ define region AES_REGION = mem:[from AES_BASE to AES_END];
define region WLAN_REGION = mem:[from WLAN_BASE to WLAN_END];
define block CSTACK with alignment = 8, size = CSTACK_SIZE { };
define block HEAP with alignment = 8, size = HEAP_SIZE { };
define block HEAP with expanding size, minimum size = HEAP_SIZE, alignment = 8 { };
define block RW { readwrite };
define block ZI { zi };

View File

@ -55,7 +55,7 @@ define block IRQ_STACK with alignment = 8, size = __ICFEDIT_size_irqstack__ { };
define block FIQ_STACK with alignment = 8, size = __ICFEDIT_size_fiqstack__ { };
define block UND_STACK with alignment = 8, size = __ICFEDIT_size_undstack__ { };
define block ABT_STACK with alignment = 8, size = __ICFEDIT_size_abtstack__ { };
define block HEAP with alignment = 8, size = __ICFEDIT_size_heap__ { };
define block HEAP with expanding size, minimum size = __ICFEDIT_size_heap__, alignment = 8 { };
initialize by copy { readwrite };
do not initialize { section .noinit };

View File

@ -26,7 +26,7 @@ if (!isdefinedsymbol(MBED_BOOT_STACK_SIZE)) {
define symbol __size_cstack__ = MBED_BOOT_STACK_SIZE;
define symbol __size_heap__ = 0x2000;
define block CSTACK with alignment = 8, size = __size_cstack__ { };
define block HEAP with alignment = 8, size = __size_heap__ { };
define block HEAP with expanding size, minimum size = __size_heap__, alignment = 8 { };
define block STACKHEAP with fixed order { block HEAP, block CSTACK };
initialize by copy { readwrite };

View File

@ -21,7 +21,7 @@ if (!isdefinedsymbol(MBED_BOOT_STACK_SIZE)) {
define symbol __size_cstack__ = MBED_BOOT_STACK_SIZE;
define symbol __size_heap__ = 0x10000;
define block CSTACK with alignment = 8, size = __size_cstack__ { };
define block HEAP with alignment = 8, size = __size_heap__ { };
define block HEAP with expanding size, minimum size = __size_heap__, alignment = 8 { };
define block STACKHEAP with fixed order { block HEAP, block CSTACK };
initialize by copy with packing = zeros { readwrite };

View File

@ -23,7 +23,7 @@ define region ROM_region = mem:[from __ICFEDIT_region_ROM_start__ to __ICFED
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__ { };
define block HEAP with expanding size, minimum size = __ICFEDIT_size_heap__, alignment = 8 { };
initialize by copy { readwrite };
do not initialize { section .noinit };

View File

@ -22,7 +22,7 @@ if (!isdefinedsymbol(MBED_BOOT_STACK_SIZE)) {
define symbol __size_cstack__ = MBED_BOOT_STACK_SIZE;
define symbol __size_heap__ = 0x800;
define block CSTACK with alignment = 8, size = __size_cstack__ { };
define block HEAP with alignment = 8, size = __size_heap__ { };
define block HEAP with expanding size, minimum size = __size_heap__, alignment = 8 { };
define block STACKHEAP with fixed order { block HEAP, block CSTACK };
initialize by copy with packing = zeros { readwrite };

View File

@ -23,7 +23,7 @@ if (!isdefinedsymbol(MBED_BOOT_STACK_SIZE)) {
define symbol __size_cstack__ = MBED_BOOT_STACK_SIZE;
define symbol __size_heap__ = 0x800;
define block CSTACK with alignment = 8, size = __size_cstack__ { };
define block HEAP with alignment = 8, size = __size_heap__ { };
define block HEAP with expanding size, minimum size = __size_heap__, alignment = 8 { };
define block STACKHEAP with fixed order { block HEAP, block CSTACK };
initialize by copy with packing = zeros { readwrite };

View File

@ -23,7 +23,7 @@ if (!isdefinedsymbol(MBED_BOOT_STACK_SIZE)) {
define symbol __size_cstack__ = MBED_BOOT_STACK_SIZE;
define symbol __size_heap__ = 0x800;
define block CSTACK with alignment = 8, size = __size_cstack__ { };
define block HEAP with alignment = 8, size = __size_heap__ { };
define block HEAP with expanding size, minimum size = __size_heap__, alignment = 8 { };
define block STACKHEAP with fixed order { block HEAP, block CSTACK };
initialize by copy with packing = zeros { readwrite };

View File

@ -28,7 +28,7 @@ if (!isdefinedsymbol(MBED_BOOT_STACK_SIZE)) {
define symbol __size_cstack__ = MBED_BOOT_STACK_SIZE;
define symbol __size_heap__ = 0x8000;
define block CSTACK with alignment = 8, size = __size_cstack__ { };
define block HEAP with alignment = 8, size = __size_heap__ { };
define block HEAP with expanding size, minimum size = __size_heap__, alignment = 8 { };
initialize by copy with packing = zeros { readwrite };
do not initialize { section .noinit };

View File

@ -25,7 +25,7 @@ if (!isdefinedsymbol(MBED_BOOT_STACK_SIZE)) {
define symbol __size_cstack__ = MBED_BOOT_STACK_SIZE;
define symbol __size_heap__ = 0x4000;
define block CSTACK with alignment = 8, size = __size_cstack__ { };
define block HEAP with alignment = 8, size = __size_heap__ { };
define block HEAP with expanding size, minimum size = __size_heap__, alignment = 8 { };
define block STACKHEAP with fixed order { block HEAP, block CSTACK };
initialize by copy with packing = zeros { readwrite };

View File

@ -28,7 +28,7 @@ if (!isdefinedsymbol(MBED_BOOT_STACK_SIZE)) {
define symbol __size_cstack__ = MBED_BOOT_STACK_SIZE;
define symbol __size_heap__ = 0x4000;
define block CSTACK with alignment = 8, size = __size_cstack__ { };
define block HEAP with alignment = 8, size = __size_heap__ { };
define block HEAP with expanding size, minimum size = __size_heap__, alignment = 8 { };
define block STACKHEAP with fixed order { block HEAP, block CSTACK };
initialize by copy with packing = zeros { readwrite };

View File

@ -25,7 +25,7 @@ if (!isdefinedsymbol(MBED_BOOT_STACK_SIZE)) {
define symbol __size_cstack__ = MBED_BOOT_STACK_SIZE;
define symbol __size_heap__ = 0x10000;
define block CSTACK with alignment = 8, size = __size_cstack__ { };
define block HEAP with alignment = 8, size = __size_heap__ { };
define block HEAP with expanding size, minimum size = __size_heap__, alignment = 8 { };
define block STACKHEAP with fixed order { block HEAP, block CSTACK };
initialize by copy with packing = zeros { readwrite };

View File

@ -26,7 +26,7 @@ if (!isdefinedsymbol(MBED_BOOT_STACK_SIZE)) {
define symbol __size_cstack__ = MBED_BOOT_STACK_SIZE;
define symbol __size_heap__ = 0x20000; /* 128KB */
define block CSTACK with alignment = 8, size = __size_cstack__ { };
define block HEAP with alignment = 8, size = __size_heap__ { };
define block HEAP with expanding size, minimum size = __size_heap__, alignment = 8 { };
define block STACKHEAP with fixed order { block HEAP, block CSTACK };
initialize by copy with packing = zeros { readwrite };

View File

@ -25,7 +25,7 @@ define region ROM_region = mem:[from __ICFEDIT_region_ROM_start__ to __ICFED
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__ { };
define block HEAP with expanding size, minimum size = __ICFEDIT_size_heap__, alignment = 8 { };
initialize by copy { readwrite };
do not initialize { section .noinit };

View File

@ -29,7 +29,7 @@ define region BRAM_region = mem:[from __BRAM_start__ to __BRAM_end__ ];
define region DFLASH_region = mem:[from __DFLASH_start__ to __DFLASH_end__];
define block CSTACK with alignment = 8, size = __ICFEDIT_size_cstack__ { };
define block HEAP with alignment = 8, size = __ICFEDIT_size_heap__ { };
define block HEAP with expanding size, minimum size = __ICFEDIT_size_heap__, alignment = 8 { };
initialize by copy { readwrite };
do not initialize { section .noinit };

View File

@ -32,7 +32,7 @@ define region BRAM_region = mem:[from __BRAM_start__ to __BRAM_end__ ];
define region DFLASH_region = mem:[from __DFLASH_start__ to __DFLASH_end__];
define block CSTACK with alignment = 8, size = __ICFEDIT_size_cstack__ { };
define block HEAP with alignment = 8, size = __ICFEDIT_size_heap__ { };
define block HEAP with expanding size, minimum size = __ICFEDIT_size_heap__, alignment = 8 { };
initialize by copy { readwrite };
do not initialize { section .noinit };

View File

@ -25,7 +25,7 @@ define region ROM_region = mem:[from __ICFEDIT_region_ROM_start__ to __ICFED
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__ { };
define block HEAP with expanding size, minimum size = __ICFEDIT_size_heap__, alignment = 8 { };
define block FLASH_CODE_ROM {section FLASH_ROM_init object flash_api.o};
define block FLASH_CODE_RAM {section FLASH_ROM object flash_api.o};

View File

@ -25,7 +25,7 @@ define region ROM_region = mem:[from __ICFEDIT_region_ROM_start__ to __ICFED
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__ { };
define block HEAP with expanding size, minimum size = __ICFEDIT_size_heap__, alignment = 8 { };
initialize by copy { readwrite };
do not initialize { section .noinit };