Skip to content

Commit 2d4e2d8

Browse files
Added debug level option
1 parent 024c402 commit 2d4e2d8

File tree

3 files changed

+26
-69
lines changed

3 files changed

+26
-69
lines changed

cores/asr650x/board/board.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ void BoardEnableIrq( void );
7878
/*!
7979
* \brief Initializes the mcu.
8080
*/
81-
void BoardInitMcu( void );
81+
void boardInitMcu( void );
8282

8383
/*!
8484
* \brief Resets the mcu.

cores/asr650x/board/inc/debug.h

Lines changed: 24 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -48,15 +48,9 @@
4848
#ifndef __DEBUG_H__
4949
#define __DEBUG_H__
5050

51-
#ifdef __cplusplus
52-
extern "C" {
53-
#endif
54-
5551
/* Includes ------------------------------------------------------------------*/
5652
#include <string.h>
57-
#include <stdio.h>
58-
#include "hw_conf.h"
59-
#include "timeServer.h"
53+
//#include <stdio.h>
6054
#include "utilities.h"
6155

6256
/* Exported types ------------------------------------------------------------*/
@@ -72,73 +66,36 @@ typedef enum LOG_LEVEL_E {
7266
LL_ALL
7367
} LOG_LEVEL;
7468

75-
#ifdef CONFIG_DEBUG_LINKWAN
76-
extern LOG_LEVEL g_log_level;
77-
#define ERR_PRINTF(format, ...) do { \
78-
if(g_log_level>=LL_ERR) { \
79-
TimerTime_t ts = TimerGetCurrentTime(); \
80-
printf("[%llu]", ts); \
81-
printf(format, ##__VA_ARGS__); \
82-
} \
83-
}while(0)
84-
85-
#define WARN_PRINTF(format, ...) do { \
86-
if(g_log_level>=LL_WARN) { \
87-
TimerTime_t ts = TimerGetCurrentTime(); \
88-
printf("[%llu]", ts); \
89-
printf(format, ##__VA_ARGS__); \
90-
} \
91-
}while(0)
92-
93-
#define DBG_PRINTF(format, ...) do { \
94-
if(g_log_level>=LL_DEBUG) { \
95-
TimerTime_t ts = TimerGetCurrentTime(); \
96-
printf("[%llu]", ts); \
97-
printf(format, ##__VA_ARGS__); \
98-
} \
99-
}while(0)
100-
101-
#define VDBG_PRINTF(format, ...) do { \
102-
if(g_log_level>=LL_VDEBUG) { \
103-
TimerTime_t ts = TimerGetCurrentTime(); \
104-
printf("[%llu]", ts); \
105-
printf(format, ##__VA_ARGS__); \
106-
} \
107-
}while(0)
108-
109-
#define PRINTF_RAW(...) do { \
110-
if(g_log_level>=LL_DEBUG) printf(__VA_ARGS__); \
111-
}while(0)
112-
113-
#define PRINTF_AT(...) printf(__VA_ARGS__)
114-
115-
#define DBG_PRINTF_CRITICAL(p)
116-
#else
117-
#define ERR_PRINTF(format, ...) do {}while(0)
118-
#define WARN_PRINTF(format, ...) do {}while(0)
119-
#define DBG_PRINTF(format, ...) do {}while(0)
120-
#define VDBG_PRINTF(format, ...) do {}while(0)
121-
#define PRINTF_RAW(...)
122-
#define PRINTF_AT(...) printf(__VA_ARGS__)
123-
#define DBG_PRINTF_CRITICAL(p)
124-
#endif
12569

70+
#ifdef __cplusplus
71+
extern "C" {
72+
#endif
12673

127-
/* Exported functions ------------------------------------------------------- */
128-
129-
/**
130-
* @brief Initializes the debug
131-
* @param None
132-
* @retval None
133-
*/
134-
void DBG_Init(void);
135-
int DBG_LogLevelGet();
136-
void DBG_LogLevelSet(int level);
13774

13875
#ifdef __cplusplus
13976
}
14077
#endif
14178

79+
80+
#define ERR_PRINTF(format, ...) do {}while(0)
81+
#define WARN_PRINTF(format, ...) do {}while(0)
82+
#define VDBG_PRINTF(format, ...) do {}while(0)
83+
#define PRINTF_RAW(...)
84+
#define PRINTF_AT(...)
85+
#define DBG_PRINTF_CRITICAL(p)
86+
#define DBG_PRINTF(format, ...) do {}while(0)
87+
88+
#if LoRaWAN_DEBUG_LEVEL >= 2
89+
#define FREQ_PRINTF(format, ...) printf(format, ##__VA_ARGS__)
90+
#define DIO_PRINTF(format, ...) printf(format, ##__VA_ARGS__)
91+
#elif LoRaWAN_DEBUG_LEVEL == 1
92+
#define FREQ_PRINTF(format, ...) printf(format, ##__VA_ARGS__)
93+
#define DIO_PRINTF(format, ...)
94+
#else
95+
#define FREQ_PRINTF(format, ...) do {}while(0)
96+
#define DIO_PRINTF(format, ...) do {}while(0)
97+
#endif
98+
14299
#endif /* __DEBUG_H__*/
143100

144101
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/

tools/platform.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ compiler.warning_flags.all=-Wall -Wextra
1818
compiler.path={runtime.platform.path}/tools/gcc-arm-none-eabi/bin/
1919

2020
compiler.sdk.path={runtime.platform.path}/cores/asr650x
21-
compiler.cpreprocessor.flags=-D{build.band} -DARDUINO={runtime.ide.version} -DACTIVE_REGION=LORAMAC_{build.band} -DLORAWAN_CLASS={build.LORAWAN_CLASS} -DLORAWAN_NETMODE={build.LORAWAN_NETMODE} -DLORAWAN_ADR={build.LORAWAN_ADR} -DLORAWAN_UPLINKMODE={build.LORAWAN_UPLINKMODE} -DLORAWAN_Net_Reserve={build.LORAWAN_Net_Reserve} -DAT_SUPPORT={build.LORAWAN_AT_SUPPORT} -DLoraWan_RGB={build.RGB} -DCY_CORE_ID=0 -DCONFIG_LORA_USE_TCXO -DCONFIG_MANUFACTURER="ASR" -DCONFIG_DEVICE_MODEL="6501" -DCONFIG_VERSION="v4.0" -D__ASR6501__ "-I{compiler.sdk.path}/board/" "-I{compiler.sdk.path}/board/src/" "-I{compiler.sdk.path}/board/inc/" "-I{compiler.sdk.path}/device/asr6501_lrwan/" "-I{compiler.sdk.path}/device/sx126x/" "-I{compiler.sdk.path}/kernel/protocols/lorawan/lora/mac/" "-I{compiler.sdk.path}/kernel/protocols/lorawan/lora/mac/region/" "-I{compiler.sdk.path}/kernel/protocols/lorawan/lora/system/" "-I{compiler.sdk.path}/kernel/protocols/lorawan/lora/system/crypto/" "-I{compiler.sdk.path}/port/" "-I{compiler.sdk.path}/port/include/" "-I{compiler.sdk.path}/projects/" "-I{compiler.sdk.path}/projects/PSoC4/" "-I{compiler.sdk.path}/cores/" "-I{compiler.sdk.path}/Serial/" "-I{compiler.sdk.path}/Wire/" "-I{compiler.sdk.path}/SPI/"
21+
compiler.cpreprocessor.flags=-D{build.band} -DARDUINO={runtime.ide.version} -DACTIVE_REGION=LORAMAC_{build.band} -DLORAWAN_CLASS={build.LORAWAN_CLASS} -DLORAWAN_NETMODE={build.LORAWAN_NETMODE} -DLORAWAN_ADR={build.LORAWAN_ADR} -DLORAWAN_UPLINKMODE={build.LORAWAN_UPLINKMODE} -DLORAWAN_NET_RESERVE={build.LORAWAN_Net_Reserve} -DAT_SUPPORT={build.LORAWAN_AT_SUPPORT} -DLoraWan_RGB={build.RGB} -DLoRaWAN_DEBUG_LEVEL={build.LORAWAN_DebugLevel} -DCY_CORE_ID=0 -DCONFIG_LORA_USE_TCXO -DCONFIG_MANUFACTURER="ASR" -DCONFIG_DEVICE_MODEL="6501" -DCONFIG_VERSION="v4.0" -D__ASR6501__ "-I{compiler.sdk.path}/board/" "-I{compiler.sdk.path}/board/src/" "-I{compiler.sdk.path}/board/inc/" "-I{compiler.sdk.path}/device/asr6501_lrwan/" "-I{compiler.sdk.path}/device/sx126x/" "-I{compiler.sdk.path}/loramac/mac/" "-I{compiler.sdk.path}/loramac/mac/region/" "-I{compiler.sdk.path}/loramac/system/" "-I{compiler.sdk.path}/loramac/system/crypto/" "-I{compiler.sdk.path}/port/" "-I{compiler.sdk.path}/port/include/" "-I{compiler.sdk.path}/projects/" "-I{compiler.sdk.path}/projects/PSoC4/" "-I{compiler.sdk.path}/cores/" "-I{compiler.sdk.path}/Serial/" "-I{compiler.sdk.path}/Wire/" "-I{compiler.sdk.path}/SPI/"
2222

2323
compiler.c.cmd=arm-none-eabi-gcc
2424
compiler.c.flags=-mcpu=cortex-m0plus -mthumb -g -gdwarf-2 -MMD -w -Os -mapcs-frame -mthumb-interwork -Wall -ffunction-sections -ffat-lto-objects -Os -fno-common -fno-builtin-printf -fno-builtin-fflush -fno-builtin-sprintf -fno-builtin-snprintf -Wno-strict-aliasing -c

0 commit comments

Comments
 (0)