MCUXpresso_MIMXRT1021xxxxx/boards/evkmimxrt1020/aws_examples/aws_httpscli_corehttp
Yilin Sun ec9dcda9ee
Update to SDK_2_12_1.
Signed-off-by: Yilin Sun <imi415@imi.moe>
2022-12-02 19:44:05 +08:00
..
armgcc Initial SDK v2.12.0 2022-08-23 23:00:33 +08:00
config_files Initial SDK v2.12.0 2022-08-23 23:00:33 +08:00
linkscripts Update to SDK_2_12_1. 2022-12-02 19:44:05 +08:00
aws_httpscli_corehttp_v3_10.xml Initial SDK v2.12.0 2022-08-23 23:00:33 +08:00
board.c Initial SDK v2.12.0 2022-08-23 23:00:33 +08:00
board.h Initial SDK v2.12.0 2022-08-23 23:00:33 +08:00
clock_config.c Initial SDK v2.12.0 2022-08-23 23:00:33 +08:00
clock_config.h Initial SDK v2.12.0 2022-08-23 23:00:33 +08:00
dcd.c Initial SDK v2.12.0 2022-08-23 23:00:33 +08:00
dcd.h Initial SDK v2.12.0 2022-08-23 23:00:33 +08:00
demo_main.c Initial SDK v2.12.0 2022-08-23 23:00:33 +08:00
evkmimxrt1020_sdram_init.jlinkscript Initial SDK v2.12.0 2022-08-23 23:00:33 +08:00
http_demo_mutual_auth_config.h Initial SDK v2.12.0 2022-08-23 23:00:33 +08:00
lwipopts.h Initial SDK v2.12.0 2022-08-23 23:00:33 +08:00
pin_mux.c Initial SDK v2.12.0 2022-08-23 23:00:33 +08:00
pin_mux.h Initial SDK v2.12.0 2022-08-23 23:00:33 +08:00
readme.txt Initial SDK v2.12.0 2022-08-23 23:00:33 +08:00

readme.txt

Overview
========
Simple https client example.


Toolchain supported
===================
- IAR embedded Workbench  9.30.1
- Keil MDK  5.37
- GCC ARM Embedded  10.3.1
- MCUXpresso  11.6.0

Hardware requirements
=====================
- Mini/micro USB cable
- EVK-MIMXRT1020 board
- Personal Computer
- Network cable RJ45 standard (Network with Internet access)

Board settings
==============
No special settings are required.


Note:
To debug in qspiflash, following steps are needed:
1. Select the flash target and compile.
2. Set the SW8: 1 off 2 off 3 on 4 off, then power on the board and connect USB cable to J23.
3. Start debugging in IDE.
   - Keil: Click "Download (F8)" to program the image to qspiflash first then clicking "Start/Stop Debug Session (Ctrl+F5)" to start debugging.
Prepare the Demo
================
1.  Create AWS Account: https://console.aws.amazon.com/console/home

2.  Configure device in the AWS IoT Console base on this guide: https://docs.aws.amazon.com/iot/latest/developerguide/iot-sdk-setup.html

    Make note of example's "Thing name" and "REST API endpoint". These strings need to be set in the "aws_clientcredential.h".

    Example:
        static const char clientcredentialMQTT_BROKER_ENDPOINT[] = "abcdefgh123456.iot.us-west-2.amazonaws.com";
        #define clientcredentialIOT_THING_NAME "MyExample"

    In the next step you will get the "device certificate" and the "primary key". The device certificate and private key needs to be opened in text editor and its content copied into the "aws_clientcredential_keys.h".
    Or you can use the CertificateConfigurator.html (mcu-sdk-2.0\rtos\freertos\tools\certificate_configuration) to generate the "aws_clientcredential_keys.h".

    Example:
        #define keyCLIENT_CERTIFICATE_PEM "Paste client certificate here."

        Needs to be changed to:

        #define keyCLIENT_CERTIFICATE_PEM "-----BEGIN CERTIFICATE-----\n"\
        "MIIDWTCCAkGgAwIBAgIUfmv3zA+JULlMOxmz+upkAzhEkQ0wDQYJKoZIhvcNAQEL\n"\
        .
        .
        .
        "mepuT3lKmD0jZupsQ9vLQOA09rMjVMd0YPmI9ozvvWqLpjVvNTKVhsf/3slM\n"\
        "-----END CERTIFICATE-----\n"

    In the same way update the private key array.

3.  This demo does not need WiFi network with internet access. You can leave these defines empty.
    Macros in aws_clientcredential.h: 
        #define clientcredentialWIFI_SSID       ""
        #define clientcredentialWIFI_PASSWORD   ""

4.  Open example's project and build it.

5.  Connect a USB cable between the PC host and the OpenSDA port on the target board.

6.  Download the program to the target board with the CMSIS-DAP or J-Link debugger.

7.  Either press the reset button on your board or launch the debugger in your IDE to begin running the demo.

8.  Open a serial terminal on PC for serial device with these settings:
    - 115200 baud rate
    - 8 data bits
    - No parity
    - One stop bit
    - No flow control

Running the demo
================
The log below shows the output of the demo in the terminal window.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Initializing PHY...
0 122 [Tmr Svc] Write certificate...

1 1808 [Tmr Svc] Getting IP address from DHCP ...

2 2809 [Tmr Svc] IPv4 Address: 192.168.0.114

3 2809 [Tmr Svc] DHCP OK

4 2810 [iot_thread] [INFO ][DEMO][2810] ---------STARTING DEMO---------


5 2812 [iot_thread] [INFO ][INIT][2812] SDK successfully initialized.

6 2812 [iot_thread] [INFO ][DEMO][2812] Successfully initialized the demo. Network type for the demo: 4

7 2812 [iot_thread] [INFO] Establishing a TLS session to abcdefgh123456.iot.us-west-2.amazonaws.com:8443.
8 4475 [iot_thread] [INFO] Sending HTTP POST request to abcdefgh123456.iot.us-west-2.amazonaws.com/topics/topic?qos=1...
9 4907 [iot_thread] [INFO] Received HTTP response from abcdefgh123456.iot.us-west-2.amazonaws.com/topics/topic?qos=1...

10 4909 [iot_thread] [INFO] Demo iteration 1 was successful.
11 4909 [iot_thread] [INFO] Demo completed successfully.
12 4909 [iot_thread] [INFO ][DEMO][4909] memory_metrics::freertos_heap::before::bytes::74912

13 4909 [iot_thread] [INFO ][DEMO][4909] memory_metrics::freertos_heap::after::bytes::28696

14 4909 [iot_thread] [INFO ][DEMO][4909] memory_metrics::demo_task_stack::before::bytes::5360

15 4909 [iot_thread] [INFO ][DEMO][4909] memory_metrics::demo_task_stack::after::bytes::3640

16 5909 [iot_thread] [INFO ][DEMO][5909] Demo completed successfully.

17 5909 [iot_thread] [INFO ][INIT][5909] SDK cleanup done.

18 5909 [iot_thread] [INFO ][DEMO][5909] -------DEMO FINISHED-------
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~