工具与软件:
你(们)好
我将一些软件移植到该 MCU、并且在我将结构清零时 MCU 抛出硬故障异常存在问题。
我在尝试找出导致问题的原因后有点迷路。 但我怀疑问题可能出在链接器文件中。
我使用 IAR 9.50和 Ozone 作为 调试器、这是例外情况

链接脚本如下:
/************** MEMORY MAP ******************************************/
/* _________________________________________________________________*/
/*| Non Main BSL |0x41C0 017F (128B)*/
/*|____________________________________|0x41C0 0100_________________*/
/*: : */
/*| Non Main BCR |0x41C0 007F */
/*|____________________________________|0x41C0 0000_________________*/
/*: : */
/*:____________________________________: _________________*/
/*| Stack, Heap, Static data |0x2020 7FFF RAM (32K) */
/*| | */
/*|____________________________________|0x2020 1650_________________*/
/*| Class B (size 0xe00) | */
/*|____________________________________|0x2020 0850_________________*/
/*| RUNTIME_CHK_BUF (0x20) | */
/*|____________________________________|0x2020 0830_________________*/
/*| CSTACK (0x800 + 0x10) | */
/*|____________________________________|0x2020 0020_________________*/
/*| Common RAM (0x20) | */
/*|____________________________________|0x2020 0000_________________*/
/*: : */
/*:____________________________________: _________________*/
/*| HwInfo |0x0001 FFFF (1K) */
/*|____________________________________|0x0001 FC00_________________*/
/*| Settings |0x0001 FBFF (2K) */
/*| | */
/*|____________________________________|0x0001 F400_________________*/
/*| Boot Config |0x0001 F3FF (85K) */
/*| (256B) | : */
/*|____________________________________|0x0001 F300 : */
/*| Application code | : */
/*|____________________________________| : */
/*| Common const for Applic | : */
/*| (version info) (568B) | : */
/*|____________________________________|0x0000 A300 : */
/*| Int vectors for Applic | */
/*|____________________________________|0x0000 A000_________________*/
/*| Boot code |0x0000 9FFF (40K) */
/*|____________________________________| */
/*| Common const for Boot | */
/*| (version info) (568B) | */
/*|____________________________________|0x0000 0300 */
/*| Int vectors for Boot | */
/*|____________________________________|0x0000 0000_________________*/
/*--- Specials ---*/
/* Offset to start of code for application */
define symbol __application_displacement__ = 0x0a000;
/* Offset to start of const data area for application (available also from boot) */
define symbol __common_const_displacement__ = 0x00300;
/* Size of common Ram area for boot and application */
define symbol __size_common_ram__ = 0x00020;
/* size_classBdata_ram */
define symbol __size_classBdata_ram__ = 0x00e00;
/* Absolute address for start of interrupt vector table */
define symbol __intvec_start__ = 0x0a000;
/* Absolute address to area with constants for boot for access from both appl and boot */
define symbol __common_const_appl_start__ = 0x0a300;
/* Size of boot configuration area located at end of a App address space */
define symbol __size_bootconfig__ = 0x00100;
/*-Sizes-*/
define symbol __size_proc_stack__ = 0x0000;
define symbol __size_cstack__ = 0x400;
define symbol __size_heap__ = 0x800;
define symbol __size_stack_bottom__ = 0x10;
/*-Memory Regions-*/
define symbol __region_ROM_start__ = 0x00000000;
define symbol __region_ROM_end__ = 0x0001FFFF;
define symbol __region_RAM_start__ = 0x20200000;
define symbol __region_RAM_end__ = 0x20207FFF;
define symbol __region_RAM_stack_start__ = __region_RAM_start__ + __size_common_ram__;
define symbol __region_RAM_stack_end__ = __region_RAM_stack_start__ + __size_cstack__ + __size_stack_bottom__ - 1;
define symbol __region_RUN_TIME_CHK_BUF_start__ = __region_RAM_stack_end__ + 1;
define symbol __region_RUN_TIME_CHK_BUF_end__ = __region_RUN_TIME_CHK_BUF_start__ + 32 - 1; // Size (6+2)*4 bytes
define symbol __region_CLASSB_start__ = __region_RUN_TIME_CHK_BUF_end__ + 4 + 1; // 4 bytes because RAM check operates 4 bytes before CLASSB RAM area.
define symbol __region_CLASSB_end__ = __region_CLASSB_start__ + __size_classBdata_ram__ - 1;
define symbol __region_NON_MAIN_BCR_start__ = 0x41C00000;
define symbol __region_NON_MAIN_BCR_end__ = 0x41C0007F;
define symbol __region_NON_MAIN_BSL_start__ = 0x41C00100;
define symbol __region_NON_MAIN_BSL_end__ = 0x41C0017F;
define symbol __region_application_end__ = __region_ROM_end__ - __size_bootconfig__;
define symbol __region_BootConf_start__ = __region_application_end__ + 1; // Start on the first address after application end
/* Reserved space in iar.dynexit for calls at exit */
define symbol __iar_maximum_atexit_calls = 3;
export symbol __region_ROM_start__;
export symbol __region_ROM_end__;
export symbol __region_RAM_start__;
export symbol __region_RAM_end__;
export symbol __region_CLASSB_start__;
export symbol __region_CLASSB_end__;
export symbol __region_BootConf_start__;
define memory mem with size = 4G;
define region ROM_region = mem:[from __region_ROM_start__ to __region_ROM_end__];
define region BOOT_CONFIG_region = mem:[from __region_BootConf_start__ to __region_ROM_end__ ]; // Boot config region/area
define region RAM_stack_region = mem:[from __region_RAM_stack_start__ to __region_RAM_stack_end__];
define region RUN_TIME_CHK_BUF_region = mem:[from __region_RUN_TIME_CHK_BUF_start__ to __region_RUN_TIME_CHK_BUF_end__];
define region CLASS_B_RAM_region = mem:[from __region_CLASSB_start__ to __region_CLASSB_end__];
define region RAM_region = mem:[from __region_RAM_start__ to __region_RAM_end__];
define region NON_MAIN_BCR_region = mem:[from __region_NON_MAIN_BCR_start__ to __region_NON_MAIN_BCR_end__];
define region NON_MAIN_BSL_region = mem:[from __region_NON_MAIN_BSL_start__ to __region_NON_MAIN_BSL_end__];
initialize by copy { readwrite };
do not initialize { section .noinit, section STACK_BOTTOM, section RUN_TIME_RAM_BUF, section CLASS_B_RAM};
// placements #############################
place at address mem:__intvec_start__ { readonly section .intvec };
place at address mem:__common_const_appl_start__ { readonly section .CommonConst };
// Create an 8-byte end-aligned block and put all read-only sections in it
define block ALIGNED_ROM with end alignment = 8 { readonly };
place in ROM_region { block ALIGNED_ROM };
define block CSTACK with alignment = 8, size = __size_cstack__ { };
define block PROC_STACK with alignment = 8, size = __size_proc_stack__ { };
define block HEAP with alignment = 8, size = __size_heap__ { };
place in RAM_region { readwrite, block PROC_STACK, block HEAP };
define block STACK_BOTTOM_B with alignment = 8, size = __size_stack_bottom__ { section STACK_BOTTOM };
define block stack_order with fixed order { block STACK_BOTTOM_B, block CSTACK };
place in RAM_stack_region { block stack_order };
place in CLASS_B_RAM_region { readwrite data section CLASS_B_RAM, section CLASS_B_RAM_REV };
place in RUN_TIME_CHK_BUF_region { readwrite data section RUN_TIME_RAM_BUF };
place in NON_MAIN_BCR_region { section .BCRConfig };
place in NON_MAIN_BSL_region { section .BSLConfig };
