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/TM4C1294NCPDT: For CCS V10- Adding GEL Files Procedure

Part Number: TM4C1294NCPDT
Other Parts Discussed in Thread: EK-TM4C123GXL

Tool/software: Code Composer Studio

Hello TI Support Team

For CCS-V10 Can we add GEL files to the Compiler and if Yes please update the procedure.

If not how can we add C++ Libraries to have File Write, Read etc..

  • krishna prasad25 said:
    For CCS-V10 Can we add GEL files to the Compiler and if Yes please update the procedure.

    No. GEL a scripting language used only by the CCS debugger.

    krishna prasad25 said:
    If not how can we add C++ Libraries to have File Write, Read etc..

    That should be all part of the standard run-time library for the compiler

    See chapter 7 of the compiler user's guide: http://dev.ti.com/tirex/explore/node?node=AO14qXY09dko-OBgS0gKHw__FUz-xrs__LATEST

    Thanks

    ki

  • Hi Ki

    As per Chapter 7 i did the following and got following error

    int
    main(void)
    {
    FILE *fid;
    int *new_device= add_device("mydevice", _MSA, MYDEVICE_open, MYDEVICE_close, MYDEVICE_read, MYDEVICE_write, MYDEVICE_lseek, MYDEVICE_unlink, MYDEVICE_rename);  // line 266 gives error as below

    fid = fopen("mydevice:test","w");
    fprintf(fid,"Hello, world\n");
    fclose(fid);

    }

    // mydevice.h has following

    #include <file.h>
    #ifndef MYDEVICE_H_
    #define MYDEVICE_H_

    _DECL _CODE_ACCESS int add_device(char * MYDEVICE,
    unsigned flags ,
    int (* fopen )(const char *path, unsigned flags, int fid),
    int (* fclose )( int fid),
    int (* fread )(int fid, char *buf, unsigned count),
    int (* fwrite )(int fid, const char *buf, unsigned count),
    off_t (* flseek )(int fid, off_t ioffset, int origin),
    int (* flink )(const char * path),
    int (* frename )(const char *old_name, const char *new_name));

    #endif /* MYDEVICE_H_ */

    error upon compilation is 

    Description Resource Path Location Type
    #306 no instance of overloaded function "add_device" matches the argument list main.cpp /I2C_Simple line 266 C/C++ Problem.

    even having only add_device(     ) also gives the same error.

    Please let me know where iam going wrong in the above??

  • Are you looking to do C I/O over a custom transport?

  • Yes please need  support to resolve the issue.

  • I am unable to reproduce this result ...

    krishna prasad25 said:
    #306 no instance of overloaded function "add_device" matches the argument list main.cpp /I2C_Simple line 266 C/C++ Problem.

    For the source file main.cpp, please follow the directions in the article How to Submit a Compiler Test Case.

    Thanks and regards,

    -George

  • Attached 

    1)compiler settings

    2)precompiled c file 

    3)Header file (mydevice,h)

    4)error snap shot 

    TI_CCS_Aug22-2020.docx

    COMPILER SETTINGS SNAP SHOT

     

    // This is part of revision 2.2.0.295 of the EK-TM4C123GXL Firmware Package.

    //MAIN.C

    //*****************************************************************************

     

    #include <stdint.h>

    #include <stdbool.h>

    #include "inc/hw_memmap.h"

    #include "inc/hw_ints.h"

    #include "driverlib/debug.h"

    #include "driverlib/gpio.h"

    #include "driverlib/i2c.h"

    #include "driverlib/interrupt.h"

    #include "driverlib/pin_map.h"

    #include "driverlib/rom.h"

    #include "driverlib/rom_map.h"

    #include "driverlib/sysctl.h"

    #include "driverlib/uart.h"

    #include "utils/uartstdio.h"

    #include <stdlib.h>

    #include "mydevice.h"

    #include <stdio.h>

    #include <SPI_Master.h>

    extern int MYDEVICE_open(const char *path, unsigned flags, int fno);

    extern int MYDEVICE_close(int fno);

    extern int MYDEVICE_read(int fno, char *buffer, unsigned count);

    extern int MYDEVICE_write(int fno, const char *buffer, unsigned count);

    extern off_t MYDEVICE_lseek(int fno, off_t offset, int origin);

    extern int MYDEVICE_unlink(const char *path);

    extern int MYDEVICE_rename(const char *old_name, char *new_name);

     

    /*****************************************************************************

    //

    // Main 'C' Language entry point. Copy of file io only, remaining portions of

    //

    //*****************************************************************************

    int

    main(void)

    {

       FILE *fid;

       add_device("mydevice", _MSA, MYDEVICE_open, MYDEVICE_close, MYDEVICE_read, MYDEVICE_write, MYDEVICE_lseek, MYDEVICE_unlink, MYDEVICE_rename);

     

        fid = fopen("mydevice:test","w");

        fprintf(fid,"Hello, world\n");

        fclose(fid);

     

    }

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

    mydevice.h

     *

     *  Created on: Aug 18, 2020

     *      Author: krishnaprasad

     */

    #include <file.h>

    #ifndef MYDEVICE_H_

    #define MYDEVICE_H_

     

    #ifdef __cplusplus

    #define _DECL extern "C"

    #else /* ! __cplusplus */

    #define _DECL extern

    #endif

     

    int add_device(char *  MYDEVICE,

    unsigned flags ,

    int (* dopen )(const char *path, unsigned flags, int llv_fd),

    int (* dclose )( int dev_fd),

    int (* dread )(int dev_fd, char *buf, unsigned count),

    int (* dwrite )(int dev_fd, const char *buf, unsigned count),

    off_t (* dlseek )(int dev_fd, off_t ioffset, int origin),

    int (* dunlink )(const char * path),

    int (* drename )(const char *old_name, const char *new_name));

     

    _DECL _CODE_ACCESS int add_device(char *  MYDEVICE,

    unsigned flags ,

    int (* fopen )(const char *path, unsigned flags, int fid),

    int (* fclose )( int fid),

    int (* fread )(int fid, char *buf, unsigned count),

    int (* fwrite )(int fid, const char *buf, unsigned count),

    off_t (* flseek )(int fid, off_t ioffset, int origin),

    int (* flink )(const char * path),

    int (* frename )(const char *old_name, const char *new_name));

     

     

     

    #endif /* MYDEVICE_H_ */

     

     

     

     

     

     

     

     

     

     

    Snap Shot of  error from compiler

     

     

    Description         Resource             Path       Location               Type

    #306 no instance of overloaded function "add_device" matches the argument list            main.cpp             /I2C_Simple       line 269         C/C++ Problem
  • Your post does not include, as an attachment, the preprocessed file requested in the article How to Submit a Compiler Test Case.  The build options are only shown as a screen shot, and not as text that I can copy and paste.  Therefore, I am unable to reproduce the problem.  Please supply this information in the form in which it is requested.

    Thanks and regards,

    -George

  • Hello George 

    Attached complete work space on CCS V10 in rar folder. Please compile and check.

    workspace_v5.rar (705KB)

    Thanks n regards

    Krishna.P.N.workspace_v5.rar

  • There were a few errors in the file main.cpp.  Below I attach main.cpp.txt.  Compare it to yours.  Here is a summary of the changes ...

    • I include <file.h> instead of "mydevice.h"
    • I change the prototype for MYDEVICE_open and MYDEVICE_rename, so they match what appears in <file.h>.

    After these changes I still get one warning diagnostic ...

    "main.cpp", line 53: warning #2825-D: conversion from a string literal to "char *" is deprecated

    This because of a minor error in <file.h>.  The first parameter in the function prototype for add_device should change from char * to const char *.  I filed the entry EXT_EP-10025 to have this changed.  You are welcome to follow it with the link below in my signature.

    Thanks and regards,

    -George

    main.cpp.txt
    
    /**
     * main.c
     */
    #include <stdint.h>
    #include<stdbool.h>
    #include "driverlib/sysctl.h"
    //#include "inc/tm4c1294ncpdt.h"
    #include "driverlib/rom_map.h"
    #include "inc/hw_memmap.h"
    #include "inc/hw_ints.h"
    #include "driverlib/debug.h"
    #include "driverlib/gpio.h"
    #include "driverlib/i2c.h"
    #include "driverlib/interrupt.h"
    #include "driverlib/pin_map.h"
    #include "driverlib/rom.h"
    #include "driverlib/rom_map.h"
    #include "driverlib/sysctl.h"
    #include "driverlib/uart.h"
    #include "utils/uartstdio.h"
    #include <stdlib.h>
    #include <file.h>
    // #include "mydevice.h"
    #include <stdio.h>
    
    #ifdef DEBUG
    void
    __error__(char *pcFilename, uint32_t ui32Line)
    {
        while(1);
    }
    #endif
    
    // extern int MYDEVICE_open(int(* fopen)(const char *path, unsigned flags, int fid)); //fno replaced with fid   int MYDEVICE_open
    extern int MYDEVICE_open(const char *path, unsigned flags, int fid);
    extern int MYDEVICE_close(int fid);
    extern int MYDEVICE_read(int fid, char *buffer, unsigned count);
    extern int MYDEVICE_write(int fid, const char *buffer, unsigned count);
    extern off_t MYDEVICE_lseek(int fid, off_t offset, int origin);
    extern int MYDEVICE_unlink(const char *path);
    // extern int MYDEVICE_rename(const char *old_name, char *new_name);
    extern int MYDEVICE_rename(const char *old_name, const char *new_name);
    
    
    void ConfigureUART(void);
    
    
     int main(void)
    {
           FILE *fid;
           add_device("mydevice", _MSA, MYDEVICE_open, MYDEVICE_close, MYDEVICE_read, MYDEVICE_write,  MYDEVICE_lseek, MYDEVICE_unlink, MYDEVICE_rename);
    
    
            fid = fopen("mydevice:test\n","w");
            fprintf(fid,"Hello, world\n");
             fclose(fid);
    
           #if defined(TARGET_IS_TM4C129_RA0) ||                                         \
                 defined(TARGET_IS_TM4C129_RA1) ||                                         \
                 defined(TARGET_IS_TM4C129_RA2)
                 uint32_t ui32SysClock;
             #endif
    
    
    
        return 0;
    }
    
    
    
    

  • Hello George

    On compilation of the code- did not get errors but linker errors are there

    error #10234-D: unresolved symbols remain
    error #10010: errors encountered during linking; "Files_IO.out" not built

    Description Resource Path Location Type
    unresolved symbol MYDEVICE_open(const, first referenced in char Files_IO C/C++ Problem

    Description Resource Path Location Type
    unresolved symbol MYDEVICE_read(int,, first referenced in char Files_IO C/C++ Problem

    so on......................................

    1)Also when  MYDEVICE_open is defined why should we use fopen(); which is a standard c call??

    2)SPNU151V–January 1998–Revised February 2020 docs page 190 or section 7.2.4 does not explain details of mydevice.h??

    Thanks n regards

    Krishna.P.N.

  • The code in main.cpp declares MYDEVICE_open, and passes a pointer to it when calling the function add_device.  But it does not supply an implementation of it.  You have to supply that implementation.  The same is true of all the other MYDEVICE functions.

    In typical practice, only MYDEVICE_open and MYDEVICE_write are implemented.  All the other functions simply return the value for error, which is -1.  Even so, you have to supply an implementation of all the functions required by the call to add_device.

    Thanks and regards,

    -George

  • Hello George

    Getting Linking Errors as below and code  portion is shown for File R/W

    Description Resource Path Location Type
    unresolved symbol MYDEVICE_close(int), first referenced in ./main.obj Files_IO C/C++ Problem

    Description Resource Path Location Type
    unresolved symbol MYDEVICE_open(const, first referenced in char Files_IO C/C++ Problem

    Description Resource Path Location Type
    unresolved symbol MYDEVICE_read(int,, first referenced in char Files_IO C/C++ Problem 

    FILE *fl;

    int main(void)
    {

    add_device("mydevice", _MSA, MYDEVICE_open, MYDEVICE_close,MYDEVICE_read,MYDEVICE_write,MYDEVICE_lseek,MYDEVICE_unlink,MYDEVICE_rename);

    return 0;

    }

    int MYDEVICE_open()
    {


    fl = fopen("mydevice:text","w");


    if (fl == NULL)
    {
    fprintf(fl, "unable to open file\n");
    fclose(fl);
    }
    else
    fprintf(fl,"Hello, world\n");


    fclose(fl);

    return 0;

    }

  • Please be sure that extern "C" is consistently applied to every declaration and implementation of the function MYDEVICE_open, and the other similar MYDEVICE functions.  I'm sorry I didn't think to tell you this before.

    Thanks and regards,

    -George

  • Hello TI Support Team

    Awaiting your response 

    Thanks 

    Krishna.P.N.

  • Hi George

    Even with extern int MYDEVICE_open declaration the same linking error is coming as posted on Sept2-2020

    Thanks 

    Krishna.P.N. 

  • Make sure every declaration of MYDEVICE_open is similar to ...

    extern "C" int MYDEVICE_open(const char *path, unsigned flags, int llv_fd);
    

    ... and the implementation is similar to ...

    extern "C" int MYDEVICE_open(const char *path, unsigned flags, int llv_fd)
    {
        /* code here */
    }

    Notice the consistent use of extern "C".

    Thanks and regards,

    -George

  • Hi George 

    Even with addition of declarations 

    extern "C" int MYDEVICE_open (const char *fid, unsigned flags, int fp); 

    and so on.....

    in main

    extern "C" int MYDEVICE_open();  // Line72

    &  error is 

    Description Resource Path Location Type

    #337 linkage specification is not allowed main.cpp /Files_IO line 72 C/C++ Problem

    Description Resource Path Location Type

    #339 linkage specification is incompatible with previous "MYDEVICE_open" (declared at line 72) main.cpp /Files_IO line 104 C/C++ Problem

    If i change the function declaration as below 

    extern  int MYDEVICE_open

    {

    }workspace_v5_Sept7.rar

    Description Resource Path Location Type
    unresolved symbol MYDEVICE_open, first referenced in ./main.obj Files_IO C/C++ Problem

    Attached is  the zip file of the workspace for you to compile and check- workspace_v5_Sept7.rar (839KB)

  • I do not explain every error.  But I do explain a few that are representative.

    Near the beginning of main.cpp you have this line ...

    extern "C" int MYDEVICE_open (const char *fid, unsigned flags, int fp);

    There is nothing wrong with this line.  No changes are needed.  But the presence of this line explains some errors that occur later.

    This line is a declaration of the function MYDEVICE_open.  A declaration is usually in a header file, and that header file is included by every source file which calls, or refers to, MYDEVICE_open.  In this particular case, all of those references occur in main.cpp, so it is OK to have that line in the file.

    Inside the function main you have this line ...

    extern "C" int MYDEVICE_open();

    There is no reason to have a declaration of MYDEVICE_open inside the function main.  It is already declared earlier in the file.  Please remove it.

    The implementation of MYDEVICE_open begins with this line ...

    extern "C" int MYDEVICE_open( )

    Keep the extern "C".  But the arguments are missing.  The same arguments used in the declaration must appear here.

    A more general comment ... This is not a good way for you to correct errors of this nature.  I highly recommend you find a local expert on C++ to help you out.  Such a method is much more likely to be successful.

    Thanks and regards,

    -George

  • George 

    With addition of dummy function calls to unused MYDEVICE_read etc.. the linking errors are gone.

    fl = fopen("mydevice:text","w"); // FILE *f1

    Not able to open a file and  i have tried giving a path 

    fid= "C:\ti\file_example.text\n"; // where fid is constant char in MYDEVICE_open()

    fp1 = open("fid",O_RDWR, 0);// fpi is int in MYDEVICE_open.

    In both cases of fopen and open are not creating a file in the directory required on Windows 10.

    Am i missing something and please not folders in project work space are not readonly.

    Thanks 

    Krishna.PN.

  • I presume your implementation of MYDEVICE_open is called with valid arguments.  If that is the case, then the problem is in the implementation of MYDEVICE_open.  Because MYDEVICE_open is a custom function supplied by you, I am unable to help you with it.

    Thanks and regards,

    -George