Cortex-M器件非0x00起始地址SWD调试失败问题咨询
问题描述
我之前用IAR IDE开发过多款Cortex-M器件,现在在用基于Eclipse的Infineon ModusToolbox开发Cortex-M0+项目。想把应用程序部署在Flash的非0x00地址(后续0x00地址将存放Bootloader),本次设置为0x00001000,已经修改链接脚本匹配该配置。从映射文件来看,复位向量已正确映射到新的Flash起始地址,但通过SWD进行调试时却失败了。
厂商表示ARM核器件无法从非0x00地址启动调试,但我99%确信此前完成过相同操作。我是不是记错了?程序计数器初始值不应该始终被设置为复位向量的地址吗?还是需要额外的调试指令?
补充内容:链接脚本与源码
链接脚本 cy8c4xx9.ld
//** file cy8c4xx9.ld * \version 1.10.1 *****************************************************************/ OUTPUT_FORMAT ("elf32-littlearm", "elf32-bigarm", "elf32-littlearm") SEARCH_DIR(.) GROUP(-lgcc -lc -lnosys) /*--------------------- Flash Configuration ---------------------------------- ; <h> Flash Configuration ; <o0> Flash Base Address <0x0-0xFFFFFFFF:8> ; <o1> Flash Size (in Bytes) <0x0-0xFFFFFFFF:8> ; </h> -----------------------------------------------------------------------------*/ __FLASH_START = 0x00000000; __FLASH_SIZE = 0x00060000; /*--------------------- Embedded RAM Configuration --------------------------- ; <h> RAM Configuration ; <o0> RAM Base Address <0x0-0xFFFFFFFF:8> ; <o1> RAM Size (in Bytes) <0x0-0xFFFFFFFF:8> ; </h> -----------------------------------------------------------------------------*/ __RAM_START = 0x20000000; __RAM_SIZE = 0x00008000; /*--------------------- Stack Configuration ---------------------------------- ; <h> Stack Configuration ; <o0> Stack Size (in Bytes) <0x0-0xFFFFFFFF:8> ; </h> -----------------------------------------------------------------------------*/ __STACK_SIZE = 0x00000400; __HEAP_SIZE = 0x00000080; /* The MEMORY section below describes the location and size of blocks of memory in the target. * Use this section to specify the memory regions available for allocation. */ MEMORY { /* The ram and flash regions control RAM and flash memory allocation. * You can change the memory allocation by editing the 'ram' and 'flash' regions. */ FLASH_Application (rx) : ORIGIN = 0x00001000, LENGTH = __FLASH_SIZE - 0x00001000 RAM (rwx) : ORIGIN = __RAM_START, LENGTH = __RAM_SIZE flash_boot_meta (rw) : ORIGIN = 0x0005FA00, LENGTH = 0x100 } /* * DFU SDK specific: aliases regions, so the rest of code does not use * application specific memory region names */ REGION_ALIAS("FLASH", FLASH_Application); /* DFU SDK specific: sets an app Id */ __cy_app_id = 1; CY_APPL_ORIGIN = 0; CY_FLASH_ROW_SIZE = 256; CY_APPL_NUM = 1; CY_APPL_MAX = 1; CY_METADATA_SIZE = 64; CY_APPL_LOADABLE = 1; CY_CHECKSUM_EXCLUDE_SIZE = ALIGN(0, CY_FLASH_ROW_SIZE); CY_APP_FOR_STACK_AND_COPIER = 0; APPL_STACK_SIZE = 0x0c00; APPL_HEAP_SIZE = 0x0000; /* Linker script to place sections and symbol values. Should be used together * with other linker script that defines memory regions FLASH and RAM. * It references following symbols, which must be defined in code: * Reset_Handler : Entry of reset handler * * It define ssymbols, which code can use without definition*/ ENTRY(Reset_Handler) SECTIONS { .cy_app_header : { KEEP(*(.cy_app_header)) } > FLASH .text : { . = ALIGN(4); KEEP(*(.vectors)) . = ALIGN(4); __end__ = .;
示例代码
#include "cy_pdl.h" #include "cybsp.h" #define LED_DELAY_MS (500u) #define CY_ASSERT_FAILED (0u) #define APP_ORIGIN 0x00001000 /*Function Name: main*/ int main(void) { SCB->VTOR = (uint32_t)APP_ORIGIN; __set_MSP(*(volatile uint32_t*)APP_ORIGIN); cy_rslt_t result; /* Initialize the device and board peripherals */ result = cybsp_init(); /* Board init failed. Stop program execution */ if (result != CY_RSLT_SUCCESS) { CY_ASSERT(CY_ASSERT_FAILED); } /* Enable global interrupts */ __enable_irq(); for(;;) { /* Toggle the user LED state */ //Cy_GPIO_Inv(CYBSP_USER_LED_PORT, CYBSP_USER_LED_PIN); /* Wait for 0.5 seconds */ Cy_SysLib_Delay(LED_DELAY_MS); } }
内容的提问来源于stack exchange,提问作者nobby
相关产品推荐
相关产品推荐

