Skip to content

Commit 3b112f7

Browse files
MarkusLassilaanangl
authored andcommitted
applications: serial_lte_modem: Fix SLM in upmerge.
- Change posix names to zsock. - Remove CONFIG_x_NRF_HW_ASYNC usage. - Correct size for the external flash. Signed-off-by: Markus Lassila <[email protected]>
1 parent 1ebdd6c commit 3b112f7

20 files changed

+361
-393
lines changed

applications/serial_lte_modem/boards/nrf9131ek_nrf9131_ns.conf

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,5 @@
88
# This file is merged with prj.conf in the application folder, and options
99
# set here will take precedence if they are present in both files.
1010

11-
CONFIG_UART_0_NRF_HW_ASYNC_TIMER=2
12-
CONFIG_UART_0_NRF_HW_ASYNC=y
1311
CONFIG_SLM_POWER_PIN=28
1412
CONFIG_SLM_INDICATE_PIN=0

applications/serial_lte_modem/boards/nrf9151dk_nrf9151_ns.conf

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,16 +8,10 @@
88
# This file is merged with prj.conf in the application folder, and options
99
# set here will take precedence if they are present in both files.
1010

11-
# Use UART_0 (when working with PC terminal)
12-
# unmask the following config
13-
CONFIG_UART_0_NRF_HW_ASYNC_TIMER=2
14-
CONFIG_UART_0_NRF_HW_ASYNC=y
11+
# When working with PC terminal, unmask the following config.
1512
CONFIG_SLM_POWER_PIN=8
1613
CONFIG_SLM_INDICATE_PIN=0
1714

18-
# Use UART_2 (when working with external MCU)
19-
# unmask the following config
20-
#CONFIG_UART_2_NRF_HW_ASYNC_TIMER=2
21-
#CONFIG_UART_2_NRF_HW_ASYNC=y
15+
# When working with external MCU, unmask the following config.
2216
#CONFIG_SLM_POWER_PIN=31
2317
#CONFIG_SLM_INDICATE_PIN=30

applications/serial_lte_modem/boards/nrf9160dk_nrf9160_ns.conf

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,16 +8,10 @@
88
# This file is merged with prj.conf in the application folder, and options
99
# set here will take precedence if they are present in both files.
1010

11-
# Use UART_0 (when working with PC terminal)
12-
# unmask the following config
13-
CONFIG_UART_0_NRF_HW_ASYNC_TIMER=2
14-
CONFIG_UART_0_NRF_HW_ASYNC=y
11+
# When working with PC terminal, unmask the following config.
1512
CONFIG_SLM_POWER_PIN=6
1613
CONFIG_SLM_INDICATE_PIN=2
1714

18-
# Use UART_2 (when working with external MCU)
19-
# unmask the following config
20-
#CONFIG_UART_2_NRF_HW_ASYNC_TIMER=2
21-
#CONFIG_UART_2_NRF_HW_ASYNC=y
15+
# When working with external MCU, unmask the following config.
2216
#CONFIG_SLM_POWER_PIN=31
2317
#CONFIG_SLM_INDICATE_PIN=30

applications/serial_lte_modem/boards/nrf9161dk_nrf9161_ns.conf

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,16 +8,10 @@
88
# This file is merged with prj.conf in the application folder, and options
99
# set here will take precedence if they are present in both files.
1010

11-
# Use UART_0 (when working with PC terminal)
12-
# unmask the following config
13-
CONFIG_UART_0_NRF_HW_ASYNC_TIMER=2
14-
CONFIG_UART_0_NRF_HW_ASYNC=y
11+
# When working with PC terminal, unmask the following config.
1512
CONFIG_SLM_POWER_PIN=8
1613
CONFIG_SLM_INDICATE_PIN=0
1714

18-
# Use UART_2 (when working with external MCU)
19-
# unmask the following config
20-
#CONFIG_UART_2_NRF_HW_ASYNC_TIMER=2
21-
#CONFIG_UART_2_NRF_HW_ASYNC=y
15+
# When working with external MCU, unmask the following config.
2216
#CONFIG_SLM_POWER_PIN=31
2317
#CONFIG_SLM_INDICATE_PIN=30

applications/serial_lte_modem/boards/thingy91_nrf9160_ns.conf

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,6 @@
99
# set here will take precedence if they are present in both files.
1010

1111
# Configuration related to external sensors.
12-
CONFIG_UART_0_NRF_HW_ASYNC_TIMER=2
13-
CONFIG_UART_0_NRF_HW_ASYNC=y
1412
CONFIG_SLM_POWER_PIN=26
1513

1614
# Increase buffer space as hardware flow control is not used with Thingy:91.

applications/serial_lte_modem/boards/thingy91x_nrf9151_ns.conf

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,6 @@
99
# set here will take precedence if they are present in both files.
1010

1111
# Configuration related to external sensors.
12-
CONFIG_UART_0_NRF_HW_ASYNC_TIMER=2
13-
CONFIG_UART_0_NRF_HW_ASYNC=y
1412
CONFIG_SLM_POWER_PIN=26
1513

1614
# Increase buffer space as hardware flow control is not necessarily used with Thingy:91 X.

applications/serial_lte_modem/doc/SOCKET_AT_commands.rst

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1235,7 +1235,8 @@ Response syntax
12351235

12361236
* The ``<error>`` value is an error code when the poll fails.
12371237
* The ``<handle>`` value is an integer. It is the handle of a socket that have events returned, so-called ``revents``.
1238-
* The ``<revents>`` value is a hexadecimal string. It represents the returned events, which could be a combination of POLLIN, POLLERR, POLLHUP and POLLNVAL.
1238+
* The ``<revents>`` value is a hexadecimal string.
1239+
It represents the returned events, which could be a combination of ``ZSOCK_POLLIN``, ``ZSOCK_POLLERR``, ``ZSOCK_POLLHUP`` and ``ZSOCK_POLLNVAL``.
12391240

12401241
Examples
12411242
~~~~~~~~

applications/serial_lte_modem/doc/slm_description.rst

Lines changed: 6 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -452,17 +452,10 @@ To connect with an external MCU using UART_2, change the configuration files for
452452

453453
* In the :file:`nrf9151dk_nrf9151_ns.conf` file::
454454

455-
# Use UART_0 (when working with PC terminal)
456-
# unmask the following config
457-
#CONFIG_UART_0_NRF_HW_ASYNC_TIMER=2
458-
#CONFIG_UART_0_NRF_HW_ASYNC=y
459-
#CONFIG_SLM_POWER_PIN=8
455+
# When working with PC terminal, unmask the following config.
460456
#CONFIG_SLM_INDICATE_PIN=0
461457

462-
# Use UART_2 (when working with external MCU)
463-
# unmask the following config
464-
CONFIG_UART_2_NRF_HW_ASYNC_TIMER=2
465-
CONFIG_UART_2_NRF_HW_ASYNC=y
458+
# When working with external MCU, unmask the following config.
466459
CONFIG_SLM_POWER_PIN=31
467460
CONFIG_SLM_INDICATE_PIN=30
468461

@@ -493,17 +486,11 @@ To connect with an external MCU using UART_2, change the configuration files for
493486

494487
* In the :file:`nrf9161dk_nrf9161_ns.conf` file::
495488

496-
# Use UART_0 (when working with PC terminal)
497-
# unmask the following config
498-
#CONFIG_UART_0_NRF_HW_ASYNC_TIMER=2
499-
#CONFIG_UART_0_NRF_HW_ASYNC=y
489+
# When working with PC terminal, unmask the following config.
500490
#CONFIG_SLM_POWER_PIN=8
501491
#CONFIG_SLM_INDICATE_PIN=0
502492

503-
# Use UART_2 (when working with external MCU)
504-
# unmask the following config
505-
CONFIG_UART_2_NRF_HW_ASYNC_TIMER=2
506-
CONFIG_UART_2_NRF_HW_ASYNC=y
493+
# When working with external MCU, unmask the following config.
507494
CONFIG_SLM_POWER_PIN=31
508495
CONFIG_SLM_INDICATE_PIN=30
509496

@@ -535,17 +522,11 @@ To connect with an external MCU using UART_2, change the configuration files for
535522

536523
* In the :file:`nrf9160dk_nrf9160_ns.conf` file::
537524

538-
# Use UART_0 (when working with PC terminal)
539-
# unmask the following config
540-
#CONFIG_UART_0_NRF_HW_ASYNC_TIMER=2
541-
#CONFIG_UART_0_NRF_HW_ASYNC=y
525+
# When working with PC terminal, unmask the following config.
542526
#CONFIG_SLM_POWER_PIN=6
543527
#CONFIG_SLM_INDICATE_PIN=2
544528

545-
# Use UART_2 (when working with external MCU)
546-
# unmask the following config
547-
CONFIG_UART_2_NRF_HW_ASYNC_TIMER=2
548-
CONFIG_UART_2_NRF_HW_ASYNC=y
529+
# When working with external MCU, unmask the following config.
549530
CONFIG_SLM_POWER_PIN=31
550531
CONFIG_SLM_INDICATE_PIN=30
551532

applications/serial_lte_modem/overlay-full_fota.conf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ CONFIG_MBEDTLS_LEGACY_CRYPTO_C=y
1818
CONFIG_MBEDTLS_SHA256_C=y
1919
CONFIG_FMFU_FDEV=y
2020
CONFIG_ZCBOR=y
21+
CONFIG_STREAM_FLASH_INSPECT=n
2122

2223
# Enable full FOTA support
2324
CONFIG_SLM_FULL_FOTA=y

applications/serial_lte_modem/src/http_c/slm_at_httpc.c

Lines changed: 26 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ static int headers_cb(int sock, struct http_request *req, void *user_data)
130130

131131
len = strlen(httpc.headers);
132132
while (offset < len) {
133-
ret = send(sock, httpc.headers + offset, len - offset, 0);
133+
ret = zsock_send(sock, httpc.headers + offset, len - offset, 0);
134134
if (ret < 0) {
135135
LOG_ERR("send header fail: %d", -errno);
136136
return -errno;
@@ -153,7 +153,7 @@ int do_send_payload(const uint8_t *data, int len)
153153

154154
/* Start to send payload */
155155
while (offset < len) {
156-
ret = send(httpc.fd, data + offset, len - offset, 0);
156+
ret = zsock_send(httpc.fd, data + offset, len - offset, 0);
157157
if (ret < 0) {
158158
LOG_ERR("Fail to send payload: %d, sent: %d", ret, offset);
159159
httpc.total_sent = -errno;
@@ -223,12 +223,12 @@ static int do_http_connect(void)
223223

224224
/* Open socket */
225225
if (httpc.sec_tag == INVALID_SEC_TAG) {
226-
ret = socket(httpc.family, SOCK_STREAM, IPPROTO_TCP);
226+
ret = zsock_socket(httpc.family, SOCK_STREAM, IPPROTO_TCP);
227227
} else {
228-
ret = socket(httpc.family, SOCK_STREAM, IPPROTO_TLS_1_2);
228+
ret = zsock_socket(httpc.family, SOCK_STREAM, IPPROTO_TLS_1_2);
229229
}
230230
if (ret < 0) {
231-
LOG_ERR("socket() failed: %d", -errno);
231+
LOG_ERR("zsock_socket() failed: %d", -errno);
232232
return ret;
233233
}
234234
httpc.fd = ret;
@@ -244,62 +244,63 @@ static int do_http_connect(void)
244244
int tls_native = 1;
245245

246246
/* Must be the first socket option to set. */
247-
ret = setsockopt(httpc.fd, SOL_TLS, TLS_NATIVE, &tls_native, sizeof(tls_native));
247+
ret = zsock_setsockopt(httpc.fd, SOL_TLS, TLS_NATIVE, &tls_native,
248+
sizeof(tls_native));
248249
if (ret) {
249250
ret = errno;
250251
goto exit_cli;
251252
}
252253
#endif
253254
sec_tag_t sec_tag_list[] = { httpc.sec_tag };
254255

255-
ret = setsockopt(httpc.fd, SOL_TLS, TLS_SEC_TAG_LIST, sec_tag_list,
256+
ret = zsock_setsockopt(httpc.fd, SOL_TLS, TLS_SEC_TAG_LIST, sec_tag_list,
256257
sizeof(sec_tag_t));
257258
if (ret) {
258-
LOG_ERR("setsockopt(TLS_SEC_TAG_LIST) error: %d", -errno);
259+
LOG_ERR("zsock_setsockopt(TLS_SEC_TAG_LIST) error: %d", -errno);
259260
ret = -errno;
260261
goto exit_cli;
261262
}
262-
ret = setsockopt(httpc.fd, SOL_TLS, TLS_PEER_VERIFY, &httpc.peer_verify,
263+
ret = zsock_setsockopt(httpc.fd, SOL_TLS, TLS_PEER_VERIFY, &httpc.peer_verify,
263264
sizeof(httpc.peer_verify));
264265
if (ret) {
265-
LOG_ERR("setsockopt(TLS_PEER_VERIFY) error: %d", -errno);
266+
LOG_ERR("zsock_setsockopt(TLS_PEER_VERIFY) error: %d", -errno);
266267
ret = -errno;
267268
goto exit_cli;
268269
}
269270
if (httpc.hostname_verify) {
270-
ret = setsockopt(httpc.fd, SOL_TLS, TLS_HOSTNAME, httpc.host,
271+
ret = zsock_setsockopt(httpc.fd, SOL_TLS, TLS_HOSTNAME, httpc.host,
271272
strlen(httpc.host));
272273
} else {
273-
ret = setsockopt(httpc.fd, SOL_TLS, TLS_HOSTNAME, NULL, 0);
274+
ret = zsock_setsockopt(httpc.fd, SOL_TLS, TLS_HOSTNAME, NULL, 0);
274275
}
275276
if (ret) {
276-
LOG_ERR("setsockopt(TLS_HOSTNAME) error: %d", -errno);
277+
LOG_ERR("zsock_setsockopt(TLS_HOSTNAME) error: %d", -errno);
277278
ret = -errno;
278279
goto exit_cli;
279280
}
280281
if (!IS_ENABLED(CONFIG_SLM_NATIVE_TLS)) {
281282
int session_cache = TLS_SESSION_CACHE_ENABLED;
282283

283-
ret = setsockopt(httpc.fd, SOL_TLS, TLS_SESSION_CACHE, &session_cache,
284+
ret = zsock_setsockopt(httpc.fd, SOL_TLS, TLS_SESSION_CACHE, &session_cache,
284285
sizeof(session_cache));
285286
if (ret) {
286-
LOG_ERR("setsockopt(TLS_SESSION_CACHE) error: %d", -errno);
287+
LOG_ERR("zsock_setsockopt(TLS_SESSION_CACHE) error: %d", -errno);
287288
ret = -errno;
288289
goto exit_cli;
289290
}
290291
}
291292
}
292293

293294
LOG_DBG("Configuring socket timeout (%lld s)", timeo.tv_sec);
294-
ret = setsockopt(httpc.fd, SOL_SOCKET, SO_SNDTIMEO, &timeo, sizeof(timeo));
295+
ret = zsock_setsockopt(httpc.fd, SOL_SOCKET, SO_SNDTIMEO, &timeo, sizeof(timeo));
295296
if (ret) {
296-
LOG_ERR("setsockopt(SO_SNDTIMEO) error: %d", -errno);
297+
LOG_ERR("zsock_setsockopt(SO_SNDTIMEO) error: %d", -errno);
297298
ret = -errno;
298299
goto exit_cli;
299300
}
300-
ret = setsockopt(httpc.fd, SOL_SOCKET, SO_RCVTIMEO, &timeo, sizeof(timeo));
301+
ret = zsock_setsockopt(httpc.fd, SOL_SOCKET, SO_RCVTIMEO, &timeo, sizeof(timeo));
301302
if (ret) {
302-
LOG_ERR("setsockopt(SO_SNDTIMEO) error: %d", -errno);
303+
LOG_ERR("zsock_setsockopt(SO_SNDTIMEO) error: %d", -errno);
303304
ret = -errno;
304305
goto exit_cli;
305306
}
@@ -310,13 +311,13 @@ static int do_http_connect(void)
310311
goto exit_cli;
311312
}
312313
if (sa.sa_family == AF_INET) {
313-
ret = connect(httpc.fd, &sa, sizeof(struct sockaddr_in));
314+
ret = zsock_connect(httpc.fd, &sa, sizeof(struct sockaddr_in));
314315
} else {
315-
ret = connect(httpc.fd, &sa, sizeof(struct sockaddr_in6));
316+
ret = zsock_connect(httpc.fd, &sa, sizeof(struct sockaddr_in6));
316317
}
317318

318319
if (ret) {
319-
LOG_ERR("connect() failed: %d", -errno);
320+
LOG_ERR("zsock_connect() failed: %d", -errno);
320321
ret = -errno;
321322
goto exit_cli;
322323
}
@@ -325,7 +326,7 @@ static int do_http_connect(void)
325326
return 0;
326327

327328
exit_cli:
328-
close(httpc.fd);
329+
zsock_close(httpc.fd);
329330
httpc.fd = INVALID_SOCKET;
330331
rsp_send("\r\n#XHTTPCCON: 0\r\n");
331332

@@ -338,10 +339,10 @@ static int do_http_disconnect(void)
338339
if (httpc.fd == INVALID_SOCKET) {
339340
return 0;
340341
}
341-
int ret = close(httpc.fd);
342+
int ret = zsock_close(httpc.fd);
342343

343344
if (ret) {
344-
LOG_WRN("close() failed: %d", -errno);
345+
LOG_WRN("zsock_close() failed: %d", -errno);
345346
ret = -errno;
346347
}
347348
httpc.fd = INVALID_SOCKET;

0 commit comments

Comments
 (0)