CC3200. compiler warnings when use freertos with math.h - gcc

I have to use some functions from math library on a CC3200 Project. This project has to use freertos and the IDE is CCS. With this combination, the compiler show these warnings:
/ymath.h", line 550: warning #225-D: function "_ftoi" declared implicitly
/ymath.h", line 592: warning #225-D: function "_hi" declared implicitly
/ymath.h", line 594: warning #225-D: function "_lo" declared implicitly
/ymath.h", line 604: warning #225-D: function "_lo" declared implicitly
To reproduce the problem, we have to import to CCS the "freertos_demo" project from CC3200SDK_X.X.X and in the main.c file add the include directive: #include <math.h> only that.
if we compile the project we get the warnings.
Thanks in advance.
JM

I'm not sure what this has to do with FreeRTOS as the functions that are generating the warnings are not used in the FreeRTOS Cortex-M4 port. Perhaps they are only used in demo code, in which case, can't you just include the necessary header files in the demo source files (this won't effect FreeRTOS at all)? Where did you get the demo from? It's not a project from the FreeRTOS distribution.

Related

how to avoid "CALL16 reloc not against global symbol" for function defined in assembly with gcc on mips [duplicate]

I'm getting these errors while linking, both messages have to do with the same object file.
CALL16 reloc at 0x5f8 not against global symbol
and
could not read symbols: Bad value
The 2nd message seems to be the reason I'm getting the CALL16 error, but the file compiles just fine.
Any tips on fixing this?
FYI, I'm cross compiling for a MIPS target and using gcc 4.1.2
EDIT: No luck so far:
Here are my flags used:
-fPIC,-Wl,-rpath,-Wl,-O1
I've also tried the following without success:
-mno-explicit-relocs
-mexplicit-relocs
-mlong-calls
-mno-long-calls
-mxgot
-mno-xgot
Meanwhile, I'll go back to the source at this point and investigate more.
Aha!
Thanks to a colleague of mine, we found the issue.
Here was the issue:
There was a forward declaration/prototype of a function.
void FooBarIsBest(void);
Later on in the file the function was defined.
static void FooBarIsBest(void)
{
// do the best
}
The issue here was that in the prototype the keyword static was left out. So it was like a whole new function was being defined.
The CALL16 reference is used by gcc for relocatable code. The assembly code of the file showed that CALL16 was being used on this function... Which is wrong, as this function is local.
Interestingly, this code used to compile & link just fine with an older version of gcc (3.2.2).
Another lessoned learned. :)
Try -mlong-calls flag to the compiler.
Also see the manual for more specific MIPS options.

C code Optimization by compiler for atmel studio

I am using Atmel Studio 7 and in that, optimization level is -O1.
Can I check what portion of code is being optimized by the compiler itself?
If I am disabling the optimization, my binary file size is of 12KB and on using optimization level -O1, binary file size if 5.5KB.
Can I check what portion of code is being optimized by the compiler itself?
All the code is optimized by the compiler, i.e affected by optimization flags except
It's code that's dragged from libraries (libgcc.a, libc.a, libm.a, lib<device>.a).
Startup code (crt<device>.o) which also includes the vector table, or code from other objects that already exist and are not (re-)compiled in the current compilation. The latter can happen with Makefiles when you change flags therein: If the modules do not depend on the Makefile itself, make will not rebuild them.
Code from assembly modules (*.S, *.sx, *.s) provided preprocessed assembly code does not use conditional assemblation by means of #ifdef __OPTIMIZE__ or similar.
Code in inline assembly, provided the inline asm is not optimized away.
In order to determine whether anything of this is in effect, you can respectively:
Link with -Wl,-Map,file.map and inspect that map file (a text file). It will list which objects have been dragged from where due to which undefined symbol.
Startup code is linked except you -nostartfiles. Add -Wl,-v to the link stage, you'll see crt<device>.o being linked.
You know your compilation units, assembly modules, don't you?
Add -save-temps to the compilation. Inline asm will show in the intermediate *.s file as
/* #APP */
; <line> "<compilation-unit>"
<inline-asm-code>
/* #NOAPP */

g++ library not found but not for gcc

I want to use my school custom library in a C++ project but the library linking seems not working... When I create my program in C and I try to compile it, it work...
See by yourself:
I think that the X11 and/or Xext libraries dependencies of the Mlx are in cause, there can be some
#if __cplusplus
void *x11_mlx_function_wanted(void);
#endif
I had already check if the mlx contains some check like that and I saw nothing.
Thank you in advance
EDIT
And I succeed in objective-c.
The problem is C++ name-mangling. If you declare a function in C11, it ends up with a "mangled" name, which encodes the namespace and the types of the arguments. That's necessary because in C++, various overloads can exist for the same function name. The overloads are independent functions; they do not even have to be in the same object library.
In the object library itself, the functions will have ordinary C names. But since the header file is processed with a C++ compiler, the declared functions will be named as though they were C++ functions.
One possible solution might be to declare all the included functions to be C functions:
extern "C" {
#include "/usr/X11/include/mlx.h"
}

Using CUDA and Armadillo

I have a .cu file in a 64x VS2010 project. This project is configured to extract a .mexw64 file. Bellow there is the example I run. Inside the mex function I want to use some functions of the Armadillo linear algebra library. So When the #include "armaMex.hpp" is used the compiler return some errors:
error C3203: 'fixed' : unspecialized class template can't be used as a template argument for template parameter 'T1', expected a real type c:....\armadillo-4.200.0\include\armadillo_bits\Mat_meat.hpp
error C2955: 'arma::Mat::fixed' : use of class template requires template argument list c:\ ....\armadillo-4.200.0\include\armadillo_bits\Mat_meat.hpp
error C1903: unable to recover from previous error(s); stopping compilation c:\ ....\armadillo-4.200.0\include\armadillo_bits\Mat_meat.hpp
I can not figure out what is causing these errors. Could you please give an explanation?
#include "mex.h"
#include "armaMex.hpp"
void
mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])
{
mexPrintf("hello!\n");
}
PS: CUDA SDK 5.5 64x, VS2010
This is a known limitation of nvcc (technically cudafe++, I think). nvcc uses file extension to determine whether a given source file should be processed for device code or passed to the CUDA preprocessors and then the device compiler. It looks like that compilation trajectory can't correctly parse some of the very complex declarations that Armadillo contains, and the compile fails. This is known to happen with Boost, Eigen and QT. I guess Armadillo is in the same boat.
The solution is to not import Armadillo headers inside a .cu file. Put your host boost code in a .cc file, device code and kernel launches in a separate .cu file and make some thin wrappers to access the kernel calls from the .cc file. You can still pass all the source to nvcc to compile into a single object file, but separating the Armadillo imports from the device code eliminates the problem of the front end choking on the complex template declarations Armadillo contains.

using WinSCard library: '__in' was not declared in this scope

I'm trying to use the WinSCard-library to read data from a Myfare Card.
To do so I link against WinSCard.lib and include the header "WinSCard.h".
from my .pro file:
win32: PRE_TARGETDEPS += $$PWD/Lib/WinSCard.lib
win32: LIBS += -L$$PWD/Lib/ -lWinSCard
from my .cpp file:
#include "WinSCard.h"
But now I get dozens of errors (337 to be precise) of undefined symbols like '_in', '_out', '__reserved' and so on.
I use QtCreator/mingw++ as environment. My guess is, that these are typedefs which are library specific or windows specific.
These errors happen by including the header file, I did not use any of the API-functions yet.
Can anybody give me a hint, what I need to include/link to satisfy the compiler?
Thanks

Resources