RTM编译时,不要编译调试信息,甚至调试字符串都不要参与编译,测试通过,固件减小12.4%
This commit is contained in:
parent
3453251026
commit
4b9161c1e6
|
@ -1,11 +1,11 @@
|
|||
#include "Sys.h"
|
||||
// 仅用于调试使用的一些函数实现,RTM不需要
|
||||
|
||||
#define MEM_DEBUG 1
|
||||
#define MEM_DEBUG DEBUG
|
||||
#if MEM_DEBUG
|
||||
#define mem_printf debug_printf
|
||||
#else
|
||||
__inline void mem_printf( const char *format, ... ) {}
|
||||
#define mem_printf(format, ...)
|
||||
#endif
|
||||
|
||||
extern uint __heap_base;
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#include "Flash.h"
|
||||
#include <stdlib.h>
|
||||
|
||||
#define FLASH_DEBUG 1
|
||||
#define FLASH_DEBUG DEBUG
|
||||
|
||||
//static const uint STM32_FLASH_KEY1 = 0x45670123;
|
||||
//static const uint STM32_FLASH_KEY2 = 0xcdef89ab;
|
||||
|
|
2
Sys.cpp
2
Sys.cpp
|
@ -270,10 +270,10 @@ typedef struct
|
|||
|
||||
void TSys::ShowInfo()
|
||||
{
|
||||
#if DEBUG
|
||||
// 刚刚初始化完成的时间
|
||||
ulong initedTime = Time.Current();
|
||||
|
||||
#if DEBUG
|
||||
byte* ver = (byte*)&Version;
|
||||
debug_printf("%s::%s Code:%04X ", Company, Name, Code);
|
||||
debug_printf("Ver:%x.%x Build:%s\r\n", *ver++, *ver++, BuildTime);
|
||||
|
|
2
Sys.h
2
Sys.h
|
@ -17,7 +17,7 @@ extern "C"
|
|||
|
||||
#else
|
||||
|
||||
__inline void debug_printf( const char *format, ... ) {}
|
||||
#define debug_printf(format, ...)
|
||||
|
||||
#endif
|
||||
}
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
#if MSG_DEBUG
|
||||
#define msg_printf debug_printf
|
||||
#else
|
||||
__inline void msg_printf( const char *format, ... ) {}
|
||||
#define msg_printf(format, ...)
|
||||
#endif
|
||||
|
||||
void SendTask(void* param);
|
||||
|
@ -585,6 +585,7 @@ void StatTask(void* param)
|
|||
// 显示统计信息
|
||||
void TinyController::ShowStat()
|
||||
{
|
||||
#if MSG_DEBUG
|
||||
static uint lastSend = 0;
|
||||
static uint lastReceive = 0;
|
||||
|
||||
|
@ -606,6 +607,7 @@ void TinyController::ShowStat()
|
|||
if(Last.Msg + Total.Msg > 0)
|
||||
retry = (Last.Send + tsend) * 100 / (Last.Msg + Total.Msg);
|
||||
msg_printf("Tiny::State 成功=%d%% 平均=%dus 速度=%d Byte/s 重发=%d.%02d 收发=%d/%d \r\n", rate, cost, speed, retry/100, retry%100, Last.Receive + Total.Receive, Last.Msg + Total.Msg);
|
||||
#endif
|
||||
}
|
||||
|
||||
void MessageNode::SetMessage(TinyMessage& msg)
|
||||
|
|
Loading…
Reference in New Issue