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.

RE: combing UDPEcho and UartConsole.

Other Parts Discussed in Thread: SYSBIOS

When I compile the program I get the following warning.

#174-D external/internal linkage conflict with previous declaration

When I click on the error it goes to the following in socket.h. I have read about this . It has something to do about using external and static. In the UartUtils.c and UartUtils.h both are used, but these are uart not socket users. With this warning when I transfer data over UDP the first message goes through, but the second message fails because it says the host, which is this device closed the port.

Again I am using UDPEcho and Uart console virtually unchanged. I have removed the logging code.  The UDPEcho used by itself doesn't give this warning and it works with no failures.

Any help would be appreciated.  Also when I post a question I don't receive any mail notifications.  I have set my email preferences in settings. 

/*
* ======== close ========
*/
static inline int close(int sockfd)
{
return fdClose((SOCKET)sockfd);
}

My config file

/*
* ======== uartconsole.cfg ========
*/

/* ================ General configuration ================ */
var Defaults = xdc.useModule('xdc.runtime.Defaults');
//var Diags = xdc.useModule('xdc.runtime.Diags');
//var Error = xdc.useModule('xdc.runtime.Error');
//var Log = xdc.useModule('xdc.runtime.Log');
//var Main = xdc.useModule('xdc.runtime.Main');
//var Memory = xdc.useModule('xdc.runtime.Memory');
var System = xdc.useModule('xdc.runtime.System');
//var Text = xdc.useModule('xdc.runtime.Text');

var Task = xdc.useModule('ti.sysbios.knl.Task');
var Hwi = xdc.useModule('ti.sysbios.hal.Hwi');
//var Load = xdc.useModule('ti.sysbios.utils.Load');
//var Ip = xdc.useModule('ti.ndk.config.Ip');
//var Udp = xdc.useModule('ti.ndk.config.Udp');
//var Global = xdc.useModule('ti.ndk.config.Global');
//var BIOS = xdc.useModule('ti.sysbios.BIOS');
//var Clock = xdc.useModule('ti.sysbios.knl.Clock');
//var HeapMem = xdc.useModule('ti.sysbios.heaps.HeapMem');
//var Tcp = xdc.useModule('ti.ndk.config.Tcp');
/* ================ General configuration ================ */


//var Clock = xdc.useModule('ti.sysbios.knl.Clock');
/*
* Program.stack is ignored with IAR. Use the project options in
* IAR Embedded Workbench to alter the system stack size.
*/
if (!Program.build.target.$name.match(/iar/)) {
/*
* Reducing the system stack size (used by ISRs and Swis) to reduce
* RAM usage.
*/
Program.stack = 2048;
}

/*
* Comment this line to allow module names to be loaded on the target.
* The module name strings are placed in the .const section. Setting this
* parameter to false will save space in the .const section. Error and
* Assert messages will contain an "unknown module" prefix instead
* of the actual module name.
*/
Defaults.common$.namedModule = false;

/*
* Minimize exit handler array in System. The System module includes
* an array of functions that are registered with System_atexit() to be
* called by System_exit().
*/
//System.maxAtexitHandlers = 2;

/* ================ System configuration ================ */
/*
var SysCallback = xdc.useModule('xdc.runtime.SysCallback');
SysCallback.abortFxn = "&UARTUtils_systemAbort";
SysCallback.putchFxn = "&UARTUtils_systemPutch";
SysCallback.readyFxn = "&UARTUtils_systemReady";
System.SupportProxy = SysCallback;
*/
/* ================ BIOS configuration ================ */
/*
* Disable unused BIOS features to minimize footprint.
* This example uses Tasks but not Swis or Clocks.
*/

var BIOS = xdc.useModule('ti.sysbios.BIOS');
BIOS.libType = BIOS.LibType_Custom;
BIOS.swiEnabled = true;
BIOS.logsEnabled = false;
BIOS.assertsEnabled = false;

BIOS.heapSize = 0x800;


/* Reduce the number of task priorities */
Task.numPriorities =10;

/* ================ Task configuration ================ */
var taskParams = new Task.Params();
taskParams.instance.name = "console";
taskParams.stackSize = 1536;
Program.global.console = Task.create("&consoleFxn", taskParams)
/* ================ System configuration ================ */
var SysMin = xdc.useModule('xdc.runtime.SysMin');
System.SupportProxy = SysMin;

/* Runtime stack checking is performed */
Task.checkStackFlag = false;
Hwi.checkStackFlag = false;

/* Enable Semihosting for GNU targets to print to CCS console */
//if (Program.build.target.$name.match(/gnu/)) {
// var SemiHost = xdc.useModule('ti.sysbios.rts.gnu.SemiHostSupport');
//};
/* ================ NDK configuration ================ */
var Ndk = xdc.loadPackage('ti.ndk.config');
var Global = xdc.useModule('ti.ndk.config.Global');
var Ip = xdc.useModule('ti.ndk.config.Ip');
var Udp = xdc.useModule('ti.ndk.config.Udp');
BIOS.heapSize = 20480;
Task.idleTaskStackSize = 768;

Global.IPv6 = false;
//Global.stackLibType = Global.MIN;
Global.networkOpenHook = "&netOpenHook";

/* automatically call fdOpen/CloseSession for our sockets Task */
Global.autoOpenCloseFD = true;

Global.pktSizeFrameBuf = 1536;

Global.pktNumFrameBufs = 10;
Global.memRawPageCount = 6;
Global.ndkThreadStackSize = 1536;
Global.lowTaskStackSize = 1024;
Global.normTaskStackSize = 1024;
Global.highTaskStackSize = 1024;

/* ================ Driver configuration ================ */
var TIRTOS = xdc.useModule('ti.tirtos.TIRTOS');
TIRTOS.useGPIO = true;
TIRTOS.useEMAC = true;
TIRTOS.useUART = true;
Ip.autoIp = false;
Ip.address = "192.168.1.9";
Ip.mask = "255.255.255.0";

  • Donald,

    Can you maybe post/attach your entire project?  Or at least the C file?

    Thanks,
    Scott

  • This is the c code.

    /*
    * ======== uartconsole.c ========
    */

    //#include <file.h>
    #include <stdio.h>
    #include <stdlib.h>
    #include <string.h>
    #include <stdbool.h>
    #include "inc/hw_memmap.h"
    //#include "driverlib/pin_map.h"
    //#include "inc/hw_types.h"
    /* XDCtools Header files */
    #include <xdc/std.h>
    #include <xdc/cfg/global.h>
    #include <xdc/runtime/Error.h>
    #include <xdc/runtime/System.h>
    #include <ti/sysbios/knl/Task.h>
    /* BIOS Header files */
    #include <ti/sysbios/BIOS.h>
    #include <ti/sysbios/utils/Load.h>
    #include "driverlib/adc.h"
    /* TI-RTOS Header files */
    #include <ti/drivers/GPIO.h>
    #include <ti/drivers/UART.h>
    #include "systick.h"

    /* Example/Board Header files */
    #include "Board.h"
    #include "UARTUtils.h"
    //#include "USBCDCD_LoggerIdle.h"
    int timedelay1 = 0;
    uint32_t ui32ADC0Value[4];
    volatile uint32_t ui32TempAvg;
    volatile uint32_t ui32TempValueC;
    volatile uint32_t ui32TempValueF;
    char disbuffer[12];
    uint32_t dis=0;
    Void gpioSpeedFxn0(void){
    dis++;
    //ltoa(dis, disbuffer);
    printf("HELP");
    }

    Void consoleFxn(UArg arg0, UArg arg1)
    {
    // unsigned int sleepDur;
    // unsigned int count;
    // unsigned int cpuLoad;
    // char input[128];

    // count = 1;

    /* printf goes to the UART com port */
    printf("\f======== Welcome to the Console ========\n");
    printf("Enter a command followed by return.\n"
    "Type help for a list of commands.\n\n");

    }
    /*
    * ======== main ========
    */
    int main(void)
    {
    /* Call board init functions */
    Board_initGeneral();
    Board_initGPIO();
    Board_initUART();
    // Board_initUSB(Board_USBDEVICE);
    Board_initADC();
    // Init_Systick();

    /* Turn on user LED */
    GPIO_write(Board_LED0, Board_LED_ON);

    /*
    * Add the UART device to the system.
    * All UART peripherals must be setup and the module must be initialized
    * before opening. This is done by Board_initUART(). The functions used
    * are implemented in UARTUtils.c.
    */
    add_device("UART", _MSA, UARTUtils_deviceopen,
    UARTUtils_deviceclose, UARTUtils_deviceread,
    UARTUtils_devicewrite, UARTUtils_devicelseek,
    UARTUtils_deviceunlink, UARTUtils_devicerename);

    /* Open UART0 for writing to stdout and set buffer */
    freopen("UART:0", "w", stdout);
    setvbuf(stdout, NULL, _IOLBF, 128);

    /* Open UART0 for reading from stdin and set buffer */
    freopen("UART:0", "r", stdin);
    setvbuf(stdin, NULL, _IOLBF, 128);

    /*
    * Initialize UART port 0 used by SysCallback. This and other SysCallback
    * UART functions are implemented in UARTUtils.c. Calls to System_printf
    * will go to UART0, the same as printf.
    */
    UARTUtils_systemInit(0);
    // GPIO_enableIn
    //

    GPIO_setCallback(Board_PP4, gpioSpeedFxn0);
    GPIO_clearInt(Board_PP4);
    GPIO_enableInt(Board_PP4);
    System_printf("Starting the UART Console example\n");



    /* Start BIOS */
    BIOS_start();
    return (0);

    }
  • I am so terribly sorry. I posted the wrong program. I fixed this problem. I modified my config file to the following which eliminated all the SWI code. I'm am not knowledgeable enough to know why it fixed it. The new config file follows:


    /*
    * ======== udpEcho.cfg ========
    */

    /* ================ General configuration ================ */
    var Defaults = xdc.useModule('xdc.runtime.Defaults');
    var Diags = xdc.useModule('xdc.runtime.Diags');
    var Error = xdc.useModule('xdc.runtime.Error');
    var Log = xdc.useModule('xdc.runtime.Log');
    var Main = xdc.useModule('xdc.runtime.Main');
    var Memory = xdc.useModule('xdc.runtime.Memory');
    var System = xdc.useModule('xdc.runtime.System');
    var Text = xdc.useModule('xdc.runtime.Text');

    var BIOS = xdc.useModule('ti.sysbios.BIOS');
    var Clock = xdc.useModule('ti.sysbios.knl.Clock');
    var Task = xdc.useModule('ti.sysbios.knl.Task');
    var Hwi = xdc.useModule('ti.sysbios.hal.Hwi');
    var HeapMem = xdc.useModule('ti.sysbios.heaps.HeapMem');

    BIOS.heapSize = 20480;
    Task.idleTaskStackSize = 768;

    /*
    * Program.stack is ignored with IAR. Use the project options in
    * IAR Embedded Workbench to alter the system stack size.
    */
    if (!Program.build.target.$name.match(/iar/)) {
    /*
    * Reducing the system stack size (used by ISRs and Swis) to reduce
    * RAM usage.
    */
    Program.stack = 2048;
    }

    /* ================ System configuration ================ */
    var SysMin = xdc.useModule('xdc.runtime.SysMin');
    System.SupportProxy = SysMin;

    /* Runtime stack checking is performed */
    Task.checkStackFlag = true;
    Hwi.checkStackFlag = true;

    /* Enable Semihosting for GNU targets to print to CCS console */
    if (Program.build.target.$name.match(/gnu/)) {
    var SemiHost = xdc.useModule('ti.sysbios.rts.gnu.SemiHostSupport');
    }

    /* ================ NDK configuration ================ */
    var Ndk = xdc.loadPackage('ti.ndk.config');
    var Global = xdc.useModule('ti.ndk.config.Global');
    var Ip = xdc.useModule('ti.ndk.config.Ip');
    var Udp = xdc.useModule('ti.ndk.config.Udp');
    var Tcp = xdc.useModule('ti.ndk.config.Tcp');

    Global.IPv6 = false;
    Global.stackLibType = Global.MIN;
    Global.networkOpenHook = "&netOpenHook";

    /* automatically call fdOpen/CloseSession for our sockets Task */
    Global.autoOpenCloseFD = true;

    Global.pktSizeFrameBuf = 1536;

    Global.pktNumFrameBufs = 10;
    Global.memRawPageCount = 6;
    Global.ndkThreadStackSize = 1536;
    Global.lowTaskStackSize = 1024;
    Global.normTaskStackSize = 1024;
    Global.highTaskStackSize = 1024;
    Tcp.transmitBufSize = 0;
    Tcp.receiveBufSize = 0;

    /* ================ Driver configuration ================ */
    var TIRTOS = xdc.useModule('ti.tirtos.TIRTOS');
    TIRTOS.useEMAC = true;
    TIRTOS.useGPIO = true;
    Ip.autoIp = false;
    Ip.address = "192.168.1.9";
    Ip.mask = "255.255.255.0";
  • Donald,

    I was JUST now typing a reply to you when you posted this.

    I’d tried building with your C file and .cfg file and there were lots of errors to seemingly unrelated things: include systick.h, Board_initADC, GPIO_setCallback(), …  And these won’t resolve with your latest .cfg code.  Can you please attach your entire project so I can try building that?

    Thanks,
    Scott