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.

TDA3x: Uart Flashing tool Issue

Hi

We are trying to flash the TDA3x EVM Reference board via UART. We dont have a JTAG for now.

Following the SBL_Userguide and Using the MFlash tool, we are facing the following issue.

We could send the initial sbl_mflash over the uart but after this stage the tool cannot proceed further and flash the QSPI images as expected.
We tried with the prebuilt binaries from SDK and our compiled binary images from Vision SDK 3.0. But cannot proceed further.

Attached the mflash logs,
Kindly help on this urgently.

Logs:

C:\Users\prsc\Desktop\Mflash>mflash_run_config.bat
C:\Users\prsc\Desktop\Mflash>SET sbl_mflash="sbl_mflash"
C:\Users\prsc\Desktop\Mflash>SET appimage_location="AppImage_BE"
C:\Users\prsc\Desktop\Mflash>SET appimage_offset="0x80000"
C:\Users\prsc\Desktop\Mflash>SET sbl_location="sbl"
C:\Users\prsc\Desktop\Mflash>SET sbl_offset="0x00"
C:\Users\prsc\Desktop\Mflash>SET uart_port_number="5"
C:\Users\prsc\Desktop\Mflash>ECHO 14:14:58.93
14:14:58.93

C:\Users\prsc\Desktop\Mflash>mflash -M "sbl_mflash" -P "5" -F "AppImage_BE" "0x8
0000" -F "sbl" "0x00"
Usage: mflash -M <sbl_mflash> -P <Port Number> -C [optional: to clean the QSPI F
lash]-F <fileName> <offset> -F <fileName> <offset> ... [PC] sbl_mflash sbl_mflas
h
[PC] File 0 AppImage_BE
[PC] Offset 0 0x80000
[PC] File 1 sbl
[PC] Offset 1 0x00
[PC] com \\.\COM5
[PC] ##########Starting USB/UART Flasing Utility##############
[PC] Put UART Boot Mode, make fresh UART connection & restart
[PC] Press Enter when done...

Baud = 115200
Parity = 2
StopBits = 0
ByteSize = 8[PC] Opening serial port successful
[RBL]0 [RBL]0 [RBL]0 [RBL]e0 [RBL]4 [RBL]1 [RBL]5 [RBL]1 [RBL]41 [RBL]4c
[RBL]7 [RBL]1 [RBL]13 [RBL]2 [RBL]1 [RBL]0 [RBL]12 [RBL]15 [RBL]1 [RBL]0
[RBL]0 [RBL]0 [RBL]0 [RBL]0 [RBL]0 [RBL]0 [RBL]0 [RBL]0 [RBL]0 [RBL]0
[RBL]0 [RBL]0 [RBL]0 [RBL]0 [RBL]0 [RBL]0 [RBL]0 [RBL]0 [RBL]0 [RBL]14
[RBL]21 [RBL]1 [RBL]0 [RBL]0 [RBL]0 [RBL]0 [RBL]0 [RBL]0 [RBL]0 [RBL]0
[RBL]0 [RBL]0 [RBL]0 [RBL]0 [RBL]0 [RBL]0 [RBL]0 [RBL]0 [RBL]0 [RBL]0
[RBL]0 [RBL]0 [RBL]0 [RBL]0 [RBL]0 [RBL]0 [RBL]0 [RBL]0 [RBL]0 [RBL]0

[PC] Requesting the ASIC ID
[RBL]0 [RBL]0 [RBL]0 [RBL]0 [RBL]4 [RBL]1 [RBL]5 [RBL]1 [RBL]41 [RBL]4c
[RBL]7 [RBL]1 [RBL]13 [RBL]2 [RBL]1 [RBL]0 [RBL]12 [RBL]15 [RBL]1 [RBL]0
[RBL]0 [RBL]0 [RBL]0 [RBL]0 [RBL]0 [RBL]0 [RBL]0 [RBL]0 [RBL]0 [RBL]0
[RBL]0 [RBL]0 [RBL]0 [RBL]0 [RBL]0 [RBL]0 [RBL]0 [RBL]0 [RBL]0 [RBL]14
[RBL]21 [RBL]1 [RBL]0 [RBL]0 [RBL]0 [RBL]0 [RBL]0 [RBL]0 [RBL]0 [RBL]0
[RBL]0 [RBL]0 [RBL]0 [RBL]0 [RBL]0 [RBL]0 [RBL]0 [RBL]0 [RBL]0 [RBL]0
[RBL]0 [RBL]0 [RBL]0 [RBL]0 [RBL]0 [RBL]0 [RBL]0 [RBL]0 [RBL]0 [RBL]0

[PC] Requesting PERI_REQ mode
[PC] Sending SBL_MFLASH filesize.
[PC] Size of sbl_mflash = 104626
[PC] Sending SBL_MFLASH... Please wait
[PC] File Size = 104626
[PC] ##
[PC] Transfer Complete. Time = 10.000
[PC] Opening port for sbl_mflash.
Baud = 12000000
Parity = 0
StopBits = 0
ByteSize = 8
[PC] Opening serial port successful.

Regards
Naveen K

  • Hi Naveen,

    I have forwarded your question to VisionSDK experts.

    Regards,
    Yordan
  • Hi Naveen,
    I'm not knowing the tool, but I knowing that the 115200 phase works good, and 12Mbps does not, then you can try 2 things:
    - try lowering the speed of 12 Mbps (if possible)
    - try another USB-to-serial converter or try the same converter with much shorter cable (UART side)

    Regards,
    Stan
  • Since, you have the source in the file mflash_uart.c . Could you just try reading the UART data, just after sbl_mflash is sent, by adding the following line after line 691.

    printf("%x ", byteRead);

    Ideally, it should be a continuous character 'a' stream i.e. 61 in hex.

    . . .
    691 noBytesRead = MFlash_gets(hComm, &byteRead, 1U);
    692 printf("%x ", byteRead);
    693 if(byteRead == 'a')
    . . .

    and then re-compile as mentioned in the Readme.md

  • Hi Prawal

    While looking into the source code of UBL side mflash code, there is some mismatches between these two implementations:

    1. The UBL is configured for a baud rate of BAUD_RATE_3686400 while the MFLASH tool tries a baud rate of BAUD_RATE_12000000.

    2. It is not seen sending this continuous sequence of ASCII 61, rather it print a menu and just waits there.

    I have attached the UBL mflash src from the Vision SDK 3.0 for reference.

    Is this mflash tool developed for a different version of Vision SDK?

    Attachments:

    sbl_mflash_utils.c
    /*
     *  Copyright (C) 2016 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.
     *
     */
    
    /**
     *  \file     sbl_mflash_utils.c
     *
     *  \brief    This file contains the SBL mflash utility functions
     */
    
    /* ========================================================================== */
    /*                             Include Files                                  */
    /* ========================================================================== */
    #include <stdint.h>
    #include <ti/csl/hw_types.h>
    #include <ti/csl/csl_types.h>
    #include <ti/csl/soc.h>
    #include <ti/drv/stw_lld/platform/platform.h>
    #include <ti/csl/csl_mmu.h>
    #include <ti/boot/sbl_auto/sbl_lib/sbl_lib.h>
    #include <ti/drv/pm/pmhal.h>
    #include <stdlib.h>
    #include <ti/csl/csl_qspi.h>
    #include <ti/drv/stw_lld/uartconsole/uartStdio.h>
    #include <ti/boot/sbl_auto/qspiflash/qspi_flash.h>
    #include <ti/csl/csl_edma.h>
    #include <sbl_mflash_utils_priv.h>
    
    /* ========================================================================== */
    /*                           Macros & Typedefs                                */
    /* ========================================================================== */
    /*
     * Number of word to be written to QSPI
     */
    #define SBL_MFLASH_NUM_QSPI_WORDS  (64U)
    /*
     * Temporary data buffer size for mflash
     */
    #define SBL_MFLASH_BUFFER_SIZE (64U * 1024U)
    
    /* ========================================================================== */
    /*                            Global Variables                                */
    /* ========================================================================== */
    /*
     * Temporary data buffer for mflash
     */
    static uint8_t gDataBuffer[SBL_MFLASH_BUFFER_SIZE];
    
    /* -------------------------------------------------------------------------- */
    /*                 Flashing Function Definitions                              */
    /* -------------------------------------------------------------------------- */
    void SBLMFlashRun(void)
    {
        SBLLibPrintf(SBLLIB_TRACE_LEVEL_INFO1,
                     "\nUtility mflash will Execute now:\n");
    
        /* Initializes memory and prints device id */
        SBLMFlashMemoryInit();
        SBLMFlashPrintQSPIDeviceId();
    
        /* Displays menu option to user */
        SBLMFlashMenu();
    }
    
    void SBLMFlashMenu(void)
    {
        SBLLibPrintf(SBLLIB_TRACE_LEVEL_INFO1,
                     "\n\n!!______TDAxx flashing utility______!!");
        uint32_t    mainMenuOption;
        uint8_t stopByte = 1U;
    
        /* Takes inputs from user until utility exits */
        while (stopByte)
        {
            SBLLibPrintf(SBLLIB_TRACE_LEVEL_INFO1, "\n[TDAxx]");
            SBLLibPrintf(SBLLIB_TRACE_LEVEL_INFO1,
                         " Currently Available options:\n");
            SBLLibPrintf(SBLLIB_TRACE_LEVEL_INFO1,
                         " 1. Erase the qspi_flash\n");
            SBLLibPrintf(SBLLIB_TRACE_LEVEL_INFO1,
                         " 2. Download the file into the flash\n");
            SBLLibPrintf(SBLLIB_TRACE_LEVEL_INFO1,
                         " 3. Help\n");
            SBLLibPrintf(SBLLIB_TRACE_LEVEL_INFO1,
                         " 4. Exit\n");
            SBLLibPrintf(SBLLIB_TRACE_LEVEL_INFO1,
                         " Enter your choice:\v");
            mainMenuOption = SBLLibGetNum();
    
            switch (mainMenuOption)
            {
                case (1U):
                    SBLLibPrintf(SBLLIB_TRACE_LEVEL_INFO1, "[TDAxx]");
                    SBLLibPrintf(SBLLIB_TRACE_LEVEL_INFO1,
                                 "You chose to erase the full qspi_flash\n");
                    SBLMFlashMemoryErase();
                    break;
    
                case (2U):
                    SBLMFlashDownloadFile();
                    break;
    
                case (3U):
                    SBLLibPrintf(SBLLIB_TRACE_LEVEL_INFO1, "[TDAxx]Help");
                    SBLMFlashHelper();
                    break;
    
                case (4U):
                    SBLLibPrintf(SBLLIB_TRACE_LEVEL_INFO1,
                                 "[TDAxx]You chose to exit. Exiting now.");
                    stopByte = 0;
                    break;
    
                default:
                    SBLLibPrintf(SBLLIB_TRACE_LEVEL_INFO1,
                                 "[TDAxx]Invalid Choice. Try again\n");
                    break;
            }
        }
    
        /* Acks PC client about exit on the target */
        SBLLibPrintf(SBLLIB_TRACE_LEVEL_INFO1, SBL_MFLASH_CMD_TRANSFER_COMPLETE);
    }
    
    void SBLMFlashMemoryInit(void)
    {
        uint32_t edmaChNum   = 1U;
        uint32_t edmaTccNum  = 1U;
        uint32_t edmaEvtqNum = 0U;
    
        SBLLibPrintf(SBLLIB_TRACE_LEVEL_INFO1, "\nSetting up QSPI \n");
        SBLLibPrintf(SBLLIB_TRACE_LEVEL_INFO1,
                     "\nQSPI Spansion 4 bit Device type\n");
    
        /* Configure PADs. */
        PlatformQSPISetPinMux();
    
        /* Initialize the EDMA */
        EDMAsetRegion(0);
        EDMA3Init(SOC_EDMA_TPCC_BASE_VIRT, 0);
    
        EDMA3RequestChannel(SOC_EDMA_TPCC_BASE_VIRT,
                            EDMA3_CHANNEL_TYPE_DMA,
                            edmaChNum,
                            edmaTccNum,
                            edmaEvtqNum);
    
        /*QSPI Initialization*/
        QSPI_Initialize(DEVICE_TYPE_QSPI4);
    }
    
    void SBLMFlashPrintQSPIDeviceId(void)
    {
        uint32_t deviceId;
        deviceId = QSPI_GetDeviceId();
        SBLLibPrintf(SBLLIB_TRACE_LEVEL_INFO1, "\nMID - ");
        SBLLibPrintHexNum(SBLLIB_TRACE_LEVEL_INFO1, deviceId & 0xFFU);
        SBLLibPrintf(SBLLIB_TRACE_LEVEL_INFO1, "\nDID - ");
        SBLLibPrintHexNum(SBLLIB_TRACE_LEVEL_INFO1, (deviceId & 0xFF0000U) >> 16U);
    }
    
    void SBLMFlashDownloadFile(void)
    {
        uint32_t bufferSize  = SBL_MFLASH_BUFFER_SIZE;
        uint32_t bytesToRead = SBL_MFLASH_BUFFER_SIZE;
        uint32_t destoffset;
        uint32_t current;
        uint32_t filesize;
    
        /* Sending "t" to client asking for file size request */
        SBLLibPrintf(SBLLIB_TRACE_LEVEL_INFO1,
                     "\n[TDAxx]Enter the File location:\t");
        filesize = SBLLibGetNum();
    
        /* Sending "?" to client asking offset from beginning of qspi */
        SBLLibPrintf(SBLLIB_TRACE_LEVEL_INFO1, "\n[TDAxx]Enter Offset: \?");
        destoffset = SBLLibGetHexNum();
        current    = destoffset;
    
        /* Sending " ' " to client asking for file to be transferred */
        SBLLibPrintf(SBLLIB_TRACE_LEVEL_INFO1,
                     "\n[TDAxx]Start sending the file.\n\'");
        SBLLibGetc();
    
        /* Sending " ' " to client asking offset from beginning of qspi */
        while (current < (destoffset + filesize))
        {
            /* Handles the case for last block if chunk size is less than
             * SBL_MFLASH_BUFFER_SIZE
             */
            if (((destoffset + filesize) - current) < SBL_MFLASH_BUFFER_SIZE)
            {
                bytesToRead = (destoffset + filesize) - current;
                bufferSize  = bytesToRead + 4U;
    
                if ((bufferSize % 4U) == 0U)
                {
                    bufferSize = bufferSize - 4U;
                }
            }
    
            /* Asks for next patch of the file being downloaded */
            SBLLibPrintf(SBLLIB_TRACE_LEVEL_INFO1, SBL_MFLASH_CMD_SEND_NEXT_PATCH);
            SBLMFlashUARTGetFile(gDataBuffer, bytesToRead);
    
            SBLMFlashWriteQSPI(gDataBuffer, bufferSize / 4U, current);
    
            current = current + bufferSize;
        }
    
        /* Notifies PC that file transfer is complete */
        SBLLibPrintf(SBLLIB_TRACE_LEVEL_INFO1, SBL_MFLASH_CMD_TRANSFER_COMPLETE);
    }
    
    void SBLMFlashMemoryErase(void)
    {
        QSPISetMAddrSpace(SOC_QSPI_ADDRSP0_BASE,
                          (uint8_t) QSPI_SPI_SWITCH_REG_MMPT_S_SEL_CFG_PORT);
        QSPI_ConfMAddrSpace((uint8_t) QSPI_SPI_SWITCH_REG_MMPT_S_SEL_CFG_PORT,
                            QSPI_MMR);
    
        QSPI_WriteEnable();
        SBLLibPrintf(
            SBLLIB_TRACE_LEVEL_INFO1,
            "\n[TDAxx]Erasing entire QSPI Flash..This takes 50-60 seconds.\n");
    
        /* Erases qspi memory */
        QSPI_FlashFullErase();
        SBLLibPrintf(SBLLIB_TRACE_LEVEL_INFO1,
                     "\n\n!!![TDAxx]Erase Completed!!!\n\n");
    }
    
    void SBLMFlashWriteQSPI(const uint8_t *buff, uint32_t length, uint32_t destination)
    {
        /* Writes SBL_MFLASH_NUM_QSPI_WORDS to qspi  */
        while (length > (SBL_MFLASH_NUM_QSPI_WORDS))
        {
            QSPISetMAddrSpace(SOC_QSPI_ADDRSP0_BASE,
                              (uint8_t) QSPI_SPI_SWITCH_REG_MMPT_S_SEL_CFG_PORT);
            QSPI_ConfMAddrSpace((uint8_t) QSPI_SPI_SWITCH_REG_MMPT_S_SEL_CFG_PORT,
                                QSPI_MMR);
            QSPI_WriteEnable();
            QSPI_WriteCfgMode(destination, (uint32_t) buff,
                              SBL_MFLASH_NUM_QSPI_WORDS);
            length      -= SBL_MFLASH_NUM_QSPI_WORDS;
            destination += (SBL_MFLASH_NUM_QSPI_WORDS * 4U);
            buff        += (SBL_MFLASH_NUM_QSPI_WORDS * 4U);
        }
        /* Writes remaining bytes to qspi  */
        if (length > 0)
        {
            QSPISetMAddrSpace(
                SOC_QSPI_ADDRSP0_BASE,
                (uint8_t) QSPI_SPI_SWITCH_REG_MMPT_S_SEL_CFG_PORT);
            QSPI_ConfMAddrSpace(
                (uint8_t) QSPI_SPI_SWITCH_REG_MMPT_S_SEL_CFG_PORT, QSPI_MMR);
            QSPI_WriteEnable();
            QSPI_WriteCfgMode(destination, (uint32_t) buff, length);
        }
    }
    
    void SBLMFlashUARTGetFile(uint8_t *pRxBuffer, uint32_t numBytesToRead)
    {
        uint32_t count = 0;
    
        /* Simliar to UARTGets but doesn't terminate at \n\r */
        do
        {
            *pRxBuffer = (uint8_t) SBLLibGetc();
            pRxBuffer++;
            count++;
        } while (count < numBytesToRead);
    }
    
    void SBLMFlashHelper(void)
    {
        SBLLibPrintf(SBLLIB_TRACE_LEVEL_INFO1,
                     "Utility mflash is for peripheral boot of TDA3xx \n");
    }
    
    
       
    sbl_tda3xx_mflash_main.c
    /*
     *  Copyright (C) 2016 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.
     *
     */
    
    /**
     *  \file     sbl_tda3xx_mflash_main.c
     *
     *  \brief    This file contains SBL mflash main
     */
    
    /* ========================================================================== */
    /*                             Include Files                                  */
    /* ========================================================================== */
    #include <stdint.h>
    #include <ti/csl/tistdtypes.h>
    #include <ti/csl/csl_types.h>
    #include <ti/csl/hw_types.h>
    #include <ti/csl/arch/csl_arch.h>
    #include <ti/csl/soc.h>
    #include <ti/csl/csl_rti.h>
    #include <ti/boot/sbl_auto/sbl_lib/sbl_lib.h>
    #include <ti/boot/sbl_auto/sbl_lib/sbl_lib_tda3xx.h>
    #include <ti/boot/sbl_auto/sbl_utils/sbl_utils_common.h>
    #include <ti/boot/sbl_auto/sbl_utils/sbl_utils_tda3xx.h>
    #include <ti/drv/stw_lld/platform/platform.h>
    #include <ti/drv/stw_lld/uartconsole/uartStdio.h>
    #include <ti/drv/pm/pmhal.h>
    #include <sbl_mflash_utils_priv.h>
    #include <ti/drv/stw_lld/uartconsole/uartConsole.h>
    
    /* ========================================================================== */
    /*                           Macros & Typedefs                                */
    /* ========================================================================== */
    
    /* Macro to disable/enable RTI */
    #define SBL_DISABLE_RTI                                ((uint32_t) TRUE)
    
    /* ========================================================================== */
    /*                         Structures and Enums                               */
    /* ========================================================================== */
    
    /* None */
    
    /* ========================================================================== */
    /*                 Internal Function Declarations                             */
    /* ========================================================================== */
    
    /**
     * \brief   This function copies the vector table to IPU RAM.
     *
     * \param   None.
     *
     * \retval  None.
     */
    static void SblCopyVectorTable(void);
    
    /**
     * \brief   This function does the SBL configuration needed before running
     *          IPU TESOC Tests.
     *
     * \param   None.
     *
     * \retval  None.
     */
    static void SblConfigSoc(void);
    
    /**
     * \brief   This function acts as a wrapper for SBL print function.
     *
     * \param   message       Message to be printed.
     *
     * \retval  None.
     *
     * \note    Below ifdef __cplusplus is added so that C++ build passes without
     *          typecasting. This is because the prototype is build as C type
     *          whereas this file is build as CPP file. Hence we get C++ build
     *          error. Also if typecasting is used, then we get MisraC error
     *          Rule 11.1.
     */
    #ifdef __cplusplus
    extern "C" {
    #endif
    
    /**
     * \brief  This is implementation of print function.
     *
     * \param   message   message to be printed
     *
     * \return  None.
     */
    static void SblPrintFunction(const char *message);
    
    /**
     * \brief  This is implementation of print hex num function.
     *
     * \param   tracelevel  trace level of message
     * \param   value       Number to be printed
     *
     * \return  None.
     */
    static void SblPrintHexNumFunction(uint32_t tracelevel, uint32_t value);
    
    /**
     * \brief  This is implementation of getc function.
     *
     * \param  None
     *
     * \return None.
     */
    static char SblGetcFunction(void);
    
    /**
     * \brief  This is implementation of get num function.
     *
     * \param  None
     *
     * \return None.
     */
    static uint32_t SblGetNumFunction(void);
    
    /**
     * \brief  This is implementation of get hex num function.
     *
     * \param  None
     *
     * \return None.
     */
    static uint32_t SblGetHexNumFunction(void);
    
    #ifdef __cplusplus
    }
    #endif
    
    /* ========================================================================== */
    /*                            Global Variables                                */
    /* ========================================================================== */
    
    extern const volatile uint32_t vector_table[NUM_ELEMENTS_VECTOR_TABLE];
    
    /* ========================================================================== */
    /*                          Function Definitions                              */
    /* ========================================================================== */
    
    int main(void)
    {
        sbllibInitParams_t sblInitPrms;
        /* Default initialization of SBL Lib Params */
        SBLLibInitParamsInit(&sblInitPrms);
        /* Assign SBL Params */
        sblInitPrms.printFxn       = &SblPrintFunction;
        sblInitPrms.printHexNumFxn = &SblPrintHexNumFunction;
        sblInitPrms.getcFxn        = &SblGetcFunction;
        sblInitPrms.getNumFxn      = &SblGetNumFunction;
        sblInitPrms.getHexNumFxn   = &SblGetHexNumFunction;
    
        SBLLibInit(&sblInitPrms);
        SblConfigSoc();
        SBLMFlashRun();
    
        return 0;
    }
    
    /* -------------------------------------------------------------------------- */
    /*                 Internal Function Definitions                              */
    /* -------------------------------------------------------------------------- */
    
    static void SblPrintFunction(const char *message)
    {
        UARTPuts(message, -((int32_t) 1));
    }
    
    static void SblPrintHexNumFunction(uint32_t tracelevel, uint32_t value)
    {
        UARTPutHexNum(value);
    }
    
    static char SblGetcFunction(void)
    {
        return UARTGetc();
    }
    
    static uint32_t SblGetNumFunction(void)
    {
        return ((uint32_t) UARTGetNum());
    }
    
    static uint32_t SblGetHexNumFunction(void)
    {
        return UARTGetHexNum();
    }
    
    static void SblCopyVectorTable(void)
    {
        uint32_t addr   = 0x8U, index = 0U;
        uint32_t length = NUM_ELEMENTS_VECTOR_TABLE;
    
        for (index = 2U; index < length; index++)
        {
            HW_WR_REG32(addr, vector_table[index]);
            addr = addr + 4U;
        }
    }
    
    static void SblConfigSoc(void)
    {
        int32_t                retVal = STW_SOK;
        pmhalPrcmDpllConfig_t *dpllParams;
        pmhalPrcmSysClkVal_t   sysClkFreq = PMHAL_PRCM_SYSCLK_20_MHZ;
        uint32_t               siliconPackageType;
        volatile uint32_t      spin = 1U;
        siliconPackageType = PlatformGetSiliconPackageType();
    
        if (TRUE == SBL_DISABLE_RTI)
        {
            /* Configure DWWD Window size */
            RTIDwwdSetWindowSize(SOC_RTI1_BASE, RTI_DWWD_WINDOWSIZE_50_PERCENT);
    
            /* Service DWWD */
            RTIDwwdService(SOC_RTI1_BASE);
    
            /* Change RTI's action to interrupt */
            RTIDwwdSetReaction(SOC_RTI1_BASE, RTI_DWWD_REACTION_GENERATE_NMI);
        }
    
        /* Configure the IPU1 AMMU */
        SBLUtilsConfigIPU1DefaultAMMU();
    
        /* Copy the vector table */
        SblCopyVectorTable();
    
        /* Enable the interrupt */
        Intc_IntEnable(0);
    
        /* Unlock the MMR registers */
        PlatformUnlockMMR();
    
        /* Get the Sys clock1 Frequency */
        sysClkFreq = PMHALCMGetSysClockFreqEnum();
    
        /* Configure DPLL CORE */
        retVal += SBLLibGetDpllStructure(PMHAL_PRCM_DPLL_CORE,
                                         sysClkFreq,
                                         SBLLIB_PRCM_DPLL_OPP_NOM,
                                         &dpllParams);
    
        /* L3 clock = CORE CLK /2, L4 clock = L3 clock /2 */
        PMHALCMDpllSetClockDivider(PMHAL_PRCM_DIV_L3_ICLK, (uint32_t) 2U);
        PMHALCMDpllSetClockDivider(PMHAL_PRCM_DIV_L4_ROOT_CLK, (uint32_t) 2U);
    
        retVal += PMHALCMDpllConfigure(PMHAL_PRCM_DPLL_CORE,
                                       dpllParams,
                                       PM_TIMEOUT_INFINITE);
    
        /* Configure DPLL PER */
        retVal += SBLLibGetDpllStructure(PMHAL_PRCM_DPLL_PER,
                                         sysClkFreq,
                                         SBLLIB_PRCM_DPLL_OPP_NOM,
                                         &dpllParams);
    
        retVal += PMHALCMDpllConfigure(PMHAL_PRCM_DPLL_PER,
                                       dpllParams,
                                       PM_TIMEOUT_INFINITE);
    
        if (STW_SOK != retVal)
        {
            SBLLibPrintf(SBLLIB_TRACE_LEVEL_ERROR,
                         "\n SBL DPLL Config Failed \n");
            SBLLibAbortBoot();
        }
    
        /* UART Initialization */
        /* Configure PRCM for UART instance */
        SBLUtilsUartPrcm(UART3_INST);
    
        /* Configure Pin Mux for UART instance */
        PlatformUARTSetPinMux(UART3_INST);
    
        /* Initialize UART Peripheral */
        UARTConsoleConfigInit(UART3_INST,
                              (uint32_t) BAUD_RATE_3686400,
                              (uint32_t) UART13x_OPER_MODE,
                              (uint32_t) UART_PARITY_NONE,
                              (uint32_t) UART_FRAME_WORD_LENGTH_8,
                              (uint32_t) UART_FRAME_NUM_STB_1
                              );
    
        SBLLibPrintf(SBLLIB_TRACE_LEVEL_INFO1, "\n TDA3xx SBL Boot \n");
    
        if (PLATFORM_SILICON_PACKAGE_TYPE_12X12 == siliconPackageType)
        {
            SBLLibPrintf(SBLLIB_TRACE_LEVEL_INFO1,
                         "\n Identified 12X12 Silicon \n");
        }
        else /* PLATFORM_SILICON_PACKAGE_TYPE_15X15 == siliconPackageType */
        {
            SBLLibPrintf(SBLLIB_TRACE_LEVEL_INFO1,
                         "\n Identified 15X15 Silicon \n");
        }
    
        /* Enable the Power Domains */
        SBLUtilsConfigPowerDomains();
    
        /* Configure DPLL DDR and DPLL GMAC */
        SBLUtilsConfigDpll(SBLLIB_PRCM_DPLL_OPP_NOM);
    
        /* Enable the Clock Domains */
        SBLUtilsConfigClockDomains();
    
        /* Enable the Modules */
        SBLUtilsConfigModules();
    
        SBLLibPrintf(SBLLIB_TRACE_LEVEL_IMP_INFO,
                     "\n TDA3xx SOC Init Completed \n");
    }
    
    

    Regards

    Naveen

  • Yes, You are building from an older version of sbl_mflash. The newer version of sbl_mflash is provided with VSDK 3.1 which is highly optimized and automated. I am attaching the sbl_mflash which should work for you. Just rename it to sbl_mflash to make it work.

    sbl_mflash.zip

  • Thanks Prawal

    This version of sbl_mflash worked perfectly. We will check the VSDK 3.1 release.

    Regards
    Naveen