Redlib semihost Preprocessor define

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

Redlib semihost Preprocessor define

1,040 次查看
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 项奖励
回复
3 回复数

1,002 次查看
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 项奖励
回复

1,002 次查看
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 项奖励
回复

1,002 次查看
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 项奖励
回复