Skip to content

Commit ee2901e

Browse files
authored
Merge pull request #99 from ActoryOu/fixOtaDemo
Move OTA max data buffer number to project configurations.
2 parents 87cc57a + be24b76 commit ee2901e

File tree

6 files changed

+30
-29
lines changed

6 files changed

+30
-29
lines changed

.github/workflows/build.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,4 +56,4 @@ jobs:
5656
esp_idf_version: ${{ matrix.esp_idf_version }}
5757
target: ${{ matrix.esp_target }}
5858
path: './'
59-
command: python -m pip install --upgrade idf-component-manager || idf.py build
59+
command: python -m pip install --upgrade idf-component-manager && idf.py build

components/FreeRTOS-Libraries-Integration-Tests/CMakeLists.txt

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,6 @@ include(${CMAKE_CURRENT_LIST_DIR}/FreeRTOS-Libraries-Integration-Tests/src/trans
77
# This gives MQTT_TEST_SOURCES, and MQTT_TEST_INCLUDE_DIRS
88
include(${CMAKE_CURRENT_LIST_DIR}/FreeRTOS-Libraries-Integration-Tests/src/mqtt_test.cmake)
99

10-
# This gives OTA_PAL_TEST_SOURCES, and OTA_PAL_TEST_INCLUDE_DIRS
11-
include(${CMAKE_CURRENT_LIST_DIR}/FreeRTOS-Libraries-Integration-Tests/src/ota_pal_test.cmake)
12-
1310
# This gives PKCS11_TEST_SOURCES, and PKCS11_TEST_INCLUDE_DIRS
1411
include(${CMAKE_CURRENT_LIST_DIR}/FreeRTOS-Libraries-Integration-Tests/src/pkcs11_test.cmake)
1512

main/Kconfig.projbuild

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -44,14 +44,6 @@ menu "Featured FreeRTOS IoT Integration"
4444
bool "Transport Interface Test."
4545
default n
4646

47-
config GRI_OTA_PAL_TEST_ENABLED
48-
bool "OTA PAL Test."
49-
default n
50-
51-
config GRI_OTA_E2E_TEST_ENABLED
52-
bool "OTA end-to-end Test."
53-
default n
54-
5547
config GRI_CORE_PKCS11_TEST_ENABLED
5648
bool "CorePKCS#11 Test."
5749
default n
@@ -211,6 +203,10 @@ menu "Featured FreeRTOS IoT Integration"
211203
int "OTA demo task stack size."
212204
default 3072
213205

206+
config GRI_OTA_MAX_NUM_DATA_BUFFERS
207+
int "OTA buffer number."
208+
default 2
209+
214210
endmenu # OTA demo configurations
215211
endmenu # Qualification Test Configurations
216212

@@ -463,6 +459,10 @@ menu "Featured FreeRTOS IoT Integration"
463459
int "Application version build."
464460
default 0
465461

462+
config GRI_OTA_MAX_NUM_DATA_BUFFERS
463+
int "OTA buffer number."
464+
default 2
465+
466466
endmenu # OTA demo configurations
467467

468468
endmenu # Golden Reference Integration

main/demo_tasks/ota_over_mqtt_demo/ota_over_mqtt_demo.c

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,6 @@
167167
#define MAX_THING_NAME_SIZE 128U
168168

169169
#define MAX_JOB_ID_LENGTH ( 64U )
170-
#define MAX_NUM_OF_OTA_DATA_BUFFERS ( 2U )
171170

172171
/**
173172
* @brief Used to clear bits in a task's notification value.
@@ -229,7 +228,7 @@ static uint8_t currentFileId = 0;
229228
static uint32_t totalBytesReceived = 0;
230229
char globalJobId[ MAX_JOB_ID_LENGTH ] = { 0 };
231230

232-
static OtaDataEvent_t dataBuffers[ otaconfigMAX_NUM_OTA_DATA_BUFFERS ] = { 0 };
231+
static OtaDataEvent_t dataBuffers[ otademoconfigMAX_NUM_OTA_DATA_BUFFERS ] = { 0 };
233232
static OtaJobEventData_t jobDocBuffer = { 0 };
234233
static AfrOtaJobDocumentFields_t jobFields = { 0 };
235234
static uint8_t OtaImageSignatureDecoded[ OTA_MAX_SIGNATURE_SIZE ] = { 0 };
@@ -898,7 +897,7 @@ static uint16_t getFreeOTABuffers( void )
898897

899898
if( xSemaphoreTake( bufferSemaphore, portMAX_DELAY ) == pdTRUE )
900899
{
901-
for( ulIndex = 0; ulIndex < MAX_NUM_OF_OTA_DATA_BUFFERS; ulIndex++ )
900+
for( ulIndex = 0; ulIndex < otademoconfigMAX_NUM_OTA_DATA_BUFFERS; ulIndex++ )
902901
{
903902
if( dataBuffers[ ulIndex ].bufferUsed == false )
904903
{
@@ -940,7 +939,7 @@ static OtaDataEvent_t * getOtaDataEventBuffer( void )
940939

941940
if( xSemaphoreTake( bufferSemaphore, portMAX_DELAY ) == pdTRUE )
942941
{
943-
for( ulIndex = 0; ulIndex < MAX_NUM_OF_OTA_DATA_BUFFERS; ulIndex++ )
942+
for( ulIndex = 0; ulIndex < otademoconfigMAX_NUM_OTA_DATA_BUFFERS; ulIndex++ )
944943
{
945944
if( dataBuffers[ ulIndex ].bufferUsed == false )
946945
{

main/demo_tasks/ota_over_mqtt_demo/ota_over_mqtt_demo_config.h

Lines changed: 17 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -43,61 +43,66 @@
4343
/**
4444
* @brief The thing name of the device.
4545
*/
46-
#define otademoconfigCLIENT_IDENTIFIER ( CONFIG_GRI_THING_NAME )
46+
#define otademoconfigCLIENT_IDENTIFIER ( CONFIG_GRI_THING_NAME )
4747

4848
/**
4949
* @brief The maximum size of the file paths used in the demo.
5050
*/
51-
#define otademoconfigMAX_FILE_PATH_SIZE ( CONFIG_GRI_OTA_DEMO_MAX_FILE_PATH_SIZE )
51+
#define otademoconfigMAX_FILE_PATH_SIZE ( CONFIG_GRI_OTA_DEMO_MAX_FILE_PATH_SIZE )
5252

5353
/**
5454
* @brief The maximum size of the stream name required for downloading update file
5555
* from streaming service.
5656
*/
57-
#define otademoconfigMAX_STREAM_NAME_SIZE ( CONFIG_GRI_OTA_DEMO_MAX_STREAM_NAME_SIZE )
57+
#define otademoconfigMAX_STREAM_NAME_SIZE ( CONFIG_GRI_OTA_DEMO_MAX_STREAM_NAME_SIZE )
5858

5959
/**
6060
* @brief The delay used in the OTA demo task to periodically output the OTA
6161
* statistics like number of packets received, dropped, processed and queued per connection.
6262
*/
63-
#define otademoconfigTASK_DELAY_MS ( CONFIG_GRI_OTA_DEMO_TASK_DELAY_MS )
63+
#define otademoconfigTASK_DELAY_MS ( CONFIG_GRI_OTA_DEMO_TASK_DELAY_MS )
6464

6565
/**
6666
* @brief The maximum time for which OTA demo waits for an MQTT operation to be complete.
6767
* This involves receiving an acknowledgment for broker for SUBSCRIBE, UNSUBSCRIBE and non
6868
* QOS0 publishes.
6969
*/
70-
#define otademoconfigMQTT_TIMEOUT_MS ( CONFIG_GRI_OTA_DEMO_MQTT_TIMEOUT_MS )
70+
#define otademoconfigMQTT_TIMEOUT_MS ( CONFIG_GRI_OTA_DEMO_MQTT_TIMEOUT_MS )
7171

7272
/**
7373
* @brief The task priority of OTA agent task.
7474
*/
75-
#define otademoconfigAGENT_TASK_PRIORITY ( CONFIG_GRI_OTA_DEMO_AGENT_TASK_PRIORITY )
75+
#define otademoconfigAGENT_TASK_PRIORITY ( CONFIG_GRI_OTA_DEMO_AGENT_TASK_PRIORITY )
7676

7777
/**
7878
* @brief The stack size of OTA agent task.
7979
*/
80-
#define otademoconfigAGENT_TASK_STACK_SIZE ( CONFIG_GRI_OTA_DEMO_AGENT_TASK_STACK_SIZE )
80+
#define otademoconfigAGENT_TASK_STACK_SIZE ( CONFIG_GRI_OTA_DEMO_AGENT_TASK_STACK_SIZE )
8181

8282
/**
8383
* @brief The task priority of the OTA demo task.
8484
*/
85-
#define otademoconfigDEMO_TASK_PRIORITY ( CONFIG_GRI_OTA_DEMO_DEMO_TASK_PRIORITY )
85+
#define otademoconfigDEMO_TASK_PRIORITY ( CONFIG_GRI_OTA_DEMO_DEMO_TASK_PRIORITY )
8686

8787
/**
8888
* @brief The task stack size of the OTA demo task.
8989
*/
90-
#define otademoconfigDEMO_TASK_STACK_SIZE ( CONFIG_GRI_OTA_DEMO_DEMO_TASK_STACK_SIZE )
90+
#define otademoconfigDEMO_TASK_STACK_SIZE ( CONFIG_GRI_OTA_DEMO_DEMO_TASK_STACK_SIZE )
91+
92+
/**
93+
* @brief The number of OTA data buffer.
94+
*/
95+
#define otademoconfigMAX_NUM_OTA_DATA_BUFFERS ( CONFIG_GRI_OTA_MAX_NUM_DATA_BUFFERS )
9196

9297
/**
9398
* @brief The version for the firmware which is running. OTA agent uses this
9499
* version number to perform anti-rollback validation. The firmware version for the
95100
* download image should be higher than the current version, otherwise the new image is
96101
* rejected in self test phase.
97102
*/
98-
#define APP_VERSION_MAJOR ( CONFIG_GRI_OTA_DEMO_APP_VERSION_MAJOR )
99-
#define APP_VERSION_MINOR ( CONFIG_GRI_OTA_DEMO_APP_VERSION_MINOR )
100-
#define APP_VERSION_BUILD ( CONFIG_GRI_OTA_DEMO_APP_VERSION_BUILD )
103+
#define APP_VERSION_MAJOR ( CONFIG_GRI_OTA_DEMO_APP_VERSION_MAJOR )
104+
#define APP_VERSION_MINOR ( CONFIG_GRI_OTA_DEMO_APP_VERSION_MINOR )
105+
#define APP_VERSION_BUILD ( CONFIG_GRI_OTA_DEMO_APP_VERSION_BUILD )
101106

102107
/* *INDENT-OFF* */
103108
#ifdef __cplusplus

sdkconfig.defaults

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ CONFIG_LWIP_MAX_SOCKETS=8
4040
# AWS OTA
4141
CONFIG_LOG2_FILE_BLOCK_SIZE=12
4242
CONFIG_MAX_NUM_BLOCKS_REQUEST=8
43-
CONFIG_MAX_NUM_OTA_DATA_BUFFERS=8
43+
CONFIG_GRI_OTA_MAX_NUM_DATA_BUFFERS=2
4444
CONFIG_ALLOW_DOWNGRADE=0
4545
CONFIG_OTA_DATA_OVER_MQTT=y
4646
# CONFIG_OTA_DATA_OVER_HTTP is not set

0 commit comments

Comments
 (0)