diff --git a/lib/common/cmp_data_types.c b/lib/common/cmp_data_types.c
index 2cff95b24e8a6044b0114a841f45c3d963bffdce..7a6989b2f3c755386bfa06bbae15d6c8f3db4f8d 100644
--- a/lib/common/cmp_data_types.c
+++ b/lib/common/cmp_data_types.c
@@ -485,7 +485,7 @@ uint8_t convert_data_type_to_subservice(enum cmp_data_type data_type)
 		break;
 	default:
 	case DATA_TYPE_UNKNOWN:
-		debug_print("Error: Unknown compression data type!\n");
+		debug_print("Error: Unknown compression data type!");
 		sst = (uint8_t)-1;
 	};
 
@@ -564,7 +564,7 @@ size_t size_of_a_sample(enum cmp_data_type data_type)
 		break;
 	case DATA_TYPE_UNKNOWN:
 	default:
-		debug_print("Error: Compression data type is not supported.\n");
+		debug_print("Error: Compression data type is not supported.");
 		break;
 	}
 	return sample_size;
@@ -854,7 +854,7 @@ int be_to_cpu_data_type(void *data, uint32_t data_size_byte, enum cmp_data_type
 		return -1;
 
 	if (data_size_byte % sample_size) {
-		debug_print("Error: Can not convert data size in samples.\n");
+		debug_print("Error: Can not convert data size in samples.");
 		return -1;
 	}
 	samples = data_size_byte / sample_size;
@@ -918,7 +918,7 @@ int be_to_cpu_data_type(void *data, uint32_t data_size_byte, enum cmp_data_type
 		break;
 	case DATA_TYPE_UNKNOWN:
 	default:
-		debug_print("Error: Can not swap endianness for this compression data type.\n");
+		debug_print("Error: Can not swap endianness for this compression data type.");
 		return -1;
 	}
 #endif /*__BYTE_ORDER__ */
@@ -954,7 +954,7 @@ int be_to_cpu_chunk(uint8_t *chunk, size_t chunk_size)
 	}
 
 	if (col_p != chunk + chunk_size) {
-		debug_print("Error: The chunk size does not match the sum of the collection sizes.\n");
+		debug_print("Error: The chunk size does not match the sum of the collection sizes.");
 		return -1;
 	}
 
diff --git a/lib/common/cmp_debug.h b/lib/common/cmp_debug.h
index 85d24d6b4f9bdb6cac81bdd0edb35d50e15a4f71..6c737d7e2057bacaafd4d9093bb3c19fd0c48b9b 100644
--- a/lib/common/cmp_debug.h
+++ b/lib/common/cmp_debug.h
@@ -22,12 +22,14 @@
 #if !defined(ICU_ASW) && (defined(DEBUG) || DEBUGLEVEL > 0)
 	#include <stdio.h>
 	__extension__
-	#define debug_print(...) \
-		do { fprintf(stderr, __VA_ARGS__); } while (0)
+	#define debug_print(...)			\
+		do {					\
+			fprintf(stderr, __VA_ARGS__);	\
+			fprintf(stderr, "\n");		\
+		} while (0)
 #else
 	#define debug_print(...) \
 		do {} while (0)
 #endif
 
-
 #endif /* CMP_DEBUG_H */
diff --git a/lib/common/cmp_entity.c b/lib/common/cmp_entity.c
index 76710b609a20236f925183343bddbd2b15505ec0..3e4bf65664d642bfb9fd056cf052b16520b533ab 100644
--- a/lib/common/cmp_entity.c
+++ b/lib/common/cmp_entity.c
@@ -20,7 +20,6 @@
 
 #include <stdint.h>
 #include <string.h>
-#include <stdio.h>
 
 #ifndef ICU_ASW
 #  if defined __has_include
@@ -1644,7 +1643,7 @@ void *cmp_ent_get_data_buf(struct cmp_entity *ent)
 
 	data_type = cmp_ent_get_data_type(ent);
 	if (data_type == DATA_TYPE_UNKNOWN) {
-		debug_print("Error: Compression data type not supported.\n");
+		debug_print("Error: Compression data type not supported.");
 		return NULL;
 	}
 
@@ -1712,13 +1711,13 @@ int32_t cmp_ent_get_cmp_data(struct cmp_entity *ent, uint32_t *data_buf,
 
 	cmp_ent_data_adr = cmp_ent_get_data_buf(ent);
 	if (!cmp_ent_data_adr) {
-		debug_print("Error: Compression data type is not supported.\n");
+		debug_print("Error: Compression data type is not supported.");
 		return -1;
 	}
 
 	cmp_size_byte = cmp_ent_get_cmp_data_size(ent);
 	if (cmp_size_byte & 0x3) {
-		debug_print("Error: The compressed data are not correct formatted. Expected multiple of 4 hex words.\n");
+		debug_print("Error: The compressed data are not correct formatted. Expected multiple of 4 hex words.");
 		return -1;
 	}
 
@@ -1727,7 +1726,7 @@ int32_t cmp_ent_get_cmp_data(struct cmp_entity *ent, uint32_t *data_buf,
 		uint32_t cmp_data_len_32;
 
 		if (cmp_size_byte > data_buf_size) {
-			debug_print("Error: data_buf size to small to hold the data.\n");
+			debug_print("Error: data_buf size to small to hold the data.");
 			return -1;
 		}
 
@@ -1806,12 +1805,12 @@ int cmp_ent_write_cmp_pars(struct cmp_entity *ent, const struct cmp_cfg *cfg,
 		return -1;
 
 	if (cfg->data_type != cmp_ent_get_data_type(ent)) {
-		debug_print("Error: The entity data product type dos not match the configuration data product type.\n");
+		debug_print("Error: The entity data product type dos not match the configuration data product type.");
 		return -1;
 	}
 
 	if (cmp_ent_get_data_type_raw_bit(ent) != (cfg->cmp_mode == CMP_MODE_RAW)) {
-		debug_print("Error: The entity's raw data bit does not match up with the compression mode.\n");
+		debug_print("Error: The entity's raw data bit does not match up with the compression mode.");
 		return -1;
 	}
 
@@ -1819,7 +1818,7 @@ int cmp_ent_write_cmp_pars(struct cmp_entity *ent, const struct cmp_cfg *cfg,
 
 	/* check if the entity can hold the compressed data */
 	if (ent_cmp_data_size < cmp_bit_to_byte((unsigned int)cmp_size_bits)) {
-		debug_print("Error: The entity size is to small to hold the compressed data.\n");
+		debug_print("Error: The entity size is to small to hold the compressed data.");
 		return -2;
 	}
 
@@ -1946,25 +1945,25 @@ int cmp_ent_write_rdcu_cmp_pars(struct cmp_entity *ent, const struct cmp_info *i
 		return -1;
 
 	if (info->cmp_err) {
-		debug_print("Error: The decompression information contains an compression error.\n");
+		debug_print("Error: The decompression information contains an compression error.");
 		return -1;
 	}
 
 	data_type = cmp_ent_get_data_type(ent);
 	if (!rdcu_supported_data_type_is_used(data_type)) {
-		debug_print("Error: The compression data type is not one of the types supported by the RDCU.\n");
+		debug_print("Error: The compression data type is not one of the types supported by the RDCU.");
 		return -1;
 	}
 
 	if (cmp_ent_get_data_type_raw_bit(ent) != raw_mode_is_used(info->cmp_mode_used)) {
-		debug_print("Error: The entity's raw data bit does not match up with the compression mode.\n");
+		debug_print("Error: The entity's raw data bit does not match up with the compression mode.");
 		return -1;
 	}
 
 	/* check if the entity can hold the compressed data */
 	ent_cmp_data_size = cmp_ent_get_cmp_data_size(ent);
 	if (ent_cmp_data_size < cmp_bit_to_byte(info->cmp_size)) {
-		debug_print("Error: The entity size is to small to hold the compressed data.\n");
+		debug_print("Error: The entity size is to small to hold the compressed data.");
 		return -2;
 	}
 
@@ -1994,7 +1993,7 @@ int cmp_ent_write_rdcu_cmp_pars(struct cmp_entity *ent, const struct cmp_info *i
 	 */
 	if (cmp_ap_imagette_data_type_is_used(data_type)) {
 		if (!cfg) {
-			debug_print("Error: Need the compression configuration to get the adaptive parameters.\n");
+			debug_print("Error: Need the compression configuration to get the adaptive parameters.");
 			return -1;
 		}
 		if (cmp_ent_set_ima_ap1_spill(ent, cfg->ap1_spill))
@@ -2184,7 +2183,7 @@ uint64_t cmp_ent_create_timestamp(const struct timespec *ts)
 
 	if (ts) {
 		if (my_timercmp(ts, &epoch, <)) {
-			debug_print("Error: Time is before PLATO epoch.\n");
+			debug_print("Error: Time is before PLATO epoch.");
 			return 0;
 		}
 		now = *ts;
@@ -2215,12 +2214,8 @@ void cmp_ent_print_header(const struct cmp_entity *ent)
 	uint32_t hdr_size = cmp_ent_get_hdr_size(ent);
 	size_t i;
 
-	for (i = 0; i < hdr_size; ++i) {
-		printf("%02X ", p[i]);
-		if (i && !((i+1) % 32))
-			printf("\n");
-	}
-	printf("\n");
+	for (i = 0; i < hdr_size; ++i)
+		debug_print("%02X", p[i]);
 }
 
 
@@ -2239,12 +2234,8 @@ void cmp_ent_print_data(struct cmp_entity *ent)
 	if (!p)
 		return;
 
-	for (i = 0; i < data_size; ++i) {
-		printf("%02X ", p[i]);
-		if (i && !((i+1) % 32))
-			printf("\n");
-	}
-	printf("\n");
+	for (i = 0; i < data_size; ++i)
+		debug_print("%02X", p[i]);
 }
 
 
@@ -2256,9 +2247,9 @@ void cmp_ent_print_data(struct cmp_entity *ent)
 
 void cmp_ent_print(struct cmp_entity *ent)
 {
-	printf("compression entity header:\n");
+	debug_print("compression entity header:");
 	cmp_ent_print_header(ent);
-	printf("compressed data in the compressed entity:\n");
+	debug_print("compressed data in the compressed entity:");
 	cmp_ent_print_data(ent);
 }
 
@@ -2283,62 +2274,62 @@ static void cmp_ent_parse_generic_header(const struct cmp_entity *ent)
 		uint16_t major = (version_id & 0x7FFF0000U) >> 16U;
 		uint16_t minor = version_id & 0xFFFFU;
 
-		printf("Compressed with cmp_tool version: %u.%02u\n", major, minor);
+		debug_print("Compressed with cmp_tool version: %u.%02u", major, minor);
 	} else
-		printf("ICU ASW Version ID: %08" PRIx32 "\n", version_id);
+		debug_print("ICU ASW Version ID: %08" PRIx32, version_id);
 
 	cmp_ent_size = cmp_ent_get_size(ent);
-	printf("Compression Entity Size: %" PRIu32 " byte\n", cmp_ent_size);
+	debug_print("Compression Entity Size: %" PRIu32 " byte", cmp_ent_size);
 
 	original_size = cmp_ent_get_original_size(ent);
-	printf("Original Data Size: %" PRIu32 " byte\n", original_size);
+	debug_print("Original Data Size: %" PRIu32 " byte", original_size);
 
 	start_coarse_time = cmp_ent_get_coarse_start_time(ent);
-	printf("Compression Coarse Start Time: %" PRIu32 "\n", start_coarse_time);
+	debug_print("Compression Coarse Start Time: %" PRIu32, start_coarse_time);
 
 	start_fine_time = cmp_ent_get_fine_start_time(ent);
-	printf("Compression Fine Start Time: %d\n", start_fine_time);
+	debug_print("Compression Fine Start Time: %d", start_fine_time);
 
 	end_coarse_time = cmp_ent_get_coarse_end_time(ent);
-	printf("Compression Coarse End Time: %" PRIu32 "\n", end_coarse_time);
+	debug_print("Compression Coarse End Time: %" PRIu32, end_coarse_time);
 
 	end_fine_time = cmp_ent_get_fine_end_time(ent);
-	printf("Compression Fine End Time: %d\n", end_fine_time);
+	debug_print("Compression Fine End Time: %d", end_fine_time);
 
 #ifdef HAS_TIME_H
 	{
 		struct tm epoch_date = PLATO_EPOCH_DATE;
 		time_t time = my_timegm(&epoch_date) + start_coarse_time;
 
-		printf("Data were compressed on (local time): %s", ctime(&time));
+		debug_print("Data were compressed on (local time): %s", ctime(&time));
 	}
 #endif
-	printf("The compression took %f second\n", end_coarse_time - start_coarse_time
+	debug_print("The compression took %f second", end_coarse_time - start_coarse_time
 		+ ((end_fine_time - start_fine_time)/256./256.));
 
 	data_type = cmp_ent_get_data_type(ent);
-	printf("Data Product Type: %d\n", data_type);
+	debug_print("Data Product Type: %d", data_type);
 
 	raw_bit = cmp_ent_get_data_type_raw_bit(ent);
-	printf("RAW bit in the Data Product Type is%s set\n", raw_bit ? "" : " not");
+	debug_print("RAW bit in the Data Product Type is%s set", raw_bit ? "" : " not");
 
 	cmp_mode_used = cmp_ent_get_cmp_mode(ent);
-	printf("Used Compression Mode: %" PRIu32 "\n", cmp_mode_used);
+	debug_print("Used Compression Mode: %" PRIu32, cmp_mode_used);
 
 	model_value_used = cmp_ent_get_model_value(ent);
-	printf("Used Model Updating Weighing Value: %" PRIu32 "\n", model_value_used);
+	debug_print("Used Model Updating Weighing Value: %" PRIu32, model_value_used);
 
 	model_id = cmp_ent_get_model_id(ent);
-	printf("Model ID: %" PRIu32 "\n", model_id);
+	debug_print("Model ID: %" PRIu32, model_id);
 
 	model_counter = cmp_ent_get_model_counter(ent);
-	printf("Model Counter: %" PRIu32 "\n", model_counter);
+	debug_print("Model Counter: %" PRIu32, model_counter);
 
 	max_used_bits_version = cmp_ent_get_max_used_bits_version(ent);
-	printf("Maximum Used Bits Registry Version: %" PRIu32 "\n", max_used_bits_version);
+	debug_print("Maximum Used Bits Registry Version: %" PRIu32, max_used_bits_version);
 
 	lossy_cmp_par_used = cmp_ent_get_lossy_cmp_par(ent);
-	printf("Used Lossy Compression Parameters: %" PRIu32 "\n", lossy_cmp_par_used);
+	debug_print("Used Lossy Compression Parameters: %" PRIu32, lossy_cmp_par_used);
 }
 
 
@@ -2353,10 +2344,10 @@ static void cmp_ent_parese_imagette_header(const struct cmp_entity *ent)
 	uint32_t spill_used, golomb_par_used;
 
 	spill_used = cmp_ent_get_ima_spill(ent);
-	printf("Used Spillover Threshold Parameter: %" PRIu32 "\n", spill_used);
+	debug_print("Used Spillover Threshold Parameter: %" PRIu32, spill_used);
 
 	golomb_par_used = cmp_ent_get_ima_golomb_par(ent);
-	printf("Used Golomb Parameter: %" PRIu32 "\n", golomb_par_used);
+	debug_print("Used Golomb Parameter: %" PRIu32, golomb_par_used);
 }
 
 
@@ -2372,22 +2363,22 @@ static void cmp_ent_parese_adaptive_imagette_header(const struct cmp_entity *ent
 		 ap1_golomb_par_used, ap2_spill_used, ap2_golomb_par_used;
 
 	spill_used = cmp_ent_get_ima_spill(ent);
-	printf("Used Spillover Threshold Parameter: %" PRIu32 "\n", spill_used);
+	debug_print("Used Spillover Threshold Parameter: %" PRIu32, spill_used);
 
 	golomb_par_used = cmp_ent_get_ima_golomb_par(ent);
-	printf("Used Golomb Parameter: %" PRIu32 "\n", golomb_par_used);
+	debug_print("Used Golomb Parameter: %" PRIu32, golomb_par_used);
 
 	ap1_spill_used = cmp_ent_get_ima_ap1_spill(ent);
-	printf("Used Adaptive 1 Spillover Threshold Parameter: %" PRIu32 "\n", ap1_spill_used);
+	debug_print("Used Adaptive 1 Spillover Threshold Parameter: %" PRIu32, ap1_spill_used);
 
 	ap1_golomb_par_used = cmp_ent_get_ima_ap1_golomb_par(ent);
-	printf("Used Adaptive 1 Golomb Parameter: %" PRIu32 "\n", ap1_golomb_par_used);
+	debug_print("Used Adaptive 1 Golomb Parameter: %" PRIu32, ap1_golomb_par_used);
 
 	ap2_spill_used = cmp_ent_get_ima_ap2_spill(ent);
-	printf("Used Adaptive 2 Spillover Threshold Parameter: %" PRIu32 "\n", ap2_spill_used);
+	debug_print("Used Adaptive 2 Spillover Threshold Parameter: %" PRIu32, ap2_spill_used);
 
 	ap2_golomb_par_used = cmp_ent_get_ima_ap2_golomb_par(ent);
-	printf("Used Adaptive 2 Golomb Parameter: %" PRIu32 "\n", ap2_golomb_par_used);
+	debug_print("Used Adaptive 2 Golomb Parameter: %" PRIu32, ap2_golomb_par_used);
 }
 
 
@@ -2404,34 +2395,34 @@ static void cmp_ent_parese_non_imagette_header(const struct cmp_entity *ent)
 		 spill_5_used, cmp_par_5_used;
 
 	spill_1_used = cmp_ent_get_non_ima_spill1(ent);
-	printf("Used Spillover Threshold Parameter 1: %" PRIu32 "\n", spill_1_used);
+	debug_print("Used Spillover Threshold Parameter 1: %" PRIu32, spill_1_used);
 
 	cmp_par_1_used = cmp_ent_get_non_ima_cmp_par1(ent);
-	printf("Used Compression Parameter 1: %" PRIu32 "\n", cmp_par_1_used);
+	debug_print("Used Compression Parameter 1: %" PRIu32, cmp_par_1_used);
 
 	spill_2_used = cmp_ent_get_non_ima_spill2(ent);
-	printf("Used Spillover Threshold Parameter 2: %" PRIu32 "\n", spill_2_used);
+	debug_print("Used Spillover Threshold Parameter 2: %" PRIu32, spill_2_used);
 
 	cmp_par_2_used = cmp_ent_get_non_ima_cmp_par2(ent);
-	printf("Used Compression Parameter 2: %" PRIu32 "\n", cmp_par_2_used);
+	debug_print("Used Compression Parameter 2: %" PRIu32, cmp_par_2_used);
 
 	spill_3_used = cmp_ent_get_non_ima_spill3(ent);
-	printf("Used Spillover Threshold Parameter 3: %" PRIu32 "\n", spill_3_used);
+	debug_print("Used Spillover Threshold Parameter 3: %" PRIu32, spill_3_used);
 
 	cmp_par_3_used = cmp_ent_get_non_ima_cmp_par3(ent);
-	printf("Used Compression Parameter 3: %" PRIu32 "\n", cmp_par_3_used);
+	debug_print("Used Compression Parameter 3: %" PRIu32, cmp_par_3_used);
 
 	spill_4_used = cmp_ent_get_non_ima_spill4(ent);
-	printf("Used Spillover Threshold Parameter 4: %" PRIu32 "\n", spill_4_used);
+	debug_print("Used Spillover Threshold Parameter 4: %" PRIu32, spill_4_used);
 
 	cmp_par_4_used = cmp_ent_get_non_ima_cmp_par4(ent);
-	printf("Used Compression Parameter 4: %" PRIu32 "\n", cmp_par_4_used);
+	debug_print("Used Compression Parameter 4: %" PRIu32, cmp_par_4_used);
 
 	spill_5_used = cmp_ent_get_non_ima_spill5(ent);
-	printf("Used Spillover Threshold Parameter 5: %" PRIu32 "\n", spill_5_used);
+	debug_print("Used Spillover Threshold Parameter 5: %" PRIu32, spill_5_used);
 
 	cmp_par_5_used = cmp_ent_get_non_ima_cmp_par5(ent);
-	printf("Used Compression Parameter 5: %" PRIu32 "\n", cmp_par_5_used);
+	debug_print("Used Compression Parameter 5: %" PRIu32, cmp_par_5_used);
 }
 
 
@@ -2446,7 +2437,7 @@ static void cmp_ent_parese_specific_header(const struct cmp_entity *ent)
 	enum cmp_data_type data_type = cmp_ent_get_data_type(ent);
 
 	if (cmp_ent_get_data_type_raw_bit(ent)) {
-		printf("Uncompressed data bit is set. No specific header is used.\n");
+		debug_print("Uncompressed data bit is set. No specific header is used.");
 		return;
 	}
 
@@ -2482,7 +2473,7 @@ static void cmp_ent_parese_specific_header(const struct cmp_entity *ent)
 		cmp_ent_parese_non_imagette_header(ent);
 		break;
 	default:
-		printf("For this data product type no parse functions is implemented!\n");
+		debug_print("For this data product type no parse functions is implemented!");
 		break;
 	}
 }
diff --git a/lib/common/cmp_support.c b/lib/common/cmp_support.c
index ad09a2409ae3a84b37560ee1517d884f2109128b..02ccd813a31e6565b0f4106b3a82639ac85d21da 100644
--- a/lib/common/cmp_support.c
+++ b/lib/common/cmp_support.c
@@ -437,25 +437,25 @@ int cmp_cfg_gen_par_is_invalid(const struct cmp_cfg *cfg, enum check_opt opt)
 	}
 
 	if (invalid_data_type) {
-		debug_print("Error: selected compression data type is not supported%s.\n", str);
+		debug_print("Error: selected compression data type is not supported%s.", str);
 		cfg_invalid++;
 	}
 
 	if (unsupported_cmp_mode) {
-		debug_print("Error: selected cmp_mode: %i is not supported%s.\n", cfg->cmp_mode, str);
+		debug_print("Error: selected cmp_mode: %i is not supported%s.", cfg->cmp_mode, str);
 		cfg_invalid++;
 	}
 
 	if (check_model_value) {
 		if (cfg->model_value > MAX_MODEL_VALUE) {
-			debug_print("Error: selected model_value: %" PRIu32 " is invalid. The largest supported value is: %u.\n",
+			debug_print("Error: selected model_value: %" PRIu32 " is invalid. The largest supported value is: %u.",
 				    cfg->model_value, MAX_MODEL_VALUE);
 			cfg_invalid++;
 		}
 	}
 
 	if (cfg->round > max_round_value) {
-		debug_print("Error: selected lossy parameter: %" PRIu32 " is not supported%s. The largest supported value is: %" PRIu32 ".\n",
+		debug_print("Error: selected lossy parameter: %" PRIu32 " is not supported%s. The largest supported value is: %" PRIu32 ".",
 			    cfg->round, str, max_round_value);
 		cfg_invalid++;
 	}
@@ -483,54 +483,54 @@ int cmp_cfg_icu_buffers_is_invalid(const struct cmp_cfg *cfg)
 		return 1;
 
 	if (cfg->input_buf == NULL) {
-		debug_print("Error: The data_to_compress buffer for the data to be compressed is NULL.\n");
+		debug_print("Error: The data_to_compress buffer for the data to be compressed is NULL.");
 		cfg_invalid++;
 	}
 
 	if (cfg->samples == 0)
-		debug_print("Warning: The samples parameter is 0. No data are compressed. This behavior may not be intended.\n");
+		debug_print("Warning: The samples parameter is 0. No data are compressed. This behavior may not be intended.");
 
 	if (cfg->icu_output_buf) {
 		if (cfg->buffer_length == 0 && cfg->samples != 0) {
-			debug_print("Error: The buffer_length is set to 0. There is no space to store the compressed data.\n");
+			debug_print("Error: The buffer_length is set to 0. There is no space to store the compressed data.");
 			cfg_invalid++;
 		}
 
 		if (raw_mode_is_used(cfg->cmp_mode) && cfg->buffer_length < cfg->samples) {
-			debug_print("Error: The compressed_data_len_samples is to small to hold the data form the data_to_compress.\n");
+			debug_print("Error: The compressed_data_len_samples is to small to hold the data form the data_to_compress.");
 			cfg_invalid++;
 		}
 
 		if (cfg->icu_output_buf == cfg->input_buf) {
-			debug_print("Error: The compressed_data buffer is the same as the data_to_compress buffer.\n");
+			debug_print("Error: The compressed_data buffer is the same as the data_to_compress buffer.");
 			cfg_invalid++;
 		}
 	}
 
 	if (model_mode_is_used(cfg->cmp_mode)) {
 		if (cfg->model_buf == NULL) {
-			debug_print("Error: The model_of_data buffer for the model data is NULL.\n");
+			debug_print("Error: The model_of_data buffer for the model data is NULL.");
 			cfg_invalid++;
 		}
 
 		if (cfg->model_buf == cfg->input_buf) {
-			debug_print("Error: The model_of_data buffer is the same as the data_to_compress buffer.\n");
+			debug_print("Error: The model_of_data buffer is the same as the data_to_compress buffer.");
 			cfg_invalid++;
 		}
 
 		if (cfg->model_buf == cfg->icu_output_buf) {
-			debug_print("Error: The model_of_data buffer is the same as the compressed_data buffer.\n");
+			debug_print("Error: The model_of_data buffer is the same as the compressed_data buffer.");
 			cfg_invalid++;
 		}
 
 		if (cfg->icu_new_model_buf) {
 			if (cfg->icu_new_model_buf == cfg->input_buf) {
-				debug_print("Error: The updated_model buffer is the same as the data_to_compress buffer.\n");
+				debug_print("Error: The updated_model buffer is the same as the data_to_compress buffer.");
 				cfg_invalid++;
 			}
 
 			if (cfg->icu_new_model_buf == cfg->icu_output_buf) {
-				debug_print("Error: The compressed_data buffer is the same as the compressed_data buffer.\n");
+				debug_print("Error: The compressed_data buffer is the same as the compressed_data buffer.");
 				cfg_invalid++;
 			}
 		}
@@ -554,7 +554,7 @@ int cmp_cfg_icu_max_used_bits_out_of_limit(const struct cmp_max_used_bits *max_u
 #define CHECK_MAX_USED_BITS_LIMIT(entry) \
 	do { \
 		if (max_used_bits->entry > MAX_USED_BITS_SAFE.entry) { \
-			debug_print("Error: The " #entry " entry in the max_used_bits structure is too large (actual: %x, max: %x).\n",  max_used_bits->entry, MAX_USED_BITS_SAFE.entry); \
+			debug_print("Error: The " #entry " entry in the max_used_bits structure is too large (actual: %x, max: %x).",  max_used_bits->entry, MAX_USED_BITS_SAFE.entry); \
 			error++; \
 		} \
 	} while (0)
@@ -562,7 +562,7 @@ int cmp_cfg_icu_max_used_bits_out_of_limit(const struct cmp_max_used_bits *max_u
 	int error = 0;
 
 	if (!max_used_bits) {
-		debug_print("Error: The pointer to the max_used_bits structure is NULL.\n");
+		debug_print("Error: The pointer to the max_used_bits structure is NULL.");
 		return 1;
 	}
 
@@ -651,17 +651,17 @@ static int cmp_pars_are_invalid(uint32_t cmp_par, uint32_t spill, enum cmp_mode
 	case CMP_MODE_MODEL_ZERO:
 	case CMP_MODE_MODEL_MULTI:
 		if (cmp_par < min_golomb_par || cmp_par > max_golomb_par) {
-			debug_print("Error: The selected %s compression parameter: %" PRIu32 " is not supported in the selected compression mode. The compression parameter has to be between [%" PRIu32 ", %" PRIu32 "] in this mode.\n",
+			debug_print("Error: The selected %s compression parameter: %" PRIu32 " is not supported in the selected compression mode. The compression parameter has to be between [%" PRIu32 ", %" PRIu32 "] in this mode.",
 				    par_name, cmp_par, min_golomb_par, max_golomb_par);
 			cfg_invalid++;
 		}
 		if (spill < min_spill) {
-			debug_print("Error: The selected %s spillover threshold value: %" PRIu32 " is too small. The smallest possible spillover value is: %" PRIu32 ".\n",
+			debug_print("Error: The selected %s spillover threshold value: %" PRIu32 " is too small. The smallest possible spillover value is: %" PRIu32 ".",
 				    par_name, spill, min_spill);
 			cfg_invalid++;
 		}
 		if (spill > max_spill) {
-			debug_print("Error: The selected %s spillover threshold value: %" PRIu32 " is too large for the selected %s compression parameter: %" PRIu32 ". The largest possible spillover value in the selected compression mode is: %" PRIu32 ".\n",
+			debug_print("Error: The selected %s spillover threshold value: %" PRIu32 " is too large for the selected %s compression parameter: %" PRIu32 ". The largest possible spillover value in the selected compression mode is: %" PRIu32 ".",
 				    par_name, spill, par_name, cmp_par, max_spill);
 			cfg_invalid++;
 		}
@@ -669,13 +669,13 @@ static int cmp_pars_are_invalid(uint32_t cmp_par, uint32_t spill, enum cmp_mode
 		break;
 	case CMP_MODE_STUFF:
 		if (cmp_par > MAX_STUFF_CMP_PAR) {
-			debug_print("Error: The selected %s stuff mode compression parameter: %" PRIu32 " is too large. The largest possible value in the selected compression mode is: %u.\n",
+			debug_print("Error: The selected %s stuff mode compression parameter: %" PRIu32 " is too large. The largest possible value in the selected compression mode is: %u.",
 				    par_name, cmp_par, MAX_STUFF_CMP_PAR);
 			cfg_invalid++;
 		}
 		break;
 	default:
-		debug_print("Error: The compression mode is not supported.\n");
+		debug_print("Error: The compression mode is not supported.");
 		cfg_invalid++;
 		break;
 	}
@@ -708,7 +708,7 @@ int cmp_cfg_imagette_is_invalid(const struct cmp_cfg *cfg, enum check_opt opt)
 		return 1;
 
 	if (!cmp_imagette_data_type_is_used(cfg->data_type)) {
-		debug_print("Error: The compression data type is not an imagette compression data type.\n");
+		debug_print("Error: The compression data type is not an imagette compression data type.");
 		cfg_invalid++;
 	}
 
@@ -843,7 +843,7 @@ int cmp_cfg_fx_cob_is_invalid(const struct cmp_cfg *cfg)
 		return 1;
 
 	if (!cmp_fx_cob_data_type_is_used(cfg->data_type)) {
-		debug_print("Error: The compression data type is not a flux/center of brightness compression data type.\n");
+		debug_print("Error: The compression data type is not a flux/center of brightness compression data type.");
 		cfg_invalid++;
 	}
 
@@ -914,7 +914,7 @@ int cmp_cfg_aux_is_invalid(const struct cmp_cfg *cfg)
 				cfg->cmp_mode, cfg->data_type, "smearing outlier pixls num");
 		break;
 	default:
-		debug_print("Error: The compression data type is not an auxiliary science compression data type.\n");
+		debug_print("Error: The compression data type is not an auxiliary science compression data type.");
 		cfg_invalid++;
 	}
 	return cfg_invalid;
@@ -966,20 +966,20 @@ int cmp_cfg_icu_is_invalid(const struct cmp_cfg *cfg)
 void print_cmp_info(const struct cmp_info *info)
 {
 	if (!info) {
-		debug_print("Pointer to the compressor information is NULL.\n");
+		debug_print("Pointer to the compressor information is NULL.");
 		return;
 	}
 
-	debug_print("cmp_mode_used: %" PRIu32 "\n", info->cmp_mode_used);
-	debug_print("spill_used: %" PRIu32 "\n", info->spill_used);
-	debug_print("golomb_par_used: %" PRIu32 "\n", info->golomb_par_used);
-	debug_print("samples_used: %" PRIu32 "\n", info->samples_used);
-	debug_print("cmp_size: %" PRIu32 "\n", info->cmp_size);
-	debug_print("ap1_cmp_size: %" PRIu32 "\n", info->ap1_cmp_size);
-	debug_print("ap2_cmp_size: %" PRIu32 "\n", info->ap2_cmp_size);
-	debug_print("rdcu_new_model_adr_used: 0x%06"PRIX32"\n", info->rdcu_new_model_adr_used);
-	debug_print("rdcu_cmp_adr_used: 0x%06"PRIX32"\n", info->rdcu_cmp_adr_used);
-	debug_print("model_value_used: %u\n", info->model_value_used);
-	debug_print("round_used: %u\n", info->round_used);
-	debug_print("cmp_err: %#X\n", info->cmp_err);
+	debug_print("cmp_mode_used: %" PRIu32 "", info->cmp_mode_used);
+	debug_print("spill_used: %" PRIu32 "", info->spill_used);
+	debug_print("golomb_par_used: %" PRIu32 "", info->golomb_par_used);
+	debug_print("samples_used: %" PRIu32 "", info->samples_used);
+	debug_print("cmp_size: %" PRIu32 "", info->cmp_size);
+	debug_print("ap1_cmp_size: %" PRIu32 "", info->ap1_cmp_size);
+	debug_print("ap2_cmp_size: %" PRIu32 "", info->ap2_cmp_size);
+	debug_print("rdcu_new_model_adr_used: 0x%06"PRIX32"", info->rdcu_new_model_adr_used);
+	debug_print("rdcu_cmp_adr_used: 0x%06"PRIX32"", info->rdcu_cmp_adr_used);
+	debug_print("model_value_used: %u", info->model_value_used);
+	debug_print("round_used: %u", info->round_used);
+	debug_print("cmp_err: %#X", info->cmp_err);
 }
diff --git a/lib/icu_compress/cmp_icu.c b/lib/icu_compress/cmp_icu.c
index 37d3a164580e2e079e8752d65786c8acb2a7ebd6..21f22e26efca8d58e0f8a62f21517ff53e1f7c29 100644
--- a/lib/icu_compress/cmp_icu.c
+++ b/lib/icu_compress/cmp_icu.c
@@ -186,7 +186,7 @@ uint32_t cmp_cfg_icu_buffers(struct cmp_cfg *cfg, void *data_to_compress,
 	uint32_t cmp_data_size, hdr_size;
 
 	if (!cfg) {
-		debug_print("Error: pointer to the compression configuration structure is NULL.\n");
+		debug_print("Error: pointer to the compression configuration structure is NULL.");
 		return 0;
 	}
 
@@ -205,7 +205,7 @@ uint32_t cmp_cfg_icu_buffers(struct cmp_cfg *cfg, void *data_to_compress,
 	hdr_size = cmp_ent_cal_hdr_size(cfg->data_type, cfg->cmp_mode == CMP_MODE_RAW);
 
 	if ((cmp_data_size + hdr_size) > CMP_ENTITY_MAX_SIZE || cmp_data_size > CMP_ENTITY_MAX_SIZE) {
-		debug_print("Error: The buffer for the compressed data is too large to fit in a compression entity.\n");
+		debug_print("Error: The buffer for the compressed data is too large to fit in a compression entity.");
 		return 0;
 	}
 
@@ -375,7 +375,7 @@ int cmp_cfg_aux(struct cmp_cfg *cfg,
 		cfg->spill_smearing_pixels_error = spillover_pixels_error;
 		break;
 	default:
-		debug_print("Error: The compression data type is not an auxiliary science compression data type.\n");
+		debug_print("Error: The compression data type is not an auxiliary science compression data type.");
 		return -1;
 	}
 
@@ -759,7 +759,7 @@ static int encode_value(uint32_t data, uint32_t model, int stream_len,
 	model = round_fwd(model, setup->lossy_par);
 
 	if (data & mask || model & mask) {
-		debug_print("Error: The data or the model of the data are bigger than expected.\n");
+		debug_print("Error: The data or the model of the data are bigger than expected.");
 		return CMP_ERROR_HIGH_VALUE;
 	}
 
@@ -2135,7 +2135,7 @@ static int compress_data_internal(const struct cmp_cfg *cfg, int stream_len)
 		return stream_len;
 
 	if (stream_len & 0x7) {
-		debug_print("Error: The stream_len parameter must be a multiple of 8.\n");
+		debug_print("Error: The stream_len parameter must be a multiple of 8.");
 		return -1;
 	}
 
@@ -2159,7 +2159,7 @@ static int compress_data_internal(const struct cmp_cfg *cfg, int stream_len)
 		bitsize += stream_len + (int)raw_size*8; /* convert to bits */
 	} else {
 		if (cfg->icu_output_buf && cfg->samples/3 > cfg->buffer_length)
-			debug_print("Warning: The size of the compressed_data buffer is 3 times smaller than the data_to_compress. This is probably unintended.\n");
+			debug_print("Warning: The size of the compressed_data buffer is 3 times smaller than the data_to_compress. This is probably unintended.");
 
 		switch (cfg->data_type) {
 		case DATA_TYPE_IMAGETTE:
@@ -2225,7 +2225,7 @@ static int compress_data_internal(const struct cmp_cfg *cfg, int stream_len)
 		/* LCOV_EXCL_START */
 		case DATA_TYPE_UNKNOWN:
 		default:
-			debug_print("Error: Data type not supported.\n");
+			debug_print("Error: Data type not supported.");
 			bitsize = -1;
 		}
 		/* LCOV_EXCL_STOP */
@@ -2414,7 +2414,7 @@ static int cmp_ent_build_chunk_header(struct cmp_entity *ent, uint32_t chunk_siz
 		err |= cmp_ent_set_version_id(ent, version_identifier);
 		err |= cmp_ent_set_size(ent, (uint32_t)cmp_ent_size_byte);
 		if (cmp_ent_set_original_size(ent, chunk_size)) {
-			debug_print("Error: The size of the chunk is too.\n");
+			debug_print("Error: The size of the chunk is too.");
 			return -1;
 		}
 		err |= cmp_ent_set_start_timestamp(ent, start_timestamp);
@@ -2491,11 +2491,11 @@ static enum chunk_type get_chunk_type(uint16_t subservice)
 	case SST_NCxx_S_SCIENCE_F_FX_EFX:
 	case SST_NCxx_S_SCIENCE_F_FX_NCOB:
 	case SST_NCxx_S_SCIENCE_F_FX_EFX_NCOB_ECOB:
-		debug_print("Error: No chunk is defined for fast cadence subservices\n");
+		debug_print("Error: No chunk is defined for fast cadence subservices");
 		chunk_type = CHUNK_TYPE_UNKNOWN;
 		break;
 	default:
-		debug_print("Error: Unknown subservice: %i.\n", subservice);
+		debug_print("Error: Unknown subservice: %i.", subservice);
 		chunk_type = CHUNK_TYPE_UNKNOWN;
 		break;
 	};
@@ -2643,15 +2643,15 @@ int32_t compress_chunk(void *chunk, uint32_t chunk_size,
 	int err;
 
 	if (!chunk) {
-		debug_print("Error: Pointer to the data chunk is NULL. No data no compression.\n");
+		debug_print("Error: Pointer to the data chunk is NULL. No data no compression.");
 		return -1;
 	}
 	if (chunk_size < COLLECTION_HDR_SIZE) {
-		debug_print("Error: The chunk size is smaller than the minimum size.\n");
+		debug_print("Error: The chunk size is smaller than the minimum size.");
 		return -1;
 	}
 	if (chunk_size > CMP_ENTITY_MAX_ORIGINAL_SIZE) {
-		debug_print("Error: The chunk size is bigger than the maximum allowed chunk size.\n");
+		debug_print("Error: The chunk size is bigger than the maximum allowed chunk size.");
 		return -1;
 	}
 
@@ -2662,7 +2662,7 @@ int32_t compress_chunk(void *chunk, uint32_t chunk_size,
 		cmp_size_byte = NON_IMAGETTE_HEADER_SIZE;
 	if (dst) {
 		if (dst_capacity < (uint32_t)cmp_size_byte) {
-			debug_print("Error: The destination capacity is smaller than the minimum compression entity size.\n");
+			debug_print("Error: The destination capacity is smaller than the minimum compression entity size.");
 			return CMP_ERROR_SMALL_BUF;
 		}
 		memset(dst, 0, (uint32_t)cmp_size_byte);
@@ -2685,7 +2685,7 @@ int32_t compress_chunk(void *chunk, uint32_t chunk_size,
 			col_up_model = ((uint8_t *)updated_chunk_model + read_bytes);
 
 		if (cmp_col_get_chunk_type(col) != chunk_type) {
-			debug_print("Error: The chunk contains collections with an incompatible mix of subservices.\n");
+			debug_print("Error: The chunk contains collections with an incompatible mix of subservices.");
 			return -1;
 		}
 		if (read_bytes + cmp_col_get_size(col) > chunk_size)
@@ -2696,7 +2696,7 @@ int32_t compress_chunk(void *chunk, uint32_t chunk_size,
 	}
 
 	if (read_bytes != chunk_size) {
-		debug_print("Error: The sum of the compressed collections does not match the size of the data in the compression header.\n");
+		debug_print("Error: The sum of the compressed collections does not match the size of the data in the compression header.");
 		return -1;
 	}
 
@@ -2732,7 +2732,7 @@ uint32_t compress_chunk_cmp_size_bound(const void *chunk, size_t chunk_size)
 	uint32_t num_col = 0;
 
 	if (chunk_size > CMP_ENTITY_MAX_ORIGINAL_SIZE-NON_IMAGETTE_HEADER_SIZE-CMP_COLLECTION_FILD_SIZE) {
-		debug_print("Error: The chunk size is bigger than the maximum allowed chunk size.\n");
+		debug_print("Error: The chunk size is bigger than the maximum allowed chunk size.");
 		return 0;
 	}
 
@@ -2743,7 +2743,7 @@ uint32_t compress_chunk_cmp_size_bound(const void *chunk, size_t chunk_size)
 
 
 	if ((uint32_t)read_bytes != chunk_size) {
-		debug_print("Error: The sum of the compressed collections does not match the size of the data in the compression header.\n");
+		debug_print("Error: The sum of the compressed collections does not match the size of the data in the compression header.");
 		return 0;
 	}
 
diff --git a/lib/rdcu_compress/cmp_rdcu.c b/lib/rdcu_compress/cmp_rdcu.c
index e804995d6d009cf163159bc2161843762da50413..7feeda49f3ef0f971414d476c49dec5f2e5887e2 100644
--- a/lib/rdcu_compress/cmp_rdcu.c
+++ b/lib/rdcu_compress/cmp_rdcu.c
@@ -28,7 +28,6 @@
 
 
 #include <stdint.h>
-#include <stdio.h>
 
 #include "../common/cmp_debug.h"
 #include "../common/cmp_support.h"
@@ -61,17 +60,17 @@ static void rdcu_syncing(void)
 
 	int cnt = 0;
 
-	printf("syncing...");
+	debug_print("syncing...");
 	while (rdcu_rmap_sync_status()) {
-		printf("pending: %d\n", rdcu_rmap_sync_status());
+		debug_print("pending: %d", rdcu_rmap_sync_status());
 
 		if (cnt++ > 10) {
-			printf("aborting; de");
+			debug_print("aborting; de-");
 			break;
 		}
 
 	}
-	printf("synced\n");
+	debug_print("synced");
 #endif
 }
 
@@ -240,11 +239,11 @@ static int rdcu_transfer_sram(const struct cmp_cfg *cfg)
 		uint32_t size = (cfg->samples * 2 + 3) & ~3U;
 		/* now set the data in the local mirror... */
 		if (rdcu_write_sram_16(cfg->input_buf, cfg->rdcu_data_adr, cfg->samples * 2) < 0) {
-			debug_print("Error: The data to be compressed cannot be transferred to the SRAM of the RDCU.\n");
+			debug_print("Error: The data to be compressed cannot be transferred to the SRAM of the RDCU.");
 			return -1;
 		}
 		if (rdcu_sync_mirror_to_sram(cfg->rdcu_data_adr, size, rdcu_get_data_mtu())) {
-			debug_print("Error: The data to be compressed cannot be transferred to the SRAM of the RDCU.\n");
+			debug_print("Error: The data to be compressed cannot be transferred to the SRAM of the RDCU.");
 			return -1;
 		}
 	}
@@ -256,11 +255,11 @@ static int rdcu_transfer_sram(const struct cmp_cfg *cfg)
 			uint32_t size = (cfg->samples * 2 + 3) & ~3U;
 			/* set the model in the local mirror... */
 			if (rdcu_write_sram_16(cfg->model_buf, cfg->rdcu_model_adr, cfg->samples * 2) < 0) {
-				debug_print("Error: The model buffer cannot be transferred to the SRAM of the RDCU.\n");
+				debug_print("Error: The model buffer cannot be transferred to the SRAM of the RDCU.");
 				return -1;
 			}
 			if (rdcu_sync_mirror_to_sram(cfg->rdcu_model_adr, size, rdcu_get_data_mtu())) {
-				debug_print("Error: The model buffer cannot be transferred to the SRAM of the RDCU.\n");
+				debug_print("Error: The model buffer cannot be transferred to the SRAM of the RDCU.");
 				return -1;
 			}
 		}
@@ -518,24 +517,24 @@ int rdcu_inject_edac_error(const struct cmp_cfg *cfg, uint32_t addr)
 		rdcu_edac_set_ctrl_reg_write_op();
 		rdcu_edac_set_bypass();
 		if (rdcu_sync_sram_edac_ctrl()) {
-			debug_print("Error: rdcu_sync_sram_edac_ctrl\n");
+			debug_print("Error: rdcu_sync_sram_edac_ctrl");
 			return -1;
 		}
 		rdcu_syncing();
 		/* verify bypass aktiv */
 		rdcu_edac_set_ctrl_reg_read_op();
 		if (rdcu_sync_sram_edac_ctrl()) {
-			debug_print("Error: rdcu_sync_sram_edac_ctrl\n");
+			debug_print("Error: rdcu_sync_sram_edac_ctrl");
 			return -1;
 		}
 		rdcu_syncing();
 		if (rdcu_sync_sram_edac_status()) {
-			printf("Error: rdcu_sync_sram_edac_status\n");
+			debug_print("Error: rdcu_sync_sram_edac_status");
 			return -1;
 		}
 		rdcu_syncing();
 		if (rdcu_edac_get_sub_chip_die_addr() != sub_chip_die_addr) {
-			printf("Error: sub_chip_die_addr unexpected !\n");
+			debug_print("Error: sub_chip_die_addr unexpected!");
 			return -1;
 		}
 #if 1
@@ -543,7 +542,7 @@ int rdcu_inject_edac_error(const struct cmp_cfg *cfg, uint32_t addr)
 		if (2 != sub_chip_die_addr && 4 != sub_chip_die_addr)
 #endif
 			if (rdcu_edac_get_bypass_status() == 0) {
-				printf("Error: bypass status unexpected !\n");
+				debug_print("Error: bypass status unexpected!");
 				return -1;
 			}
 	}
@@ -563,7 +562,7 @@ int rdcu_inject_edac_error(const struct cmp_cfg *cfg, uint32_t addr)
 	if (rdcu_write_sram(buf, addr, sizeof(buf)) < 0)
 		return -1;
 	if (rdcu_sync_mirror_to_sram(addr, sizeof(buf), rdcu_get_data_mtu())) {
-		debug_print("Error: The data to be compressed cannot be transferred to the SRAM of the RDCU.\n");
+		debug_print("Error: The data to be compressed cannot be transferred to the SRAM of the RDCU.");
 		return -1;
 	}
 	rdcu_syncing();
@@ -576,28 +575,28 @@ int rdcu_inject_edac_error(const struct cmp_cfg *cfg, uint32_t addr)
 		rdcu_edac_set_ctrl_reg_write_op();
 		rdcu_edac_clear_bypass();
 		if (rdcu_sync_sram_edac_ctrl()) {
-			debug_print("Error: rdcu_sync_sram_edac_ctrl\n");
+			debug_print("Error: rdcu_sync_sram_edac_ctrl");
 			return -1;
 		}
 		rdcu_syncing();
 		/* verify bypass disable */
 		rdcu_edac_set_ctrl_reg_read_op();
 		if (rdcu_sync_sram_edac_ctrl()) {
-			debug_print("Error: rdcu_sync_sram_edac_ctrl\n");
+			debug_print("Error: rdcu_sync_sram_edac_ctrl");
 			return -1;
 		}
 		rdcu_syncing();
 		if (rdcu_sync_sram_edac_status()) {
-			printf("Error: rdcu_sync_sram_edac_status\n");
+			debug_print("Error: rdcu_sync_sram_edac_status");
 			return -1;
 		}
 		rdcu_syncing();
 		if (rdcu_edac_get_sub_chip_die_addr() != sub_chip_die_addr) {
-			printf("Error: sub_chip_die_addr unexpected !\n");
+			debug_print("Error: sub_chip_die_addr unexpected!");
 			return -1;
 		}
 		if (1 == rdcu_edac_get_bypass_status()) {
-			printf("Error: bypass status unexpected !\n");
+			debug_print("Error: bypass status unexpected!");
 			return -1;
 		}
 	}
@@ -666,14 +665,14 @@ int rdcu_compress_data_parallel(const struct cmp_cfg *cfg,
 				return -1;
 		}
 	} else {
-		debug_print("Warning: input_buf = NULL; input_buf is not written to the sram and compressed data is not read from the SRAM\n");
+		debug_print("Warning: input_buf = NULL; input_buf is not written to the sram and compressed data is not read from the SRAM.");
 	}
 
 	/* read model and write model in parallel */
 	if (cfg->model_buf && model_mode_is_used(cfg->cmp_mode) && model_mode_is_used(last_info->cmp_mode_used)) {
 		if (cfg->rdcu_model_adr == last_info->rdcu_new_model_adr_used &&
 		    cfg->samples == last_info->samples_used) {
-			printf("The last updated model buffer and the current model buffer overlap exactly in the SRAM of the RDCU. Skip model transfer.\n");
+			debug_print("The last updated model buffer and the current model buffer overlap exactly in the SRAM of the RDCU. Skip model transfer.");
 		} else {
 			uint32_t new_model_size_4byte;
 
diff --git a/lib/rdcu_compress/cmp_rdcu_cfg.c b/lib/rdcu_compress/cmp_rdcu_cfg.c
index 7b2ece5cfbc0c2e8b645d791f8679cbd711580dd..8f1b3f6d79ce9c0955fe5c9219f1d71894e95ad4 100644
--- a/lib/rdcu_compress/cmp_rdcu_cfg.c
+++ b/lib/rdcu_compress/cmp_rdcu_cfg.c
@@ -121,28 +121,28 @@ static int rdcu_cfg_buffers_is_invalid(const struct cmp_cfg *cfg)
 
 	if (cfg->cmp_mode == CMP_MODE_RAW) {
 		if (cfg->buffer_length < cfg->samples) {
-			debug_print("rdcu_buffer_length is smaller than the samples parameter. There is not enough space to copy the data in RAW mode.\n");
+			debug_print("rdcu_buffer_length is smaller than the samples parameter. There is not enough space to copy the data in RAW mode.");
 			cfg_invalid++;
 		}
 	}
 
 	if (cfg->rdcu_data_adr & 0x3) {
-		debug_print("Error: The RDCU data to compress start address is not 4-Byte aligned.\n");
+		debug_print("Error: The RDCU data to compress start address is not 4-Byte aligned.");
 		cfg_invalid++;
 	}
 
 	if (cfg->rdcu_buffer_adr & 0x3) {
-		debug_print("Error: The RDCU compressed data start address is not 4-Byte aligned.\n");
+		debug_print("Error: The RDCU compressed data start address is not 4-Byte aligned.");
 		cfg_invalid++;
 	}
 
 	if (outside_sram_range(cfg->rdcu_data_adr, cfg->samples * IMA_SAM2BYT)) {
-		debug_print("Error: The RDCU data to compress buffer is outside the RDCU SRAM address space.\n");
+		debug_print("Error: The RDCU data to compress buffer is outside the RDCU SRAM address space.");
 		cfg_invalid++;
 	}
 
 	if (outside_sram_range(cfg->rdcu_buffer_adr, cfg->buffer_length * IMA_SAM2BYT)) {
-		debug_print("Error: The RDCU compressed data buffer is outside the RDCU SRAM address space.\n");
+		debug_print("Error: The RDCU compressed data buffer is outside the RDCU SRAM address space.");
 		cfg_invalid++;
 	}
 
@@ -150,23 +150,23 @@ static int rdcu_cfg_buffers_is_invalid(const struct cmp_cfg *cfg)
 			    cfg->rdcu_data_adr + cfg->samples * IMA_SAM2BYT,
 			    cfg->rdcu_buffer_adr,
 			    cfg->rdcu_buffer_adr + cfg->buffer_length * IMA_SAM2BYT)) {
-		debug_print("Error: The RDCU data to compress buffer and the RDCU compressed data buffer are overlapping.\n");
+		debug_print("Error: The RDCU data to compress buffer and the RDCU compressed data buffer are overlapping.");
 		cfg_invalid++;
 	}
 
 	if (model_mode_is_used(cfg->cmp_mode)) {
 		if (cfg->model_buf && cfg->model_buf == cfg->input_buf) {
-			debug_print("Error: The model buffer (model_buf) and the data to be compressed (input_buf) are equal.\n");
+			debug_print("Error: The model buffer (model_buf) and the data to be compressed (input_buf) are equal.");
 			cfg_invalid++;
 		}
 
 		if (cfg->rdcu_model_adr & 0x3) {
-			debug_print("Error: The RDCU model start address is not 4-Byte aligned.\n");
+			debug_print("Error: The RDCU model start address is not 4-Byte aligned.");
 			cfg_invalid++;
 		}
 
 		if (outside_sram_range(cfg->rdcu_model_adr, cfg->samples * IMA_SAM2BYT)) {
-			debug_print("Error: The RDCU model buffer is outside the RDCU SRAM address space.\n");
+			debug_print("Error: The RDCU model buffer is outside the RDCU SRAM address space.");
 			cfg_invalid++;
 		}
 
@@ -175,7 +175,7 @@ static int rdcu_cfg_buffers_is_invalid(const struct cmp_cfg *cfg)
 			    cfg->rdcu_model_adr + cfg->samples * IMA_SAM2BYT,
 			    cfg->rdcu_data_adr,
 			    cfg->rdcu_data_adr + cfg->samples * IMA_SAM2BYT)) {
-			debug_print("Error: The model buffer and the data to compress buffer are overlapping.\n");
+			debug_print("Error: The model buffer and the data to compress buffer are overlapping.");
 			cfg_invalid++;
 		}
 
@@ -185,19 +185,19 @@ static int rdcu_cfg_buffers_is_invalid(const struct cmp_cfg *cfg)
 			cfg->rdcu_buffer_adr,
 			cfg->rdcu_buffer_adr + cfg->buffer_length * IMA_SAM2BYT)
 		    ) {
-			debug_print("Error: The model buffer and the compressed data buffer are overlapping.\n");
+			debug_print("Error: The model buffer and the compressed data buffer are overlapping.");
 			cfg_invalid++;
 		}
 
 		if (cfg->rdcu_model_adr != cfg->rdcu_new_model_adr) {
 			if (cfg->rdcu_new_model_adr & 0x3) {
-				debug_print("Error: The RDCU updated model start address (rdcu_new_model_adr) is not 4-Byte aligned.\n");
+				debug_print("Error: The RDCU updated model start address (rdcu_new_model_adr) is not 4-Byte aligned.");
 				cfg_invalid++;
 			}
 
 			if (outside_sram_range(cfg->rdcu_new_model_adr,
 					   cfg->samples * IMA_SAM2BYT)) {
-				debug_print("Error: The RDCU updated model buffer is outside the RDCU SRAM address space.\n");
+				debug_print("Error: The RDCU updated model buffer is outside the RDCU SRAM address space.");
 				cfg_invalid++;
 			}
 
@@ -207,7 +207,7 @@ static int rdcu_cfg_buffers_is_invalid(const struct cmp_cfg *cfg)
 				cfg->rdcu_data_adr,
 				cfg->rdcu_data_adr + cfg->samples * IMA_SAM2BYT)
 			    ) {
-				debug_print("Error: The updated model buffer and the data to compress buffer are overlapping.\n");
+				debug_print("Error: The updated model buffer and the data to compress buffer are overlapping.");
 				cfg_invalid++;
 			}
 
@@ -217,7 +217,7 @@ static int rdcu_cfg_buffers_is_invalid(const struct cmp_cfg *cfg)
 				cfg->rdcu_buffer_adr,
 				cfg->rdcu_buffer_adr + cfg->buffer_length * IMA_SAM2BYT)
 			    ) {
-				debug_print("Error: The updated model buffer and the compressed data buffer are overlapping.\n");
+				debug_print("Error: The updated model buffer and the compressed data buffer are overlapping.");
 				cfg_invalid++;
 			}
 			if (buffers_overlap(
@@ -226,7 +226,7 @@ static int rdcu_cfg_buffers_is_invalid(const struct cmp_cfg *cfg)
 				cfg->rdcu_model_adr,
 				cfg->rdcu_model_adr + cfg->samples * IMA_SAM2BYT)
 			    ) {
-				debug_print("Error: The updated model buffer and the model buffer are overlapping.\n");
+				debug_print("Error: The updated model buffer and the model buffer are overlapping.");
 				cfg_invalid++;
 			}
 		}
@@ -270,7 +270,7 @@ int rdcu_cfg_buffers(struct cmp_cfg *cfg, uint16_t *data_to_compress,
 		     uint32_t rdcu_buffer_lenght)
 {
 	if (!cfg) {
-		debug_print("Error: pointer to the compression configuration structure is NULL.\n");
+		debug_print("Error: pointer to the compression configuration structure is NULL.");
 		return -1;
 	}
 
@@ -308,7 +308,7 @@ int rdcu_cfg_imagette(struct cmp_cfg *cfg,
 		      uint32_t ap2_golomb_par, uint32_t ap2_spillover_par)
 {
 	if (!cfg) {
-		debug_print("Error: pointer to the compression configuration structure is NULL.\n");
+		debug_print("Error: pointer to the compression configuration structure is NULL.");
 		return -1;
 	}
 
@@ -334,7 +334,7 @@ int rdcu_cfg_imagette_default(struct cmp_cfg *cfg)
 {
 
 	if (!cfg) {
-		debug_print("Error: pointer to the compression configuration structure is NULL.\n");
+		debug_print("Error: pointer to the compression configuration structure is NULL.");
 		return -1;
 	}
 
@@ -371,29 +371,29 @@ int rdcu_cmp_cfg_is_invalid(const struct cmp_cfg *cfg)
 	int cfg_invalid = 0;
 
 	if (!cfg) {
-		debug_print("Error: pointer to the compression configuration structure is NULL.\n");
+		debug_print("Error: pointer to the compression configuration structure is NULL.");
 		return -1;
 	}
 
 	if (!cfg->input_buf)
-		debug_print("Warning: The data to compress buffer is set to NULL. No data will be transferred to the rdcu_data_adr in the RDCU SRAM.\n");
+		debug_print("Warning: The data to compress buffer is set to NULL. No data will be transferred to the rdcu_data_adr in the RDCU SRAM.");
 
 	if (model_mode_is_used(cfg->cmp_mode)) {
 		if (!cfg->model_buf)
-			debug_print("Warning: The model buffer is set to NULL. No model data will be transferred to the rdcu_model_adr in the RDCU SRAM.\n");
+			debug_print("Warning: The model buffer is set to NULL. No model data will be transferred to the rdcu_model_adr in the RDCU SRAM.");
 	}
 
 	if (cfg->samples == 0)
-		debug_print("Warning: The samples parameter is set to 0. No data will be compressed.\n");
+		debug_print("Warning: The samples parameter is set to 0. No data will be compressed.");
 
 	if (cfg->icu_new_model_buf)
-		debug_print("Warning: ICU updated model buffer is set. This buffer is not used for an RDCU compression.\n");
+		debug_print("Warning: ICU updated model buffer is set. This buffer is not used for an RDCU compression.");
 
 	if (cfg->icu_output_buf)
-		debug_print("Warning: ICU compressed data buffer is set. This buffer is not used for an RDCU compression.\n");
+		debug_print("Warning: ICU compressed data buffer is set. This buffer is not used for an RDCU compression.");
 
 	if (cfg->buffer_length == 0) {
-		debug_print("Error: The buffer_length is set to 0. There is no place to store the compressed data.\n");
+		debug_print("Error: The buffer_length is set to 0. There is no place to store the compressed data.");
 		cfg_invalid++;
 	}
 
diff --git a/lib/rdcu_compress/rdcu_ctrl.c b/lib/rdcu_compress/rdcu_ctrl.c
index 79a28d13539388132eb478befdf9cd669a7e4884..0c23b5bf7396386f886ff763ada7552f6b454bd7 100644
--- a/lib/rdcu_compress/rdcu_ctrl.c
+++ b/lib/rdcu_compress/rdcu_ctrl.c
@@ -57,12 +57,12 @@
  */
 
 
-#include <stdio.h>
 #include <stdlib.h>
 #include <stdint.h>
 #include <string.h>
 
 #include "../common/byteorder.h"
+#include "../common/cmp_debug.h"
 #include "rdcu_cmd.h"
 #include "rdcu_ctrl.h"
 #include "rdcu_rmap.h"
@@ -2440,7 +2440,7 @@ int rdcu_sync_sram_mirror_parallel(uint32_t rx_addr, uint32_t rx_size,
 
 	/* check buffer overlap */
 	if (rx_addr < tx_addr+tx_size && rx_addr+rx_size > tx_addr) {
-		printf("Error: The two parallel transferring buffers overlap. Read buffer: 0x%x size: %u. Write buffer: 0x%x size: %u.\n",
+		debug_print("Error: The two parallel transferring buffers overlap. Read buffer: 0x%x size: %u. Write buffer: 0x%x size: %u.",
 			rx_addr, rx_size, tx_addr, tx_size);
 		return -1;
 	}
@@ -2524,7 +2524,7 @@ int rdcu_ctrl_init(void)
 {
 	rdcu = (struct rdcu_mirror *) calloc(1, sizeof(struct rdcu_mirror));
 	if (!rdcu) {
-		printf("Error allocating memory for the RDCU mirror\n");
+		debug_print("Error allocating memory for the RDCU mirror");
 		return -1;
 	}
 
@@ -2534,7 +2534,7 @@ int rdcu_ctrl_init(void)
 
 	rdcu->sram = (uint8_t *) malloc(RDCU_SRAM_SIZE);
 	if (!rdcu->sram) {
-		printf("Error allocating memory for the RDCU SRAM mirror\n");
+		debug_print("Error allocating memory for the RDCU SRAM mirror");
 		return -1;
 	}
 #endif
diff --git a/lib/rdcu_compress/rdcu_rmap.c b/lib/rdcu_compress/rdcu_rmap.c
index 5eee776b5f1ccac88fe5db00374ac89e7148a5c9..7a740e8c205585a62be58ed05bd0960e89e6b217 100644
--- a/lib/rdcu_compress/rdcu_rmap.c
+++ b/lib/rdcu_compress/rdcu_rmap.c
@@ -62,11 +62,11 @@
  */
 
 
-#include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
 
 #include "../common/byteorder.h"
+#include "../common/cmp_debug.h"
 #include "rmap.h"
 #include "rdcu_rmap.h"
 
@@ -246,7 +246,7 @@ static int rdcu_process_rx(void)
 		/* we received something, allocate enough space for the packet */
 		spw_pckt = (uint8_t *) malloc(n);
 		if (!spw_pckt) {
-			printf("malloc() for packet failed!\n");
+			debug_print("malloc() for packet failed!");
 			return -1;
 		}
 
@@ -254,7 +254,7 @@ static int rdcu_process_rx(void)
 		n = rmap_rx(spw_pckt);
 
 		if (!n) {
-			printf("Unknown error in rmap_rx()\n");
+			debug_print("Unknown error in rmap_rx()");
 			free(spw_pckt);
 			return -1;
 		}
@@ -269,20 +269,20 @@ static int rdcu_process_rx(void)
 		free(spw_pckt);
 
 		if (!rp) {
-			printf("Error converting to RMAP packet\n");
+			debug_print("Error converting to RMAP packet");
 			continue;
 		}
 
 		local_addr = trans_log_get_addr(rp->tr_id);
 
 		if (!local_addr) {
-			printf("Warning: response packet received not in transaction log\n");
+			debug_print("Warning: response packet received not in transaction log");
 			rmap_erase_packet(rp);
 			continue;
 		}
 
 		if (rp->data_len & 0x3) {
-			printf("Error: response packet data size is not a multiple of 4, transaction dropped\n");
+			debug_print("Error: response packet data size is not a multiple of 4, transaction dropped");
 			trans_log_release_slot(rp->tr_id);
 			rmap_erase_packet(rp);
 			return -1;
@@ -306,7 +306,7 @@ static int rdcu_process_rx(void)
 
 			crc8 = rmap_crc8(rp->data, rp->data_len);
 			if (crc8 != rp->data_crc) {
-				printf("Error: data CRC8 mismatch, data invalid or packet truncated. Transaction dropped\n");
+				debug_print("Error: data CRC8 mismatch, data invalid or packet truncated. Transaction dropped");
 
 				trans_log_release_slot(rp->tr_id);
 				rmap_erase_packet(rp);
@@ -346,10 +346,10 @@ int rdcu_submit_tx(const uint8_t *cmd,  uint32_t cmd_size,
 		return -1;
 
 	if (RDCU_CONFIG_DEBUG)
-		printf("Transmitting RMAP command\n");
+		debug_print("Transmitting RMAP command");
 
 	if (rmap_tx(cmd, cmd_size, dpath_len, data, data_size)) {
-		printf("rmap_tx() returned error!\n");
+		debug_print("rmap_tx() returned error!");
 		return -1;
 	}
 
@@ -383,7 +383,7 @@ int rdcu_gen_cmd(uint16_t trans_id, uint8_t *cmd,
 
 	pkt = rmap_create_packet();
 	if (!pkt) {
-		printf("Error creating packet\n");
+		debug_print("Error creating packet");
 		return 0;
 	}
 
@@ -452,20 +452,20 @@ int rdcu_sync(int (*fn)(uint16_t trans_id, uint8_t *cmd),
 	/* determine size of command */
 	n = fn((uint16_t)slot, NULL);
 	if (n <= 0) {
-		printf("Error creating command packet\n");
+		debug_print("Error creating command packet");
 		return -1;
 	}
 
 	rmap_cmd = (uint8_t *)malloc((size_t)n);
 	if (!rmap_cmd) {
-		printf("Error allocating rmap cmd");
+		debug_print("Error allocating rmap cmd");
 		return -1;
 	}
 
 	/* now fill actual command */
 	n = fn((uint16_t)slot, rmap_cmd);
 	if (n <= 0) {
-		printf("Error creating command packet\n");
+		debug_print("Error creating command packet");
 		free(rmap_cmd);
 		return -1;
 	}
@@ -524,7 +524,7 @@ int rdcu_sync_data(int (*fn)(uint16_t trans_id, uint8_t *cmd,
 	slot = trans_log_grab_slot(data);
 	if (slot < 0 || slot > UINT16_MAX) {
 		if (RDCU_CONFIG_DEBUG)
-			printf("Error: all slots busy!\n");
+			debug_print("Error: all slots busy!");
 		return 1;
 	}
 
@@ -532,21 +532,21 @@ int rdcu_sync_data(int (*fn)(uint16_t trans_id, uint8_t *cmd,
 	/* determine size of command */
 	n = fn((uint16_t)slot, NULL, addr, data_len);
 	if (n <= 0) {
-		printf("Error creating command packet\n");
+		debug_print("Error creating command packet");
 		return -1;
 	}
 
 
 	rmap_cmd = (uint8_t *)malloc((size_t)n);
 	if (!rmap_cmd) {
-		printf("Error allocating rmap cmd");
+		debug_print("Error allocating rmap cmd");
 		return -1;
 	}
 
 	/* now fill actual command */
 	n = fn((uint16_t)slot, rmap_cmd, addr, data_len);
 	if (n <= 0) {
-		printf("Error creating command packet\n");
+		debug_print("Error creating command packet");
 		free(rmap_cmd);
 		return -1;
 	}
diff --git a/lib/rdcu_compress/rmap.c b/lib/rdcu_compress/rmap.c
index 9db4358a488bcd7a77c2997677a9b9ae3ecfc322..2361329552aabc07674e600a554e38ba6ad8b349 100644
--- a/lib/rdcu_compress/rmap.c
+++ b/lib/rdcu_compress/rmap.c
@@ -22,8 +22,8 @@
 
 #include <string.h>
 #include <stdlib.h>
-#include <stdio.h>
 
+#include "../common/cmp_debug.h"
 #include "../common/leon_inttypes.h"
 #include "rmap.h"
 
@@ -497,19 +497,19 @@ struct rmap_pkt *rmap_pkt_from_buffer(uint8_t *buf, uint32_t len)
 		goto error;
 
 	if (len < RMAP_HDR_MIN_SIZE_WRITE_REP) {
-		printf("buffer len is smaller than the smallest RMAP packet\n");
+		debug_print("buffer len is smaller than the smallest RMAP packet");
 		goto error;
 	}
 
 	if (buf[RMAP_PROTOCOL_ID] != RMAP_PROTOCOL_ID) {
-		printf("Not an RMAP packet, got %x but expected %x\n",
+		debug_print("Not an RMAP packet, got %x but expected %x",
 		       buf[RMAP_PROTOCOL_ID], RMAP_PROTOCOL_ID);
 		goto error;
 	}
 
 	pkt = rmap_create_packet();
 	if (!pkt) {
-		printf("Error creating packet\n");
+		debug_print("Error creating packet");
 		goto error;
 	}
 
@@ -523,7 +523,7 @@ struct rmap_pkt *rmap_pkt_from_buffer(uint8_t *buf, uint32_t len)
 		goto error;
 
 	if (len < (uint32_t)min_hdr_size) {
-		printf("buffer len is smaller than the contained RMAP packet\n");
+		debug_print("buffer len is smaller than the contained RMAP packet");
 		goto error;
 	}
 
@@ -531,7 +531,7 @@ struct rmap_pkt *rmap_pkt_from_buffer(uint8_t *buf, uint32_t len)
 	if (pkt->ri.cmd_resp) {
 		pkt->rpath_len = (pkt->ri.reply_addr_len << 2) & 0xFF;
 		if (len < (uint32_t)min_hdr_size + pkt->rpath_len) {
-			printf("buffer is smaller than the contained RMAP packet\n");
+			debug_print("buffer is smaller than the contained RMAP packet");
 			goto error;
 		}
 
@@ -571,12 +571,12 @@ struct rmap_pkt *rmap_pkt_from_buffer(uint8_t *buf, uint32_t len)
 		size_t pkt_size = RMAP_DATA_START + n + pkt->data_len + 1; /* +1 for data CRC */
 
 		if (len < pkt_size) {
-			printf("buffer len is smaller than the contained RMAP packet; buf len: %" PRIu32 " bytes vs RMAP: %zu bytes needed\n",
+			debug_print("buffer len is smaller than the contained RMAP packet; buf len: %" PRIu32 " bytes vs RMAP: %zu bytes needed",
 				len, pkt_size);
 			goto error;
 		}
 		if (len > pkt_size)
-			printf("warning: the buffer is larger than the included RMAP packet\n");
+			debug_print("warning: the buffer is larger than the included RMAP packet");
 
 		pkt->data = (uint8_t *)malloc(pkt->data_len);
 		if (!pkt->data)
@@ -609,56 +609,53 @@ error:
 __extension__
 static int rmap_check_status(uint8_t status)
 {
-	printf("\tStatus: ");
+	debug_print("Status: ");
 
 	switch (status) {
 	case RMAP_STATUS_SUCCESS:
-		printf("Command executed successfully");
+		debug_print("Command executed successfully");
 		break;
 	case RMAP_STATUS_GENERAL_ERROR:
-		printf("General error code");
+		debug_print("General error code");
 		break;
 	case RMAP_STATUS_UNUSED_TYPE_OR_CODE:
-		printf("Unused RMAP Packet Type or Command Code");
+		debug_print("Unused RMAP Packet Type or Command Code");
 		break;
 	case RMAP_STATUS_INVALID_KEY:
-		printf("Invalid key");
+		debug_print("Invalid key");
 		break;
 	case RMAP_STATUS_INVALID_DATA_CRC:
-		printf("Invalid Data CRC");
+		debug_print("Invalid Data CRC");
 		break;
 	case RMAP_STATUS_EARLY_EOP:
-		printf("Early EOP");
+		debug_print("Early EOP");
 		break;
 	case RMAP_STATUS_TOO_MUCH_DATA:
-		printf("Too much data");
+		debug_print("Too much data");
 		break;
 	case RMAP_STATUS_EEP:
-		printf("EEP");
+		debug_print("EEP");
 		break;
 	case RMAP_STATUS_RESERVED:
-		printf("Reserved");
+		debug_print("Reserved");
 		break;
 	case RMAP_STATUS_VERIFY_BUFFER_OVERRRUN:
-		printf("Verify buffer overrun");
+		debug_print("Verify buffer overrun");
 		break;
 	case RMAP_STATUS_CMD_NOT_IMPL_OR_AUTH:
-		printf("RMAP Command not implemented or not authorised");
+		debug_print("RMAP Command not implemented or not authorised");
 		break;
 	case RMAP_STATUS_RMW_DATA_LEN_ERROR:
-		printf("RMW Data Length error");
+		debug_print("RMW Data Length error");
 		break;
 	case RMAP_STATUS_INVALID_TARGET_LOGICAL_ADDR:
-		printf("Invalid Target Logical Address");
+		debug_print("Invalid Target Logical Address");
 		break;
 	default:
-		printf("Reserved unused error code %d", status);
+		debug_print("Reserved unused error code %d", status);
 		break;
 	}
 
-	printf("\n");
-
-
 	return status;
 }
 
@@ -676,16 +673,14 @@ static void rmap_process_read_reply(uint8_t *pkt)
 	len |= ((uint32_t)pkt[RMAP_DATALEN_BYTE2]) <<  0;
 
 #if defined(__sparc__)
-	printf("\tData length is %lu bytes:\n\t", len);
+	debug_print("Data length is %lu bytes:", len);
 #else
-	printf("\tData length is %u bytes:\n\t", len);
+	debug_print("Data length is %u bytes:", len);
 #endif
 
 
 	for (i = 0; i < len; i++)
-		printf("%02x:", pkt[RMAP_DATA_START + i]);
-
-	printf("\b\n");
+		debug_print("%02x:", pkt[RMAP_DATA_START + i]);
 }
 
 
@@ -694,7 +689,7 @@ static void rmap_process_read_reply(uint8_t *pkt)
 static void rmap_parse_cmd_pkt(uint8_t *pkt)
 {
 	(void)pkt;
-	printf("\trmap_parse_cmd_pkt() not implemented\n");
+	debug_print("rmap_parse_cmd_pkt() not implemented");
 }
 
 
@@ -705,29 +700,29 @@ static void rmap_parse_reply_pkt(uint8_t *pkt)
 
 	ri = (struct rmap_instruction *)&pkt[RMAP_INSTRUCTION];
 
-	printf("\tInstruction: ");
+	debug_print("Instruction: ");
 
 	switch (ri->cmd) {
 
 	case RMAP_READ_ADDR_SINGLE:
-		printf("Read single address\n");
+		debug_print("Read single address");
 		rmap_process_read_reply(pkt);
 		break;
 	case RMAP_READ_ADDR_INC:
-		printf("Read incrementing address\n");
+		debug_print("Read incrementing address");
 		rmap_process_read_reply(pkt);
 		break;
 	case RMAP_READ_MODIFY_WRITE_ADDR_INC:
-		printf("RMW incrementing address verify reply\n");
+		debug_print("RMW incrementing address verify reply");
 		break;
 	case RMAP_WRITE_ADDR_INC_VERIFY_REPLY:
-		printf("Write incrementing address verify reply\n");
+		debug_print("Write incrementing address verify reply");
 		break;
 	case RMAP_WRITE_ADDR_INC_REPLY:
-		printf("Write incrementing address reply\n");
+		debug_print("Write incrementing address reply");
 		break;
 	default:
-		printf("decoding of instruction 0x%02X not implemented\n",
+		debug_print("decoding of instruction 0x%02X not implemented",
 		       ri->cmd);
 		break;
 	}
@@ -745,7 +740,7 @@ void rmap_parse_pkt(uint8_t *pkt)
 	struct rmap_instruction *ri;
 
 	if (pkt[RMAP_PROTOCOL_ID] != RMAP_PROTOCOL_ID) {
-		printf("\nNot an RMAP packet, got %x but expected %x\n",
+		debug_print("Not an RMAP packet, got %x but expected %x",
 		       pkt[RMAP_PROTOCOL_ID], RMAP_PROTOCOL_ID);
 		return;
 	}
@@ -754,11 +749,11 @@ void rmap_parse_pkt(uint8_t *pkt)
 	ri = (struct rmap_instruction *)&pkt[RMAP_INSTRUCTION];
 
 	if (ri->cmd_resp) {
-		printf("This is a command packet\n");
+		debug_print("This is a command packet");
 		if (!rmap_check_status(pkt[RMAP_REPLY_STATUS]))
 			rmap_parse_cmd_pkt(pkt);
 	} else {
-		printf("This is a reply packet\n");
+		debug_print("This is a reply packet");
 		if (!rmap_check_status(pkt[RMAP_REPLY_STATUS]))
 			rmap_parse_reply_pkt(pkt);
 	}