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.

2806x flash api

Hi everyone,

I try to use 2806x flash api for a custom bootloader implementation, It works fine when I use C, but when I check the compiler option "treat c files as c++ files"(I use classes for main program and I need it), I get a few errors, I solved pragma(for code and data alocation) erros using a correct pragma format for c++, but I get an error of variable "callback pointer" that says the declaration is incompatible with "void (*Flash_CallbackPtr) ()" declared at line 31 of F2806x_BootVars.h, and two erros that say "erase and program api fuctions are undefined".

Any suggestion?

  • Jose,

    I suspect the issue lies in the name mangling the compiler does.  The f2806x flash API would have been compiled without that option, so when you compile your code with that option enabled the mangled name of your Flash_CallbackPtr doesn't match what is in the library's symbol table.

    I don't have an easy solution for you right now, but I'll do some research and get back to you before the end of the day.

    Regards,

    Trey German

  • Jose,

    I've confirmed that the issue is related to the name mangler.  I suggest you disable the "treat c files as c++ files" option and simply rename your c++ files to have a cpp extension.  This will allow you to interface to the flash API with c as was originally intended and still maintain your application in c++.

    Let me know if that works for you,

    Trey

  • Hi Trey, thanks for your reply, I will try it and I tell you the results.

  • I am having the same problem when using the "treat c files as c++ files"

    Error text: #148 declaration is incompatible with "void (*Flash_CallbackPtr)() C" (declared at line 29 of F2806x_BootVars.h)

    I cannot disable the "treat c files as c++ files" option because I am working on a team with  large existing code base.  A solution I tried was to treat F2806x_GlobalVariableDefs.c itself as a C file using (Properties->CSS Build->C2000 Compiler->Advanced Options->File Type Specifier->"File is a C file."  It appears through that the compiler is still treating the file as a c++ file.

    This is still an issue with me.  Are there any other solutions?

    Thanks,

    John