AnsweredAssumed Answered

I'm not able to use macro PRIu32 with KDS 3.0.0 toolchain

Question asked by Denis Martins Dantas on May 19, 2016
Latest reply on Jun 15, 2016 by ZhangJennie



I'm trying to build the following code for a K22F family processor:

#include <inttypes.h> #include <stdint.h> #include <stdio.h>  char myBuffer[20]; uint32_t myVar = 1234; uint16_t size;  void foo (void) {     size = sprintf(myBuffer, "%"PRIu32, myVar); }


but I get the error "format '%u' expects argument of type 'unsigned int', but argument 4 has type 'uint32_t'". If I switch "%"PRIu32 for "%ul" I can build with the regular KDS Cross ARM gcc compiler, though.


The thing is that we have a testing environment that builds our platform using Cygwin's gcc, which complains if I use %ul passing a uint32_t argument. The alternative would be to use PRIu32 - it's a preciser way of specifying the type of argument, since the size of %u or %ul may change between compilers.


The solution I found was switching my KDS's toolchain for Cross ARM gcc latest toolchain. However, using the new toolchain is giving giving issuing an error when I try to debug my project using KDS.


Is there anyway I can use the latest Cross ARM gcc toolchain without breaking my KDS debugger?


Best Regards,


Denis Dantas