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.

Simple UART application

Hi All !

I write simple UART program for c6678 (text of the program is below):

#include <stdio.h>
#include <stdlib.h>
#include <xdc/std.h>
#include <string.h>
#include <ti/platform/platform.h>

#define DEF_INIT_CONFIG_UART_BAUDRATE    115200            // baud rate

void test_UART(uint32_t *args)
{
    uint8_t     message[] = "\r\nThis is a Platform UART API unit test ...\r\n";
    int         length = strlen((char *)message);
    uint8_t     buf;
    int         i;
    WRITE_info     setting;

    platform_uart_set_baudrate(*args);
  
    setting = platform_write_configure (PLATFORM_WRITE_PRINTF);

    for (i = 0; i < length; i++)
    {
        platform_uart_write(message[i]);
    }

    for (i = 0; i < 10; i++)
    {
        platform_errno = PLATFORM_ERRNO_RESET;
        if (platform_uart_read(&buf, 30 * 10000000) == Platform_EOK)
        {
            platform_write("Char %d = %c\n", i, buf);
        }
        else
        {
            platform_write("Char %d = %c (errno: 0x%x)\n", i, buf, platform_errno);
        }
    }

    platform_write_configure (setting);
}

void main()
{
    uint32_t args = DEF_INIT_CONFIG_UART_BAUDRATE;

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

    test_UART(&args);
}

However I get errors at compilation. These errors like:

"Undefined symbol platform_uart_init, platform_uart_set_baudrate, platform_uart_write, platform_uart_read in main.obj".

Whats wrong in me simple program ?

It seems like I forgot to add some module in *.cfg file...

  • Compilation error is:


     undefined                  first referenced
      symbol                        in file     
     ---------                  ----------------
     platform_errno             ./main.obj      
     platform_uart_init         ./main.obj      
     platform_uart_read         ./main.obj      
     platform_uart_set_baudrate ./main.obj      
     platform_uart_write        ./main.obj      
     platform_write             ./main.obj      
     platform_write_configure   ./main.obj      

    error: unresolved symbols remain
    error: errors encountered during linking; "UART1.out" not built
    gmake: *** [UART1.out] Error 1

    I copied ti.platform.evm6678l.ae66 and ti.platform.evm6678l.lite.lib files to root directory of my project. It helped, but anyway "platform_write" and "platform_write_configure" are not defined yet. How to solve this problem ?

  • Andrey,

    Search for the functions platform_write_configure() and platform_write() in your whole project and CCS directories. Try using the tool "windows grep". If you can find the library, include it in your build.