Jump to content

chibios.c not compiled in Keil


radiotech

Recommended Posts

Hi everybody,

I have a problem with a compilation project in Keil. File chibios.c not compiled, Keil produces 2 errors:

in

void *gfxRealloc(void *ptr, size_t oldsz, size_t newsz)
{
void *np;
if (newsz <= oldsz)
return ptr;
np = gfxAlloc(newsz); // 63 string string with error
if (!np)
return 0;
if (oldsz)
memcpy(np, ptr, oldsz);
return np;
}

error:

ext\ugfx\src\gos\chibios.c(63): warning:  #223-D: function "chHeapAlloc" declared implicitly
ext\ugfx\src\gos\chibios.c(63): error: #513: a value of type "int" cannot be assigned to an entity of type "void *"

second

gfxThreadHandle gfxThreadCreate(void *stackarea, size_t stacksz, threadpriority_t prio, DECLARE_THREAD_FUNCTION((*fn),p), void *param)
{
if (!stackarea) {
if (!stacksz) stacksz = 256;
return chThdCreateFromHeap(0, stacksz, prio, fn, param); //156 string with error
}

if (!stacksz)
return 0;

return chThdCreateStatic(stackarea, stacksz, prio, fn, param);
}

error

ext\ugfx\src\gos\chibios.c(156): warning:  #223-D: function "chThdCreateFromHeap" declared implicitly
ext\ugfx\src\gos\chibios.c(156): error: #120: return value type does not match the function type

Chibios without ugfx work fine. Please help me.

Link to comment
Share on other sites

Thank you very much for reporting this issue. GCC does not even throw a warning about these...

The second one can be fixed easily:


return chThdCreateStatic(stackarea, stacksz, prio, fn, param);

becomes


return (gfxThreadHandle)chThdCreateStatic(stackarea, stacksz, prio, fn, param);

However, I am not sure about the first error yet. I don't see a problem there. Can you please show me the type definition for your size_t type?

The implicit declaration warnings can be temporarily vanished by include ch.h on top of the file.

As soon as everything works for you, I'll push the fixes to the main repository.

~ Tectu

Link to comment
Share on other sites

Thank you, Tectu.

Second error was corrected. Definition of size_t type:

#if defined(__cplusplus) || !defined(__STRICT_ANSI__)
/* unconditional in C++ and non-strict C for consistency of debug info */
typedef unsigned int size_t;
#elif !defined(__size_t)
#define __size_t 1
typedef unsigned int size_t; /* others (e.g. ) also define */
/* the unsigned integral type of the result of the sizeof operator. */
#endif

Link to comment
Share on other sites

About the first error: This seems to be some file inclusion error. You are either not including all necessary files or you are having a different file named chibios.h somewhere. For some reason, chibios.h does not get included properly. Hence the implicit declaration warnings.

Please check your include path carefully and compare it to the ones from our Makefiles. If you don't find the source of the problem, please post your include path here.

Also, which version of ChibiOS/RT are you using?

~ Tectu

Link to comment
Share on other sites

Version of ChibioOS 2.6.5

Include PATH:

..\veloos;
.\os\kernel\include;
.\os\ports\common\ARMCMx;
.\os\ports\common\ARMCMx\CMSIS\include;
.\os\ports\RVCT\ARMCMx;
.\os\ports\RVCT\ARMCMx\STM32F1xx;
.\os\hal\include;
.\os\hal\platforms\STM32;
.\os\hal\platforms\STM32F1xx;
.\conf;
.\os\hal\platforms\STM32\GPIOv1;
.\ext\ugfx;
.\ext\ugfx\src\gdisp;
.\ext\ugfx\src\gdisp\fonts;
.\ext\ugfx\src\gdisp\mcufont;
.\ext\ugfx\drivers\gdisp\SSD1289

Link to comment
Share on other sites

Add to path, no result :(

Did the 'implicit declaration' warnings go away when you added the path? (Make sure that you don't manually include ch.h on top of the chibios.c file anymore).

I took a look at the link you posted and I don't see much similarity. He is definitely assigning a different datatype, but our pointer is of the type void*. You can try to force a cast to see what happens:


np = (void*)gfxAlloc((size_t)newsz);

However, I am pretty sure that you're still having problems including the chibios.h properly. I don't know Keil, but is there any mechanism to give a list of all files that are included and compiled (-> files that are handled by the compiler & linker).

Also, is there something like a pedantic mode for the Keil compiler that is set on by default? If so, can you please try to disable that mode and lower the over-all warning level? We know that this is no permanent solution, just to see where the problem lies.

~ Tectu

Link to comment
Share on other sites

'implicit declaration' warning dont go away. I didnt write any includes manually.

Add this string

np = (void*)gfxAlloc((size_t)newsz);

Error is gone. But three new errors add

compiling chibios.c...
ext/ugfx/src/gos/chibios.c(63): warning: #223-D: function "chHeapAlloc" declared implicitly
linking...
velo.axf: Error: L6218E: Undefined symbol _gdispDeinit (referred from gfx.o).
velo.axf: Error: L6218E: Undefined symbol _gdispInit (referred from gfx.o).
velo.axf: Error: L6218E: Undefined symbol chHeapAlloc (referred from chibios.o).
Target not created

Link to comment
Share on other sites

You are clearly having some inclusion problem.

Can you please make sure that all the ChibiOS/RT relevant files are there? I'd recommend you to compile and run the test suite from ChibiOS/RT to ensure that everything runs smoothly.

If you're using the project templates for Keil that come with some ChibiOS/RT versions, please make sure that they are still fully supported and work with your Keil version. I remember that Giovanni once mentioned that he's going to discontinue the IAR and Keil examples.

~ Tectu

Link to comment
Share on other sites

Add all files get linking errors

linking...
velo.axf: Error: L6218E: Undefined symbol Image$$RW_IRAM1$$ZI$$Limit (referred from chmemcore.o).
velo.axf: Error: L6218E: Undefined symbol Image$$RW_IRAM2$$Base (referred from chmemcore.o).
Target not created

Link to comment
Share on other sites

Another thing to test us to make sure you have "." at the beginning of your include path. The current directory should always be searched first for an include file but some compilers don't follow the rules. For those compilers "." (without the quotes) must be the first include path to operate in the c standard manner.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...