/******************************************************************************* * BlueNRG-LP generic linker file for IAR * Main linker variables to control it are: * * MEMORY_FLASH_APP_SIZE: define the size of the application in case not all the flash is needed. * Default value is: 252KB when no OTA firmware upgrade is supported * * MEMORY_FLASH_APP_OFFSET: define the offset of the application. * Default value is: 0 offset * * MEMORY_RAM_APP_OFFSET: define the offset in RAM from which sections can be * allocated. * Default value is: 0 offset * * CONFIG_OTA_HIGHER: When defined application is built for OTA support * in the higher part of memory * * CONFIG_OTA_LOWER: When defined application is built for OTA support * in the lower part of memory * * CONFIG_OTA_USE_SERVICE_MANAGER: When defined application is built for * OTA firmware upgrade support with separated application for firmware upgrade * *******************************************************************************/ /******************************************************************************* * Memory Definitions *******************************************************************************/ /* BlueNRG-LP memory map +-----------------------+ 0x2000FFFF | RAM (64K) | +-----------------------+ 0x20000000 | | | | +-----------------------+ 0x1007FFFF | | | FLASH (256K) | +-----------------------+ 0x10040000 | | +-----------------------| 0x100017FF | ROM (6K) | +-----------------------+ 0x10000000 */ define symbol _MEMORY_RAM_BEGIN_ = 0x20000000; if( isdefinedsymbol(CONFIG_DEVICE_BLUENRG_345) ) { define symbol _MEMORY_RAM_SIZE_ = 0x8000; /* 32KB */ define symbol _MEMORY_RAM_END_ = 0x20007FFF; } else { define symbol _MEMORY_RAM_SIZE_ = 0x10000; /* 64KB */ define symbol _MEMORY_RAM_END_ = 0x2000FFFF; } define symbol _MEMORY_FLASH_BEGIN_ = 0x10040000; define symbol _MEMORY_FLASH_SIZE_ = 0x40000; /* 256KB */ define symbol _MEMORY_FLASH_END_ = 0x1007FFFF; define symbol _MEMORY_ROM_BEGIN_ = 0x10000000; define symbol _MEMORY_ROM_SIZE_ = 0x01800; /* 6KB */ define symbol _MEMORY_ROM_END_ = 0x100007FF; /* Reserved for BTLE stack non volatile memory */ define symbol FLASH_NVM_DATASIZE = (4*1024); if( !isdefinedsymbol( MEMORY_RAM_APP_OFFSET) ) { define symbol MEMORY_RAM_APP_OFFSET = (0x00); } if( isdefinedsymbol(CONFIG_OTA_HIGHER) ) { /* This configuration is intended for application supporting OTA firmware upgrade with 2-app scheme (app in the upper part of memory map) */ /* BlueNRG-LP OTA firmware upgrade support for higher application memory map +-----------------------+ 0x2000FFFF | RAM (64K) | +-----------------------+ 0x20000000 | | | | +-----------------------+ 0x10080000 | | | NVM(4K) | +-----------------------+ 0x1007E800 | | | Higher app (124K) | +-----------------------+ 0x1005F800 | | | Lower app (124K) | +-----------------------| 0x10040800 | Reset Manager (2K) | +-----------------------+ 0x10040000 | | +-----------------------| 0x100017FF | ROM (6K) | +-----------------------+ 0x10000000 */ if( !isdefinedsymbol( RESET_MANAGER_SIZE) ) { define symbol RESET_MANAGER_SIZE = (0x800); } /* Divide remaining space by 2 and round to the sector boundary. */ define symbol MEMORY_FLASH_APP_SIZE = (((_MEMORY_FLASH_SIZE_ - RESET_MANAGER_SIZE - FLASH_NVM_DATASIZE)/2)/2048)*2048; define symbol MEMORY_FLASH_APP_OFFSET = (RESET_MANAGER_SIZE + MEMORY_FLASH_APP_SIZE); } else if ( isdefinedsymbol(CONFIG_OTA_LOWER) ) { /* This configuration is intended for application supporting OTA firmware upgrade with 2-app scheme (app in the lower part of memory map) */ /* BlueNRG-LP OTA firmware upgrade support for lower application memory map +-----------------------+ 0x2000FFFF | RAM (64K) | +-----------------------+ 0x20000000 | | | | +-----------------------+ 0x10080000 | | | NVM(4K) | +-----------------------+ 0x1007E800 | | | Higher app (124K) | +-----------------------+ 0x1005F800 | | | Lower app (124K) | +-----------------------| 0x10040800 | Reset Manager (2K) | +-----------------------+ 0x10040000 | | +-----------------------| 0x100017FF | ROM (6K) | +-----------------------+ 0x10000000 */ if( !isdefinedsymbol( RESET_MANAGER_SIZE) ) { define symbol RESET_MANAGER_SIZE = (0x800); } define symbol MEMORY_FLASH_APP_SIZE = (((_MEMORY_FLASH_SIZE_ - RESET_MANAGER_SIZE - FLASH_NVM_DATASIZE)/2)/2048)*2048; define symbol MEMORY_FLASH_APP_OFFSET = (RESET_MANAGER_SIZE); } else if ( isdefinedsymbol(CONFIG_OTA_USE_SERVICE_MANAGER) ) { /* This configuration is intended for application supporting OTA firmware upgrade with independent OTA firmware upgrade service manager (app in the upper part of memory map) */ /* BlueNRG-LP OTA firmware upgrade support for service manager application memory map +-----------------------+ 0x2000FFFF | RAM (64K) | +-----------------------+ 0x20000000 | | | | +-----------------------+ 0x10080000 | | | NVM(4K) | +-----------------------+ 0x1007F000 | | | User app (158K) | +-----------------------+ 0x10057800 | OTA Service | | Manager (94K) | +-----------------------+ 0x10040000 | | +-----------------------| 0x100017FF | ROM (6K) | +-----------------------+ 0x10000000 */ if( !isdefinedsymbol( SERVICE_MANAGER_SIZE) ) { define symbol SERVICE_MANAGER_SIZE = (0x17800); /* Including OTA firmware upgrade service manager application */ } define symbol MEMORY_FLASH_APP_SIZE = (_MEMORY_FLASH_SIZE_ - SERVICE_MANAGER_SIZE - FLASH_NVM_DATASIZE); define symbol MEMORY_FLASH_APP_OFFSET = (SERVICE_MANAGER_SIZE); } else { /* This configuration is intended for application not supporting OTA firmware upgrade */ /* BlueNRG-LP standard application memory map +-----------------------+ 0x2000FFFF | RAM (64K) | +-----------------------+ 0x20000000 | | | | +-----------------------+ 0x10080000 | | | NVM(4K) | +-----------------------+ 0x1007F000 | | | User app (252K) | +-----------------------+ 0x10040000 | | +-----------------------| 0x100017FF | ROM (6K) | +-----------------------+ 0x10000000 */ if( !isdefinedsymbol( MEMORY_FLASH_APP_OFFSET) ) { define symbol MEMORY_FLASH_APP_OFFSET = 0; } if( !isdefinedsymbol( MEMORY_FLASH_APP_SIZE) ) { define symbol MEMORY_FLASH_APP_SIZE = (_MEMORY_FLASH_SIZE_ - FLASH_NVM_DATASIZE - MEMORY_FLASH_APP_OFFSET); } } /******************************************************************************* * Memory Definitions *******************************************************************************/ define memory mem with size = 4G; /* This is mandatory for the IAR linker. */ /* It creates a memory space "mem" with */ /* 4 gigabytes. 32-bit data bus always */ /* means 4G memory space. */ /* region definitions */ define region REGION_RAM = mem:[from _MEMORY_RAM_BEGIN_ + MEMORY_RAM_APP_OFFSET to _MEMORY_RAM_END_]; define region REGION_FLASH_BOOTLOADER = mem:[from _MEMORY_FLASH_BEGIN_ to _MEMORY_FLASH_BEGIN_ + MEMORY_FLASH_APP_OFFSET]; define region REGION_FLASH = mem:[from _MEMORY_FLASH_BEGIN_ + MEMORY_FLASH_APP_OFFSET to _MEMORY_FLASH_BEGIN_ + MEMORY_FLASH_APP_OFFSET + MEMORY_FLASH_APP_SIZE - 1]; define region REGION_FLASH_NVM = mem:[from _MEMORY_FLASH_END_- FLASH_NVM_DATASIZE + 1 to _MEMORY_FLASH_END_]; define region REGION_ROM = mem:[from _MEMORY_ROM_BEGIN_ to _MEMORY_ROM_END_]; /******************************************************************************* * BlueNRG-LP STACK Sections *******************************************************************************/ define block BLUE with alignment = 8 { section .bss.__blue_RAM}; // Radio Global configuration data keep {section .bss.__blue_RAM}; place at address mem: 0x200000C0 { block BLUE, }; /******************************************************************************* * FLASH Sections *******************************************************************************/ place at start of REGION_FLASH_BOOTLOADER { readonly section .bootloader}; place at start of REGION_FLASH { readonly section .intvec }; keep {section .intvec}; /******************************************************************************* * RAM Sections *******************************************************************************/ define block CSTACK with alignment = 8, size = 0xC00 { }; do not initialize { section CSTACK }; define block HEAP with alignment = 8, size = 12288 { }; do not initialize { section HEAP }; initialize by copy { readwrite }; do not initialize {section .noinit}; /* RAM VR Block */ define block ram_vr_block with alignment = 4 { section .ram_vr}; keep {section .ram_vr}; place at address mem: 0x20000004 { block ram_vr_block, }; /* Crash Handler Storage Information Block */ define symbol CRASH_RAM_SIZE = 40; define block crash_info_ram_vr_block with alignment = 4, size = CRASH_RAM_SIZE { section .crash_info_ram_vr}; keep {section .crash_info_ram_vr}; do not initialize {section .crash_info_ram_vr}; place at address mem: 0x20000034 { block crash_info_ram_vr_block, }; /******************************************************************************* * Sections placement *******************************************************************************/ place in REGION_FLASH { readonly }; place in REGION_RAM { readwrite }; place at end of REGION_RAM {block CSTACK }; place in REGION_RAM {block HEAP }; /******************************************************************************* * End of File *******************************************************************************/