Import Touch Project into IAR Embedded Workbench

Last modified by Microchip on 2023/11/09 08:55

Objective

This article provides information on importing a QTouch® project generated from START to IAR Embedded Workbench.

Materials

Software Tools

Procedure

Create a QTouch Project

Go to START and create your QTouch project. Detailed information on how to create a QTouch project in START can be found on the "Generate User Board Touch Project" page.


Export

Once you've configured your project and are ready to export, ensure that the IAR Embedded Workbench option is selected. In this example, the project name is qt5_atmega324pb_xpro. We will be referencing this project throughout the rest of the step-by-step instructions on this page.

Screenshot of the Export Project dialog box on Atmel START with IAR Embedded Workbench selected

Download the pack to the desired folder by clicking on the DOWNLOAD PACK button. By default, it downloads to C:\Users\user-name\Downloads.


Rename Pack

Rename the downloaded package from qt5_atmega324pb_xpro.atzip to qt5_atmega324pb_xpro.zip.

Screenshot of changing the .atzip file suffix to .zip in Windows File Explorer


Extract

Create a new folder and name it qt5_atmega324pb_xpro. Then, extract the contents of qt5_atmega324pb_xpro.zip to this new folder.


Create New Project

Open IAR Embedded Workbench. In the top menu, select Project > Create New Project.

Screenshot of Creating New Project in IAR EW from the menu bar by clicking 'Project>Create New Project'


Empty Project

Create an 'Empty Project' for the AVR® toolchain.

Screenshot of Create New Project window with 'AVR' in the toolchain box and 'Empty' for the project template


Name the Project

Browse for the qt5_atmega324pb_xpro folder created in Step 4 and give this newly created project a name. The project will then be created and displayed in workspace.

Newly created project in IAR Embedded Workbench


Add Connections

Select Project > Add Project Connection and select 'IAR Project Connection' in the subsequent window.

Add Project Connections dialog box with IAR Project Connection selected


Connection File

Look for the iar-project-connection.ipcf file inside the qt5_atmega324pb_xpro folder and click Open. You may ignore any warning that appears.


Source Files

The source files generated from START will be added to the IAR project file.

Source files added to project in Step 9 show up in the 'Files' pane of IAR EW


General Options

Select Project > Options.

Screenshot of 'Project>Options' selection in IAR EW

In 'General Options' select the 'Normal DLIB' option in the 'Library Configuration' tab.

'Normal DLIB' selected in 'General Options/Library' tab of Project Options window


Stack Memory

The stack memory set by default is not sufficient. Select the 'System' tab and update the stack size as shown below.

Setting the Stack sizes in 'General Options/System' tab of Project Options window


Output Format

Change the output format as follows:

  • Select Linker > Output.
  • Click on the Override default box and change the output file extension to .hex.
  • Under 'Format', select 'Others' and select 'intel-extended' from the drop-down menu.
  • Click OK.

Setting output mode to 'Other>intel-extended' in 'Linker/Output' tab of Project Options Window


Initialization Code

By default, only the initialization code is called in main() as shown below.

1
2
3
4
5
6
7
8
9
10
int main(void)
{
   /* Initializes MCU, drivers and middleware */
    atmel_start_init();

   while (1)
    {
   /* Replace with your application code */
    }
}

Modify main()

Modify the content of main.c as follows.
Include touch_example.h file at the top of the main file after inclusion of atmel_start.h file as #include "touch_example.h".

1
2
3
4
5
6
7
8
9
10
11
12
#include "touch_example.h"

int main(void)
{
   /* Initializes MCU, drivers and middleware */
    atmel_start_init();

   while (1)
    {
        touch_example();
    }
}

Note: An example on using the touch APIs and getting touch sensor state is given in touch_example.c file.


Build Project

The project is ready to be built and tested. Press F7 to build the project. If IAR Embedded Workbench asks you to save the workspace, give it a name and then click Save. The built .hex can be found in the ..\Debug\Exe\ project folder.

Back to Top