AppWizard: Creating a new project and adding a background image

cancel
Showing results for 
Search instead for 
Did you mean: 

AppWizard: Creating a new project and adding a background image

AppWizard: Creating a new project and adding a background image

Introduction

Graphical user interfaces (GUIs) have become increasingly popular and have richer graphics than ever before, but creating these displays can be time consuming without help. With time to market being such an important factor in product development, it is important to have a tool to speed up the development of GUIs for your products. SEGGER's AppWizard is a GUI development tool that does just that, by helping you create ready to run GUI applications (built on top of SEGGER's emWin graphics library of course).

This document will show you how to create a new AppWizard project and add a background image to get you started on GUI project. We will be using the i.MX RT1050 but the directions should apply to any device that is supported by emWin in the MCUXpresso SDK.

Environment

  • SEGGER AppWizard v1.0 or later
  • NXP MCUXpresso IDE v11.0.1 or later
  • MIMXRT1050-EVKB
  • MCUXpresso SDK for the MIMXRT1050-EVKB (including emWin)

Downloading and installing the MCUXpresso SDK

The first step is to download and install the MCUXpresso SDK for the device you are working with. Make sure that emWin is included as an optional software component. Refer to the video Getting Started with emWin and MCUXpresso if you need instructions on how to do this. 

Downloading and installing AppWizard

AppWizard can be downloaded from the NXP emWin Libraries Download tab. Navigate to www.nxp.com/emwin-graphics-libraries, click on the download tab, and then click on Download next to the AppWizard Application Development Tool.   pastedImage_1.png

Clicking this link will download an installer to your PC. Just run the installer and follow the prompts to install AppWizard to your PC. Remember that NXP recommends selecting defaults for any install options present.  

Importing an SDK example

Before creating your new AppWizard project, a space to save and export the generated files to is needed. NXP recommends importing the simplest example to use as a template: the emwin_serial_terminal demo. To import this example, follow these directions.

  1. Open MCUXpresso IDE and select any workspace desired.
  2. In the Quickstart Panel, select Import SDK examples.                                                          pastedImage_2.png  
  3. Select your Board or Device. Make sure your board or device is supported by emWin in the SDK. For this example, we will select the evkbmimxrt1050. pastedImage_3.png
  4. In the next dialog box, locate the emwin_examples group in the Examples category and expand it.  Select the emwin_serial_terminal example.  Note that here you can also give your project a descriptive prefix or suffix.   pastedImage_4.png

Creating a new AppWizard project

After the example project has been created, the AppWizard project can now be created, as there is a location to save the project and keep the generated files. Perform the following directions to create a new AppWizard project. 

  1. First open AppWizard.  If this is the first time you have opened AppWizard, it will prompt you to create a new project, open a project, or cancel (which would simply close the application).  If so, select "Create new project".  If not, you can select File->New project.  pastedImage_9.png
  2. A dialog box with extra options will pop-up.             pastedImage_10.png
  3. Select Browse to choose a destination folder for the AppWizard generated files.  It is recommended to choose a location local to the project you just imported. This will be located in the workspace location you chose when starting MCUXpresso. pastedImage_1.png
  4. The next step is to give your AppWizard project a name.  It is recommended to choose the same name as the MCUXpresso project appended with "_AppWizard" as shown below.                                                             pastedImage_2.png
  5. Now, you can either select a BSP                     pastedImage_3.png
    • If you select a BSP, make sure you select the BSP for your board.  pastedImage_7.png
  6. Or manually select the display size and color format if the device and display you are using is not available in a predetermined BSP.   (NOTE:  If you don't select a BSP, you will need to create the Target/GUI_Lib folder manually to get this tutorial to work. The directions for this are presented later in the document.)pastedImage_4.png                                                                    The last three check-boxes are optional selections that enable SD-card support, bi-directional text support and Thai language support.  
  7. Finally, click Ok to create your new project.  pastedImage_6.png

In the newly created AppWizard project, a blank canvas will be displayed.  pastedImage_15.png

In the project folder, a new folder will be created named with the project named established in the creation of the project. 

pastedImage_9.png

In this folder, there will be the AppWizard project you created, a Simulation folder (for holding the simulation files), Source folder (for holding the source files AppWizard will create) and a Target folder (that holds BSP files and library files).  (NOTE:  The target folder will not exist if you did not select a BSP.)

pastedImage_10.png

If you did not select a BSP, manually create a Target folder in the evkbimxrt1050_emwin_serial_terminal_AppWizard folder.  Within the Target folder, create a GUI_Lib folder.  Then copy the header files from <root>/ProgramData/Segger/AppWizard_<version>/Lib/Include to the Target/GUI_Lib folder you just created.  

pastedImage_3.png

Then copy the library from <root>/ProgramData/Segger/AppWizard_<version>/Lib/GCCM4 to the Target/GUI_Lib folder you just created.  (NOTE:  You could use the library in GCCM7FP if desired, but you would need to rename the library to libGUI.a and enable floating point support. )

pastedImage_5.png


Adding a background image to your AppWizard project

Next, you will want to add a background image to your project and generate the files for use in your MCUXpresso project.  Follow these directions to add a background image to your project.

  1. Click Images on the left hand panel to bring up the Image Resource dialog box.                                                                                         pastedImage_7.png
  2. In the Image Resource dialog box, select Add.                                                       pastedImage_8.png
  3. This will allow you to select an image from anywhere on your PC. The file you will select will automatically be copied and placed in <AppWizard project root>/Resource/Image. Once you have added the images, they need to be added to the canvas. The first step to being able to add any objects (including images) to your blank canvas is to add a screen to the canvas. Drag and drop the screen icon onto the canvas to add a screen. With the screen added and selected, you should see the properties of the screen and can edit the properties if you need. pastedImage_1.png
  4. Now, add an image object to the screen, by clicking and dragging the Image icon to the screen you just added. pastedImage_4.png
  5. With the image selected, you can change the size, position, and name of the image from the window pane on the right side of the screen. Change the height and width to match that of the size of the screen and change to 0, 0.                                                                                                                pastedImage_5.png
  6. Using this control panel, click the arrow to the left of bitmap, and then click the square underneath bitmap to set the bitmap image to use for this image object.  pastedImage_6.png
  7. Clicking the square brings up the Select image dialog box. Scroll to find the image you want to use, select it, and then click Select to use it as the image.  pastedImage_9.png
  8. The image should now appear in the project as it would appear on your screen. pastedImage_10.png
  9. Finally, click File->Export and Save.  This will generate the AppWizard files necessary to program your development board. pastedImage_1.png

Modifying your MCUXpresso project settings

Once the AppWizard project files are generated, the MCUXpresso project needs to be modified to use the AppWizard files.  The MCUXpresso project should still be open from the previous directions in this document.  If not, go back and perform them to make sure the project is open. 

The following directions detail how to configure your MCUXpresso project to use the AppWizard files.  

  1. In the MCUXpresso project, first find the AppWizard project folder in the MCUXpresso Project Explorer. Right click on the folder and select Properties as shown.  pastedImage_3.png
  2. Select Settings in the C/C++ Build Category.  Ensure that "Exclude resource from build" is unchecked, and click Apply and Close.  pastedImage_6.png
  3. Next, expand the AppWizard project folder and then expand the Target folder.  Right click on the Config folder and open the Properties dialog box.  pastedImage_7.png
  4. In C/C++ Build -> Settings, be sure to check "Exclude resource from build". Then click Apply and Close.  pastedImage_10.png
  5. Repeat steps 3 and 4 for the BSP, FS_Lib, OS_Lib, SEGGER, Shared, and Simulation folders.  pastedImage_11.png
  6. Right click on the project and select properties to open the project properties dialog box.  pastedImage_12.png
  7. In the C/C++ Build -> Settings category, select MCU C Compiler -> Architecture.  Change Floating point to None as shown. pastedImage_13.png
  8. In MCU Assembler -> Architecture and Headers, change Floating point to None as shown.  pastedImage_14.png
  9. In MCU Linker-> Architecture, change Floating point to None as shown.     pastedImage_15.png
  10. Next, in MCU Linker -> Libraries, change the library to "GUI" and change the search path to the location where the library is located.  (Note that in the file system on your PC, the library will actually be named "libGUI.a".  MCUXpresso should still be set to look for GUI.  MCUXpresso will look for a file that begins with "lib" and will remove this prefix when passing this library to the linker.)   pastedImage_16.png
  11.  The final step in modifying the project settings is adding the include search paths.  Under MCU C Compiler, select includes and ensure the following paths are included
    • "${workspace_loc:/${ProjName}/evkbimxrt1050_emwin_serial_terminal_AppWizard/Target/GUI_Lib"
    • "${workspace_loc:/${ProjName}/evkbimxrt1050_emwin_serial_terminal_AppWizard/Source/Generated"
    • "${workspace_loc:/${ProjName}/evkbimxrt1050_emwin_serial_terminal_AppWizard/Source/CustomCode"
    • "${workspace_loc:/${ProjName}/evkbimxrt1050_emwin_serial_terminal_AppWizard/Target/BSP/iMXRT1052_MIMXRT1050_EVK/Setup"
    • "${workspace_loc:/${ProjName}/evkbimxrt1050_emwin_serial_terminal_AppWizard/Target/Inc"pastedImage_17.png
  12. Also be sure to remove the following paths:
    • "${workspace_loc:/${ProjName}/emwin/emWin_Config
    • "${workspace_loc:/${ProjName}/emwin/emWin_header

Modifying the project source

After modifying the project properties, there are source file changes that need to be made since the original source was not intended to be used with AppWizard. Here are the source changes that need to be made to get you going. 

  1. Add APPW_X_NoFS.c to the project by simply copying this file into the Source folder in the file system on your PC. (Note that the APPW_X_NoFS.c file can be downloaded from the NXP emWin Libraries download tab.) pastedImage_1.png
  2. In the main source file, emwin_serial_terminal.c, comment out or delete everything underneath BOARD_InitLcd() as shown below.  pastedImage_2.png
  3. Just underneath BOARD_InitLcd(), insert a call to MainTask() as shown.  pastedImage_3.png
  4. Finally, open emwin_support.h (found in the board folder), change the LCD_BITS_PER_PIXEL to 32.  If you keep the default to 8, the background image will be loaded into the frame buffer because of how LCD_X_DisplayDriver was written.  pastedImage_4.png

Conclusion

That's it for how to create a new project in AppWizard and how to add a background image. At this point, you should be able to compile and download your project to the target board. You should know how to import a simple SDK example to use as a template, create a new AppWizard project, add a screen and image to this project, modify the template project to use the AppWizard project source files and library, and how to modify the source to use the new AppWizard project.  

Labels (1)
Version history
Revision #:
1 of 1
Last update:
‎04-08-2020 04:57 PM
Updated by: