Overview

This example shows how to build an HTTP server using Mongoose Library and run it on an NXP i.MX RT1020 development board with AzureRTOS. The source code for this tutorial is located at https://github.com/mongoose-examples/nxp-mimxrt1020-azurertos

Project structure

A big part of this example is a regular MCUXpresso IDE project (a lot of generated files, FreeRTOS and lwIP sources, etc.). Mongoose-related functions are located in files source/web_server.c and source/web_server.h. Mongoose itself is located in the source directory as well. Board network configuration (e.g. IP address) can be found in source/web_server.h

General description

Below is a general process outline:

  • First of all, set IP address, network mask and gateway suitable for your network in the source/web_server.h file. Default address is 192.168.0.10.
  • Build the example and run it on your development board (see next section).
  • The firmware initializes the network
  • After initialization, the application starts Mongoose's event loop and blinks an LED
  • Once the LED starts blinking - the web server is ready
  • Open your web browser and navigate to the board IP address, you should see a "Hello, world" page
helloworld

Build options

There are (at least) two options to build the example:

  1. Using the make command
  2. Using the MCUXpresso IDE software

Option 1 - make

  • Install Docker
  • Start a terminal, navigate to the project folder, and from there run
    $ make build
    
  • When build finishes, flash the board using your favorite tool

Done! See the LEDs to understand the application status

Option 2 - MCUXpresso IDE

MCUXpresso IDE is an IDE software provided by NXP Semiconductor. To build this sample with MCUXpresso IDE you need to do the following steps:

  1. Start MCUXpresso IDE
  2. Choose File -> Open Projects from File System... pic
  3. Pick the project directory as Import source, make sure that MIMXRT1020-azure project is checked, and click Finish pic
  4. Check if you have the required SDK installed, if not:
    • Press Install New Plugin SDKs pic
    • In the board list choose evkmimxrt1020 and press Install
      pic
    • Once the wizard has finished, you should see the SDK has been installed pic
  5. Choose Debug as -> MCUXpresso IDE LinkServer (inc. CMSIS-DAP) probes, to build and flash the application. NOTE: you may prefer to debug using other interfaces, but this sample is configured to print output information in semi-host mode. pic
  6. You can be asked to choose the board to use pic
  7. After a successful building and flashing, the execution will pause at the beginning of the main function
  8. Go to the Terminal tab and open terminal settings. pic
  9. Configure your terminal as shown in the picture below pic
  10. Choose Run -> Resume to continue pic
  11. Done! The LED should start to blink and you should see Mongoose output in the terminal window pic
  12. Open your web browser and navigate to the board IP address, you should see the "Hello, world" page. pic