printf and FLASHing

Technical questions regarding the XTC tools and programming with XMOS.
Post Reply
User avatar
aclassifier
Respected Member
Posts: 483
Joined: Wed Apr 25, 2012 8:52 pm
Contact:

printf and FLASHing

Post by aclassifier »

When I FLASH my code I am in the impression that printf statemenets that are seen by the compiler have nowhere to go (xCORE-200 eXplorerKIT but XTAG3 not present after FLASHing) and therefore are, in some way disabled, "shorted" or whatever. That's what I want. How does the xTIMEcomposer do this? I could not find anything about his in the xTIMEcomposer User Guide or in the FLASH Config screen.
Off Topic
Somewhat Off Topic: I am using a general macro to remove printf statements, like this (from [1]):

Code: Select all

#define DEBUG_PRINT_GLOBAL_APP 1 // Seen by all files
#define DEBUG_PRINT_LOCAL 1 // Local
#define debug_print(fmt, ...) do { if((DEBUG_PRINT_LOCAL==1) && (DEBUG_PRINT_GLOBAL_APP==1)) printf(fmt, __VA_ARGS__); } while (0)
The compiler wil understand that printf-only variables are not needed when printf is not seen by the compiler. Quite nice.

I will use lib_logging since it has a scheme to enable or disable printing via compile options and a scheme to enable or disable printing for sets of source files. I just haven't come around to doing it.

[1] C #define macro for debug printing at stack overflow


--
Øyvind Teig
Trondheim (Norway)
https://www.teigfam.net/oyvind/home/
Post Reply