The ATSAML11 is an Arm® Cortex®-M23 based MCU featuring Arm TrustZone® technology which provides additional security features. SAML11 flash can be partitioned as secure vs non-secure. The touch library can reside in either the secure flash area or the non-secure flash area. Even if the touch library has to reside and run from a non-secure flash area, the device still needs to boot up in the secure flash area and then the program execution will jump into a non-secure flash area.
SAM L11 Projects classification with respect to the security features is provided below.
- Non-Secure Project - By default, a SAM L11 project created in START comes without the TrustZone Manager middleware and it is considered a non-secure project. To import a non-secure project to the IDE, a secure linker script, a library, and a header file needs to be added.
- Secure Project - Add the TrustZone Manager middleware in START to convert a non-secure project to a secure project and then configure the TrustZone settings.
Objective
The following lab shows you how to create ATSAML11 QTouch® secure and non-secure projects in START, and import them into Atmel Studio. This project is generated for the ATSAML11 Xplained Pro along with the QT7 Xplained Pro Extension Kit.
Materials
Hardware Tools
Tool | About | Purchase |
---|---|---|
ATSAML11E16
ATSAML11E16 |
| |
ATSAML11E16
XplainedPro |
| |
QT7 Xplained Pro
Extension Kit |
| |
Software Tools
Tool | About | Installers |
Installation
Instructions |
||
---|---|---|---|---|---|
Windows | Linux | Mac OSX | |||
Atmel® Studio
Integrated Development Environment |
| | | | |
Atmel® START (ASF4)
Integrated Software Framework |
| Web Based |
Procedure
1
Go to http://start.atmel.com and click on the CREATE NEW PROJECT button.
2
Start typing saml11e in the Filter on device… box. Select 'ATSAML11E16A-A' and then:
a
Add the QTouch middleware.
b
Add the TrustZone Manager middleware for a Secure Project. Do not add the TrustZone middleware for Non-Secure Project.
c
Click on CREATE NEW PROJECT.
Additional secure elements such as trustzone_veneer.h, linker file, and libsecure_gateway_veneer.lib are to be linked from the secure project during non-secure project import to Atmel Studio.
3
After project creation, the project dashboard will open as follows. Click on TRUSTZONE_MANAGER_0 to configure the TrustZone settings.
Configure the TrustZone Manager settings as shown in the figure below.
The SERCOM1 fuse has to be checked in the TrustZone settings in order to configure PA18 and PA19 as touch lines. In addition, secure and non-secure stacks and other peripherals are to be configured either as secure or non-secure depending on your application.
Refer to the following SAML11E16 Xplained Pro EXT1 header and QT7 Xplained Pro documents for connection details.
Based on the design files, the Y lines should be selected as follows:
4
Refer to the link below to add buttons, slider sensors, configure the driven shield, debug pins, and generate the project from START as per the SAM11LE16 and QT7 design files.
SAML11 Non-Secure Project Import and Creation in Atmel Studio
1
First, download the 'QTouch SAM L11 Trustzone Settings Example Project' by clicking on 'BROWSE EXAMPLES' in http://start.atmel.com.
Note: You can set the peripherals needed for a Non-Secure project as non-secure in this step. All you have to do is select the 'QTouch SAM L11 Trustzone Project', click 'OPEN SELECTED EXAMPLE' in START and change the settings in the TrustZone Manager prior to downloading the example project.
3
The peripherals needed for a Non-Secure QTouch project can also be configured as non-secure by setting them as 1 in the trustzone_config.h file in the QTouch SAML11 Trustzone Project after downloading it. The list of the peripherals to be configured as non-secure for a QTouch project is given below. Other peripherals can also be configured in the trustzone_config.h file as needed in your application.
- PTC
- RTC
- PORT
- SERCOM used for UART (Data Visualizer Interface)
- SERCOM1 (Linked with XY14 (PA18) and XY15 (PA19)
8
Build the L11-Non-Secure project and keep it aside. Now both projects have been created and built.
SAML11 Non-Secure Project Device Programming
Program Mode
2
5
Now the device is ready with the QTouch code. Open the Data Visualizer, browse the scripts and connect it to see the touch status.
Note: These fuse settings are applicable only to this QTouch project with its required peripherals. These settings may vary if additional peripherals/other configurations are added.
SAM L11 Secure Project Import and Creation in Atmel Studio
1
Open Atmel Studio and now import the SAM L11 Secure QTouch Project (with TrustZone) generated from START.
2
Atmel Studio will not ask for any additional files while importing a secure project and the project will be created as usual in a standard procedure.
3
Now TrustZone is part of the QTouch project itself as marked below.
4
You can debug or program the Secure QTouch project generated hex file to the SAML11 as usual in a standard procedure.
Note: 'USER_WORD_6.NONSECC_SERCOM1' fuse has to be checked (ticked) in the fuse settings after flashing the hex file to the device in program mode in order to enable XY14 (PA18) and XY15 (PA19) as touchlines.
Results
SAML11 Secure and Non-Secure projects were generated from START, created projects by importing to Atmel Studio, and programmed successfully.