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.

[参考译文] AM243X-M4 MCU-PLUS-SDK:无法在 M4 Hello World 工程上调试

Guru**** 2465890 points
Other Parts Discussed in Thread: SYSCONFIG

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

https://e2e.ti.com/support/microcontrollers/arm-based-microcontrollers-group/arm-based-microcontrollers/f/arm-based-microcontrollers-forum/1461822/mcu-plus-sdk-am243x-unable-to-debug-on-m4-hello-world-project

器件型号:MCU-PLUS-SDK AM243X
主题中讨论的其他器件:SysConfig

工具与软件:

您好!

我已经导入 hello world M4项目。 当不对代码进行任何更改时、它会正常生成并正常调试。
以下是 SDK 中调试的原始代码:

#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"

void hello_world_main(void *args)
{
    /* Open drivers to open the UART driver for console */
    Drivers_open();
    Board_driversOpen();

    DebugP_log("Hello World!\r\n");

    Board_driversClose();
    Drivers_close();
}

调试时、我能够正常在 M4内核上进行调试。 但是、当我向 hello_world.cpp 添加代码时、在构建项目时、我无法调试此代码。 以下是我尝试调试的代码。 即使在将项目刷写到 M4内核时、我也只会看到"hello world"输出、而不是我从代码获得的额外输出。唯一的更改是在 hello_world.cpp 中:

#include <stdio.h>
#include <string.h>
#include <kernel/dpl/DebugP.h>
#include "ti_drivers_config.h"
#include "ti_drivers_open_close.h"
#include "ti_board_open_close.h"

typedef unsigned int uint;

/// Sample class that sets a string
class Foo
{
public:
    Foo(void);

    static const uint uStrLen = 20U;
    char mystr[uStrLen + 1U];
}; // class Foo

Foo::Foo(void)
{
    strncpy(mystr, "Testing\r\n", uStrLen);
    mystr[uStrLen] = '\0';
}

/// Declare static class instance
Foo foo;

void hello_world_main(void *args)
{
    /* Open drivers to open the UART driver for console */
    Drivers_open();
    Board_driversOpen();

    DebugP_log("Hello World!\r\n");
    DebugP_log(foo.mystr);

    Board_driversClose();
    Drivers_close();
}


当我尝试在 M4内核上调试此代码时、会收到以下错误消息:
BLAZAR_Cortex_M4F_0: GEL Output: CPU reset (soft reset) has been issued through GEL.
BLAZAR_Cortex_M4F_0: File Loader: Verification failed: Values at address 0x00014C40 do not match Please verify target memory and memory map.
BLAZAR_Cortex_M4F_0: GEL: File: C:\dev\ccs\hello_world_cpp_am243x-evm_m4fss0-0_nortos_ti-arm-clang\Debug\hello_world_cpp_am243x-evm_m4fss0-0_nortos_ti-arm-clang.out: a data verification error occurred, file load failed.


为什么我不能在这个项目上添加/编辑代码然后对其进行调试? 此问题似乎与 Code Composer Studio 有关。 我们如何解决和解决此问题、以便我可以编辑此项目和调试 M4内核? 此相同的代码在 R5内核上运行和调试。

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

    虽然 上面提到的代码无法在 M4处理器上进行调试(并且在刷写到 M4上时无法打印竞争输出、但只能打印 Hello World、而不是额外的文本)、但它在 R5内核上确实能正常运行。 上面在 M4内核上出现问题的代码与在 R5内核上预期一样工作、并进行调试。 为什么会这样呢? 我无法在 M4内核上运行 c++代码吗?

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

    尊敬的 Jacob:

    这个问题本周已不在办公室。 对该线程的响应将被延迟。 感谢您的耐心。

    同时、您能否说明您使用的是哪个 MCU+SDK 版本?

    此致、

    Tushar  

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

    请注意、SDK 中有一个针对 M4F 内核的单独 hello_world_cpp 工程。 您能否确认您使用的是正确的示例工程?

    针对 R5F 内核的项目构建将不能在 M4F 内核上运行。  

    此致、

    Tushar

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

    是、

    我使用了针对 M4的正确 Hello World 示例和针对 R5的正确 Hello World 示例。

    hello_world.cpp 文件对于这两个工程是"相同的"。 当添加问题中所示的相同示例代码行时、M4和 R5都是构建的、但在 M4上进行调试不起作用(我收到错误消息)。 刷写到 M4中会发生闪存、但我无法获取所添加代码的输出。  
    另一方面、R5在使用相同的添加代码时工作正常;在 R5上刷写和调试工作正常。

    SDK 是当前最新的 SDK 版本。

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

    尊敬的 Jacob:

    感谢以上确认。 请留出一些时间来检查上述内容并恢复。

    此致、

    Tushar

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

    尊敬的 Jacob:

    您在禁用 M4F 内核验证后能否进行一次尝试并更新结果。

    请参阅  sk-am62-data-verificy-error-while -loading-the-program 以了解详细信息。

    此致、

    Tushar

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

    我会在我能够做到的时候尝试这种方法。 但是、这一建议似乎只是用于调试;这只是问题的一半。  这仍然不能解决为什么在将 M4内核的 EVM 板刷写到 EVM 板时无法获得预期输出的问题。

    M4内核只会打印出 Hello World (当用 M4项目刷写时)、而 R5内核将打印出预期的"Hello World \n Testing"(当用 R5项目刷写时)。 如上所述、两个工程的 hello_world.cpp 中的代码相同。

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

    我刚尝试使用"No Verification"(不验证)、但未解决问题

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

    尊敬的 Jacob:

    查看上述错误、似乎验证已成功禁用。

    我可以看到您仍然收到数据验证失败错误、如果对 M4F 内核禁用验证、则不会出现该错误。

    请确保在禁用"Program Load"和"Run"选项中的数据验证时选择了 M4F 内核。

    此致、

    Tushar

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

    您是对的。 开始调试时、会重置我所选的设置。 现在是"无验证"示例。 M4现在会进行调试、但我不会将我添加的代码字符串输出到控制台、如图所示。 请尝试重现此问题并找到解决方法。 相同的代码在 R5工程中工作、并在"Hello World"字符串后输出"Testing"。 但是、进行调试或刷写时、相同的代码不会在 M4项目上打印出"Testing"。 我似乎只在 M4内核上崩溃或跳过该部分代码???

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

    尊敬的 Jacob:

    感谢以上确认、您现在能够在 M4F 上加载该程序。 我将在星期一尝试复制您的问题。

    请给我们留出一些时间、以便找出问题的根本原因。

    此致、

    Tushar

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

    好的、请告诉我此问题的进展情况。 这似乎是只在 M4内核上进行初始化时的问题。 我想在 M4内核上运行 C++代码(而不是直接运行 C 代码)、但看不到。 尽可能低。 R5似乎会运行 C++代码、但 M4不会运行。

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

    在 M4内核上复制此问题是否有状态或更新?

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

    尊敬的 Jacob:

    我能够在最后重复您的问题

    是的、似乎没有为创建的对象调用 Foo 类的构造函数。 我仍在调试此问题、请允许一些时间。

    此致、

    Tushar

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

    您好!

    在这一问题上是否取得了进展? 我们正在尝试在 M4上编写 C++代码、但仍然无法做到。 您是否对这一问题的当前进展有任何了解?

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

    是否有关于此问题的任何更新? 由于无法将 c++写入 M4内核、因此我们目前已停止

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

    您好!

    以下补丁应能解决此问题。

    diff --git a/examples/hello_world_cpp/am243x-evm/m4fss0-0_nortos/example.syscfg b/examples/hello_world_cpp/am243x-evm/m4fss0-0_nortos/example.syscfg
    index 37917c45..1b90fd37 100644
    --- a/examples/hello_world_cpp/am243x-evm/m4fss0-0_nortos/example.syscfg
    +++ b/examples/hello_world_cpp/am243x-evm/m4fss0-0_nortos/example.syscfg
    @@ -23,6 +23,7 @@ const section5                  = section.addInstance();
     const section6                  = section.addInstance();
     const section7                  = section.addInstance();
     const section8                  = section.addInstance();
    +const section9                  = section.addInstance();
     
     const addr_translate  = scripting.addModule("/kernel/dpl/addr_translate", {}, false);
     const addr_translate1 = addr_translate.addInstance();
    @@ -105,17 +106,11 @@ section4.output_section[1].palignment = true;
     section5.load_memory                  = "M4F_IRAM";
     section5.group                        = false;
     section5.$name                        = "Memory and Stack Segments";
    -section5.output_section.create(5);
    +section5.output_section.create(2);
     section5.output_section[0].$name      = ".sysmem";
     section5.output_section[0].palignment = true;
     section5.output_section[1].$name      = ".stack";
     section5.output_section[1].palignment = true;
    -section5.output_section[2].$name      = ".ARM.exidx";
    -section5.output_section[2].palignment = true;
    -section5.output_section[3].$name      = ".init_array";
    -section5.output_section[3].palignment = true;
    -section5.output_section[4].$name      = ".fini_array";
    -section5.output_section[4].palignment = true;
     
     section6.type                        = "NOLOAD";
     section6.load_memory                 = "USER_SHM_MEM";
    @@ -141,6 +136,17 @@ section8.output_section.create(1);
     section8.output_section[0].$name     = ".bss.ipc_vring_mem";
     section8.output_section[0].alignment = 0;
     
    +section9.load_memory                  = "M4F_DRAM";
    +section9.group                        = false;
    +section9.$name                        = "C++ Sections";
    +section9.output_section.create(3);
    +section9.output_section[0].$name      = ".ARM.exidx";
    +section9.output_section[0].palignment = true;
    +section9.output_section[1].$name      = ".init_array";
    +section9.output_section[1].palignment = true;
    +section9.output_section[2].$name      = ".fini_array";
    +section9.output_section[2].palignment = true;
    +
     addr_translate1.$name     = "CONFIG_ADDR_TRANSLATE_REGION0";
     addr_translate1.localAddr = 0x80000000;
     
    

    此补丁将 C++相关段从 M4F_IRAM 存储器区域移动到 M4F_DRAM 存储器区域。

    此致、

    Prashant

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

    所以、

    在尝试构建时、将您的更改添加到 example.sysconfig 会导致以下错误:

    Building file: "../example.syscfg"
    Invoking: SysConfig
    "C:/ti/ccs1280/ccs/utils/sysconfig_1.21.0/sysconfig_cli.bat" --script "C:/dev/ccs/hello_world_cpp_am243x-evm_m4fss0-0_nortos_ti-arm-clang/example.syscfg" -o "syscfg" -s "C:/dev/mcusdk/.metadata/product.json" --context "m4fss0-0" --part ALV --package ALV --compiler ticlang
    Running script...
    Validating...
    info: /kernel/dpl/debug_log uartLog.baudRate: Actual Baudrate Possible: 115385 (0 % error)
    subdir_rules.mk:9: recipe for target 'build-1619419905' failed
    error: CONFIG_SECTION5(/memory_configurator/section) load_memory: This field can't be kept empty
    error: CONFIG_SECTION5(/memory_configurator/section) run_memory: This field can't be kept empty
    error: CONFIG_SECTION5(/memory_configurator/section) output_section: Add atleast 1 output section
    error: CONFIG_SECTION6(/memory_configurator/section) load_memory: This field can't be kept empty
    error: CONFIG_SECTION6(/memory_configurator/section) run_memory: This field can't be kept empty
    error: CONFIG_SECTION6(/memory_configurator/section) output_section: Add atleast 1 output section
    error: CONFIG_SECTION7(/memory_configurator/section) load_memory: This field can't be kept empty
    error: CONFIG_SECTION7(/memory_configurator/section) run_memory: This field can't be kept empty
    error: CONFIG_SECTION7(/memory_configurator/section) output_section: Add atleast 1 output section
    9 error(s), 0 warning(s)
    gmake: *** [build-1619419905] Error 1
    gmake: Target 'all' not remade because of errors.
    
    **** Build Finished ****

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。
    将您的更改添加到 example.sysconfig 中会导致在尝试使用 buiild:
    时出现这些错误

    在这种情况下、您可以使用 SysConfig 中的 Memory Configurator (内存配置器)手动将这些段分配到 M4F_DRAM 存储器区域。

    否则、您可以共享"example.syscfg"文件供我查看、并在需要时予以更正。