Skip to content

Commit 099340b

Browse files
plskeggsmbolivar-nordic
authored andcommitted
applications: asset_tracker_v2: integrate with P-GPS partition
When using P-GPS partition in flash, no need to refer to PM_MCUBOOT_SECONDARY_ADDRESS or SIZE. The P-GPS partition will be enabled if CONFIG_BUILD_S1_VARIANT is enabled in order to prevent BOOT FOTA conflicts. Disable CONFIG_SECURE_BOOT and CONFIG_BUILD_S1_VARIANT when building for the thingy91_nrf9160 board, as its statically- defined partitions do not have enough extra space for MCUboot FOTA. Fix A-GPS when combined with P-GPS to not request both ephemerides and almanac via A-GPS. Signed-off-by: Pete Skeggs <[email protected]>
1 parent a869025 commit 099340b

File tree

4 files changed

+19
-13
lines changed

4 files changed

+19
-13
lines changed

applications/asset_tracker_v2/boards/thingy91_nrf9160_ns.conf

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,3 +27,7 @@ CONFIG_BME680=y
2727
CONFIG_PWM=y
2828
CONFIG_LED_PWM=y
2929
CONFIG_CAF_LEDS_PWM=y
30+
31+
# Disable MCUboot DFU -- incompatible with static partitions
32+
CONFIG_SECURE_BOOT=n
33+
CONFIG_BUILD_S1_VARIANT=n

applications/asset_tracker_v2/prj.conf

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,8 @@ CONFIG_BOOTLOADER_MCUBOOT=y
7575
CONFIG_IMG_MANAGER=y
7676
CONFIG_MCUBOOT_IMG_MANAGER=y
7777
CONFIG_IMG_ERASE_PROGRESSIVELY=y
78+
CONFIG_SECURE_BOOT=y
79+
CONFIG_BUILD_S1_VARIANT=y
7880

7981
# Watchdog
8082
CONFIG_WATCHDOG_APPLICATION=y

applications/asset_tracker_v2/src/modules/cloud_module.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616
#endif
1717
#if defined(CONFIG_NRF_CLOUD_PGPS)
1818
#include <net/nrf_cloud_pgps.h>
19-
#include <pm_config.h>
2019
#endif
2120

2221
#include "cloud_wrapper.h"
@@ -906,8 +905,9 @@ static void on_all_states(struct cloud_msg_data *msg)
906905
if (IS_EVENT(msg, data, DATA_EVT_DATE_TIME_OBTAINED)) {
907906
struct nrf_cloud_pgps_init_param param = {
908907
.event_handler = pgps_handler,
909-
.storage_base = PM_MCUBOOT_SECONDARY_ADDRESS,
910-
.storage_size = PM_MCUBOOT_SECONDARY_SIZE
908+
/* storage is defined by CONFIG_NRF_CLOUD_PGPS_STORAGE */
909+
.storage_base = 0u,
910+
.storage_size = 0u
911911
};
912912

913913
int err = nrf_cloud_pgps_init(&param);

applications/asset_tracker_v2/src/modules/data_module.c

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515

1616
#if defined(CONFIG_NRF_CLOUD_PGPS)
1717
#include <net/nrf_cloud_pgps.h>
18-
#include <pm_config.h>
1918
#endif
2019

2120
#include "cloud/cloud_codec/cloud_codec.h"
@@ -695,8 +694,11 @@ static int agps_request_encode(struct nrf_modem_gnss_agps_data_frame *incoming_r
695694
}
696695

697696
if (incoming_request == NULL) {
698-
cloud_agps_request.request.sv_mask_ephe = 0xFFFFFFFF,
699-
cloud_agps_request.request.sv_mask_alm = 0xFFFFFFFF,
697+
const uint32_t mask = IS_ENABLED(CONFIG_NRF_CLOUD_PGPS) ? 0u : 0xFFFFFFFFu;
698+
699+
LOG_DBG("Requesting all A-GPS elements");
700+
cloud_agps_request.request.sv_mask_ephe = mask,
701+
cloud_agps_request.request.sv_mask_alm = mask,
700702
cloud_agps_request.request.data_flags =
701703
NRF_MODEM_GNSS_AGPS_GPS_UTC_REQUEST |
702704
NRF_MODEM_GNSS_AGPS_KLOBUCHAR_REQUEST |
@@ -996,13 +998,11 @@ static void agps_request_handle(struct nrf_modem_gnss_agps_data_frame *incoming_
996998
#if defined(CONFIG_NRF_CLOUD_AGPS)
997999
struct nrf_modem_gnss_agps_data_frame request;
9981000

999-
if (IS_ENABLED(CONFIG_NRF_CLOUD_PGPS) && incoming_request != NULL) {
1000-
request.sv_mask_ephe = 0;
1001-
request.sv_mask_alm = 0;
1002-
request.data_flags = incoming_request->data_flags;
1003-
} else if (incoming_request != NULL) {
1004-
request.sv_mask_ephe = incoming_request->sv_mask_ephe;
1005-
request.sv_mask_alm = incoming_request->sv_mask_alm;
1001+
if (incoming_request != NULL) {
1002+
request.sv_mask_ephe = IS_ENABLED(CONFIG_NRF_CLOUD_PGPS) ?
1003+
0u : incoming_request->sv_mask_ephe;
1004+
request.sv_mask_alm = IS_ENABLED(CONFIG_NRF_CLOUD_PGPS) ?
1005+
0u : incoming_request->sv_mask_alm;
10061006
request.data_flags = incoming_request->data_flags;
10071007
}
10081008

0 commit comments

Comments
 (0)