Skip to content

Commit

Permalink
Add OTA Orchestrator fixes (#107)
Browse files Browse the repository at this point in the history
* ota-orchestrator: Add multiple enhancements and fixes

* Do not suspend OTA agent after successful update.

* vOtaNotActiveHook() should be called whenever there
are no OTA jobs available.

* Use LogDebug and LogError instead of LogInfo to
follow the previous ota-for-embedded-iot-sdk library
implementation (avoiding new issues).

Signed-off-by: Devaraj Ranganna <[email protected]>
Signed-off-by: Ahmed Ismail <[email protected]>

* mqtt-agent: Increase MQTT Agent keep alive interval

The `MQTT_AGENT_KEEP_ALIVE_INTERVAL_SECONDS` is increased
to 100 as in case of using SOFTWARE inference with speech
recognition application the connection is dropped before
the ML Inference is done as the software inference is generally
much slower compared to the Ethos NPU. This connection drop
cause the ML inference to have wrong results as the task
is interrupted. Hence, increasing the keep alive interval
to avoid the connection drop.

Signed-off-by: Ahmed Ismail <[email protected]>

* github-upload-artifact: Upgrade the deprecated version

actions/upload-artifact v3 is now deprecated and cannot
be used anymore. Hence, updating to v4.

`strategy.job-index` is post-fixed to the artifact
name to overcome the known issue of upload-artifact v4
not allowing multiple artifacts with the same name on
the workflow run.

Signed-off-by: Ahmed Ismail <[email protected]>

---------

Signed-off-by: Devaraj Ranganna <[email protected]>
Signed-off-by: Ahmed Ismail <[email protected]>
Co-authored-by: Devaraj Ranganna <[email protected]>
  • Loading branch information
AhmedIsmail02 and urutva authored Feb 2, 2025
1 parent 09fb523 commit 2c16a18
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 24 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright (c) 2023-2024 Arm Limited and/or its affiliates
# Copyright (c) 2023-2025 Arm Limited and/or its affiliates
# <[email protected]>
# SPDX-License-Identifier: MIT

Expand Down Expand Up @@ -85,9 +85,9 @@ jobs:
build/${{ matrix.application }}-update_signed.bin \
build/update-signature.txt
- name: Upload Build Artifacts
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: FRI-build-logs
name: FRI-build-logs-${{ strategy.job-index }}
path: |
${{ github.workspace }}/${{ matrix.application }}_gnu_build.tar.gz
retention-days: 5
5 changes: 3 additions & 2 deletions applications/helpers/ota_orchestrator/src/ota_orchestrator.c
Original file line number Diff line number Diff line change
Expand Up @@ -1075,6 +1075,7 @@ STATIC void processOTAEvents()
case OtaPalNewImageBootFailed:
case OtaPalJobDocProcessingStateInvalid:
LogInfo( ( "No OTA job available. \n" ) );
vOtaNotActiveHook();
break;
}

Expand Down Expand Up @@ -1171,11 +1172,11 @@ STATIC void processOTAEvents()
if( activateImage() == true )
{
LogInfo( ( "Activated image.\n" ) );
nextEvent.eventId = OtaAgentEventActivateImage;

nextEvent.eventId = OtaAgentEventRequestJobDocument;
OtaSendEvent_FreeRTOS( &nextEvent );
}

otaAgentState = OtaAgentStateStopped;
break;


Expand Down
34 changes: 17 additions & 17 deletions applications/helpers/ota_orchestrator/src/ota_os_freertos.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* Copyright Amazon.com, Inc. and its affiliates. All Rights Reserved.
* Copyright 2024 Arm Limited and/or its affiliates
* Copyright 2024-2025 Arm Limited and/or its affiliates
* <[email protected]>
*
* SPDX-License-Identifier: MIT
Expand Down Expand Up @@ -67,14 +67,14 @@ OtaOsStatus_t OtaInitEvent_FreeRTOS()
{
otaOsStatus = OtaOsEventQueueCreateFailed;

LogInfo( ( "Failed to create OTA Event queue: "
"xQueueCreateStatic returned error: "
"OtaOsStatus_t=%d \n",
( int ) otaOsStatus ) );
LogError( ( "Failed to create OTA Event queue: "
"xQueueCreateStatic returned error: "
"OtaOsStatus_t=%d \n",
( int ) otaOsStatus ) );
}
else
{
LogInfo( ( "OTA Event Queue created.\n" ) );
LogDebug( ( "OTA Event Queue created.\n" ) );
}

return otaOsStatus;
Expand All @@ -90,16 +90,16 @@ OtaOsStatus_t OtaSendEvent_FreeRTOS( const void * pEventMsg )

if( retVal == pdTRUE )
{
LogInfo( ( "OTA Event sent.\n" ) );
LogDebug( ( "OTA Event sent.\n" ) );
}
else
{
otaOsStatus = OtaOsEventQueueSendFailed;

LogInfo( ( "Failed to send event to OTA Event Queue: "
"xQueueSendToBack returned error: "
"OtaOsStatus_t=%d \n",
( int ) otaOsStatus ) );
LogError( ( "Failed to send event to OTA Event Queue: "
"xQueueSendToBack returned error: "
"OtaOsStatus_t=%d \n",
( int ) otaOsStatus ) );
}

return otaOsStatus;
Expand All @@ -114,16 +114,16 @@ OtaOsStatus_t OtaReceiveEvent_FreeRTOS( void * pEventMsg )

if( retVal == pdTRUE )
{
LogInfo( ( "OTA Event received \n" ) );
LogDebug( ( "OTA Event received \n" ) );
}
else
{
otaOsStatus = OtaOsEventQueueReceiveFailed;

LogInfo( ( "Failed to receive event or timeout from OTA Event Queue: "
"xQueueReceive returned error: "
"OtaOsStatus_t=%d \n",
( int ) otaOsStatus ) );
LogDebug( ( "Failed to receive event or timeout from OTA Event Queue: "
"xQueueReceive returned error: "
"OtaOsStatus_t=%d \n",
( int ) otaOsStatus ) );
}

return otaOsStatus;
Expand All @@ -133,5 +133,5 @@ void OtaDeinitEvent_FreeRTOS()
{
vQueueDelete( otaEventQueue );

LogInfo( ( "OTA Event Queue Deleted. \n" ) );
LogDebug( ( "OTA Event Queue Deleted. \n" ) );
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
* FreeRTOS V202012.00
* Copyright (C) 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved.
* Copyright 2023-2024 Arm Limited and/or its affiliates
* Copyright 2023-2025 Arm Limited and/or its affiliates
* <[email protected]>
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of
Expand Down Expand Up @@ -141,7 +141,7 @@
* absence of sending any other Control Packets, the Client MUST send a
* PINGREQ Packet.
*/
#define MQTT_AGENT_KEEP_ALIVE_INTERVAL_SECONDS ( 60U )
#define MQTT_AGENT_KEEP_ALIVE_INTERVAL_SECONDS ( 100U )

/**
* @brief Socket send and receive timeouts to use. Specified in milliseconds.
Expand Down
2 changes: 2 additions & 0 deletions release_changes/202501301446.change.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
ota-orchestrator: Add multiple enhancements and fixes.
mqtt-agent: Increase MQTT Agent keep alive interval.

0 comments on commit 2c16a18

Please sign in to comment.