--- a/targets/plc_debug.c Sun Jan 06 02:00:07 2019 +0300
+++ b/targets/plc_debug.c Sun Jan 06 03:11:39 2019 +0300
@@ -10,8 +10,7 @@
-#ifdef TARGET_DEBUG_DISABLE
+#ifdef TARGET_DEBUG_AND_RETAIN_DISABLE void __init_debug (void){}
void __cleanup_debug (void){}
@@ -26,6 +25,7 @@
+#ifndef TARGET_ONLINE_DEBUG_DISABLE #define BUFFER_SIZE %(buffer_size)d
/* Atomically accessed variable for buffer state */
@@ -38,6 +38,8 @@
static char* buffer_cursor = debug_buffer;
static unsigned int retain_offset = 0;
@@ -126,9 +128,12 @@
/* init local static vars */
+#ifndef TARGET_ONLINE_DEBUG_DISABLE buffer_cursor = debug_buffer;
+ buffer_state = BUFFER_FREE; - buffer_state = BUFFER_FREE;
/* Iterate over all variables to fill debug buffer */
@@ -147,8 +152,11 @@
void __cleanup_debug(void)
+#ifndef TARGET_ONLINE_DEBUG_DISABLE buffer_cursor = debug_buffer;
@@ -169,6 +177,8 @@
if(flags & ( __IEC_DEBUG_FLAG | __IEC_RETAIN_FLAG)){
USINT size = __get_type_enum_size(dsc->type);
+#ifndef TARGET_ONLINE_DEBUG_DISABLE if(flags & __IEC_DEBUG_FLAG){
/* copy visible variable to buffer */;
@@ -192,6 +202,8 @@
memcpy(real_value_p, visible_value_p, size);
if(flags & __IEC_RETAIN_FLAG){
/* compute next cursor positon*/
unsigned int next_retain_offset = retain_offset + size;
@@ -248,6 +260,8 @@
InValidateRetainBuffer();
+#ifndef TARGET_ONLINE_DEBUG_DISABLE /* Check there is no running debugger re-configuration */
if(TryEnterDebugSection()){
@@ -273,13 +287,16 @@
__for_each_variable_do(RetainIterator);
/* when not debugging, do only retain */
__for_each_variable_do(RetainIterator);
+#ifndef TARGET_ONLINE_DEBUG_DISABLE #define __RegisterDebugVariable_case_t(TYPENAME) \
((__IEC_##TYPENAME##_t *)varp)->flags |= flags;\
@@ -362,6 +379,6 @@