3 Replies Latest reply on Nov 23, 2017 10:47 PM by pieter_2521576

    Cyble-212006-01 printf issue

    rp-engineering

      Hello,

      it looks simple but didnt work. I want to add printf for debuging.
      I used a sample code from a "BLE_Battery_Level" example project.

       

      I have a debug.c file with the following code.

      #include <project.h>
      #include <stdio.h>
      #include "main.h"
      /* For GCC compiler revise _write() function for printf functionality */
      int _write(int file, char *ptr, int len)
      {
          int i;
          file = file;
          for (i = 0; i < len; i++)
          {
              UART_DEB_PutChar(*ptr++);
          }
          return len;
      }
      

       

      And in my main.h the following

      #include <project.h>
      #include <stdio.h>
      #if (DEBUG_UART_ENABLED == ENABLED)
          #define DBG_PRINTF(...)          (printf(__VA_ARGS__))
      #else
          #define DBG_PRINTF(...)
      #endif /* (DEBUG_UART_ENABLED == ENABLED) */
      

       

      I cant find any different setting in the project build settings. But it will not work.

      Any idea?

      Thanks a lot

      Max