This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

scatter file issue

Hi, we are migrating the project from IAR to Keil environment.

We are facing scatter file issues, after reading available files from infocenter, it confused more. It seems the IAR linker file is very straightforward and easy to define various sections under ROM and RAM.

Here I am providing the IAR linker file, could you please help in migration to Scatter file syntax.

Basically we are missing how to declare multi RAM and ROM regions in Scatter file with specific section references.

Existing IAR linker file description: Which is working fine with IAR.

/*************************************************************************************** * Module $Id: bootLinker.icf,v 1.6 2009-12-08 07:23:19 paspuls1 Exp $ * * This Linker Configuration file defines the Linker settings for * BootLoader Firmware. ***************************************************************************************/

/*************************************************************************************** * ARM CPU : STR910FAZ32H6 * RAM SIZE : 64KBytes address range - 0x04000000 to 0x0400FFFF * BANK0 SIZE : 256KBytes address range - 0x00080000 to 0x000BFFFF * BANK1 SIZE : 32KBytes address range - 0x00000000 to 0x00007FFF * BOOT BANK : BANK1 * PRIMFW BANK : BANK0 * * ROM Memory Sections * ------------------- * Interrupt Vector Section : address range - 0x00000000 to 0x000001FF - ROM * BootLoader ROM Section : address range - 0x00000200 to 0x00007FCB - ROM * BootLoader CRC Section : address range - 0x00007FCC to 0x00007FCF - CHECKSUM * BootLoader Data Section : address range - 0x00007FD0 to 0x00007FFF - BOOT_DATA_SEC

* RAM Memory Sections * ------------------- * Exception Vectors : address range - 0x04000000 to 0x04000007 * Fatal Error Status Section : address range - 0x04000050 to 0x0400007F - FATAL_ERR_SEC * CStack Sections : address range - 0x04000100 to 0x040040FF - CSTACK * IRQStack Sections : address range - 0x04004100 to 0x040058FF - IRQ_STACK * FIQStack Sections : address range - 0x04005900 to 0x04005CFF - FIQ_STACK * SVCStack Sections : address range - 0x04005D00 to 0x040060FF - SVC_STACK * UNDStack Sections : address range - 0x04006100 to 0x040064FF - UND_STACK * ABTStack Sections : address range - 0x04006500 to 0x040068FF - ABT_STACK * Heap Section : address range - 0x04006900 to 0x040078FF - HEAP ***************************************************************************************/

/* Memory Regions */
define memory mem with size = 4G;

/* Use Bank1 as boot bank - BootLoader Firmware */
/* size of Bank1: 32K */

/* define Interrupt Vector start location */
define symbol __intvec_start__ = 0x00000000;

/* create section for Interrupt Vector Table */
place at address mem:__intvec_start__ { readonly section .intvec };

/* define ROM Start & End addresses for BootLoader Firmware */
/* size of Boot Bank(Bank 1): 32K */
define symbol __region_ROM_start__ = 0x00000200;
define symbol __region_ROM_end__ = 0x00007FCB;

/* create region for ROM */
define region ROM_region = mem:[from __region_ROM_start__ to __region_ROM_end__];

/* create ROM Sections & Blocks */
place in ROM_region { first block ICode{section .icode}, readonly };

/* define RAM start & end addresses */
/* size of RAM: 64K */
define symbol __region_RAM_start__ = 0x04000100;
define symbol __region_RAM_end__ = 0x0400FFFF;

/* create region for RAM */
define region RAM_region = mem:[from __region_RAM_start__ to __region_RAM_end__];

/* define sizes for various STACKS & HEAP */
define symbol __size_cstack__ = 0x4000;
define symbol __size_irqstack__ = 0x1800;
define symbol __size_fiqstack__ = 0x400;
define symbol __size_svcstack__ = 0x400;
define symbol __size_undstack__ = 0x400;
define symbol __size_abtstack__ = 0x400;
define symbol __size_heap__ = 0x1000;

/* define memory Blocks & their alignment for STACK & HEAP */
define block CSTACK with alignment = 8, size = __size_cstack__ { };
define block IRQ_STACK with alignment = 8, size = __size_irqstack__ { };
define block FIQ_STACK with alignment = 8, size = __size_fiqstack__ { };
define block SVC_STACK with alignment = 8, size = __size_svcstack__ { };
define block UND_STACK with alignment = 8, size = __size_undstack__ { };
define block ABT_STACK with alignment = 8, size = __size_abtstack__ { };
define block HEAP with alignment = 8, size = __size_heap__ { };

initialize by copy { readwrite };
do not initialize { section .noinit };

/* create RAM Sections & Blocks */
place in RAM_region { readwrite, block CSTACK, block IRQ_STACK, block FIQ_STACK, block SVC_STACK, block UND_STACK, block ABT_STACK, block HEAP };

/***************************************** CHEKSUM BLOCK ****************************************/

/* define start & end addresses of Checksum block */
define symbol __region_crc_start__ = 0x00007FCC;
define symbol __region_crc_end__ = 0x00007FCF;

/* define CheckSum Block Size */
define symbol __Checksum_size__ = 0x4;

/* define region for Checksum Block */
define region CRC_region = mem:[from __region_crc_start__ to __region_crc_end__];

/* create Checksum Block */
define block CHECKSUM with alignment = 4, size = __Checksum_size__ { };
place in CRC_region { block CHECKSUM };

/*********************************** FATAL ERROR STATUS - BLOCK ********************************/

/* define start & end addresses of Fatal Error Block */
define symbol __region_FE_Sec_start__ = 0x04000050;
define symbol __region_FE_Sec_end__ = 0x0400007F;

/* define size of Fatal Error Block */
define symbol __FatalErr_Block_size__ = 0x30;

/* define region for creating Fatal Error Block */
define region FE_SEC_region = mem:[from __region_FE_Sec_start__ to __region_FE_Sec_end__];

/* create Fatal Error status Block */
define block FATAL_ERR_SEC with alignment = 4, size = __FatalErr_Block_size__ { };
place in FE_SEC_region { block FATAL_ERR_SEC };

/************************************ BOOTLOADER DATA - SECTION *********************************/

/* define start & end addresses of BootLoader Data Section */
define symbol __region_boot_data_start__ = 0x00007FD0;
define symbol __region_boot_data_end__ = 0x00007FFF;

/* define region for BootLoader Data Section */
define region BOOT_DATA_region = mem:[from __region_boot_data_start__ to __region_boot_data_end__];

/* create BootLoader Data Section */
place at start of BOOT_DATA_region { ro section BOOT_DATA_SEC };

/************************************************************************************************/