Redlib semihost Preprocessor define

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Redlib semihost Preprocessor define

343 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by atomicdog on Thu Mar 01 21:16:34 MST 2012
Is there a C preprocessor define that gets set when the semihost library is used?

I want to be able to redefine a symbol based on if the semihost library is used.
0 Kudos
3 Replies

305 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by atomicdog on Fri Mar 02 18:01:38 MST 2012

Quote: CodeRedSupport
Just to follow up on this, can you explain in more detail exactly what you are trying to achieve here?  There may well be an alternative approach.

Regards,
CodeRedSupport


Yeah, now that I've thought about it more I can just use NDEBUG since I just wanted to remove some semihosting functions from the binary with a release build.


#if defined NDEBUG
#define debug_puts(s)
#else
#define debug_puts(s) __sys_write0(s)
#endif

int main(void) {


  debug_puts("Begin Main Loop:\n");
0 Kudos

305 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by CodeRedSupport on Fri Mar 02 04:10:15 MST 2012
Just to follow up on this, can you explain in more detail exactly what you are trying to achieve here?  There may well be an alternative approach.

Regards,
CodeRedSupport
0 Kudos

305 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by CodeRedSupport on Fri Mar 02 03:09:11 MST 2012

Quote: atomicdog
Is there a C preprocessor define that gets set when the semihost library is used?

I want to be able to redefine a symbol based on if the semihost library is used.



This is not possible, because none/nohost/semihost is a library selection. That is, it affects the libraries that you link with - it does not affect the compilation in any way.
0 Kudos