aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLedion Daja <ledion.daja@arm.com>2023-02-17 09:37:58 +0100
committerLedion Daja <ledion.daja@arm.com>2023-03-14 11:21:33 +0100
commitb0aacb484c2316b71909b3b7cb6968879e5bc8ca (patch)
treef8b78eb812023ef9d880fc6f404ff55af7cfc76c
parent00b8e7beb4fef59c5bef3bc963dfff5bd11718b6 (diff)
downloadethos-u-core-platform-b0aacb484c2316b71909b3b7cb6968879e5bc8ca.tar.gz
Fix SEI CERT coding standard warnings
Change-Id: I47fdf29a50440c82fd9ccf111a846bf87e8a9e29
-rw-r--r--applications/driver_unit_tests/command_stream.cpp4
-rw-r--r--applications/driver_unit_tests/conv.cpp6
-rw-r--r--applications/freertos/main.cpp2
-rw-r--r--applications/message_handler_openamp/inference_runner.cpp2
-rw-r--r--applications/threadx_demo/main.cpp46
-rw-r--r--drivers/mhu_v2/src/mhu_v2.cpp18
-rw-r--r--drivers/mpu/src/mpu.cpp4
7 files changed, 41 insertions, 41 deletions
diff --git a/applications/driver_unit_tests/command_stream.cpp b/applications/driver_unit_tests/command_stream.cpp
index 6ec8cba..d2e62ce 100644
--- a/applications/driver_unit_tests/command_stream.cpp
+++ b/applications/driver_unit_tests/command_stream.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2021-2022 Arm Limited. All rights reserved.
+ * SPDX-FileCopyrightText: Copyright 2021-2023 Arm Limited and/or its affiliates <open-source-office@arm.com>
*
* SPDX-License-Identifier: Apache-2.0
*
@@ -66,7 +66,7 @@ Pmu::Pmu(ethosu_driver *_drv, const PmuEvents &_config) : drv(_drv), config(_con
// Configure event types
for (size_t i = 0; i < config.size(); i++) {
ETHOSU_PMU_Set_EVTYPER(drv, i, config[i]);
- ETHOSU_PMU_CNTR_Enable(drv, 1 << i);
+ ETHOSU_PMU_CNTR_Enable(drv, 1u << i);
}
}
diff --git a/applications/driver_unit_tests/conv.cpp b/applications/driver_unit_tests/conv.cpp
index 9e3dcc9..4a29db8 100644
--- a/applications/driver_unit_tests/conv.cpp
+++ b/applications/driver_unit_tests/conv.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2021-2022 Arm Limited.
+ * SPDX-FileCopyrightText: Copyright 2021-2023 Arm Limited and/or its affiliates <open-source-office@arm.com>
*
* SPDX-License-Identifier: Apache-2.0
*
@@ -288,7 +288,7 @@ int main() {
// Expected output data
DataPointer expectedPointer(expected0, sizeof(expected0));
- printf("Running %d iterations using sync API...\n", repeat);
+ printf("Running %u iterations using sync API...\n", repeat);
// Clear PMU
cs.getPmu().clear();
@@ -312,7 +312,7 @@ int main() {
printf("\n");
// Test using the async API
- printf("Running %d iterations using async API...\n", repeat);
+ printf("Running %u iterations using async API...\n", repeat);
// Clear PMU
cs.getPmu().clear();
diff --git a/applications/freertos/main.cpp b/applications/freertos/main.cpp
index 712b9a4..6ba369b 100644
--- a/applications/freertos/main.cpp
+++ b/applications/freertos/main.cpp
@@ -263,7 +263,7 @@ void inferenceSenderTask(void *pvParameters) {
printf("Error: inferenceSenderTask failed in receive from Q.\n");
exit(1);
}
- printf("inferenceSenderTask: received response for job: %s, status = %u\n",
+ printf("inferenceSenderTask: received response for job: %s, status = %d\n",
pSendJob->name.c_str(),
pSendJob->status);
diff --git a/applications/message_handler_openamp/inference_runner.cpp b/applications/message_handler_openamp/inference_runner.cpp
index 2f9d8ec..00e95a9 100644
--- a/applications/message_handler_openamp/inference_runner.cpp
+++ b/applications/message_handler_openamp/inference_runner.cpp
@@ -148,7 +148,7 @@ void ethosu_inference_begin(ethosu_driver *drv, void *userArg) {
// Configure and enable events
for (int i = 0; i < numEvents; i++) {
ETHOSU_PMU_Set_EVTYPER(drv, i, static_cast<ethosu_pmu_event_type>(response->pmu_event_config[i]));
- ETHOSU_PMU_CNTR_Enable(drv, 1 << i);
+ ETHOSU_PMU_CNTR_Enable(drv, 1u << i);
}
// Enable cycle counter
diff --git a/applications/threadx_demo/main.cpp b/applications/threadx_demo/main.cpp
index 0eaa55e..1211c78 100644
--- a/applications/threadx_demo/main.cpp
+++ b/applications/threadx_demo/main.cpp
@@ -141,7 +141,7 @@ void *ethosu_mutex_create(void) {
mutex = new TX_MUTEX;
status = tx_mutex_create(mutex, nullptr, TX_NO_INHERIT);
if (status != TX_SUCCESS) {
- printf("mutex create failed, error - %d\n", status);
+ printf("mutex create failed, error - %u\n", status);
}
return (void *)mutex;
}
@@ -156,7 +156,7 @@ int ethosu_mutex_lock(void *mutex) {
status = tx_mutex_get(reinterpret_cast<TX_MUTEX *>(mutex), TX_WAIT_FOREVER);
if (status != TX_SUCCESS) {
- printf("mutex get failed, error - %d\n", status);
+ printf("mutex get failed, error - %u\n", status);
return -1;
}
return 0;
@@ -172,7 +172,7 @@ int ethosu_mutex_unlock(void *mutex) {
status = tx_mutex_put(reinterpret_cast<TX_MUTEX *>(mutex));
if (status != TX_SUCCESS) {
- printf("mutex put failed, error - %d\n", status);
+ printf("mutex put failed, error - %u\n", status);
return -1;
}
return 0;
@@ -186,7 +186,7 @@ void *ethosu_semaphore_create(void) {
status = tx_semaphore_create(semaphore, nullptr, 0);
if (status != TX_SUCCESS) {
- printf("Semaphore create failed, error - %d\n", status);
+ printf("Semaphore create failed, error - %u\n", status);
}
return (void *)semaphore;
@@ -198,7 +198,7 @@ int ethosu_semaphore_take(void *sem) {
status = tx_semaphore_get(reinterpret_cast<TX_SEMAPHORE *>(sem), TX_WAIT_FOREVER);
if (status != TX_SUCCESS) {
- printf("Semaphore get/take, error - %d\n", status);
+ printf("Semaphore get/take, error - %u\n", status);
return -1;
}
@@ -211,7 +211,7 @@ int ethosu_semaphore_give(void *sem) {
status = tx_semaphore_put(reinterpret_cast<TX_SEMAPHORE *>(sem));
if (status != TX_SUCCESS) {
- printf("Semaphore put/give, error - %d\n", status);
+ printf("Semaphore put/give, error - %u\n", status);
return -1;
}
@@ -235,7 +235,7 @@ void inferenceProcessThread(ULONG pvParameters) {
// Get the job details from the process queue
tx_status = tx_queue_receive(params.queueHandle, &xJob, TX_WAIT_FOREVER);
if (tx_status != TX_SUCCESS) {
- printf("process failed to receive from Queue, error - %d\n", tx_status);
+ printf("process failed to receive from Queue, error - %u\n", tx_status);
exit(1);
}
@@ -246,14 +246,14 @@ void inferenceProcessThread(ULONG pvParameters) {
// Send response for the job in the response queue
tx_status = tx_queue_send(xJob->responseQueue, &xJob, TX_WAIT_FOREVER);
if (tx_status != TX_SUCCESS) {
- printf("process inferenceProcessThread failed to send to Queue, error - %d\n", tx_status);
+ printf("process inferenceProcessThread failed to send to Queue, error - %u\n", tx_status);
exit(1);
}
}
tx_status = tx_thread_terminate(nullptr);
if (tx_status != TX_SUCCESS) {
- printf("process inferenceProcessThread failed to terminate thread, error - %d\n", tx_status);
+ printf("process inferenceProcessThread failed to terminate thread, error - %u\n", tx_status);
exit(1);
}
}
@@ -271,7 +271,7 @@ void inferenceSenderThread(ULONG pvParameters) {
/* Allocate memory for this inference sender thread responses queue */
status = tx_byte_allocate(&bytePool, reinterpret_cast<VOID **>(&senderQueuePtr), SENDER_QUEUE_SIZE, TX_NO_WAIT);
if (status != TX_SUCCESS) {
- printf("Sender thread failed to allocate bytes for Queue, error - %d\n", status);
+ printf("Sender thread failed to allocate bytes for Queue, error - %u\n", status);
exit(1);
}
@@ -280,7 +280,7 @@ void inferenceSenderThread(ULONG pvParameters) {
&senderQueue, senderQueueName, sizeof(xInferenceJob *) / sizeof(uint32_t), senderQueuePtr, SENDER_QUEUE_SIZE);
if (status != TX_SUCCESS) {
- printf("Sender thread failed to create Queue, error - %d\n", status);
+ printf("Sender thread failed to create Queue, error - %u\n", status);
exit(1);
}
@@ -298,7 +298,7 @@ void inferenceSenderThread(ULONG pvParameters) {
// queue job
status = tx_queue_send(inferenceProcessQueueLocal, &job, TX_WAIT_FOREVER);
if (status != TX_SUCCESS) {
- printf("Sender thread failed to send to Queue, error - %d\n", status);
+ printf("Sender thread failed to send to Queue, error - %u\n", status);
exit(1);
}
}
@@ -309,7 +309,7 @@ void inferenceSenderThread(ULONG pvParameters) {
status = tx_queue_receive(&senderQueue, &pSendJob, TX_WAIT_FOREVER);
if (status != TX_SUCCESS) {
- printf("Sender thread failed to receive from Queue, error - %d\n", status);
+ printf("Sender thread failed to receive from Queue, error - %u\n", status);
exit(1);
}
@@ -323,7 +323,7 @@ void inferenceSenderThread(ULONG pvParameters) {
/* delete the response queue */
status = tx_queue_delete(&senderQueue);
if (status != TX_SUCCESS) {
- printf("Sender thread failed to delete Queue, error - %d\n", status);
+ printf("Sender thread failed to delete Queue, error - %u\n", status);
exit(1);
}
@@ -352,14 +352,14 @@ void tx_application_define(void *first_unused_memory) {
/* Create a byte memory pool from which to allocate the threads stacks and queues. */
status = tx_byte_pool_create(&bytePool, bytePoolName, memoryArea, BYTE_POOL_SIZE);
if (status != TX_SUCCESS) {
- printf("Main failed to allocate pool of bytes, error - %d\n", status);
+ printf("Main failed to allocate pool of bytes, error - %u\n", status);
exit(1);
}
/* Allocate memory for the inference process queue */
status = tx_byte_allocate(&bytePool, reinterpret_cast<VOID **>(&processQueuePtr), PROCESS_QUEUE_SIZE, TX_NO_WAIT);
if (status != TX_SUCCESS) {
- printf("Main failed to allocate bytes for process queue, error - %d\n", status);
+ printf("Main failed to allocate bytes for process queue, error - %u\n", status);
exit(1);
}
@@ -369,7 +369,7 @@ void tx_application_define(void *first_unused_memory) {
processQueuePtr,
PROCESS_QUEUE_SIZE);
if (status != TX_SUCCESS) {
- printf("Main failed to create Queue, error - %d\n", status);
+ printf("Main failed to create Queue, error - %u\n", status);
exit(1);
}
@@ -380,7 +380,7 @@ void tx_application_define(void *first_unused_memory) {
status =
tx_byte_allocate(&bytePool, reinterpret_cast<VOID **>(&senderThreadPtr[n]), sizeof(TX_THREAD), TX_NO_WAIT);
if (status != TX_SUCCESS) {
- printf("Main failed to allocate bytes for sender tread, error - %d\n", status);
+ printf("Main failed to allocate bytes for sender tread, error - %u\n", status);
exit(1);
}
@@ -388,7 +388,7 @@ void tx_application_define(void *first_unused_memory) {
status = tx_byte_allocate(
&bytePool, reinterpret_cast<VOID **>(&senderThreadStackPtr[n]), SENDER_THREAD_STACK_SIZE, TX_NO_WAIT);
if (status != TX_SUCCESS) {
- printf("Main failed to allocate bytes for sender tread stack, error - %d\n", status);
+ printf("Main failed to allocate bytes for sender tread stack, error - %u\n", status);
exit(1);
}
@@ -406,7 +406,7 @@ void tx_application_define(void *first_unused_memory) {
TX_NO_TIME_SLICE,
TX_AUTO_START);
if (status != TX_SUCCESS) {
- printf("Main failed to create Thread, error - %d\n", status);
+ printf("Main failed to create Thread, error - %u\n", status);
exit(1);
}
}
@@ -418,7 +418,7 @@ void tx_application_define(void *first_unused_memory) {
status =
tx_byte_allocate(&bytePool, reinterpret_cast<VOID **>(&processThreadPtr[n]), sizeof(TX_THREAD), TX_NO_WAIT);
if (status != TX_SUCCESS) {
- printf("Main failed to allocate bytes for process tread, error - %d\n", status);
+ printf("Main failed to allocate bytes for process tread, error - %u\n", status);
exit(1);
}
@@ -426,7 +426,7 @@ void tx_application_define(void *first_unused_memory) {
status = tx_byte_allocate(
&bytePool, reinterpret_cast<VOID **>(&processThreadStackPtr[n]), PROCESS_THREAD_STACK_SIZE, TX_NO_WAIT);
if (status != TX_SUCCESS) {
- printf("Main failed to allocate bytes for process stack, error - %d\n", status);
+ printf("Main failed to allocate bytes for process stack, error - %u\n", status);
exit(1);
}
@@ -446,7 +446,7 @@ void tx_application_define(void *first_unused_memory) {
TX_NO_TIME_SLICE,
TX_AUTO_START);
if (status != TX_SUCCESS) {
- printf("Main failed to create thread, error - %d\n", status);
+ printf("Main failed to create thread, error - %u\n", status);
exit(1);
}
}
diff --git a/drivers/mhu_v2/src/mhu_v2.cpp b/drivers/mhu_v2/src/mhu_v2.cpp
index cdeb90b..1c2e2f6 100644
--- a/drivers/mhu_v2/src/mhu_v2.cpp
+++ b/drivers/mhu_v2/src/mhu_v2.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2020-2021 Arm Limited. All rights reserved.
+ * SPDX-FileCopyrightText: Copyright 2020-2021, 2023 Arm Limited and/or its affiliates <open-source-office@arm.com>
*
* SPDX-License-Identifier: Apache-2.0
*
@@ -112,9 +112,9 @@ void MHUv2::disableAccessRequest() {
void MHUv2::setCombinedClearInterrupt(bool enable) {
uint32_t val = txRead(MHUv2_SND_INT_EN_OFFS);
if (enable) {
- val |= (1 << 2);
+ val |= (1u << 2);
} else {
- val &= ~(1 << 2);
+ val &= ~(1u << 2);
}
txWrite(MHUv2_SND_INT_EN_OFFS, val);
}
@@ -126,9 +126,9 @@ void MHUv2::setCombinedClearInterrupt(bool enable) {
void MHUv2::setCombinedRecvInterrupt(bool enable) {
uint32_t val = rxRead(MHUv2_RCV_INT_EN_OFFS);
if (enable) {
- val |= (1 << 2);
+ val |= (1u << 2);
} else {
- val &= ~(1 << 2);
+ val &= ~(1u << 2);
}
rxWrite(MHUv2_SND_INT_EN_OFFS, val);
}
@@ -137,9 +137,9 @@ void MHUv2::setCombinedRecvInterrupt(bool enable) {
void MHUv2::setReadyNotReadyInterrupts(bool enable) {
uint32_t val = txRead(MHUv2_SND_INT_EN_OFFS);
if (enable) {
- val |= (1 << 0 | 1 << 1);
+ val |= (1u << 0 | 1u << 1);
} else {
- val &= ~(1 << 0 | 1 << 1);
+ val &= ~(1u << 0 | 1u << 1);
}
txWrite(MHUv2_SND_INT_EN_OFFS, val);
}
@@ -197,12 +197,12 @@ void MHUv2::printAIDR(bool tx, bool rx) {
if (tx) {
aidr = getTxAIDR();
a = reinterpret_cast<struct aidr_t *>(&aidr);
- LOG("TX MHUv2 reports: Major rev: %d, Minor rev: %d", a->ARCH_MAJOR_REV, a->ARCH_MINOR_REV);
+ LOG("TX MHUv2 reports: Major rev: %u, Minor rev: %u", a->ARCH_MAJOR_REV, a->ARCH_MINOR_REV);
}
if (rx) {
aidr = getRxAIDR();
a = reinterpret_cast<struct aidr_t *>(&aidr);
- LOG("RX MHUv2 reports: Major rev: %d, Minor rev: %d", a->ARCH_MAJOR_REV, a->ARCH_MINOR_REV);
+ LOG("RX MHUv2 reports: Major rev: %u, Minor rev: %u", a->ARCH_MAJOR_REV, a->ARCH_MINOR_REV);
}
}
diff --git a/drivers/mpu/src/mpu.cpp b/drivers/mpu/src/mpu.cpp
index bd5c6cd..3f9e62a 100644
--- a/drivers/mpu/src/mpu.cpp
+++ b/drivers/mpu/src/mpu.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2020-2022 Arm Limited. All rights reserved.
+ * SPDX-FileCopyrightText: Copyright 2020-2023 Arm Limited and/or its affiliates <open-source-office@arm.com>
*
* SPDX-License-Identifier: Apache-2.0
*
@@ -47,7 +47,7 @@ void dump() {
for (size_t region = 0; region < mpuRegions; region++) {
MPU->RNR = region;
- printf("-- Region %2d - RBAR:%08" PRIx32 " RLAR:%08" PRIx32 "\n", region, MPU->RBAR, MPU->RLAR);
+ printf("-- Region %2u - RBAR:%08" PRIx32 " RLAR:%08" PRIx32 "\n", region, MPU->RBAR, MPU->RLAR);
}
#endif
}