Skip to content
This repository has been archived by the owner on Dec 8, 2022. It is now read-only.

Commit

Permalink
Merge pull request #1617 from tgsong/fix/ota_cmake
Browse files Browse the repository at this point in the history
Let vendor choose which OTA backend to enable
  • Loading branch information
Tiangang Song authored Dec 14, 2019
2 parents 571462f + d8856af commit a192b58
Show file tree
Hide file tree
Showing 9 changed files with 62 additions and 16 deletions.
5 changes: 2 additions & 3 deletions libraries/c_sdk/standard/ble/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,9 @@ afr_module_sources(

afr_module_include_dirs(
${AFR_CURRENT_MODULE}
PUBLIC "${inc_dir}"
"$<${AFR_IS_TESTING}:${inc_dir}/private>"
PUBLIC
"${inc_dir}"
PRIVATE
"${inc_dir}/private"
"${test_dir}"
)

Expand Down
42 changes: 32 additions & 10 deletions libraries/freertos_plus/aws/ota/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,6 @@ afr_module_sources(
"${src_dir}/aws_iot_ota_interface.c"
"${src_dir}/aws_iot_ota_interface.h"
"${src_dir}/aws_iot_ota_pal.h"
"${src_dir}/mqtt/aws_iot_ota_cbor_internal.h"
"${src_dir}/mqtt/aws_iot_ota_cbor.c"
"${src_dir}/mqtt/aws_iot_ota_cbor.h"
"${src_dir}/mqtt/aws_iot_ota_mqtt.c"
"${src_dir}/mqtt/aws_iot_ota_mqtt.h"
"${src_dir}/http/aws_iot_ota_http.c"
"${src_dir}/http/aws_iot_ota_http.h"
)

afr_module_include_dirs(
Expand All @@ -45,9 +38,6 @@ afr_module_dependencies(
AFR::common
PRIVATE
AFR::${AFR_CURRENT_MODULE}::mcu_port
AFR::mqtt
AFR::https
3rdparty::tinycbor
3rdparty::jsmn
)

Expand All @@ -69,6 +59,38 @@ if(AFR_IS_TESTING)
)
endif()

# Link to this INTERFACE target to enable the MQTT backend.
afr_module(NAME ota_mqtt INTERFACE)
afr_module_sources(
${AFR_CURRENT_MODULE}
INTERFACE
"${src_dir}/mqtt/aws_iot_ota_cbor_internal.h"
"${src_dir}/mqtt/aws_iot_ota_cbor.c"
"${src_dir}/mqtt/aws_iot_ota_cbor.h"
"${src_dir}/mqtt/aws_iot_ota_mqtt.c"
"${src_dir}/mqtt/aws_iot_ota_mqtt.h"
)
afr_module_dependencies(
${AFR_CURRENT_MODULE}
INTERFACE
AFR::mqtt
3rdparty::tinycbor
)

# Link to this INTERFACE target to enable the HTTP backend.
afr_module(NAME ota_http INTERFACE)
afr_module_sources(
${AFR_CURRENT_MODULE}
INTERFACE
"${src_dir}/http/aws_iot_ota_http.c"
"${src_dir}/http/aws_iot_ota_http.h"
)
afr_module_dependencies(
${AFR_CURRENT_MODULE}
INTERFACE
AFR::https
)

# OTA test
afr_test_module()
afr_module_sources(
Expand Down
2 changes: 2 additions & 0 deletions vendors/espressif/boards/esp32/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -286,6 +286,8 @@ target_link_libraries(
INTERFACE
AFR::crypto
AFR::pkcs11
AFR::ota_mqtt
AFR::ota_http
)

# -------------------------------------------------------------------------------------------------
Expand Down
5 changes: 4 additions & 1 deletion vendors/microchip/boards/curiosity_pic32mzef/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,10 @@ target_sources(
)
target_link_libraries(
AFR::ota::mcu_port
INTERFACE AFR::pkcs11
INTERFACE
AFR::pkcs11
AFR::ota_mqtt
AFR::ota_http
)

# -------------------------------------------------------------------------------------------------
Expand Down
5 changes: 4 additions & 1 deletion vendors/microchip/boards/ecc608a_plus_winsim/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,10 @@ target_sources(
)
target_link_libraries(
AFR::ota::mcu_port
INTERFACE AFR::crypto
INTERFACE
AFR::crypto
AFR::ota_mqtt
AFR::ota_http
)

# -------------------------------------------------------------------------------------------------
Expand Down
1 change: 1 addition & 0 deletions vendors/nordic/boards/nrf52840-dk/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -432,6 +432,7 @@ target_link_libraries(
AFR::ota::mcu_port
INTERFACE
AFR::crypto
AFR::ota_mqtt
)

# POSIX
Expand Down
5 changes: 4 additions & 1 deletion vendors/pc/boards/windows/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,10 @@ target_sources(
)
target_link_libraries(
AFR::ota::mcu_port
INTERFACE AFR::crypto
INTERFACE
AFR::crypto
AFR::ota_mqtt
AFR::ota_http
)

# -------------------------------------------------------------------------------------------------
Expand Down
6 changes: 6 additions & 0 deletions vendors/ti/boards/cc3220_launchpad/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,12 @@ target_sources(
AFR::ota::mcu_port
INTERFACE "${afr_ports_dir}/ota/aws_ota_pal.c"
)
target_link_libraries(
AFR::ota::mcu_port
INTERFACE
AFR::ota_mqtt
AFR::ota_http
)

# -------------------------------------------------------------------------------------------------
# Amazon FreeRTOS demos and tests
Expand Down
7 changes: 7 additions & 0 deletions vendors/vendor/boards/board/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,13 @@ afr_set_board_metadata(KEY_IMPORT_PROVISIONING "TRUE")
# AFR::ota::mcu_port
# INTERFACE "${portable_dir}/ota/aws_ota_pal.c"
# )
# Choose which backend to enable. Link to AFR::ota_mqtt to enable MQTT, link to AFR:ota_http to enable HTTP.
# target_link_libraries(
# AFR::ota::mcu_port
# INTERFACE
# AFR::ota_mqtt
# AFR::ota_http
)

# -------------------------------------------------------------------------------------------------
# Amazon FreeRTOS demos and tests
Expand Down

0 comments on commit a192b58

Please sign in to comment.