/*###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__   = 0x0801FFFF;
define symbol __ICFEDIT_region_RAM_start__ = 0x20000000;
define symbol __ICFEDIT_region_RAM_end__   = 0x20003FFF;
/*-Sizes-*/
define symbol __ICFEDIT_size_cstack__ = 0x500;
define symbol __ICFEDIT_size_heap__ = 0x200;
/**** End of ICF editor section. ###ICF###*/

define exported symbol size_cstack_protect = 32;

define memory mem with size = 4G;
define region ROM_region   = mem:[from __ICFEDIT_region_ROM_start__   to __ICFEDIT_region_ROM_end__];

define symbol ram_start = __ICFEDIT_region_RAM_start__;
define symbol ram_end = __ICFEDIT_region_RAM_end__;

define symbol size_bootreservedram = 32; // Bootloader I/O (ISP)
define symbol size_bootioram = 32;       // Bootloader I/O (App <-> Boot)
define symbol size_stack_protect = 32;   // neutral area for CSTACK overflow detection

define symbol ram0_start = ram_start;
define symbol ram0_end = ram_start + size_bootreservedram;
define symbol ram1_start = ram0_end;
define symbol ram1_end = ram1_start + size_bootioram;
define symbol ram2_start = ram1_end;
define symbol ram2_end = ram2_start + size_stack_protect;
define symbol ram3_start = ram2_end;
define symbol ram3_end = ram3_start + __ICFEDIT_size_cstack__;
define symbol ram4_start = ram3_end;
define symbol ram4_end = ram_end;

define region RAM0_region = mem:[from ram0_start to ram0_end ]; // Bootloader ISP reserved
define region RAM1_region = mem:[from ram1_start to ram1_end ]; // Bootloader I/O (APP <-> BOOT) reserved
define region RAM2_region = mem:[from ram2_start to ram2_end ]; // Application CSTACK neutral zone
define region RAM3_region = mem:[from ram3_start to ram3_end ]; // Application CSTACK
define region RAM4_region = mem:[from ram4_start to ram4_end ]; // Application RAM

define block BOOTRESERVED with alignment = 8, size = size_bootreservedram     { section .bootreserved };
define block BOOTIO       with alignment = 8, size = size_bootioram           { section .bootio };
define block CSTACKTAIL   with alignment = 8, size = size_cstack_protect      { section .cstacktail };
define block CSTACK       with alignment = 8, size = __ICFEDIT_size_cstack__  { };
define block HEAP         with alignment = 8, size = __ICFEDIT_size_heap__    { };

initialize by copy { readwrite, section .cstacktail };
do not initialize  { section .noinit, section .bootreserved, section .bootio };

place at address mem:__ICFEDIT_intvec_start__ { readonly section .intvec };

place in ROM_region   { readonly };
place in RAM0_region  { block BOOTRESERVED };
place in RAM1_region  { block BOOTIO };
place in RAM2_region  { block CSTACKTAIL };
place in RAM3_region  { block CSTACK };
place in RAM4_region  { block HEAP, readwrite };
