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.

The question about ibl code



Hi,everyone,

    I use C6678EVM and I have changed IBL code in the path of ibl/src/device/c66x/c66xinit.c and use MinGW to build it ,the code I have changed is added the UART function,as following:  

#include "platform.h"

#define BOOT_UART_BAUDRATE         115200

void
write_uart
(
char* msg
)
{
uint32_t i;
uint32_t msg_len = strlen(msg);

/* Write the message to the UART */
for (i = 0; i < msg_len; i++)
{
platform_uart_write(msg[i]);
}
}

platform_uart_init();
platform_uart_set_baudrate(BOOT_UART_BAUDRATE);
write_uart("simon");

     The purpose I do this change is I want to set C6678 as pcie boot ,and I know after I power on compiler c6678,it will first execute IBL code,so I want to verify the conclusion according to the print information in UART. 

      The error have occurred when I build the code as following :

How can I solve the problem ?Or there is another idea to send messages to UART when execute ibl code ? 

Regards,

Simon

  • Please don't use platform UART APIs, instead, you can use the following IBL UART code stuff.
    C:\ti\mcsdk_2_01_02_06\tools\boot_loader\ibl\src\hw\uart\c66x_uart\c66x_uart.c

    Try this API in your code.
    uart_write_string("Simon")

    Refer this file for IBL UART APIs.
    C:\ti\mcsdk_2_01_02_06\tools\boot_loader\ibl\src\device\c66x\c66x.c
  • As recommended above by Titus, please use the IBL API's to add the custom uart prints in it. Refer iblmain.c file for usage,

    PATH: ~\ti\mcsdk_2_01_02_06\tools\boot_loader\ibl\src\main\iblmain.c

    #include <string.h>
    
    #include "uart.h"
    
    .
    
    .
    
    .
    
    /* Init UART */
    
    uart_init();
    
    uart_write_string("", 0);
    
    uart_write_string("IBL version: "ibl_VERSION_STR, 0);

    Thank you.

  • Hi,Raja,

            I have used IBL API function uart_init() and uart_write _string () in /ibl/ src/main/iblinit.c and include "uart .h",to my surprise  the issue remain as following :

            

            And ibl/src/main/iblmain.c can use the function normally ,why ?

            Thank you 

            Simon

  • Simon,
    May be the IBL is not designed that way.
    You can modify the makefile available in IBL directories to link the required libraries and files. Thank you.
  • Hi,Raja,

          1. I have changed the makefile "makestg2" in the path of ibl/src/make,and it can be built successfully .the file before I change as following :

          

           Because the error occurred when linking Lib,and iblmain() can build successfully but iblinit() can't,I found "ibl_init.cmd$(RTLIBS)" may have some relationship to linking Lib, so I changed ibl_init.cmd$(RTLIBS) to ibl.cmd$(RTLIBS),and it can build without error .  

            Is my thought reasonable ?Can you give me more professional explanation about this makefile? 

          2.I want to program the ibl to EEPROM 0x51 after I have added uart_init() and uart_write_string() function ,  after I connect core0 to CCS,load .out,load the i2crom_0x51_c6678_le.bin the latest generated to 0x0c000000,and run core0,the error occurred in CCS console as following :

          

          The project I use is eepromwriter_evmc6678l,and according to the code in the project as following :      

         

    if (data_len > (eepromWriterInfo.deviceTotalBytes - eepromWriterInfo.startAddr))
        {
            printf ("The data file is too big to fit into the device.\n");
            return FALSE;
        }

    What's the meaning about variable data_len,eepromWriterInfo.deviceTotalBytes and eepromWriterInfo.startAddr?

    Is there some idea to solve the problem ?
    Thank you
    Simon

  • What is the size of the build binary file?  

    The file size should be less than 64KB.

    #if (PLATFORM_EEPROM_IN)
    
    #pragma DATA_SECTION(gDeviceEeprom0,"platform_lib");
    
    PLATFORM_DEVICE_info gDeviceEeprom0 = {PLATFORM_EEPROM_MANUFACTURER_ID,PLATFORM_EEPROM_DEVICE_ID_1,PLATFORM_DEVICE_EEPROM, 8, 1, 1, 65536, 0, PLATFORM_DEVID_EEPROM50, 0, 0, 0, NULL, NULL};
    
    #pragma DATA_SECTION(gDeviceEeprom1,"platform_lib");
    
    PLATFORM_DEVICE_info gDeviceEeprom1 = {PLATFORM_EEPROM_MANUFACTURER_ID,PLATFORM_EEPROM_DEVICE_ID_2,PLATFORM_DEVICE_EEPROM, 8, 1, 1, 65536, 0, PLATFORM_DEVID_EEPROM51, 0, 0, 0, NULL, NULL};
    
    #endif
    
    .
    
    .
    
    .
    
    eepromWriterInfo.deviceTotalBytes = p_device->block_count * p_device->page_count * p_device->page_size;

    which is

    eepromWriterInfo.deviceTotalBytes = 1 * 1 * 65536;

  • Hi,Raja,

            Thank you for your reply.

             The binary file generated is more than 70KB.

             But why the binary file is so big after I built?

            What I have changed is only changed the makefile“makestg2” as I latest post  and added function uart_init() and  uart_write_string()in ibl_init.c.

             Thank you

             Simon

  • Simon,
    To solve the problem,
    Option 1: Instead of linking library, statically put those UART functions with different name in required .c file and build and try.

    Option 2: This may be possible, please check. The size of the EEPROM is 128K with 2 slave addressing (0x50/0x51). With hardware modification, try to access whole 128K for single slave address. This will require EEPROM writer update as well.

    Thank you.
  • Hi,Raja,

           For option 2,you mean I should modify hardware structure reference hardware principle diagram?Or only modify EEPROM writer code to realize it?

           Best Regards,

           Simon

  • Please check the feasibility in EEPROM data manual and EVM schematic. Without the hardware changes, modifying writer won't help.
  • Hi,Raja,

        The problem have been solved after I define the functions in iblinit.c,Thank you very much.

        But the main purpose for me is configure MPAX register in IBL code ,there is a problem ,you can see the MPAX code as following :

       

         lvMarPtr = (volatile uint32_t*)0x08000024;
    
         H_Value = 0x90000017    ;
    
         if (coreNum == 0) L_Value = 0x8100003f    ;
         if (coreNum == 1) L_Value = 0x8110003f    ;
         if (coreNum == 2) L_Value = 0x8120003f    ;
         if (coreNum == 3) L_Value = 0x8130003f    ;
         if (coreNum == 4) L_Value = 0x8140003f    ;
         if (coreNum == 5) L_Value = 0x8150003f    ;
         if (coreNum == 6) L_Value = 0x8160003f    ;
         if (coreNum == 7) L_Value = 0x8170003f    ;
    
    
         *lvMarPtr++ = L_Value;
         *lvMarPtr++ = H_Value;
    

        We can see, the code use MPAX4 registers to map the same 32 bit address(0x90000000) to 36 bit  physical address,and the value of L_Value is different between coreNum.So how can I set the value of MPAX4 different depend on coreNum in IBL code ?

       The address  0x08000024 is logical address or physical address ?MPAX4 register is private for every core ?

       Regards,

       Simon 

  • Glad to here. How did you solve the issue?

    So how can I set the value of MPAX4 different depend on coreNum in IBL code ?

    IBL is a secondary bootloader not an end application; The MPAX configuration can be handled in application level.

     The address  0x08000024 is logical address or physical address ?MPAX4 register is private for every core ?

    I request you to create new thread for queries on MPAX. I will ping few experts to respond over there.

    Thank you.

  • Hi,Raja,

           I have defined the function in the iblinit.c file,and after build it,the .bin generated only 51.1KB,smaller than 64KB,so it can program to EEPROM successfully.And then I set C6678 as PCIe boot,after power on C6678 EVM,I can see the information I added print from UART.

           I will create a new thread about MPAX,Thank you very much.

           Best Regards,

           Simon

  • Simon,
    That sounds good. Thank you for the post.