From 97906ebb4687efee3678f2cbaf01ce881573d849 Mon Sep 17 00:00:00 2001 From: Bhavik Patel Date: Thu, 17 Dec 2020 15:32:16 +0100 Subject: MLBEDSW-3728 Resolve compiler warnings Change-Id: I6245d4fa6cf32c9edb05f52bb07e1d7b6a1c17fe --- applications/inference_process/src/inference_process.cc | 4 ++-- applications/message_process/src/message_process.cc | 7 +++++-- cmsis.cmake | 2 ++ drivers/uart/src/uart_cmsdk_apb.c | 1 + rtos/freertos_config/CMakeLists.txt | 3 +++ 5 files changed, 13 insertions(+), 4 deletions(-) diff --git a/applications/inference_process/src/inference_process.cc b/applications/inference_process/src/inference_process.cc index f3d2da8..b5ed5c4 100644 --- a/applications/inference_process/src/inference_process.cc +++ b/applications/inference_process/src/inference_process.cc @@ -109,10 +109,10 @@ InferenceJob::InferenceJob(const string &_name, const vector &_expectedOutput, size_t _numBytesToPrint, const vector &_pmuEventConfig, - const uint32_t pmuCycleCounterEnable) : + const uint32_t _pmuCycleCounterEnable) : name(_name), networkModel(_networkModel), input(_input), output(_output), expectedOutput(_expectedOutput), - numBytesToPrint(_numBytesToPrint), pmuEventConfig(_pmuEventConfig), pmuCycleCounterEnable(pmuCycleCounterEnable), + numBytesToPrint(_numBytesToPrint), pmuEventConfig(_pmuEventConfig), pmuCycleCounterEnable(_pmuCycleCounterEnable), pmuEventCount(), pmuCycleCounterCount(0) { #if defined(INFERENCE_PROC_TFLU_PROFILER) && defined(ETHOSU) pmuEventCount = vector(ETHOSU_PMU_NCOUNTERS, 0); diff --git a/applications/message_process/src/message_process.cc b/applications/message_process/src/message_process.cc index 9c0fc84..13ed8c4 100644 --- a/applications/message_process/src/message_process.cc +++ b/applications/message_process/src/message_process.cc @@ -139,7 +139,8 @@ void QueueImpl::cleanHeader() const { void QueueImpl::cleanHeaderData() const { #if defined(__DCACHE_PRESENT) && (__DCACHE_PRESENT == 1U) SCB_CleanDCache_by_Addr(reinterpret_cast(&queue.header), sizeof(queue.header)); - SCB_CleanDCache_by_Addr(reinterpret_cast(queue.data), queue.header.size); + uintptr_t queueDataPtr = reinterpret_cast(&queue.data[0]); + SCB_CleanDCache_by_Addr(reinterpret_cast(queueDataPtr & ~3), queue.header.size + (queueDataPtr & 3)); #endif } @@ -152,7 +153,9 @@ void QueueImpl::invalidateHeader() const { void QueueImpl::invalidateHeaderData() const { #if defined(__DCACHE_PRESENT) && (__DCACHE_PRESENT == 1U) SCB_InvalidateDCache_by_Addr(reinterpret_cast(&queue.header), sizeof(queue.header)); - SCB_InvalidateDCache_by_Addr(reinterpret_cast(queue.data), queue.header.size); + uintptr_t queueDataPtr = reinterpret_cast(&queue.data[0]); + SCB_InvalidateDCache_by_Addr(reinterpret_cast(queueDataPtr & ~3), + queue.header.size + (queueDataPtr & 3)); #endif } diff --git a/cmsis.cmake b/cmsis.cmake index f383f96..4615c58 100644 --- a/cmsis.cmake +++ b/cmsis.cmake @@ -50,6 +50,8 @@ target_link_libraries(cmsis_device INTERFACE cmsis_core) add_library(cmsis_startup STATIC ${CMSIS_PATH}/Device/ARM/${ARM_CPU}/Source/startup_${ARM_CPU}.c ${CMSIS_PATH}/Device/ARM/${ARM_CPU}/Source/system_${ARM_CPU}.c) +set_source_files_properties(${CMSIS_PATH}/Device/ARM/${ARM_CPU}/Source/startup_${ARM_CPU}.c PROPERTIES COMPILE_FLAGS + -Wno-redundant-decls) target_compile_definitions(cmsis_startup PRIVATE ${ARM_CPU}${ARM_FEATURES}) target_link_libraries(cmsis_startup PRIVATE cmsis_device) diff --git a/drivers/uart/src/uart_cmsdk_apb.c b/drivers/uart/src/uart_cmsdk_apb.c index 2639ef5..4cbc68c 100644 --- a/drivers/uart/src/uart_cmsdk_apb.c +++ b/drivers/uart/src/uart_cmsdk_apb.c @@ -122,6 +122,7 @@ unsigned int GetLine(char *lp, unsigned int len) { lp++; /* increment line pointer */ cnt++; /* and count */ c = LF; + /* fall through */ default: UartPutc(*lp = c); /* echo and store character */ fflush(stdout); diff --git a/rtos/freertos_config/CMakeLists.txt b/rtos/freertos_config/CMakeLists.txt index bd3fd3c..34fe132 100644 --- a/rtos/freertos_config/CMakeLists.txt +++ b/rtos/freertos_config/CMakeLists.txt @@ -43,6 +43,9 @@ set(FREERTOS_CONFIG_INCLUDE_DIR ${CMAKE_CURRENT_BINARY_DIR}) # FreeRTOS kernel library add_library(freertos_kernel STATIC) +target_compile_options(freertos_kernel PRIVATE + $<$:${TOOLCHAIN_CXX_OPTIONS}> "-Wno-redundant-decls") + # Set include directories target_include_directories(freertos_kernel PUBLIC ${FREERTOS_KERNEL_PATH}/include -- cgit v1.2.1