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.

[参考译文] AM6548:R5F 应用开发

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

https://e2e.ti.com/support/processors-group/processors/f/processors-forum/1508230/am6548-r5f-application-development

器件型号:AM6548

工具/软件:

您好、

我正在尝试在 AM6548的 R5F 内核上开发裸机应用、从而帮助我利用安全特性。 我在 E2E 上看到有人提问的帖子、但我还没有看到关于如何做到这一点的明确详细信息。

我安装了 CCS、随附处理器开发套件和 MCU+ SDK。 我能够使用不同的编译器编译 R5F C 程序。 我的目标是在 U-Boot 中使用 rproc 将固件加载到 R5F 内核中、并以这种方式运行裸机应用。 每当我尝试加载.elf/.out 可执行文件时、U-Boot 都会冻结。 我尝试了为3种不同的编译器编译:TI、CLANG 和 GNU。 在 R5F CCS 工程的属性中、我尝试添加 AM65x 的链接器命令文件、但出现错误、例如"HEAPSIZE"未定义。  

我能够让 C 程序通过我 AM65 IDK 系统的 R 内核上的 XDS110调试器运行、但我需要该程序才能从 U-Boot 运行。

我不确定还要尝试什么、以及可执行文件冻结 U-Boot 的原因。  

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

    您好 AKM、

    设定支持期望

    首先、请注意、我们对 AM65x R5F 内核的软件支持有限。 有关更多详细信息、请参阅此主题:
    https://e2e.ti.com/support/processors-group/processors/f/processors-forum/1402124/am6548-how-to-develop-applications-for-the-mcu-r5f-cores/5368606#5368606

    您可以在版本说明中查看 AM65x MCU+ SDK 中支持的软件驱动程序:
    https://software-dl.ti.com/mcu-plus-sdk/esd/AM65X/09_01_00_04/docs/api_guide_am65x/RELEASE_NOTES_09_01_00_PAGE.html

    如果您希望获得 TI 提供的带有其他驱动程序或特性的软件支持、我建议您评估另一款器件、以了解它是否适用于您的用例(如 AM64x)。 如果需要、我们可以帮助进行处理器选择。

    谈一谈您的实际问题  

    您使用的是哪个版本的 Linux SDK/ U-Boot?

    此致、

    Nick

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

    感谢您的支持提醒。

    我同时使用7.03.*和9.01.*

    您知道如何正确构建 R5F 应用吗?

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

    您好 AKM、

    构建步骤

    我通常使用 makefile 来构建 R5F 应用程序(因为我经常对 Linux 进行编程、所以我通常在终端中)。 但是、若要在 CCS 或使用 Makefile 进行编译、我建议按照 MCU+ SDK 入门文档中的步骤进行操作。

    从此处开始、并确保安装了所有工具的正确版本:
    https://software-dl.ti.com/mcu-plus-sdk/esd/AM65X/09_01_00_04/docs/api_guide_am65x/GETTING_STARTED.html

    此页面包含从 CCS 和 Makefile 构建工程的说明。 还有一些链接指向包含更多详细信息的页面(将 SDK 与 CCS Projects/Makefile 配合使用): https://software-dl.ti.com/mcu-plus-sdk/esd/AM65X/09_01_00_04/docs/api_guide_am65x/GETTING_STARTED_BUILD.html

    从已知良好的示例开始  

    您是否从可以编译、加载和运行的"已知良好"示例开始? 这使得一次改变一件事和测试变得容易得多,然后在事情发生故障时向后工作。

    此致、

    Nick

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

    您好、Nick、

    我能够得到一个项目进行编译。 我还能够将可执行文件加载到 R 内核中。 但是、我不确定它是否正常运行。 我使用的链接器脚本可能不一定正确。 您能帮您验证一下吗?

    下面是我正在使用的 lds 文件、我添加了带有"AKM"的行。 我使用 GNU 编译器进行编译并生成.elf 文件。  

    /****************************************************************************/
    /*  AM65x.lds                                                               */
    /*  Copyright (c) 2018  Texas Instruments Incorporated                      */
    /*  Author: Rafael de Souza                                                 */
    /*                                                                          */
    /*    Description: This file is a sample linker command file that can be    */
    /*                 used for linking programs built with the GCC compiler    */
    /*                 and running the resulting .out file on a AM65x device.   */
    /*                 Use it as a guideline.  You will want to                 */
    /*                 change the memory layout to match your specific          */
    /*                 target system.  You may want to change the allocation    */
    /*                 scheme according to the size of your program.            */
    /*                                                                          */
    /****************************************************************************/
    
    STACKSIZE = 0x2000; /* akm */
    HEAPSIZE = 0x1000; /* akm */
    Entry = 0x90000000; /* akm */
    
    MEMORY
    {
    
        MSMC_SRAM1 :  o = 0x70000000,  l = 0x00100000  /* 1MB L3 MSMC with ECC SRAM1 */
        MSMC_SRAM2 :  o = 0x70100000,  l = 0x00100000  /* 1MB L3 MSMC with ECC SRAM2 */
        /*DDR0 :        o = 0x80000000,  l = 0x40000000  /* 1GB external DDR Bank 0 */
        /*DDR1 :        o = 0xC0000000,  l = 0x40000000  /* 1GB external DDR Bank 1 */
        DDR0 :        o = 0x80000000,  l = 0x80000000  /* akm 2GB external DDR Bank 0 */
        DDR1 :        o = 0x880000000,  l = 0x80000000  /* akm 2GB external DDR Bank 1 */
    }
    
    /* Linker script to place sections and symbol values. Should be used together
     * with other linker script that defines memory region DDR0.
     * It references following symbols, which must be defined in code:
     *   Entry : Entry of reset handler
     * 
     * It defines following symbols, which code can use without definition:
     *   __exidx_start
     *   __exidx_end
     *   __etext
     *   __data_start__
     *   __preinit_array_start
     *   __preinit_array_end
     *   __init_array_start
     *   __init_array_end
     *   __fini_array_start
     *   __fini_array_end
     *   __data_end__
     *   __bss_start__
     *   __bss_end__
     *   __end__
     *   end
     *   __HeapLimit
     *   __HeapBase     - To be compatible with Linaro's semihosting support 
     *   __StackLimit
     *   __StackTop
     *   __StackBase    - To be compatible with Linaro's semihosting support 
     *   __stack
     */
    ENTRY(Entry)
    
    SECTIONS
    {
        .rsthand :
        {
            . = ALIGN(0x10000);
            KEEP(*(.isr_vector))
            *startup_ARMCA53.o (.text)
        } > MSMC_SRAM1
        
        . = ALIGN(4);
        .text :
        {
            *(.text*)
    
            KEEP(*(.init))
            KEEP(*(.fini))
    
            /* .ctors */
            *crtbegin.o(.ctors)
            *crtbegin?.o(.ctors)
            *(EXCLUDE_FILE(*crtend?.o *crtend.o) .ctors)
            *(SORT(.ctors.*))
            *(.ctors)
    
            /* .dtors */
             *crtbegin.o(.dtors)
             *crtbegin?.o(.dtors)
             *(EXCLUDE_FILE(*crtend?.o *crtend.o) .dtors)
             *(SORT(.dtors.*))
             *(.dtors)
    
            *(.rodata*)
    
            KEEP(*(.eh_frame*))
        } > MSMC_SRAM1
    
        .ARM.extab : 
        {
            *(.ARM.extab* .gnu.linkonce.armextab.*)
        } > MSMC_SRAM1
    
        __exidx_start = .;
        .ARM.exidx :
        {
            *(.ARM.exidx* .gnu.linkonce.armexidx.*)
        } > MSMC_SRAM1
        __exidx_end = .;
    
            
        .data :
        {
            . = ALIGN(4);
            __data_start__ = .;
            *(vtable)
            *(.data*)
    
            . = ALIGN(4);
            /* preinit data */
            PROVIDE_HIDDEN (__preinit_array_start = .);
            KEEP(*(.preinit_array))
            PROVIDE_HIDDEN (__preinit_array_end = .);
    
            . = ALIGN(4);
            /* init data */
            PROVIDE_HIDDEN (__init_array_start = .);
            KEEP(*(SORT(.init_array.*)))
            KEEP(*(.init_array))
            PROVIDE_HIDDEN (__init_array_end = .);
    
    
            . = ALIGN(4);
            /* finit data */
            PROVIDE_HIDDEN (__fini_array_start = .);
            KEEP(*(SORT(.fini_array.*)))
            KEEP(*(.fini_array))
            PROVIDE_HIDDEN (__fini_array_end = .);
    
            . = ALIGN(4);
            /* All data end */
            __data_end__ = .;
    
        } > MSMC_SRAM1
    
        .bss :
        {
            . = ALIGN(4);
            __bss_start__ = .;
            *(.bss*)
            *(COMMON)
            __bss_end__ = .;
        } > MSMC_SRAM1
        
        .heap (NOLOAD):
        {
            /* The line below can be used to FILL the memory with a known value and
             * debug any stack overruns. For this to work, the specifier (NOLOAD) above 
             * must be removed at the expense of an increase in the output binary size */
            FILL(0xDEADBEEF)
            . = ALIGN(16);
            __end__ = .;
            end = __end__;
            /* The line below created to be compatible with Linaro's semihosting support */
            __HeapBase = __end__; 
            *(.heap*)
            . = . + HEAPSIZE;
            __HeapLimit = .; 
        } > MSMC_SRAM1
    
        /* .stack section doesn't contain any symbols. It is only
         * used for linker to calculate size of stack sections, and assign
         * values to stack symbols later */
        .stack (NOLOAD):
        {
            /* The line below can be used to FILL the memory with a known value and
             * debug any stack overruns. For this to work, the specifier (NOLOAD) above 
             * must be removed at the expense of an increase in the output binary size */
            FILL(0xBAD0BAD0)
            . = ALIGN(16);
            __StackLimit = . ;
            *(.stack*)
            . = . + STACKSIZE;
            __StackTop = . ;
            /* The line below created to be compatible with Linaro's semihosting support */
            __StackBase = . ;
        } > MSMC_SRAM1
        PROVIDE(__stack = __StackTop);
    
    }
    /**************************************************************************/
    

    这是要在 R core 上运行的 C 程序。 我尝试切换 GPIO 以使 LED 闪烁。 我知道引脚可以正常工作、因为我可以在 U-Boot 中切换它、并且使用相同的地址。 R core 是否可以访问这些区域?

    //#include <stdio.h>
    #include <stdio.h>
    //#include <kernel/dpl/DebugP.h>
    //#include "ti_drivers_config.h"
    //#include "ti_drivers_open_close.h"
    //#include "ti_board_open_close.h"
    
    /**
     * hello.c
     */
    
    
    #define CTRLMMR_PADCONFIG114    (0x0011C1C8)
    #define GPIO1_DIR01             (0x00601010)
    #define GPIO1_OUT_DATA01        (0x00601014)
    
    #define BIT_POS                 (18)
    #define BIT_MASK                (1 << BIT_POS)
    
    void delay(uint32_t count);
    void InitializeGPIOs(void);
    
    int main(void)
    {
        volatile uint32_t *gpioPinOutdata= (uint32_t*) (GPIO1_OUT_DATA01);
    
        volatile uint32_t *gpioPinConfig = (uint32_t*) (CTRLMMR_PADCONFIG114);
        volatile uint32_t *gpioPinDir = (uint32_t*) (GPIO1_DIR01);
    
        *gpioPinConfig = 0x00010007;    // Configure pin for GPIO mapping.
        *gpioPinDir &= ~(BIT_MASK);     // Set GPIO1_18 to be output direction.
    
    	while(1)
    	{
    	    *gpioPinOutdata ^= (BIT_MASK);
    	    delay(1000);
    	}
    
    	return 0;
    }
    
    void delay(uint32_t count)
    {
        while(count--)
        {
            __asm__("nop");
        }
    }
    
    void InitializeGPIOs(void)
    {
        volatile uint32_t *gpioPinConfig = (uint32_t*) (CTRLMMR_PADCONFIG114);
        volatile uint32_t *gpioPinDir = (uint32_t*) (GPIO1_DIR01);
    
        *gpioPinConfig = 0x00010007;    // Configure pin for GPIO mapping.
        *gpioPinDir &= ~(BIT_MASK);     // Set GPIO1_18 to be output direction.
    }

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

    您好 AKM、

    您可以在此处找到 MCU+ SDK GPIO 示例的文档:
    https://software-dl.ti.com/mcu-plus-sdk/esd/AM65X/09_01_00_04/docs/api_guide_am65x/EXAMPLES_DRIVERS_GPIO_LED_BLINK.html

    以及此处的驱动程序文档:
    https://software-dl.ti.com/mcu-plus-sdk/esd/AM65X/09_01_00_04/docs/api_guide_am65x/DRIVERS_GPIO_PAGE.html

    我首先尝试让这个未修改的 MCU+ GPIO 示例正常工作。 一旦它工作,你可以从那里开始修改。

    您发布的代码看起来并不是基于 MCU+ SDK 代码、因此我们无法做出评论。

    此致、

    Nick

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

    您好、Nick、

    我无法从 MCU Plus SDK 将示例工程导入到 CCS 中。 我已重新安装 SDK 文档中提到的特定版本。 当我导入"Hello World"工程时、收到一个错误、显示"Import Failed for project"hello_world"、因为无法解释其元数据。 请联系支持部门。" 我不知道从哪里去。

    即使我要让 MCU+SDK 正常工作、我是否可以直接获取生成的可执行文件、并在 U-Boot 中使用 rproc 在 R5内核上运行它们? 请确认这一点、因为这是关键。

    至于我使用的代码、我只想通过切换 GPIO 来测试基本的 C 代码在 R5内核上的工作情况。 这是一个简单的代码、我通过 CCS 调试器在 IDK 上运行。 但是、我想能够通过 rproc 在 U-Boot 中运行该、但在使用 GNU 编译时似乎没有执行任何操作、并且在使用 TI LTS 编译器时不会加载。   

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

    您好 AKM、

    如果您使用 AM65x Linux SDK 9.1中提供的 u-boot 版本、则是的、您应该能够获取 ELF 文件并将其加载到 R5F 内核中、如此处的 Linux SDK 文档所述:
    https://software-dl.ti.com/processor-sdk-linux/esd/AM65X/09_01_00_01/exports/docs/linux/Foundational_Components /U-Boot/UG-RemoteProc.html

    我正在将您的线程重新分配给另一个团队成员、以便对 CCS 导入 问题进行注释。 今天是在印度的假期,所以可能是几天前你得到答复。 如果您在几个工作日内没有收到回复、请随时 ping 通该主题。

    此致、

    Nick

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

    尊敬的 AKM:

    导入"Hello World"工程时、收到一个错误、显示"Import failed for project 'hello_world"、因为无法解释其元数据。

    您能否提供完整错误消息的屏幕截图?

    另请说明您正在使用哪个版本的 MCU+SDK 和 CCS?

    此致、

    Tushar

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

    您好、

    之所以出现此问题、是因为工程目录中存在一些缓存文件。 删除.project 文件后、我能够成功导入工程并编译程序。 谢谢。