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.

PLATFORM_DEBUG = 1, platform_init(), debugging and print statements

Hi Ti folks,

                  I got into an issue with platform_init. Somehow Code flow is stuck inside that. I am debugging that and i could see few comments in platform.c

<PDK INSTALLATION PATH>\packages\ti\platform\evmc667Xl\platform_lib\src

/*************************************************************************
* This routine may be called before BIOS or the application has loaded.
* Do not try and write debug statements from here.
***********************************************************************/

So Accordingly, i am not placing any comments or debug statements inside. 

Also i made PLATFORM_DEBUG = 1 in platform_internal.h

/* Turn on and off debug statements (may not be safe in certain contexts) */
#define PLATFORM_DEBUG 0 [i made this to 1]

1 .I am not seeing any debug prints, let me know is there anything which i can do for enabling debug prints. Please put these information clearly in doc for debugging inside platform_init and also let me know if i missed this info anywhere written in Ti literature.

2. Also is it ok to call platform_write in all possible places in platform_init(), so that i can know the issue exactly.

Ofcourse, i am rebuilding the complete libraries [from pdk installation path] and rebuilding my application code

Thanks

RC Reddy

  • Also,

           since this

    #if (PLATFORM_DEBUG)
             #define IFPRINT(x) (x)
    #else
              #define IFPRINT(x)
    #endif

    and there are many [around 51 inside platform.c] print statements like below,

    IFPRINT(platform_write("PA PLL programmable divider = %d\n", ddr3_plld));

    i expect it to work, let me know if my understanding is incorrect

    wait. one more info..i am looking at uart for these prints. mm.in oneway..that may be incorrect as uart_init is yet to happen within this platform_init(). does this platform_write is to external world [uart to console]

    ====================

    * @remark This routine will output the printf style string
    * to one or both of the UART and/or through a printf
    * call (in CCS this is mapped to the console window).
    * By default, both are written. This can be controlled
    * by setting write_type in the paltform_init structure.
    * By default, both the UART and printf outputs are used.

    void platform_write(const char *fmt, ...);

    ====================

  • Hi Ti folks,

                       you can close the post. I was able to resolve the issue

    Here are my mistakes..which i was doing

    1. I was always building PDK packages and after a while i checked in pdk build logs. nowhere it is touching platform_lib .ae66 .ae66e files.

    2. in windows i imported the project C:\ti\pdk_C6678_1_0_0_21\packages\ti\platform\evmc6678l\platform_lib

    and put the appropriate endian and compiler and rebuilt the project.this time it bulit the .ae66 [litle endian lib]

    3.i closed the ccs

    4. imported C:\ti\pdk_C6678_1_0_0_21\packages\ti\platform\evmc6678l\platform_test into ccs

    5. while doing step 2, i put some prints inside the code and i can see them coming

    6. a small correction is that i pull the following 3 lines before platform_init

    platform_write_configure(PLATFORM_WRITE_PRINTF);
    platform_uart_init();
    platform_uart_set_baudrate(args.init_config_uart_baudrate);

    if (platform_init(&init_flags, &init_config) != Platform_EOK) {
    printf("Platform failed to initialize, errno = 0x%x \n", platform_errno);
    }

    this is to configure that print shud happen to OUTPUT CONSOLE not any uart.

    7. i also enabled the debug prints PLATFORM_DEBUG = 1

    8. i can see the prints as follows [boldened are my platform write statements]

    C66xx_0] platform_uart_init called
    [C66xx_0] platform_uart_set_baudrate(baudrate=115200) called
    [C66xx_0] platform_uart_set_baudrate(baudrate=115200) called
    [C66xx_0] Setup 1 Done.
    [C66xx_0] Setup 2 Done.
    [C66xx_0] SYSCLK/ALTCORECLK is the input to the PA PLL...
    [C66xx_0] PA PLL programmable multiplier = 21
    [C66xx_0] PA PLL programmable divider = 1
    [C66xx_0] PLL3 Setup for PASSCLK @ 2580.5 MHz...
    [C66xx_0] PLL3 Setup... Done.
    [C66xx_0] PA PLL programmable multiplier = 20
    [C66xx_0] PA PLL programmable divider = 1
    [C66xx_0] PLL2 Setup... Done.

    it took a while for me to understand which lib to build to get platform_lib working. but at the end it worked

    Thanks

    RC Reddy