Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

9160 Socket Network Support #2517

Open
wants to merge 8 commits into
base: develop-nordic-zephyr-port
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -380,3 +380,6 @@ sdkconfig
CMakeUserPresets.json
config/user-tools-repos.json
config/user-prefs.json

# nordic
g.cmd
2 changes: 1 addition & 1 deletion CMake/binutils.Nordic.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ macro(nf_setup_target_build)

zephyr_compile_definitions(PROJECT_NAME=nanoCLR)

zephyr_compile_definitions(APP_VERSION=${BUILD_VERSION})
#zephyr_compile_definitions(APP_VERSION=${BUILD_VERSION})
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if you comment this line of code, please add a little comment on why :-)

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry for the sloppy code. I wanted to post what I could as I'm not sure when I'll be able to work on the code again. I'll try to clean things up today.


#######################################################
# the following are nanoCLR common compile definitions
Expand Down
1 change: 0 additions & 1 deletion targets/Nordic/ARDESCO/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,4 @@ endif()
nf_setup_target_build()

target_sources(app PRIVATE main.c )

nf_copy_zephyr_build_artifacts()
2 changes: 1 addition & 1 deletion targets/Nordic/ARDESCO/nrf9160_ard0022B_ns.overlay
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
// set UART1 out the Grove Connector
&uart1 {
compatible = "nordic,nrf-uarte";
current-speed = <921600>;
current-speed = <115200>;
dboling-ericsson marked this conversation as resolved.
Show resolved Hide resolved
status = "okay";
pinctrl-0 = <&uart1_default>;
pinctrl-1 = <&uart1_sleep>;
Expand Down
38 changes: 16 additions & 22 deletions targets/Nordic/ARDESCO/prj.conf
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
#CONFIG_REQUIRES_FULL_LIBC=y
# NEWLIB C (needed by math lib)
CONFIG_NEWLIB_LIBC=y
#CONFIG_MINIMAL_LIBC_RAND=y

CONFIG_CPLUSPLUS=y
CONFIG_REBOOT=y
Expand Down Expand Up @@ -37,36 +36,31 @@ CONFIG_UART_0_NRF_TX_BUFFER_SIZE=1024
CONFIG_UART_0_GPIO_MANAGEMENT=y

# Need power management for uart
#Change for v2.0
#CONFIG_DEVICE_POWER_MANAGEMENT=y
CONFIG_PM_DEVICE=y
CONFIG_POLL=y

# # 9160 specifc config
# CONFIG_NRF_MODEM_LIB=y

# # Modem info (used by ard_lte)
# CONFIG_MODEM_INFO=y
# CONFIG_MODEM_INFO_ADD_SIM_ICCID=y
# CONFIG_NEWLIB_LIBC_FLOAT_PRINTF=y

CONFIG_UART_1_INTERRUPT_DRIVEN=y
CONFIG_UART_1_ENHANCED_POLL_OUT=y
CONFIG_UART_1_NRF_TX_BUFFER_SIZE=1024
CONFIG_UART_1_GPIO_MANAGEMENT=y

# # Disable Modem traces, since we need UART1 for netnf debug uart
# CONFIG_NRF_MODEM_LIB_TRACE_ENABLED=n
CONFIG_NRF_MODEM_LIB_TRACE_ENABLED=n

# Network support
CONFIG_NETWORKING=y
CONFIG_NET_SOCKETS=y
CONFIG_NET_NATIVE=n
CONFIG_NET_SOCKETS_POSIX_NAMES=y
CONFIG_NET_SOCKETS_OFFLOAD=y
CONFIG_NET_SOCKETS_OFFLOAD_TLS=y

# # Network support
# CONFIG_NETWORKING=y
# CONFIG_NET_SOCKETS=y
# CONFIG_NET_NATIVE=n
# CONFIG_NET_SOCKETS_POSIX_NAMES=y
# CONFIG_NET_SOCKETS_OFFLOAD=y
# CONFIG_NET_SOCKETS_OFFLOAD_TLS=y
# LTE support
CONFIG_LTE_LINK_CONTROL=y
CONFIG_LTE_AUTO_INIT_AND_CONNECT=n

# # LTE support
# CONFIG_LTE_LINK_CONTROL=y
# CONFIG_LTE_AUTO_INIT_AND_CONNECT=n
# Modem info (used by ard_lte)
CONFIG_MODEM_INFO=y
CONFIG_MODEM_INFO_ADD_SIM_ICCID=y

CONFIG_DATE_TIME=y
2 changes: 1 addition & 1 deletion targets/Nordic/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ else()
endif()

if (NOT "v${NRF_CONNECT_SDK_FOUND_VERSION}" STREQUAL ${NRF_CONNECT_SDK_VERSION})
message(FATAL_ERROR "\n\nFound nRF Connect SDK ${NRF_CONNECT_SDK_FOUND_VERSION}.\nExpecting ${NRF_CONNECT_SDK_VERSION}.\n\n")
message(WARNING "\n\nFound nRF Connect SDK ${NRF_CONNECT_SDK_FOUND_VERSION}.\nExpecting ${NRF_CONNECT_SDK_VERSION}.\n\n")
endif()

# save path for later
Expand Down
1 change: 0 additions & 1 deletion targets/Nordic/NRF52840_DK/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,4 @@ endif()
nf_setup_target_build()

target_sources(app PRIVATE main.c )

nf_copy_zephyr_build_artifacts()
6 changes: 1 addition & 5 deletions targets/Nordic/NRF52840_DK/prj.conf
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,10 @@
# Portions Copyright (c) Ericsson AB 2020, all rights reserved
# See LICENSE file in the project root for full license information.

#CONFIG_REQUIRES_FULL_LIBC=y
# NEWLIB C (needed by math lib)
CONFIG_NEWLIB_LIBC=y
CONFIG_REBOOT=y

# 9160 specifc config
CONFIG_NEWLIB_LIBC_FLOAT_PRINTF=y
CONFIG_CPLUSPLUS=y
CONFIG_REBOOT=y

CONFIG_BUILD_WITH_TFM=n

Expand Down
4 changes: 2 additions & 2 deletions targets/Nordic/NRF9160_DK/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
# Copyright (c) .NET Foundation and Contributors
# See LICENSE file in the project root for full license information.
#
include(binutils.Nordic)

# If board not specified set it now...
if(NOT BOARD)
Expand All @@ -11,6 +12,5 @@ endif()
# invoke the Zephyr build
nf_setup_target_build()

target_sources(app PRIVATE main.c)

target_sources(app PRIVATE main.c )
nf_copy_zephyr_build_artifacts()
90 changes: 90 additions & 0 deletions targets/Nordic/NRF9160_DK/cert/GlobalSign-Root-CA-R2
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
/*
Certificate:
Data:
Version: 3 (0x2)
Serial Number:
04:00:00:00:00:01:0f:86:26:e6:0d
Signature Algorithm: sha1WithRSAEncryption
Issuer: OU = GlobalSign Root CA - R2, O = GlobalSign, CN = GlobalSign
Validity
Not Before: Dec 15 08:00:00 2006 GMT
Not After : Dec 15 08:00:00 2021 GMT
Subject: OU = GlobalSign Root CA - R2, O = GlobalSign, CN = GlobalSign
Subject Public Key Info:
Public Key Algorithm: rsaEncryption
RSA Public-Key: (2048 bit)
Modulus:
00:a6:cf:24:0e:be:2e:6f:28:99:45:42:c4:ab:3e:
21:54:9b:0b:d3:7f:84:70:fa:12:b3:cb:bf:87:5f:
c6:7f:86:d3:b2:30:5c:d6:fd:ad:f1:7b:dc:e5:f8:
60:96:09:92:10:f5:d0:53:de:fb:7b:7e:73:88:ac:
52:88:7b:4a:a6:ca:49:a6:5e:a8:a7:8c:5a:11:bc:
7a:82:eb:be:8c:e9:b3:ac:96:25:07:97:4a:99:2a:
07:2f:b4:1e:77:bf:8a:0f:b5:02:7c:1b:96:b8:c5:
b9:3a:2c:bc:d6:12:b9:eb:59:7d:e2:d0:06:86:5f:
5e:49:6a:b5:39:5e:88:34:ec:bc:78:0c:08:98:84:
6c:a8:cd:4b:b4:a0:7d:0c:79:4d:f0:b8:2d:cb:21:
ca:d5:6c:5b:7d:e1:a0:29:84:a1:f9:d3:94:49:cb:
24:62:91:20:bc:dd:0b:d5:d9:cc:f9:ea:27:0a:2b:
73:91:c6:9d:1b:ac:c8:cb:e8:e0:a0:f4:2f:90:8b:
4d:fb:b0:36:1b:f6:19:7a:85:e0:6d:f2:61:13:88:
5c:9f:e0:93:0a:51:97:8a:5a:ce:af:ab:d5:f7:aa:
09:aa:60:bd:dc:d9:5f:df:72:a9:60:13:5e:00:01:
c9:4a:fa:3f:a4:ea:07:03:21:02:8e:82:ca:03:c2:
9b:8f
Exponent: 65537 (0x10001)
X509v3 extensions:
X509v3 Key Usage: critical
Certificate Sign, CRL Sign
X509v3 Basic Constraints: critical
CA:TRUE
X509v3 Subject Key Identifier:
9B:E2:07:57:67:1C:1E:C0:6A:06:DE:59:B4:9A:2D:DF:DC:19:86:2E
X509v3 CRL Distribution Points:

Full Name:
URI:http://crl.globalsign.net/root-r2.crl

X509v3 Authority Key Identifier:
keyid:9B:E2:07:57:67:1C:1E:C0:6A:06:DE:59:B4:9A:2D:DF:DC:19:86:2E

Signature Algorithm: sha1WithRSAEncryption
99:81:53:87:1c:68:97:86:91:ec:e0:4a:b8:44:0b:ab:81:ac:
27:4f:d6:c1:b8:1c:43:78:b3:0c:9a:fc:ea:2c:3c:6e:61:1b:
4d:4b:29:f5:9f:05:1d:26:c1:b8:e9:83:00:62:45:b6:a9:08:
93:b9:a9:33:4b:18:9a:c2:f8:87:88:4e:db:dd:71:34:1a:c1:
54:da:46:3f:e0:d3:2a:ab:6d:54:22:f5:3a:62:cd:20:6f:ba:
29:89:d7:dd:91:ee:d3:5c:a2:3e:a1:5b:41:f5:df:e5:64:43:
2d:e9:d5:39:ab:d2:a2:df:b7:8b:d0:c0:80:19:1c:45:c0:2d:
8c:e8:f8:2d:a4:74:56:49:c5:05:b5:4f:15:de:6e:44:78:39:
87:a8:7e:bb:f3:79:18:91:bb:f4:6f:9d:c1:f0:8c:35:8c:5d:
01:fb:c3:6d:b9:ef:44:6d:79:46:31:7e:0a:fe:a9:82:c1:ff:
ef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Jot39wZhi4wNgYDVR0fBC8wLTAroCmgJ4YlaHR0cDovL2NybC5n\n"
"bG9iYWxzaWduLm5ldC9yb290LXIyLmNybDAfBgNVHSMEGDAWgBSb4gdXZxwewGoG\n"
"3lm0mi3f3BmGLjANBgkqhkiG9w0BAQUFAAOCAQEAmYFThxxol4aR7OBKuEQLq4Gs\n"
"J0/WwbgcQ3izDJr86iw8bmEbTUsp9Z8FHSbBuOmDAGJFtqkIk7mpM0sYmsL4h4hO\n"
"291xNBrBVNpGP+DTKqttVCL1OmLNIG+6KYnX3ZHu01yiPqFbQfXf5WRDLenVOavS\n"
"ot+3i9DAgBkcRcAtjOj4LaR0VknFBbVPFd5uRHg5h6h+u/N5GJG79G+dwfCMNYxd\n"
"AfvDbbnvRG15RjF+Cv6pgsH/76tuIMRQyV+dTZsXjAzlAcmgQWpzU/qlULRuJQ/7\n"
"TBj0/VLZjmmx6BEP3ojY+x1J96relc8geMJgEtslQIxq/H5COEBkEveegeGTLg==\n"
"-----END CERTIFICATE-----\n"
4 changes: 3 additions & 1 deletion targets/Nordic/NRF9160_DK/nrf9160dk_nrf9160_ns.overlay
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,10 @@
//

// Enable uart1
// compatible = "nordic,nrf-uarte";
// It appears that only 115200 works when piping through the 52840
// current-speed = <921600>;
&uart1 {
compatible = "nordic,nrf-uarte";
current-speed = <115200>;
status = "okay";
};
25 changes: 23 additions & 2 deletions targets/Nordic/NRF9160_DK/prj.conf
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
# Portions Copyright (c) Ericsson AB 2020, all rights reserved
# See LICENSE file in the project root for full license information.

#CONFIG_REQUIRES_FULL_LIBC=y
# NEWLIB C (needed by math lib)
CONFIG_NEWLIB_LIBC=y

# 9160 specifc config
Expand All @@ -28,6 +26,10 @@ CONFIG_HEAP_MEM_POOL_SIZE=98304
CONFIG_FLASH=y
CONFIG_FLASH_PAGE_LAYOUT=y

# for debugging
CONFIG_DEBUG_OPTIMIZATIONS=y
CONFIG_DEBUG_THREAD_INFO=y

# for serial
CONFIG_SERIAL=y
CONFIG_UART_ASYNC_API=n
Expand All @@ -47,9 +49,28 @@ CONFIG_UART_1_INTERRUPT_DRIVEN=y
CONFIG_UART_1_ENHANCED_POLL_OUT=y
CONFIG_UART_1_NRF_TX_BUFFER_SIZE=1024
CONFIG_UART_1_GPIO_MANAGEMENT=y
CONFIG_MODEM_KEY_MGMT=y

# Disable Modem traces, since we need UART1 for netnf debug uart
CONFIG_NRF_MODEM_LIB_TRACE_ENABLED=n

CONFIG_I2C=y

# Network support
CONFIG_NETWORKING=y
CONFIG_NET_SOCKETS=y
CONFIG_NET_NATIVE=n
CONFIG_NET_SOCKETS_POSIX_NAMES=y
CONFIG_NET_SOCKETS_OFFLOAD=y
CONFIG_NET_SOCKETS_OFFLOAD_TLS=y
CONFIG_NET_SOCKETS_SOCKOPT_TLS=y

# LTE support
CONFIG_LTE_LINK_CONTROL=y
CONFIG_LTE_AUTO_INIT_AND_CONNECT=n

# Modem info (used by ard_lte)
CONFIG_MODEM_INFO=y
CONFIG_MODEM_INFO_ADD_SIM_ICCID=y

CONFIG_DATE_TIME=y
50 changes: 50 additions & 0 deletions targets/Nordic/_include/nrf9160_lte.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
/*
* Copyright (c) Ericsson AB 2020, all rights reserved
*/
#ifndef NRF9610_LTE_H__
#define NRF9610_LTE_H__

// Include basic operating system dependencies

#ifdef __cplusplus
extern "C"
{
#endif

#if defined(CONFIG_NET_SOCKETS_SOCKOPT_TLS)
#include <modem/modem_key_mgmt.h>
#define TLS_SEC_TAG 42
#endif

// Default connection timeout
#define NETWORK_TIMEOUT 120
#define IMxI_LEN 16
#define ICCID_LEN 22
#define IP_ADDR_LEN 17
#define FW_VER_LEN 32
#define APN_LEN 64

#define DEFAULT_TIMEOUT -1

// Connect State values
#define CONN_STATE_DISCONNECTED 0
#define CONN_STATE_CONN_HOME 1
#define CONN_STATE_CONN_ROAM 2

// Initialize the LTE library
int nrf9160_lte_init(uint16_t timeout);

// Connect to the network.
int nrf9160_lte_connect(uint16_t timeout);

// Disconnect to the network.
int nrf9160_lte_offline(void);

// Turn off the modem.
int nrf9160_lte_power_off(void);

#ifdef __cplusplus
}
#endif

#endif /* NRF9610_LTE_H__ */
Loading