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.

[参考译文] TMS570LC4357:TSM570LC4357以太网引导加载程序不工作。

Guru**** 2477075 points
Other Parts Discussed in Thread: LAUNCHXL2-570LC43

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

https://e2e.ti.com/support/microcontrollers/arm-based-microcontrollers-group/arm-based-microcontrollers/f/arm-based-microcontrollers-forum/1025514/tms570lc4357-tsm570lc4357-ethernet-bootloader-is-not-working

器件型号:TMS570LC4357
主题中讨论的其他器件:LAUNCHXL2-570LC43

您好!

我希望 您在这段困难的19岁大的时期内保持健康。

我已经下载了一个从 QJ Wang 构建的关于电路板 LAUNCHXL2-570LC43的项目

当我尝试 将代码加载到主板时 ,我收到了以下消息:  

CortexR5:加载程序:程序的一个或多个部分落在一个不可写的存储器区域中。 这些区域实际上不会写入目标。 检查链接器配置和/或存储器映射。

CortexR5:文件加载程序:验证失败:地址0xF0407FF0处的值不匹配请验证目标存储器和存储器映射。

CortexR5:GEL:文件:C:\Users\PC_1742_admin\Desktop\Hercules_Ethernet_Bootloader_deleted\build-LAUNCHXL2-TMS570LC43x-tftpboot\Debug\build-LAUNCHXL2-TMS570LC43x-tftpboot.out:发生数据验证错误、文件加载失败。

当我关闭 DE 验证时,会显示如下消息:  

CortexR5:加载程序:程序的一个或多个部分落在一个不可写的存储器区域中。  这些区域实际上不会写入目标。  检查链接器配置和/或存储器映射。

我在 main.c 中更改了 GJ Wang 代码,如下所示;  

/********************************************************************************************************
*
* main.c      : The main file for ethernet bootloader.
* Author         : QJ Wang. qjwang@ti.com
* Date           : 4-25-2021
*/
/* Copyright (C) 2013-2020 Texas Instruments Incorporated - http://www.ti.com/
 *
 *
 *  Redistribution and use in source and binary forms, with or without
 *  modification, are permitted provided that the following conditions
 *  are met:
 *
 *    Redistributions of source code must retain the above copyright
 *    notice, this list of conditions and the following disclaimer.
 *
 *    Redistributions in binary form must reproduce the above copyright
 *    notice, this list of conditions and the following disclaimer in the
 *    documentation and/or other materials provided with the
 *    distribution.
 *
 *    Neither the name of Texas Instruments Incorporated nor the names of
 *    its contributors may be used to endorse or promote products derived
 *    from this software without specific prior written permission.
 *
 *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
 *  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
 *  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
 *  A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
 *  OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
 *  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
 *  LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
 *  DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
 *  THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
 *  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 *  OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */
/*---------------------------------------------------------------------------------------------------------------------
* Revision History
*---------------------------------------------------------------------------------------------------------------------
* Version          Date        Author         Description
*---------------------------------------------------------------------------------------------------------------------
* 00.10.00       25/04/2021    QJ Wang        1. Initial Version
***********************************************************************************************************/
/* USER CODE BEGIN (0) */
/* USER CODE END */

/* Include Files */

#include "HL_sys_common.h"

/* USER CODE BEGIN (1) */
#include "HL_system.h"
#include "HL_gio.h"
#include "HL_sci.h"
#include "lwiplib.h"
#include "bl_tftp.h"
#include "bl_config.h"
#include "uartstdio.h"
#include "ustdlib.h"
#include "HL_esm.h"
/* USER CODE END */

/** @fn void main(void)
*   @brief Application main function
*   @note This function is empty by default.
*
*   This function is called after startup.
*   The user can use this function to implement the application.
*/

/* USER CODE BEGIN (2) */
#define ENABLE_UPDATE_CHECK
#define FORCED_UPDATE_PIN       4

//*****************************************************************************
//
// This holds the current address that is being written to during a download
// command.
//union
//*****************************************************************************
uint32_t g_ulTransferAddress;
uint32_t g_pulUpdateSuccess[8] = {0x5A5A5A5A, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0};
uint32_t g_ulUpdateStatusAddr = APP_STATUS_ADDRESS;
uint32_t g_ulUpdateBufferSize = 32;    /*32 bytes */

void    IntMasterIRQEnable  (void);
void    sciDisplayText(sciBASE_t *sci, uint8_t *text,uint32_t length);
uint32_t CheckGPIOForceUpdate(void);

#if 1
extern unsigned int apiLoadStart;
extern unsigned int apiLoadSize;
extern unsigned int apiRunStart;

extern unsigned int constLoadStart;
extern unsigned int constLoadSize;
extern unsigned int constRunStart;
#endif

/* USER CODE END */

uint8_t     emacAddress[6]  =   {0x7C, 0xE6, 0xD3, 0x69, 0x8E, 0xD7};

//*****************************************************************************
//
// Display an lwIP type IP Address.
//
//*****************************************************************************
void
DisplayIPAddress(uint32_t ui32Addr)
{
    char pcBuf[16];

    //
    // Convert the IP Address into a string.
    //
#if defined(_TMS570LC43x_)
        usprintf(pcBuf, "%d.%d.%d.%d", (ui32Addr >> 24) & 0xff, (ui32Addr >> 16) & 0xff,
                (ui32Addr >> 8) & 0xff, (ui32Addr >> 0) & 0xff);
#endif
#if defined(_RM57Lx_)
        usprintf(pcBuf, "%d.%d.%d.%d", ui32Addr & 0xff, (ui32Addr >> 8) & 0xff,
                (ui32Addr >> 16) & 0xff, (ui32Addr >> 24) & 0xff);
#endif

    //
    // Display the string.
    //
    UARTprintf(pcBuf);
}

/* This example works for HDK*/
void main(void)
{
    /* USER CODE BEGIN (3) */
    unsigned int ipAddr;

    g_pulUpdateSuccess[1]= APP_START_ADDRESS;
    g_pulUpdateSuccess[3] = 0x20002021;  /*version number, 02.00, in 2021*/

    esmREG->SR1[0] = 0xFFFFFFFF;
    esmREG->SR1[1] = 0xFFFFFFFF;
    esmREG->SR1[2] = 0xFFFFFFFF;
    esmREG->SR4[0] = 0xFFFFFFFF;
    esmREG->EKR = 0x0A;
    esmREG->EKR = 0x00;

    /* Copy the flash APIs to SRAM*/
    memcpy(&apiRunStart, &apiLoadStart, (uint32)&apiLoadSize);

    gioInit();
    sciInit();
    gioSetDirection(gioPORTB, 0xC0);
    sciSetBaudrate(UART, UART_BAUDRATE);

    /* Enable the interrupt generation in CPSR register */
    _enable_IRQ();

    UARTprintf("Ethernet lwIP Bootloader \n\r");

    uint8 ip_addr[4] = { 192, 168, 0, 2};
    uint8 netmask[4] = { 255, 255, 255, 0 };
    uint8 gateway[4] = { 192, 168, 0, 3};
    bool isProcessDone = false;
    bool isPressed = false;
    if(((*(uint32_t *) APP_STATUS_ADDRESS) == 0x5A5A5A5A))
    {
        UARTprintf("ITS ENTER HERE.................................");
        g_ulTransferAddress = (uint32_t)APP_START_ADDRESS;
//        ((void (*)(void))g_ulTransferAddress)();
    }
    while (!isProcessDone)
    {

        if(!gioGetBit(gioPORTB, 4))
        {
            isPressed = true;
            gioToggleBit(gioPORTB, 6);
        }


        if (!ipAddr)
        {
            ipAddr = lwIPInit(0, emacAddress,
                            *((uint32_t *)ip_addr),
                            *((uint32_t *)netmask),
                            *((uint32_t *)gateway),
                            IPADDR_USE_STATIC);
            gioSetBit(gioPORTB, 7, 0);
        }
        else
        {
            gioSetBit(gioPORTB, 7, 1);
        }

        UARTprintf("HDK IP Address: ");
        DisplayIPAddress (ipAddr);
        UARTprintf("    \n\r ");

        if(isPressed)
        {
            break;
//            isProcessDone = true;
//            isPressed = false;
//            gioSetBit(gioPORTB, 6, 0);
//            gioSetBit(gioPORTB, 7, 0);

        }

    }
    TFTPQSInit(); // If the isPressed ( TO BUTTON GPIOB_4  EXIT FROM WHILE LOOP AND COMES HERE. )
    UARTprintf("DONE ");





}


void sciDisplayText(sciBASE_t *sci, uint8_t *text,uint32_t length)
{
    while(length--)
    {
        while ((sci->FLR & 0x4) == 4);
        sciSendByte(sci,*text++);
    };
}


void IntMasterIRQEnable(void)
{
    _enable_IRQ();
    return;
}

void IntMasterIRQDisable(void)
{
    _disable_IRQ();
    return;
}

unsigned int IntMasterStatusGet(void)
{
    return (0xC0 & _get_CPSR());
}

/*
** Interrupt Handler for Core 0 Receive interrupt
*/
volatile int countEMACCore0RxIsr = 0;
#pragma INTERRUPT(EMACCore0RxIsr, IRQ)
void EMACCore0RxIsr(void)
{
    countEMACCore0RxIsr++;
    lwIPRxIntHandler(0);
}

/*
** Interrupt Handler for Core 0 Transmit interrupt
*/
volatile int countEMACCore0TxIsr = 0;
#pragma INTERRUPT(EMACCore0TxIsr, IRQ)
void EMACCore0TxIsr(void)
{
    countEMACCore0TxIsr++;
    lwIPTxIntHandler(0);
}

//*****************************************************************************
//
// Checks a GPIO for a forced update.
//
// This function checks the state of a GPIO to determine if a update is being
// requested.
//
// \return Returns a non-zero value if an update is being requested and zero
// otherwise.
//
//*****************************************************************************
#ifdef ENABLE_UPDATE_CHECK
uint32_t
CheckGPIOForceUpdate(void)
{
    /** bring GIO module out of reset */
    gioREG->GCR0      = 1;
    gioREG->ENACLR    = 0xFF;
    gioREG->LVLCLR    = 0xFF;

    // Set the pin as input
    gioPORTA->DIR &= ~(1 << FORCED_UPDATE_PIN);

    // Enable the pull up/down.
    gioPORTA->PULDIS &= ~(1 << FORCED_UPDATE_PIN);

    // Enable the weak pull up.
    gioPORTA->PSL |= 1 << FORCED_UPDATE_PIN;

    // Check the pin to see if an update is being requested.

    if ((gioPORTA->DIN & (0x1 << FORCED_UPDATE_PIN) ) == 0)
    {
        // Remember that this was a forced update.
        return(1);  //force to update
    }

    // No update is being requested so return 0.
    return(0);
}
#endif

/* USER CODE END */

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

    顺便说一下,当我将图像创建为.bin 格式时,其大小几乎为2GB,这是可能的吗?

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

    您好、Abdulmecid、

    ECC 可在 CCS 或 Unitlash 将输出文件加载到闪存时生成、也可在编译的最终链接步骤期间生成。 通过链接器生成 ECC、ECC 数据将连同代码和数据一起包含在目标文件中。  因此、编译后不需要额外的 ECC 生成步骤、ECC 可以与其他所有内容一起上载到器件中。

    将文件加载到闪存时 ,必须更改加载程序设置,以便加载程序也 不会尝试生成 ECC。 编程期间的验证也需要跳过、因为数据区域和 ECC 区域现在将采用单独的步骤进行编程。

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

    二进制文件非常大、它包含整个闪存的内容。

    原始二进制文件不包含地址、因此所有存储器空位都填充为零。 ECC 地址位于0xF040_0000。 二进制文件包含填充到闪存(0x00xxxxxx)、SRAM (0x08xxxxxx) 和0xF04_0000之间所有未使用地址的零。

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

    感谢您的帮助 QJ Wang。 你是最好的

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

    那么,我是否应该在 bl_config.h 中更改内容? 另外、当我尝试上传至电路板时、2.75GB 的 bin 文件可能会导致问题?

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

    我还有一个问题要问你王先生、

    我们能否使用.hex 文件而不是.bin 来执行此以太网引导加载过程?

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

    您好、Abdulmecid、

    对于引导加载程序、我不使用二进制文件。 对于应用程序、我使用二进制格式、并且不使用链接器为应用程序映像生成 ECC。 ECC 使用引导加载程序(BL_FLASH.c)中的 F021闪存 API 进行计算和编程。

    是的、您可以使用十六进制格式。 但引导加载程序示例仅支持二进制格式。

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

    感谢您的所有回复 QJ Wang, 对此我表示感谢。

    为什么我们无法以图像格式发送.hex 文件?  我们还能实现它以 将.hex 文件作为映像发送吗?

    如果 以可能的映像形式发送.hex 文件、我应该怎么办?

    通过王的方式,将 2.75GB.bin 文件(图像)上载 到板上会产生问题吗?

    此致、

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

    正如我提到过的、我不使用链接器为我的应用生成 ECC。 引导加载程序将应用程序加载到闪存中、 同时计算和加载 ECC。 因此、应用程序不应达到2.75 GB。  

    在引导加载程序中、必须从接收到的软件包中提取数据、并使用引导加载程序中的相同函数将数据编程到闪存中。