aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavide Grohmann <davide.grohmann@arm.com>2021-08-11 13:23:09 +0200
committerDavide Grohmann <davide.grohmann@arm.com>2021-08-16 09:23:50 +0200
commitfa479e4e206dd30714448873e9c931699441c282 (patch)
treee6854379be71d54152df769aef889d6caaacf000
parent1a57eb9d35b90c35a144bc8a6af02bf9ab24e408 (diff)
downloadethos-u-core-software-fa479e4e206dd30714448873e9c931699441c282.tar.gz
Fix wrong output data json format when compiling with GCC21.08-rc1
This change works around an issue when compiling with GCC where by printing only a '\n' the produced global output is wrong. What happens is that new lines are actually printed before the content in the precedent fprintf calls. Hence the generated json is unparsable. Note also that replacing the LOG macros with direct calls to fprintf does _not_ solve the issue. Change-Id: I2d97703cbe7703aae94def1943e2ac693945ab31
-rw-r--r--applications/inference_process/src/inference_process.cpp11
1 files changed, 8 insertions, 3 deletions
diff --git a/applications/inference_process/src/inference_process.cpp b/applications/inference_process/src/inference_process.cpp
index 7058f9c..c26bb13 100644
--- a/applications/inference_process/src/inference_process.cpp
+++ b/applications/inference_process/src/inference_process.cpp
@@ -55,10 +55,15 @@ void print_output_data(TfLiteTensor *output, size_t bytesToPrint) {
LOG("\"data_address\": \"%08" PRIx32 "\",\n", (uint32_t)output->data.data);
LOG("\"data\":\"");
for (int i = 0; i < numBytesToPrint - 1; ++i) {
- if (i % 16 == 0 && i != 0) {
- LOG("\n");
+ /*
+ * Workaround an issue when compiling with GCC where by
+ * printing only a '\n' the produced global output is wrong.
+ */
+ if (i % 15 == 0 && i != 0) {
+ LOG("0x%02x,\n", output->data.uint8[i]);
+ } else {
+ LOG("0x%02x,", output->data.uint8[i]);
}
- LOG("0x%02x,", output->data.uint8[i]);
}
LOG("0x%02x\"\n", output->data.uint8[numBytesToPrint - 1]);
LOG("}");