-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
night1rider
committed
Jun 21, 2024
1 parent
2a15afc
commit 00a6258
Showing
14 changed files
with
1,986 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
cmake_minimum_required(VERSION 3.20.0) | ||
find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE}) | ||
project(MCXN947-mqtt-client-wolfMQTT) | ||
|
||
# Check if the symbolic link __repo__ exists | ||
if(NOT EXISTS "${CMAKE_SOURCE_DIR}/__repo__") | ||
# Create a symbolic link from __repo__ to the ZEPHYR_BASE environment variable | ||
execute_process( | ||
COMMAND ${CMAKE_COMMAND} -E create_symlink $ENV{ZEPHYR_BASE}/.. ${CMAKE_SOURCE_DIR}/__repo__ | ||
COMMAND_ECHO STDOUT | ||
) | ||
endif() | ||
|
||
|
||
target_sources(app PRIVATE src/main.c) | ||
|
||
target_include_directories(app PRIVATE src) | ||
|
||
|
||
add_definitions(-DWOLFMQTT_ZEPHYR) | ||
add_definitions(-DWOLFMQTT_USER_SETTINGS) | ||
add_definitions(-DWOLFSSL_USER_SETTINGS) |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,213 @@ | ||
# wolfSSL NXP Application Code Hub | ||
|
||
<a href="https://www.nxp.com"> <img src="https://mcuxpresso.nxp.com/static/icon/nxp-logo-color.svg" width="125" style="margin-bottom: 40px;" /> </a> <a href="https://www.wolfssl.com"> <img src="../Images/wolfssl_logo_300px.png" width="100" style="margin-bottom: 40px" align=right /> </a> | ||
|
||
## wolfSSL MQTT AWS Test using Zephyr RTOS | ||
|
||
This demo demostrate capabilities of new FRDM-MCXN947. | ||
|
||
### Demo | ||
Simple conencts to a AWS broker subscribes, and publishes a message. | ||
|
||
*This is currently not a stable demo on the FRDM-MCXN947 Board* | ||
|
||
#### Boards: FRDM-MCXN947 | ||
#### Categories: RTOS, Zephyr, Networking | ||
#### Peripherals: UART, ETHERNET | ||
#### Toolchains: Zephyr | ||
|
||
## Table of Contents | ||
1. [Software](#step1) | ||
2. [Hardware](#step2) | ||
3. [Setup](#step3) | ||
4. [Project Options](#step4) | ||
5. [Project Flow Chart](#step5) | ||
6. [FAQs](#step6) | ||
7. [Support](#step7) | ||
8. [Release Notes](#step8) | ||
|
||
## 1. Software<a name="step1"></a> | ||
- [MCUXpresso for VScode 1.5.61 or newer](https://www.nxp.com/products/processors-and-microcontrollers/arm-microcontrollers/general-purpose-mcus/lpc800-arm-cortex-m0-plus-/mcuxpresso-for-visual-studio-code:MCUXPRESSO-VSC?cid=wechat_iot_303216) | ||
|
||
- [Zephyr Setup](https://docs.zephyrproject.org/latest/develop/getting_started/index.html) | ||
- [wolfSSL as a Module added to Zephyr](https://github.com/wolfSSL/wolfssl/blob/master/zephyr/README.md) | ||
- [Adding the Zephyr Repository (Part 5)](https://community.nxp.com/t5/MCUXpresso-for-VSCode-Knowledge/Training-Walkthrough-of-MCUXpresso-for-VS-Code/ta-p/1634002) | ||
|
||
- MCUXpresso Installer: | ||
- MCUXpresso SDK Developer | ||
- Zephyr Developer | ||
- Linkserver | ||
|
||
- Ubuntu or MacOS with the following packages: | ||
- autoconf | ||
- automake | ||
- libtool | ||
- make | ||
- gcc | ||
- git | ||
|
||
|
||
## 2. Hardware<a name="step2"></a> | ||
- [FRDM-MCXN947.](https://www.nxp.com/products/processors-and-microcontrollers/arm-microcontrollers/general-purpose-mcus/mcx-arm-cortex-m/mcx-n94x-and-n54x-mcus-with-dual-core-arm-cortex-m33-eiq-neutron-npu-and-edgelock-secure-enclave-core-profile:MCX-N94X-N54X) | ||
[<img src="Images/FRDM-MCXN947-TOP.jpg" width="300"/>](Images/FRDM-MCXN947-TOP.jpg) | ||
- USB Type-C cable. | ||
- Ethernet Cable. | ||
- Networking/Router | ||
- Personal Computer. | ||
|
||
|
||
## 3. Setup<a name="step3"></a> | ||
|
||
### 3.1 Import the Project and build | ||
1. Follow section 1: `Setup` in the top level [README](../README.md) | ||
2. Under the "Projects" tab, right click the project and choose "build selected", this should result in no errors. | ||
|
||
[<img src="Images/Setup3-1.png" width="400"/>](Images/Setup3-1.png) | ||
|
||
The project should be called `dm-wolfmqtt-publisher-client-with-zephyr`. | ||
|
||
|
||
### 3.2 Connect hardware | ||
1. Connect the FRDM-MCXN947 to you computer with the provided USB-C Cable | ||
|
||
2. Connect the FRDM-MCXN947 to your network with a ethernet cable | ||
|
||
### 3.4 Program and Run the Server | ||
1. Flash the .elf to FRDM-MCXN947, Can be done with right clicking the project and choosing to "flash the selected target" | ||
2. Connect to the Serial Output of the FRDM-MCXN947 via: | ||
- Screen Command - `screen /dev/tty"MCXN-Port 115200` | ||
- Some Serial Terminal you are familiar with | ||
3. Push reset button on the FRDM-MCXN947 board and view the startup message and MQTT demo. | ||
|
||
[<img src="Images/Results.png" width="500"/>](Images/Results.png) | ||
|
||
|
||
|
||
|
||
|
||
## 4. Project Options<a name="step4"></a> | ||
Currently there are no extra project options. | ||
|
||
|
||
## 5. Project Flowchart<a name="step5"></a> | ||
### Overview | ||
|
||
```mermaid | ||
flowchart TD | ||
A[Start mqttsimple_test] --> B[Initialize MQTT Client and Network] | ||
B --> C{MqttClient_Init Successful?} | ||
C -- No --> D[Print Initialization Error] | ||
D --> E[Exit with Error Code] | ||
C -- Yes --> F[Enable wolfSSL Debugging] | ||
F --> G[Resolve MQTT Hostname] | ||
G --> H[MqttClient_NetConnect] | ||
H --> I{Network Connection Successful?} | ||
I -- No --> J[Print Connection Error] | ||
J --> K[Exit with Error Code] | ||
I -- Yes --> L[Print Network Connection Success] | ||
L --> M[Prepare MQTT Connection Object] | ||
M --> N[Set Connection Parameters] | ||
N --> O[MqttClient_Connect] | ||
O --> P{MQTT Connection Successful?} | ||
P -- No --> Q[Print Connection Error] | ||
Q --> R[Exit with Error Code] | ||
P -- Yes --> S[Print Broker Connection Success] | ||
S --> T[Prepare Subscription Object] | ||
T --> U[Set Subscription Parameters] | ||
U --> V[MqttClient_Subscribe] | ||
V --> W{Subscription Successful?} | ||
W -- No --> X[Print Subscription Error] | ||
X --> Y[Exit with Error Code] | ||
W -- Yes --> Z[Print Subscription Success] | ||
Z --> AA[Prepare Publish Object] | ||
AA --> AB[Set Publish Parameters] | ||
AB --> AC[MqttClient_Publish] | ||
AC --> AD{Publish Successful?} | ||
AD -- No --> AE[Print Publish Error] | ||
AE --> AF[Exit with Error Code] | ||
AD -- Yes --> AG[Print Publish Success] | ||
AG --> AH[Return Success] | ||
AH --> AI[End mqttsimple_test] | ||
subgraph "Initialization" | ||
B | ||
C | ||
D | ||
E | ||
end | ||
subgraph "Network Connection" | ||
F | ||
G | ||
H | ||
I | ||
J | ||
K | ||
L | ||
end | ||
subgraph "MQTT Connection" | ||
M | ||
N | ||
O | ||
P | ||
Q | ||
R | ||
S | ||
end | ||
subgraph "Subscription" | ||
T | ||
U | ||
V | ||
W | ||
X | ||
Y | ||
Z | ||
end | ||
subgraph "Publishing" | ||
AA | ||
AB | ||
AC | ||
AD | ||
AE | ||
AF | ||
AG | ||
end | ||
subgraph "Completion" | ||
AH | ||
AI | ||
end | ||
``` | ||
|
||
|
||
## 6. FAQs<a name="step6"></a> | ||
No FAQs have been identified for this project. | ||
|
||
## 7. Support<a name="step7"></a> | ||
|
||
#### Project Metadata | ||
<!----- Boards -----> | ||
[](https://github.com/search?q=org%3Anxp-appcodehub+FRDM-MCXN947+in%3Areadme&type=Repositories) | ||
|
||
<!----- Categories -----> | ||
|
||
|
||
<!----- Peripherals -----> | ||
[](https://github.com/search?q=org%3Anxp-appcodehub+uart+in%3Areadme&type=Repositories) [](https://github.com/search?q=org%3Anxp-appcodehub+ethernet+in%3Areadme&type=Repositories) | ||
|
||
<!----- Toolchains -----> | ||
[](https://github.com/search?q=org%3Anxp-appcodehub+vscode+in%3Areadme&type=Repositories) | ||
|
||
Questions regarding the content/correctness of this example can be entered as Issues within this GitHub repository. | ||
|
||
>**Warning**: For more general technical questions regarding NXP Microcontrollers and the difference in expected funcionality, enter your questions on the [NXP Community Forum](https://community.nxp.com/) | ||
|
||
|
||
## 8. Release Notes<a name="step8"></a> | ||
| Version | Description / Update | Date | | ||
|:-------:|------------------------------------------------|----------------------------:| | ||
| 1.0 | Initial release on Application Code Hub | TBD| |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
# General config | ||
CONFIG_NEWLIB_LIBC=y | ||
CONFIG_MAIN_STACK_SIZE=65536 | ||
CONFIG_HEAP_MEM_POOL_SIZE=65536 | ||
CONFIG_COMMON_LIBC_MALLOC_ARENA_SIZE=16384 | ||
|
||
# Enable the MQTT Lib | ||
CONFIG_WOLFMQTT=y | ||
CONFIG_WOLFMQTT_TLS=y | ||
CONFIG_WOLFMQTT_SETTINGS_FILE="wolfmqtt_usersettings.h" | ||
|
||
# Networking | ||
CONFIG_NETWORKING=y | ||
CONFIG_NET_SOCKETS=y | ||
CONFIG_NET_TCP=y | ||
CONFIG_NET_IPV4=y | ||
CONFIG_NET_CONFIG_SETTINGS=y | ||
CONFIG_NET_DHCPV4=y | ||
# Enable TLS for MQTT | ||
CONFIG_NET_HOSTNAME_ENABLE=y | ||
CONFIG_NET_HOSTNAME="Zephyr-MQTT" | ||
CONFIG_MBEDTLS=n | ||
CONFIG_NET_TCP_ISN_RFC6528=n | ||
|
||
# Logging | ||
CONFIG_PRINTK=y | ||
CONFIG_LOG=y | ||
CONFIG_LOG_MODE_IMMEDIATE=y | ||
#CONFIG_WOLFSSL_DEBUG=y | ||
|
||
# File system | ||
#CONFIG_FILE_SYSTEM=y | ||
|
||
### TLS ### | ||
|
||
# Enable wolfSSL | ||
CONFIG_WOLFSSL=y | ||
CONFIG_WOLFSSL_BUILTIN=y | ||
CONFIG_WOLFSSL_TLS_VERSION_1_2=y | ||
CONFIG_WOLFSSL_TLS_VERSION_1_3=y | ||
CONFIG_WOLFSSL_SETTINGS_FILE="wolfssl_usersettings.h" | ||
|
||
# Threading | ||
CONFIG_PTHREAD_IPC=y | ||
CONFIG_POSIX_CLOCK=y | ||
CONFIG_SNTP=y | ||
CONFIG_NET_BUF_TX_COUNT=16 | ||
CONFIG_NET_BUF_RX_COUNT=16 | ||
CONFIG_NET_BUF_DATA_SIZE=1536 | ||
|
||
# ETHERNET | ||
CONFIG_ETH_NXP_ENET_QOS=y | ||
CONFIG_ETH_NXP_ENET_QOS_MAC=y | ||
|
||
# RANDOM/ENTROPY | ||
CONFIG_ENTROPY_GENERATOR=y | ||
CONFIG_TEST_RANDOM_GENERATOR=y | ||
CONFIG_ENTROPY_DEVICE_RANDOM_GENERATOR=y | ||
|
||
# Enable DNS resolver | ||
CONFIG_DNS_RESOLVER=y | ||
|
||
# DNS resolver settings | ||
CONFIG_DNS_RESOLVER_MAX_SERVERS=2 | ||
CONFIG_DNS_RESOLVER_ADDITIONAL_QUERIES=2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
sample: | ||
description: A hello server that uses the ethernet avaliable for the FRDM-MCXN947 | ||
name: TLS 1.3 Hello Server | ||
tests: | ||
sample.basic.wolfssl: | ||
tags: | ||
- Ethernet | ||
- Networking | ||
- TLS 1.3 |
Oops, something went wrong.