radiotech Posted July 11, 2014 Report Posted July 11, 2014 Hi everybody,I have a problem with a compilation project in Keil. File chibios.c not compiled, Keil produces 2 errors:invoid *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 implicitlyext\ugfx\src\gos\chibios.c(63): error: #513: a value of type "int" cannot be assigned to an entity of type "void *"secondgfxThreadHandle 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);}errorext\ugfx\src\gos\chibios.c(156): warning: #223-D: function "chThdCreateFromHeap" declared implicitlyext\ugfx\src\gos\chibios.c(156): error: #120: return value type does not match the function typeChibios without ugfx work fine. Please help me.
Joel Bodenmann Posted July 11, 2014 Report Posted July 11, 2014 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);becomesreturn (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
radiotech Posted July 12, 2014 Author Report Posted July 12, 2014 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
Joel Bodenmann Posted July 12, 2014 Report Posted July 12, 2014 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
radiotech Posted July 12, 2014 Author Report Posted July 12, 2014 I found similar problem here http://www.keil.com/forum/20793/
radiotech Posted July 12, 2014 Author Report Posted July 12, 2014 Version of ChibioOS 2.6.5Include 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
Joel Bodenmann Posted July 12, 2014 Report Posted July 12, 2014 You are missing the path to .\ext\ugfx\src\gos.Make sure that you add .\ext\ugfx\src\gos\chibios.c to your sources as well.~ Tectu
radiotech Posted July 12, 2014 Author Report Posted July 12, 2014 You are missing the path to .\ext\ugfx\src\gos.Make sure that you add .\ext\ugfx\src\gos\chibios.c to your sources as well.~ TectuAdd to path, no result
Joel Bodenmann Posted July 12, 2014 Report Posted July 12, 2014 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
radiotech Posted July 12, 2014 Author Report Posted July 12, 2014 'implicit declaration' warning dont go away. I didnt write any includes manually.Add this stringnp = (void*)gfxAlloc((size_t)newsz);Error is gone. But three new errors addcompiling chibios.c...ext/ugfx/src/gos/chibios.c(63): warning: #223-D: function "chHeapAlloc" declared implicitlylinking...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
Joel Bodenmann Posted July 12, 2014 Report Posted July 12, 2014 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
radiotech Posted July 12, 2014 Author Report Posted July 12, 2014 Add all files get linking errorslinking...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
Joel Bodenmann Posted July 12, 2014 Report Posted July 12, 2014 I think that this seems to be a ChibiOS/RT + Keil problem where I cannot help. Please ask in the ChibiOS/RT community forum.I'll be more than happy to help once you hit other uGFX problems.~ Tectu
radiotech Posted July 12, 2014 Author Report Posted July 12, 2014 I think that this seems to be a ChibiOS/RT + Keil problem where I cannot help. Please ask in the ChibiOS/RT community forum.I'll be more than happy to help once you hit other uGFX problems.~ TectuThank you, Tectu. You helped me a lot.
Joel Bodenmann Posted July 12, 2014 Report Posted July 12, 2014 You're very welcome. Please let us know about the result.~ Tectu
inmarket Posted July 12, 2014 Report Posted July 12, 2014 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.
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now