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.

CCS/TM4C123GH6PM: Error #249 function "CMD_help" has already been defined.

Part Number: TM4C123GH6PM

Tool/software: Code Composer Studio

Hi

I want to transmit data from TM4C123GH6PM to mobile phone using ZIGBEE Wi-Fi module. But compiling code in CCS, I am getting 3 errors (all are similar) function has already been defined.

 

cmd.c code

//*****************************************************************************
// Copyright (c) 2012-2013 Texas Instruments Incorporated.  All rights reserved.
// Software License Agreement
// 
// Texas Instruments (TI) is supplying this software for use solely and
// exclusively on TI's microcontroller products. The software is owned by
// TI and/or its suppliers, and is protected under applicable copyright
// laws. You may not combine this software with "viral" open-source
// software in order to form a larger program.
// 
// THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS.
// NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT
// NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
// A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY
// CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL
// DAMAGES, FOR ANY REASON WHATSOEVER.
// 
// This is part of revision 1.0 of the EK-TM4C123GXL Firmware Package.
//
//*****************************************************************************

#include <stdint.h>
#include <stdbool.h>
#include "main.h"
#include "inc/hw_types.h"
#include "utils/ustdlib.h"
#include "utils/uartstdio.h"
#include "utils/cmdline.h"
#include "cmd.h"

//*****************************************************************************
//
// Table of valid command strings, callback functions and help messages.  This
// is used by the cmdline module.
//
//*****************************************************************************
/*tCmdLineEntry g_psCmdTable[] =
{
    {"Help",     CMD_help,      " : Display list of commands" },
    {"SetAngle",     CMD_SetServoAngle,      " : Set servo angle" },
    {"CloseConnection",     CMD_QuitProcess,      " : Close the Connection" },
    { 0, 0, 0 }
};
*/
//*****************************************************************************
//
// Command: help
//
// Print the help strings for all commands.
//
//*****************************************************************************
int CMD_help(int argc, char **argv)
{
    int32_t i32Index;
    (void)argc;
    (void)argv;
    i32Index = 0;
    UARTprintf("List of Commands\n");
    while(g_psCmdTable[i32Index].pcCmd)
    {
      UARTprintf("%17s %s\n", g_psCmdTable[i32Index].pcCmd,
                 g_psCmdTable[i32Index].pcHelp);
      i32Index++;
    }
    UARTprintf("\n");
    return (0);
}

int CMD_SetServoAngle(int argc, char **argv)
{
	uint32_t ServoAngle;

	if(argc == 2)
	{
		ServoAngle = ustrtoul(argv[1], 0, 10);
		SetServoAngle(ServoAngle);
	}
	return 0;
}

int CMD_QuitProcess(int argc, char **argv)
{
	QuitProcess();
	return 0;
}

cmd.h file

//*****************************************************************************
// Copyright (c) 2012-2013 Texas Instruments Incorporated.  All rights reserved.
// Software License Agreement
// 
// Texas Instruments (TI) is supplying this software for use solely and
// exclusively on TI's microcontroller products. The software is owned by
// TI and/or its suppliers, and is protected under applicable copyright
// laws. You may not combine this software with "viral" open-source
// software in order to form a larger program.
// 
// THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS.
// NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT
// NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
// A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY
// CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL
// DAMAGES, FOR ANY REASON WHATSOEVER.
// 
// This is part of revision 1.0 of the EK-TM4C123GXL Firmware Package.
//
//*****************************************************************************

#ifndef __RGB_COMMANDS_H__
#define __RGB_COMMANDS_H__

//*****************************************************************************
//
// Defines for the command line argument parser provided as a standard part of
// TivaWare.  qs-rgb application uses the command line parser to extend
// functionality to the serial port.
//
//*****************************************************************************

#define CMDLINE_MAX_ARGS 3

//*****************************************************************************
//
// Declaration for the callback functions that will implement the command line
// functionality.  These functions get called by the command line interpreter
// when the corresponding command is typed into the command line.
//
//*****************************************************************************
extern int CMD_help(int argc, char **argv);
extern int CMD_SetServoAngle(int argc, char **argv);
extern int CMD_QuitProcess(int argc, char **argv);
#endif

Here i am attaching the screenshot of console window.

Any help will be highly appreciated. 

 

  • Well, somewhere you have already defined these. You may need to have the compiler output the preprocess code to see where.

    This line

    Himanshu Goswami said:
    #include "main.h"

    Is decidedly odd. Not necessarily wrong but odd. In a code review I'd probably insist on a rewrite.

    Robert

    BTW PC-Lint would probably give you the source of the issue.

  • Indeed those error messages are quite clear. May suggest a "mismatch" between "desire & capability/experience."

    PC-Lint is unlikely to have "much blipped" poster's radar... (yet can be SO helpful - as you often note - yet rarely does vendor "promote such..."