两个 技巧模块debugH--varC

//不需要C只需要H的模块:debug 它是宏定义!
//不需要H只需要C的模块:var 它需要冠以别人的头文件 在它的C中定死内存
#include "spi.h"
#include "usart.h"


//uint8_t 				mqttsendbuf[2048]@(0x10000000);
uint8_t 				mqttreadbuf[2048]@(0x10000800);	                   
BleUserMsgType          BleUserMsg@0x10004800;


上面都是IAR

如果是KEIL呢?几乎一样的 @ 不用了 用:
#ifndef _DEBUG_H
#define _DEBUG_H

#define PRINT_DEBUG_ENABLE		    0		/* 打印调试信息 */
#define PRINT_ERR_ENABLE			0	    /* 打印错误信息 */
#define PRINT_INFO_ENABLE			0		/* 打印个人信息 */


#if PRINT_DEBUG_ENABLE
#define PRINT_DEBUG(fmt, args...) 	 do{(printf("\n[DEBUG] >> "), printf(fmt, ##args));}while(0)     
#else
#define PRINT_DEBUG(fmt, args...)	     
#endif

#if PRINT_ERR_ENABLE
#define PRINT_ERR(fmt, args...) 	 do{(printf("\n[ERR] >> "), printf(fmt, ##args));}while(0)     
#else
#define PRINT_ERR(fmt, args...)	       
#endif

#if PRINT_INFO_ENABLE
#define PRINT_INFO(fmt, args...) 	 do{(printf("\n[INFO] >> "), printf(fmt, ##args));}while(0)     
#else
#define PRINT_INFO(fmt, args...)	       
#endif



#endif /* __DEBUG_H */

猜你喜欢

转载自blog.csdn.net/weixin_42381351/article/details/86567905