Skip to content

Commit 89666d5

Browse files
urutvaAhmedIsmail02
authored andcommitted
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]>
1 parent 09fb523 commit 89666d5

File tree

2 files changed

+20
-19
lines changed

2 files changed

+20
-19
lines changed

applications/helpers/ota_orchestrator/src/ota_orchestrator.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1075,6 +1075,7 @@ STATIC void processOTAEvents()
10751075
case OtaPalNewImageBootFailed:
10761076
case OtaPalJobDocProcessingStateInvalid:
10771077
LogInfo( ( "No OTA job available. \n" ) );
1078+
vOtaNotActiveHook();
10781079
break;
10791080
}
10801081

@@ -1171,11 +1172,11 @@ STATIC void processOTAEvents()
11711172
if( activateImage() == true )
11721173
{
11731174
LogInfo( ( "Activated image.\n" ) );
1174-
nextEvent.eventId = OtaAgentEventActivateImage;
1175+
1176+
nextEvent.eventId = OtaAgentEventRequestJobDocument;
11751177
OtaSendEvent_FreeRTOS( &nextEvent );
11761178
}
11771179

1178-
otaAgentState = OtaAgentStateStopped;
11791180
break;
11801181

11811182

applications/helpers/ota_orchestrator/src/ota_os_freertos.c

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*
22
* Copyright Amazon.com, Inc. and its affiliates. All Rights Reserved.
3-
* Copyright 2024 Arm Limited and/or its affiliates
3+
* Copyright 2024-2025 Arm Limited and/or its affiliates
44
55
*
66
* SPDX-License-Identifier: MIT
@@ -67,14 +67,14 @@ OtaOsStatus_t OtaInitEvent_FreeRTOS()
6767
{
6868
otaOsStatus = OtaOsEventQueueCreateFailed;
6969

70-
LogInfo( ( "Failed to create OTA Event queue: "
71-
"xQueueCreateStatic returned error: "
72-
"OtaOsStatus_t=%d \n",
73-
( int ) otaOsStatus ) );
70+
LogError( ( "Failed to create OTA Event queue: "
71+
"xQueueCreateStatic returned error: "
72+
"OtaOsStatus_t=%d \n",
73+
( int ) otaOsStatus ) );
7474
}
7575
else
7676
{
77-
LogInfo( ( "OTA Event Queue created.\n" ) );
77+
LogDebug( ( "OTA Event Queue created.\n" ) );
7878
}
7979

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

9191
if( retVal == pdTRUE )
9292
{
93-
LogInfo( ( "OTA Event sent.\n" ) );
93+
LogDebug( ( "OTA Event sent.\n" ) );
9494
}
9595
else
9696
{
9797
otaOsStatus = OtaOsEventQueueSendFailed;
9898

99-
LogInfo( ( "Failed to send event to OTA Event Queue: "
100-
"xQueueSendToBack returned error: "
101-
"OtaOsStatus_t=%d \n",
102-
( int ) otaOsStatus ) );
99+
LogError( ( "Failed to send event to OTA Event Queue: "
100+
"xQueueSendToBack returned error: "
101+
"OtaOsStatus_t=%d \n",
102+
( int ) otaOsStatus ) );
103103
}
104104

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

115115
if( retVal == pdTRUE )
116116
{
117-
LogInfo( ( "OTA Event received \n" ) );
117+
LogDebug( ( "OTA Event received \n" ) );
118118
}
119119
else
120120
{
121121
otaOsStatus = OtaOsEventQueueReceiveFailed;
122122

123-
LogInfo( ( "Failed to receive event or timeout from OTA Event Queue: "
124-
"xQueueReceive returned error: "
125-
"OtaOsStatus_t=%d \n",
126-
( int ) otaOsStatus ) );
123+
LogDebug( ( "Failed to receive event or timeout from OTA Event Queue: "
124+
"xQueueReceive returned error: "
125+
"OtaOsStatus_t=%d \n",
126+
( int ) otaOsStatus ) );
127127
}
128128

129129
return otaOsStatus;
@@ -133,5 +133,5 @@ void OtaDeinitEvent_FreeRTOS()
133133
{
134134
vQueueDelete( otaEventQueue );
135135

136-
LogInfo( ( "OTA Event Queue Deleted. \n" ) );
136+
LogDebug( ( "OTA Event Queue Deleted. \n" ) );
137137
}

0 commit comments

Comments
 (0)