This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

[参考译文] LP-AM263:用于外部应用的 AM263链接器和启动文件示例

Guru**** 1828310 points
请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

https://e2e.ti.com/support/processors-group/processors/f/processors-forum/1243929/lp-am263-am263-linker-and-startup-file-examples-for-external-application

器件型号:LP-AM263

您好!

我想知道如何正确配置启动序列、链接和引导应用、通过通信接口(UART、ETH 等)将应用加载到 RAM 中

对于我的用例、我希望实施自定义引导加载程序、以便能够将应用程序直接加载到 RAM、并跳转到应用程序入口点。

我更改了链接器并将应用的入口点移到了0x701B0000、以便可以从该地址加载 hello world 应用。 "hello world"应用程序会启动并正常工作、但一旦触发中断、便会崩溃。

因为我理解向量表出了问题、无法找到如何正确配置这些表的信息。 请指导我如何为本例配置启动序列和设置矢量表。

期待回复

/* This is the stack that is used by code running within main()
 * In case of NORTOS,
 * - This means all the code outside of ISR uses this stack
 * In case of FreeRTOS
 * - This means all the code until vTaskStartScheduler() is called in main()
 *   uses this stack.
 * - After vTaskStartScheduler() each task created in FreeRTOS has its own stack
 */
--stack_size=16384
/* This is the heap size for malloc() API in NORTOS and FreeRTOS
 * This is also the heap used by pvPortMalloc in FreeRTOS
 */
--heap_size=32768
-e_vectors  /* This is the entry of the application, _vector MUST be plabed starting address 0x0 */

/* This is the size of stack when R5 is in IRQ mode
 * In NORTOS,
 * - Here interrupt nesting is enabled
 * - This is the stack used by ISRs registered as type IRQ
 * In FreeRTOS,
 * - Here interrupt nesting is enabled
 * - This is stack that is used initally when a IRQ is received
 * - But then the mode is switched to SVC mode and SVC stack is used for all user ISR callbacks
 * - Hence in FreeRTOS, IRQ stack size is less and SVC stack size is more
 */
__IRQ_STACK_SIZE = 256;
/* This is the size of stack when R5 is in IRQ mode
 * - In both NORTOS and FreeRTOS nesting is disabled for FIQ
 */
__FIQ_STACK_SIZE = 256;
__SVC_STACK_SIZE = 4096; /* This is the size of stack when R5 is in SVC mode */
__ABORT_STACK_SIZE = 256;  /* This is the size of stack when R5 is in ABORT mode */
__UNDEFINED_STACK_SIZE = 256;  /* This is the size of stack when R5 is in UNDEF mode */

SECTIONS
{
    /* This has the R5F boot code until MPU is enabled,  this MUST be at a address < 0x80000000
     * i.e this cannot be placed in DDR
     */
    GROUP {
    	.vectors:{} palign(8)
        .text.hwi: palign(8)
        .text.cache: palign(8)
        .text.mpu: palign(8)
        .text.boot: palign(8)
        .text:abort: palign(8) /* this helps in loading symbols when using XIP mode */
        .text:   {} palign(8)   /* This is where code resides */
        .rodata: {} palign(8)   /* This is where const's go */

        .data:   {} palign(8)   /* This is where initialized globals and static go */
        .bss:    {} palign(8)   /* This is where uninitialized globals go */
        RUN_START(__BSS_START)
        RUN_END(__BSS_END)
        .sysmem: {} palign(8)   /* This is where the malloc heap goes */
        .stack:  {} palign(8)   /* This is where the main() stack goes */
        .irqstack: {. = . + __IRQ_STACK_SIZE;} align(8)
        RUN_START(__IRQ_STACK_START)
        RUN_END(__IRQ_STACK_END)
        .fiqstack: {. = . + __FIQ_STACK_SIZE;} align(8)
        RUN_START(__FIQ_STACK_START)
        RUN_END(__FIQ_STACK_END)
        .svcstack: {. = . + __SVC_STACK_SIZE;} align(8)
        RUN_START(__SVC_STACK_START)
        RUN_END(__SVC_STACK_END)
        .abortstack: {. = . + __ABORT_STACK_SIZE;} align(8)
        RUN_START(__ABORT_STACK_START)
        RUN_END(__ABORT_STACK_END)
        .undefinedstack: {. = . + __UNDEFINED_STACK_SIZE;} align(8)
        RUN_START(__UNDEFINED_STACK_START)
        RUN_END(__UNDEFINED_STACK_END)
        .ARM.exidx:  {} palign(8)   /* Needed for C++ exception handling */
        .init_array: {} palign(8)   /* Contains function pointers called before main */
        .fini_array: {} palign(8)   /* Contains function pointers called after main */
    } > OCRAM

}

MEMORY
{
    /*R5F_VECS  : ORIGIN = 0x701B0000 , LENGTH = 0x00000040*/
    /*R5F_TCMA  : ORIGIN = 0x00000040 , LENGTH = 0x00007FC0*/
    /*R5F_TCMB  : ORIGIN = 0x00080000 , LENGTH = 0x00008000*/

    /* when using multi-core application's i.e more than one R5F/M4F active, make sure
     * this memory does not overlap with other R5F's
     */

    OCRAM     : ORIGIN = 0x701B0000 , LENGTH = 0x40000

    /* This section can be used to put XIP section of the application in flash, make sure this does not overlap with
     * other CPUs. Also make sure to add a MPU entry for this section and mark it as cached and code executable
     */
    FLASH     : ORIGIN = 0x60100000 , LENGTH = 0x80000


    }

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    尊敬的 Artem:

    AM263x 引导加载包含两个步骤:ROM 引导加载(RBL)、次级引导加载(SBL)、然后是应用程序(appImage)。 有关详细信息、请参阅以下 URL:  

    AM263x MCU+ SDK:了解引导流程和引导加载程序(TI.com)

    SBL_QSPI 是需要重点介绍的主器件。

    如果您更关心 appImage 的链接器命令文件、那么 MCU+ SDK 中的任何示例(例如 hello_world、empty 等)都可以作为一个不错的参考。

    此致、

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    您好!  

    由于无法更改 QSPI 闪存内容或触发热复位、因此我需要跳过 ROM 和 SBL 序列。  

    在本例中、我需要将临时应用程序加载到 RAM 部分并跳转到入口点。  

    请告诉我、在 AM263x 上是否可以实现

    此致、  

    阿尔特姆

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    尊敬的 Artem:

    如果只想加载并运行应用程序(*。out 文件)、则将 AM263x CC 或 LP 设置为 NOBOOT 模式。 使用 CCS 目标配置文件连接到 R5F 内核、然后加载并运行应用程序。

      有关如何创建 CCS 目标配置文件的详细信息、请参阅 URL:AM263x MCU+ SDK:下载、安装和设置 CCS (TI.com)。

    此致、

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    您好!
    我不确定您是否理解了我的问题。

    我想通过以太网接口上传 RAM 区域中应用的二进制文件、然后在不执行复位或引导流程的情况下跳转到入口点。

    我现在遇到的问题是、异常中断(PendSV)使我的应用程序崩溃。 该问题与我尝试从以太网上传的应用程序的启动序列有关、根据我的理解、矢量表加载不正确。

    请告诉我如何将矢量表从地址0x00000000重新定位到我的自定义地址、以及如何为我的 RAM 应用正确配置链接器脚本

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    尊敬的 Artem:

    根据 ARM Cortex R5F TRM:

    向量表位于0x0或0xff0000处、在复位时由引脚定义、并反映在 SCTLR 的 V 位中:
    https://developer.arm.com/documentation/den0042/a/ARM-Processor-modes-and-Registers/Registers/System-Control-Register--SCTLR-

    如果 TCM 位于0x0并且 V 位为0、那么是的、您可以将矢量表放在这里(这是一种很常见的情况)。 您可能有一个从0xFFFF0000开始的复位行为、然后启用和初始化 TCM、再清除 V 位来启用后续的异常以便在 TCM 中处理。

    我认为、对于 AM263x、中断矢量表必须位于 ATCM 0x00000000处。

    有关详细信息、请参阅以下 URL:

    R5:异常矢量表是否位于 TCM 中、如果地址是0x0000 0000 -架构和处理器论坛-支持论坛- Arm 社区

    我是否可以知道您必须将中断矢量表位置更改为 0x701B0000的原因?

    此致、

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    您好! 我想解释一下我的用例。

    我有 应用 驻留在外部闪存内、并通过  RBL 作为任何常规应用程序引导。
    为  应用 可以下载  外部  应用程序 二进制文件 进入0x701B0000存储器区域、并执行该应用程序跳转到入口点。 的矢量表  外部  应用  位于 0x701B0000 存储器的开头(请参阅上面随附的链接器文件)。 我需要一个解决方案来正确配置矢量表和  外部 应用程序

    请注意、在任何应用的启动流程中、我无法修改外部闪存内容

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    尊敬的 Artem:

    您可以将外部应用的中断矢量表放在0x00000000 (TCMA)位置、因为当主应用跳转到外部应用的入口点时、主应用的中断矢量表毫无用处。 此后、控制权从主应用程序传递给外部应用程序。

    MCU+ SDK 中的示例是 SBL_QSPI (您的主应用程序)和 hello_world (您的外部应用程序)。 它们都将中断矢量表放在同一个0x00000000处、因为 SBL_QSPI 会将 hello_world 加载到 RAM 中并将控制权传递给 hello_world。

    此致、