Accessing Serial Flash Using SPI Interface-Libero and IAR Flow Tutorial for SmartFusion2

Accessing Serial Flash Memory Using SPI
Interface
Su
pe
rs
ed
ed
Libero SoC and IAR Embedded Workbench Flow
Tutorial for SmartFusion2 SoC FPGA
Accessing Serial Flash Memory Using SPI Interface Libero SoC and IAR Embedded Workbench Flow Tutorial for
SmartFusion2 SoC FPGA
Table of Contents
Accessing Serial Flash Memory using SPI Interface - Libero SoC and IAR Embedded Workbench Flow
Tutorial for SmartFusion2 SoC FPGA . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
ed
ed
Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
Tutorial Requirements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
Associated Project Files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
Target Board . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
Design Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
Step 1: Creating a Libero SoC Project . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
Launching Libero SoC . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
Connecting Components in SPI_Flash_top SmartDesign . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
Configuring and Generating Firmware . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
Step 2: Generating the Program File . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
Step 3: Programming the SmartFusion2 Board Using FlashPro . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
Step 4: Building the Software Application using IAR Embedded Workbench . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
Step 5: Configuring Serial Terminal Emulation Program . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35
Step 6: Debugging the Application Project using IAR Workbench . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37
Conclusion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43
Appendix A - Board Setup for Programming the Tutorial . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44
rs
Appendix B- Board Setup for Running the IAR Tutorial . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45
Appendix C - SmartFusion2 Development Kit Board Jumper Locations . . . . . . . . . . . . . . . . . . . . . . . . . 46
pe
Product Support . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47
Su
Customer Service . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Customer Technical Support Center . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Technical Support . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Website . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Contacting the Customer Technical Support Center . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Email . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
My Cases . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Outside the U.S. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
ITAR Technical Support . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Revision 1
47
47
47
47
47
47
48
48
48
2
Accessing Serial Flash Memory using SPI Interface
- Libero SoC and IAR Embedded Workbench Flow
Tutorial for SmartFusion2 SoC FPGA
Introduction
ed
ed
The Libero® System-on-Chip (SoC) software generates firmware projects using IAR, Keil, and
SoftConsole tools. This tutorial describes the process to build an IAR application that can be
implemented and validated using the SmartFusion®2 system-on-chip (SoC) field programmable gate
array (FPGA) Development Kit.
The same firmware project can be built using SoftConsole and Keil tools. Refer to the respective tutorials
(links given below):
•
Accessing Serial Flash Memory using SPI Interface - Libero SoC and SoftConsole Flow Tutorial
for SmartFusion2 SoC FPGA
•
Accessing Serial Flash Memory Using SPI Interface - Libero SoC and Keil uVision Flow Tutorial
for SmartFusion2 SoC FPGA
After completing this tutorial, you will be able to perform the following tasks:
Create a Libero SoC project using System Builder
•
Generate the programming file to program the SmartFusion2 device
•
Open the project in IAR Embedded Workbench from Libero SoC
•
Compile application code
•
Debug and run code using IAR Embedded Workbench
rs
•
pe
Tutorial Requirements
Table 1 • Reference Design Requirements and Details
Reference Design Requirements and Details
Description
Hardware Requirements
•
SmartFusion2 Development Kit
Rev C or later
Su
– FlashPro4 programmer
– J-Link programmer
– USB A to Micro-B cable
– 12 V adapter
Host PC or Laptop
Any 64-bit Windows Operating System
Software Requirements
Libero SoC
•
11.3
FlashPro programming software v11.3
IAR Embedded Workbench for ARM
6.40
Revision 1
3
Accessing Serial Flash Memory using SPI Interface - Libero SoC and IAR Embedded Workbench Flow Tutorial for
SmartFusion2 SoC FPGA
Table 1 • Reference Design Requirements and Details (continued)
Reference Design Requirements and Details
Description
USB to UART drivers
-
One of the following serial terminal emulation programs:
-
•
HyperTerminal
•
TeraTerm
•
PuTTY
Associated Project Files
The demo design files include:
•
Libero project
•
Programming files
•
Source files
•
Flash drivers
•
Readme file
ed
ed
Download the associated project files for this tutorial from the Microsemi® website:
www.microsemi.com/soc/download/rsc/?f=SF2_SPI_Flash_IAR_Tutorial_DF
Refer to the Readme.txt file provided in the design files for the complete directory structure.
Target Board
Design Overview
rs
SmartFusion2 Development Kit board (SF2_DEV_KIT) Rev C (or later).
pe
This design example demonstrates the execution of basic read and write operations on the SPI flash
present on the SmartFusion2 Development Kit board. This kit has a built-in Atmel SPI flash memory
AT25DF641, which is connected to the SmartFusion2 microcontroller subsystem (MSS) through
dedicated MSS SPI_0 interface. The SPI flash memory transfers are performed using the peripheral
direct memory access (PDMA).
Read and write data information is displayed using HyperTerminal which communicates to the
SmartFusion2 MSS using the MMUART_1 interface.
Su
For more information on SPI, refer to the SmartFusion2 Microcontroller Subsystem User Guide.
4
R e vi s i o n 1
Step 1: Creating a Libero SoC Project
Figure 1 shows interfacing the external SPI flash to MSS SPI_0.
6PDUW)XVLRQ
066
WH[W
63,BB&/.
63,BB662
63,BB',
6,
6&.
&6
62
([WHUQDO)ODVK
0HPRU\
ed
ed
008$57BB5;'
63,B
+\SHU7HUPLQDO
63,BB'2
008$57B
+RVW3&
008$57BB7;'
)DEULF
Figure 1 • SPI Flash Interfacing Block Diagram
Step 1: Creating a Libero SoC Project
Launching Libero SoC
rs
1. Click Start > Programs > Microsemi Libero SoC v11.3 > Libero SoC v11.3, or click the shortcut
on desktop to open the Libero SoC v11.3 Project Manager.
Su
pe
2. Create a new project by selecting New on the Start Page tab (highlighted in Figure 2), or by
clicking Project > New Project from the Libero SoC menu.
Figure 2 • Libero SoC Project Manager
Revision 1
5
Accessing Serial Flash Memory using SPI Interface - Libero SoC and IAR Embedded Workbench Flow Tutorial for
SmartFusion2 SoC FPGA
3. Enter the information as required for the new project and the device in the New Project dialog
box as shown in Figure 3.
–
Project
- Name: SPI_Flash
- Location: Select an appropriate location (for example, D:/Microsemi_prj)
- Preferred HDL type: Verilog
–
Device (select the following values using the drop-down list provided):
- Family: SmartFusion2
- Die: M2S050T
- Package: 896 FBGA
- Core Voltage: 1.2
Operating conditions: COM
Su
pe
rs
–
ed
ed
- Speed: STD
6
R e vi s i o n 1
Step 1: Creating a Libero SoC Project
Su
pe
rs
ed
ed
4. Check the Use Design Tool check box and select Use System Builder in the Design
Templates and Creators section of the New Project window as shown in Figure 3.
Figure 3 • New Project Dialog Box
Note: System Builder is a graphical design wizard. It creates a design based on high-level design
specifications by taking the user through a set of high-level questions that will define the intended
system.
Revision 1
7
Accessing Serial Flash Memory using SPI Interface - Libero SoC and IAR Embedded Workbench Flow Tutorial for
SmartFusion2 SoC FPGA
5. Clicking Edit Tool Profiles (highlighted in Figure 3 on page 7) displays the Tool Profiles window
as shown in Figure 4. Check the following tool settings:
Software IDE: IAR
–
Synthesis: Synplify Pro ME I-2013.09M-SP1
–
Simulation: ModelSim ME 10.2c
–
Programming: FlashPro 11.3
Figure 4 • Tool Profiles
rs
ed
ed
–
6. Click OK on the Tool Profiles window.
pe
7. Click OK on the New Project window. This displays the System Builder dialog box.
Su
8. Enter a name for your system, enter SPI_Flash as the name of the system and click OK. The
System Builder dialog box is displayed with the Device Features page open by default, as
shown in Figure 5.
Figure 5 • Create New System Builder Dialog Box
8
R e vi s i o n 1
Step 1: Creating a Libero SoC Project
rs
ed
ed
9. In the System Builder – Device Features page, check the Peripheral DMA check box under
Microcontroller Options as shown in Figure 6.
Su
pe
Figure 6 • System Builder – Device Features Page
Revision 1
9
Accessing Serial Flash Memory using SPI Interface - Libero SoC and IAR Embedded Workbench Flow Tutorial for
SmartFusion2 SoC FPGA
pe
rs
ed
ed
10. Click Next. The System Builder – Peripherals page is displayed. Under the MSS Peripherals
section, uncheck all the check boxes except MM_UART_1 and MSS_SPI_0, as shown in
Figure 7.
Su
Figure 7 • System Builder Configurator – Peripherals Page
10
R e visio n 1
Step 1: Creating a Libero SoC Project
rs
ed
ed
11. Configure MMUART_1 for Fabric by clicking on the MM_UART_1 configurator highlighted as
shown in Figure 8.
pe
Figure 8 • System Builder – Peripherals Page
Su
12. In the MM_UART_1 configurator window, select Fabric from the Connect To drop-down list, as
shown in Figure 9.
Revision 1
11
rs
ed
ed
Accessing Serial Flash Memory using SPI Interface - Libero SoC and IAR Embedded Workbench Flow Tutorial for
SmartFusion2 SoC FPGA
Su
pe
Figure 9 • Configuring MM_UART_1
12
R e visio n 1
Step 1: Creating a Libero SoC Project
rs
ed
ed
13. Click Next. The System Builder – Clocks page is displayed, as shown in Figure 10. Select
System Clock source as On-chip 25/50 MHz RC Oscillator. The M3_CLK is configured to
100 MHz by default.
pe
Figure 10 • System Builder – Clocks Page
14. Click Next. The System Builder – Microcontroller page is displayed. Leave all the default
selections.
15. Click Next. The System Builder – SECDED page is displayed. Leave all the default selections.
16. Click Next. The System Builder – Security page is displayed. Leave all the default selections.
17. Click Next. The System Builder – Interrupts page is displayed. Leave all the default selections.
Su
18. Click Next. The System Builder – Memory Map page is displayed. Leave all the default
selections.
19. Click Finish.
Revision 1
13
Accessing Serial Flash Memory using SPI Interface - Libero SoC and IAR Embedded Workbench Flow Tutorial for
SmartFusion2 SoC FPGA
ed
ed
The System Builder generates the system based on the selected options. The System Builder
block is created and added to the Libero SoC project automatically, as shown in Figure 11.
Figure 11 • System Builder Generated System
Connecting Components in SPI_Flash_top SmartDesign
Perform the following steps to connect the SmartDesign components:
1. Right-click FAB_RESET_N and select Tie High.
2. Right-click POWER_ON_RESET_N and select Mark Unused.
3. Right-click MSS_READY and select Mark Unused.
4. Right-click MMUART_1_FABRIC and select Promote to Top Level.
5. Expand INIT_PINS, right-click INIT_DONE and select Mark Unused.
6. Expand FAB_CCC_PINS, right-click FAB_CCC_GL0 and select Mark Unused.
pe
rs
7. Click File > Save. The SPI_Flash_top design is displayed as shown in Figure 12.
Su
Figure 12 • SPI_Flash_top Design
Configuring and Generating Firmware
The Design Firmware window displays compatible firmware drivers based on peripherals configured in
the design. Following drivers are used in this tutorial:
•
CMSIS
•
MMUART
•
PDMA
•
SPI
1. To generate the required drivers, click Design > Configure Firmware and uncheck all drivers
except CMSIS, MMUART, PDMA, and SPI as shown in Figure 13.
14
R e visio n 1
Step 1: Creating a Libero SoC Project
Figure 13 • Configuring Firmware
ed
ed
Note:Select the latest version of the drivers.
rs
2. From the SPI_Flash_top tab, click Generate Component, as shown in Figure 14.
Figure 14 • Generate Component
Su
pe
If the design is generated without any errors, a message, ’SPI_Flash_top’ was generated is
displayed on the Libero SoC Log window as shown in Figure 15.
Figure 15 • Log Window
Revision 1
15
Accessing Serial Flash Memory using SPI Interface - Libero SoC and IAR Embedded Workbench Flow Tutorial for
SmartFusion2 SoC FPGA
Step 2: Generating the Program File
pe
rs
ed
ed
1. Double-click I/O Constraints in the Design Flow window as shown in Figure 16. The I/O Editor
window is displayed after completing Synthesize and Compile.
Figure 16 • I/O Constraints
2. In the I/O Editor window, make the pin assignments as shown in Table 2.
Table 2 • Port to Pin Mapping
Port Name
MMUART_1_RXD_F2M
R29
MMUART_1_TXD_M2F
R24
Su
16
Pin Number
R e visio n 1
Step 3: Programming the SmartFusion2 Board Using FlashPro
ed
ed
These pin assignments are for connecting MMUART_1 ports TX and RX to the mini-B USB
through fabric I/Os. After the pins are assigned, the I/O Editor window is displayed as shown in
Figure 17.
Figure 17 • I/O Editor
3. After updating the I/O Editor, click Commit and Check.
rs
4. Close the I/O Editor window.
pe
5. Click Generate Programming Data as shown in Figure 18 to complete place-and-route and
generate the programming file.
Su
Figure 18 • Generate Programming Data
Step 3: Programming the SmartFusion2 Board Using
FlashPro
1. Connect the FlashPro4 programmer to the J59 connector of the SmartFusion2 Development Kit.
2. Connect the jumpers on the SmartFusion2 Development Kit board as listed in Table 3 on
page 18.
For more information on jumper locations, refer Appendix C - SmartFusion2 Development Kit
Board Jumper Locations.
CAUTION: While making the jumper connections, the SW7 power supply switch on the board
must be in OFF position.
Revision 1
17
Accessing Serial Flash Memory using SPI Interface - Libero SoC and IAR Embedded Workbench Flow Tutorial for
SmartFusion2 SoC FPGA
Table 3 • SmartFusion2 Development Kit Jumper Settings
Jumper Number
Settings
Notes
J70, J93, J94, J117,
J123, J142, J157, J160,
J167, J225, J226, J227
1-2 closed
J2
1-3 closed
J23
2-3 closed
J121,J110,J119,J118
1-2 closed
These are the default jumper settings of the Development
Kit. Ensure that these jumpers are set properly.
To connect the SmartFusion2 SPI0 to the external flash.
3. Connect the power supply to the J18 connector.
ed
ed
4. Switch ON the SW7 power supply switch.
Refer to Appendix A - Board Setup for Programming the Tutorial for information on board setup
for running the tutorial.
Su
pe
rs
5. To program the SmartFusion2 device, double-click Run PROGRAM Action in the Design Flow
window as shown in Figure 19.
Figure 19 • Run Programming Action
After successful programming, the SmartFusion2 Development Kit is ready for running and
debugging the IAR Embedded Workbench application through J-Link Debugger.
18
R e visio n 1
Step 4: Building the Software Application using IAR Embedded Workbench
Step 4: Building the Software Application using IAR
Embedded Workbench
1. Connect the J-Link programmer to J34 connector of SmartFusion2 Development Kit.
Refer to "Appendix B- Board Setup for Running the IAR Tutorial" on page 45 for information on
the board setup for running and debugging the IAR software application.
Make sure that the SmartFusion2 Development Kit Jumper J93 is in 2-3 closed position for IAR
Embedded Workbench and J-Link communication.
Su
pe
rs
ed
ed
2. Open the IAR project by double-clicking Write Application Code under Develop Firmware in the
Design Flow window as shown in Figure 20.
Figure 20 • Invoking IAR Embedded Workbench from the Libero SoC Software
Revision 1
19
Accessing Serial Flash Memory using SPI Interface - Libero SoC and IAR Embedded Workbench Flow Tutorial for
SmartFusion2 SoC FPGA
Figure 21 • IAR Workspace
rs
ed
ed
The IAR workspace is displayed, as shown in Figure 21.
pe
3. Browse to the main.c file location in the design files folder:
<download folder>\SF2_SPI_Flash_IAR_Tutorial_DF\SourceFiles.
Su
4. Copy the main.c file and replace the existing main.c file under SPI_Flash_MSS_CM3_app
project in the IAR workspace.
20
R e visio n 1
Step 4: Building the Software Application using IAR Embedded Workbench
rs
ed
ed
The IAR window displays the main.c file, as shown in Figure 22.
Figure 22 • IAR Workspace main.c file
pe
5. at25df641 SPI flash drivers are not included in the Libero generated IAR workspace. To include
the drivers in the IAR workspace, browse to the location of the at25df641 drivers in the design
files folder: <download_folder>\SF2_SPI_Flash_IAR_Tutorial_DF\SPI_Flash_Drivers.
Su
6. Copy the at25df641 folder to the drivers folder of SPI_Flash_MSS_CM3_hw_platform project in
the IAR workspace: projectdirectory\IAR\drivers.
Revision 1
21
Accessing Serial Flash Memory using SPI Interface - Libero SoC and IAR Embedded Workbench Flow Tutorial for
SmartFusion2 SoC FPGA
rs
ed
ed
7. Right-click and add the driver files (at25df641.c and at25df641.h) to the
SPI_Flash_MSS_CM3_hw_platform project in the IAR workspace as shown in Figure 23.
Su
pe
Figure 23 • IAR Workspace Window - Add at25df641 SPI Driver Files
22
R e visio n 1
Step 4: Building the Software Application using IAR Embedded Workbench
rs
ed
ed
Figure 24 shows the IAR workspace window displaying at25df641 SPI Driver Files.
Su
pe
Figure 24 • IAR Workspace Window - Display at25df641 SPI Driver Files
Revision 1
23
Accessing Serial Flash Memory using SPI Interface - Libero SoC and IAR Embedded Workbench Flow Tutorial for
SmartFusion2 SoC FPGA
rs
ed
ed
8. To configure the project, right-click the project name (SPI_Flash_MSS_CM3_hw_platform) and
click Options as shown in Figure 25.
Figure 25 • IAR Workspace Window - Choose Options
pe
This tutorial uses printf statements to display memory read data. Redirection of the output of
printf() to a UART is enabled by adding the MICROSEMI_STDIO_THRU_UART symbol.
9.
In Options window, click C/C ++ Compiler.
Su
10. Click Preprocessor tab.
24
R e visio n 1
Step 4: Building the Software Application using IAR Embedded Workbench
rs
ed
ed
11. Under Defined symbols enter MICROSEMI_STDIO_THRU_UART and click OK, as shown in
Figure 26.
Su
pe
Figure 26 • IAR Workspace Window - Adding Symbol
Revision 1
25
Accessing Serial Flash Memory using SPI Interface - Libero SoC and IAR Embedded Workbench Flow Tutorial for
SmartFusion2 SoC FPGA
rs
ed
ed
12. To configure the project, right-click the project name (SPI_Flash_MSS_CM3_app) and click
Options as shown in Figure 27.
Su
pe
Figure 27 • IAR Workspace Window - Choose Options
26
R e visio n 1
Step 4: Building the Software Application using IAR Embedded Workbench
Figure 28 • IAR Node Options
rs
ed
ed
13. The Options for node SPI_Flash_MSS_CM3_app window is displayed as shown in Figure 28.
Su
pe
14. Click Debugger. Under the Setup tab, select J-Link/J-Trace from the Driver the drop-down list
(refer to Figure 29).
Revision 1
27
ed
ed
Accessing Serial Flash Memory using SPI Interface - Libero SoC and IAR Embedded Workbench Flow Tutorial for
SmartFusion2 SoC FPGA
Figure 29 • IAR Debugger Options - Selecting Driver
Su
pe
rs
15. Click Download tab and select the Verify download check box as shown in Figure 30.
Figure 30 • IAR Debugger Options - Download
16. Click OK to close the Options window and build the project.
28
R e visio n 1
Step 4: Building the Software Application using IAR Embedded Workbench
rs
ed
ed
17. Right-click on SPI_Flash_MSS_CM3_hw_platform - Debug and select Make as shown in
(Figure 31 and Figure 32 on page 30).
Su
pe
Figure 31 • IAR Workspace - Hardware Platform Code Compilation using Make
Revision 1
29
rs
ed
ed
Accessing Serial Flash Memory using SPI Interface - Libero SoC and IAR Embedded Workbench Flow Tutorial for
SmartFusion2 SoC FPGA
Su
pe
Figure 32 • IAR Workspace - Successful Hardware Platform Code Compilation using Make
30
R e visio n 1
Step 4: Building the Software Application using IAR Embedded Workbench
rs
ed
ed
18. Right-click on the SPI_Flash_MSS_CM3_app - Debug project name and select Set as Active as
shown in Figure 33.
Su
pe
Figure 33 • IAR Workspace - SPI_Flash_MSS_CM3_app Set as Active
Revision 1
31
Accessing Serial Flash Memory using SPI Interface - Libero SoC and IAR Embedded Workbench Flow Tutorial for
SmartFusion2 SoC FPGA
rs
ed
ed
19. Right-click on the SPI_Flash_MSS_CM3_app - Debug project name and select Clean as shown
in Figure 34.
Su
pe
Figure 34 • IAR Workspace - Execute Clean on SPI_Flash_MSS_CM3_app Project
32
R e visio n 1
Step 4: Building the Software Application using IAR Embedded Workbench
rs
ed
ed
20. After cleaning the project, the Messages log section shows that some files are deleted as shown
in Figure 35.
Su
pe
Figure 35 • IAR Workspace - Deleted Files
Revision 1
33
Accessing Serial Flash Memory using SPI Interface - Libero SoC and IAR Embedded Workbench Flow Tutorial for
SmartFusion2 SoC FPGA
rs
ed
ed
21. Right-click on the SPI_Flash_MSS_CM3_app - Debug project name and click Rebuild All as
shown in Figure 36.
Su
pe
Figure 36 • IAR Workspace - Select Rebuild All
34
R e visio n 1
rs
ed
ed
Step 5: Configuring Serial Terminal Emulation Program
Figure 37 • IAR Workspace - Rebuild All
Step 5: Configuring Serial Terminal Emulation Program
Su
pe
1. Install the USB driver. For serial terminal communication through the FTDI mini USB cable, install
the FTDI D2XX driver. Download the drivers and the installation guide from:
www.microsemi.com/soc/documents/CDM_2.08.24_WHQL_Certified.zip.
Revision 1
35
Accessing Serial Flash Memory using SPI Interface - Libero SoC and IAR Embedded Workbench Flow Tutorial for
SmartFusion2 SoC FPGA
rs
ed
ed
2. Connect the host PC to the J24 connector using the USB Mini-B cable. The USB to UART bridge
drivers are automatically detected. Of the four COM ports, select the one with Location as on
USB Serial Converter D. Figure 38 shows an example Device Manager window.
Figure 38 • Device Manager Window
pe
3. Start the HyperTerminal session. If the HyperTerminal program is not available in the computer,
any free serial terminal emulation program such as PuTTY or TeraTerm can be used. Refer to the
Configuring Serial Terminal Emulation Programs Tutorial for configuring the HyperTerminal,
TeraTerm, or PuTTY.
The HyperTerminal settings are as follows:
57,600 baud rate
–
8 data bits
–
1 stop bit
Su
–
36
–
No parity
–
No flow control
R e visio n 1
Step 6: Debugging the Application Project using IAR Workbench
Step 6: Debugging the Application Project using IAR
Workbench
pe
Figure 39 • Debug Window
rs
ed
ed
1. Switch to SPI_Flash_MSS_CM3_app - Debug tab from Overview tab as shown in Figure 39.
Su
2. In the IAR Workbench, click Download and Debug as shown in Figure 40.
Figure 40 • IAR Workbench - Download and Debug Option
Revision 1
37
Accessing Serial Flash Memory using SPI Interface - Libero SoC and IAR Embedded Workbench Flow Tutorial for
SmartFusion2 SoC FPGA
rs
ed
ed
IAR Debugger Perspective window is opened, as shown in Figure 41.
Figure 41 • IAR Workbench - Debugger Perspective
pe
3. Click Go on IAR workbench to run the application as shown in Figure 42.
Su
Figure 42 • IAR Workbench - Go Option
38
R e visio n 1
Step 6: Debugging the Application Project using IAR Workbench
rs
ed
ed
4. On successful operation, the HyperTerminal window displays a message as Read Data From
Flash as shown in Figure 43.
Su
pe
Figure 43 • HyperTerminal Window
Revision 1
39
Accessing Serial Flash Memory using SPI Interface - Libero SoC and IAR Embedded Workbench Flow Tutorial for
SmartFusion2 SoC FPGA
rs
ed
ed
5. Click View > Register to view the values of the ARM® Cortex™-M3 processor internal registers
as shown in Figure 44.
Su
pe
Figure 44 • Values of the Cortex-M3 Internal Registers
40
R e visio n 1
Step 6: Debugging the Application Project using IAR Workbench
rs
ed
ed
6. Click View > Statics to view the values of variables in the source code as shown in Figure 45.
Su
pe
Figure 45 • Values of the Source Code Variables
Revision 1
41
Accessing Serial Flash Memory using SPI Interface - Libero SoC and IAR Embedded Workbench Flow Tutorial for
SmartFusion2 SoC FPGA
rs
ed
ed
7. Click View > Disassembly to view the values of variables in the source code as shown in
Figure 46.
Figure 46 • Assembly Level Instructions
Su
pe
8. When debug process is finished, terminate execution of the code by choosing Debug > Stop
Debugging as shown in Figure 47.
Figure 47 • IAR Workbench - Stop Debugging Option
42
R e visio n 1
Conclusion
rs
ed
ed
9. The Step Level Debugging can be performed before running the application using Go. These can
be accessed from the Debug menu or on the IAR workbench as shown in Figure 48:
Figure 48 • IAR Workbench - Step Level Debugging
Source code can be single-stepped by selecting from the Debug menu Debug > Step Into,
Debug > Step Out, Debug > Step Over or selecting the respective options from the IAR
workbench as shown in Figure 48. Observe the changes in the source code window and
Disassembly view. Performing a Step Over provides an option for stepping over functions.
The entire function is run but there is no need to single-step through each instruction
contained in the function.
pe
–
10. Close Debug Perspective by selecting Close Perspective from the Window menu.
Su
11. Close IAR Embedded Workbench using File > Exit.
12. Close the HyperTerminal using File > Exit.
Conclusion
This tutorial provides steps to create a Libero SoC design using the System Builder. It describes the
procedure to build, debug, and run an IAR Embedded Workbench application. It also provides a simple
design to access the SPI flash.
Revision 1
43
Appendix A - Board Setup for Programming the
Tutorial
Su
pe
rs
ed
ed
Figure 1 shows the board setup for programming the tutorial on the SmartFusion2 Development Kit
board.
Figure 1 • SmartFusion2 Development Kit Setup
Revision 1
44
Appendix B- Board Setup for Running the IAR
Tutorial
Su
pe
rs
ed
ed
Figure 1 shows the board setup for running and debugging the tutorial on the SmartFusion2
Development Kit board.
Figure 1 • SmartFusion2 Development Kit J-Link Programmer Connection
Revision 1
45
Appendix C - SmartFusion2 Development Kit Board
Jumper Locations
B11
B14
J1
R26
C7
R24
R23
R21
R22
D5
D6
3
C42
6
AT FLAG
DS10
R55
R36
R56
DS11 PGOOD
R52
R35
OFF
J103
C44
SC1
U15 R104
L5
C58
C61
SC2
D11
DS22
C84
GND
T2
J112
1
R170
Q18
DS25
J116
1
J132
R189
C105
U37
GND
L10
RXP0
RXN0
TXP2
TXN2
TXP1
TXN1
RXN1
RXP1
TXP3
TXN3
C119
C120
C121
TXN0
J171
C134
J150
J148
J149
J169
R243
J186 J182
J191
RXN2
RXP2
RXN3
RXP3
D14
J190
J189
J192
TP25
TS_MDIO
TS_MDC
J170
R219
J156
J166
J168
U45 R220
R221
J147
J151
C128
C129
C130
C131
R242
1 R247
J185
R238
R239
R240
R241
C152
C153
R278
R279
R244
1P0V_PHY
Q24
Q25
Q26
Q27
1
DDR3_1P5V
TP21 R354
R355
D18
R365 C204
R366
D20
TP20
J208
J207
U61
D17
C200 C202
DVDD12
R375
D15
R350
TP24
C198
D16
R339
R346
TP12
U59
R338
C186
R353
J229
1
GND
R325
2P5V_LDO
U60
R356 C189
LED8
R383
Q23
R381
R380
Q22
R382
R378
R379
Q21
R326
C191
J220
J219
J228
Q20
J206
J205
R312
C68
SC3
SC4
R123
R130
U20
C71
R131
R150
R151
R152
R157R153
R154
C78
C79
R158R155
J80
1
U33
TXP0
SERDES1
REFCLK0_N
LED7
R374 R364
LED5
R372 R362
LED6
R373 R363
LED4
R371 R361
LED3
R370 R360
LED2
R369 R359
LED1
R368 R358
R27
R25
CONN1
C6
1
ON
R102
R103
R100
R111
R112
4
HPOUTCLK5
R80
R113
R81
R114
DS16 P1LED3
J31
DS17 P1LED2 R82
DS18 P1LED1
DS19 P1LED0 R83 DS12 P0LED3
DS13 P0LED2
DS14 P0LED1
DS15 P0LED0
J29
J44
C67
1
J67
1P0V_PHY
C76 C75 C73 C72 C69 C62 C60 C59
SW8
2
J82
U36
R185
R184
789
123
A
B
C
D
E
F
G
H
J
1
L13
J160
RS6 1
J167
1
1
SF2 DEV KIT
R367 R357
C74
GND
R377
3P3V_LDO
R137
R143
C111
TP14
J211
DDR3_VTT
R376
PLLXVDDA
1
R132
GND
R670
R230
J177
1
C150
C151
R276
R277
R274
R275
C164 TP22
U56
POE PWR ENB
R32
C32
C33
R50
R46
R93
R94
C49R87
J33 C50R88
R89
R90
R106
R107
R108
R109
R110
R95
C52 R91
C53 R92
R178
R179
C94
C95
R182
R183
1
J142
R203
R204
R206
R207
R212
R217
C148
C149
C146
R2 C147
66
R2
86
R282
R283
C159
C173
R311
1
Q15
ON
DVP-102-000400-001 REFCLK0_P
RevC
U55
POE CONN
J10
J16
R30
J15
J13
J14
C28
C29
R45
R47
R48
R49
R60
R61
1
1
C66
1
4
R149
R159
R160
R662
Y2
R172
R173
C91
C92
C85
C86
C87
C88
C89
C90
J117
C98
1
J230
3
R146
U23
4
J81
3
1
RS2
U54
C184
R385
2
1
B1
J54
R148 LED9
RST LED
J70
2
U27
SW9
JTAG SEL
U31
C100
C96
C103
C104
R680
R681
R678
R679
R677
R675
3
A
B
C
D
E
F
G
H
KJ
L
M
N
C70
T1
TP13
1
J152
R256
U51
C167
789
123
789
A
B
DC
E
F
G
H
J
K
L
M
N
VPP
2
123
789
J227
3
J233
1
123
A
B
DC
E
F
G
H
J
K
L
M
N
J226
1
R280
C162
C197
C203
R384
C199
R329
C188
R340
C192
J223 R341
R342
1
R351 R344
R345
C195
3
R281
R226
R229
R231
R232
R234
R235
R236
R237
R267
R269
R268
C63
D10
Q14
7
1
R335
R336
C190
R337
U58
1
J234
J215 R290
R291
C187
J217 R295 J130 R187
R332
R296
R333R334
1 R299
R302
R303
R304 TP7
R305
R306
R307
R308
R309 GND
R270
TP29
GND_0
C54
J153
R218
RS5
A1
J225
R319
R320
R317
R318
C177
C178
C182
C183
C185
R327
R328
R331
R330
C193C194
J222
R343
C196
R348 R349
R352 C201
J203
1
L12
R213
R215
U42
PLLMDDRVDDA
R287
C160
R288
U53
U57
GND
J218
1
1
C181
R321
J212
R322R314
R323
C180 C176
C175
R315
R313
R316
C179
R324
J216
R289
C143
J204
1
20
DB9-RS232 1
ANALOG INPUT
19
HDR-RS485
R347
L15 C171
1 C174
J128
ON
SW10
A30
R97
C51
C77
R671 R181
R186
R188
J126 J127
J124
J125
RS4
C37
R74
C48
R86
1
U62
J193
C165
U52
R293
R300R294
C169C166 U50
TP26
VDDIO
R292
C168
R298 R297
C170 R301
U48
1
1
V2J21 M2 J20 M2J20 H2 J19G3 J196 H2J19 J2 J18 J3 J18 J2 J17 K2 J174
9 4 8 7 0 3 6 8 4
63 4 9 5 1 7 9 0
1
C145
R259
R260R250
R248
R255
C144
R264 C161
C163
J172
K23
J175
L26
J179
H26
J184
J29
J188
H30
J195
H28
J197
G29
J200
F30
J202
K25
J210
L23
J214
N23
Y3
U40
C114
C38
C40
C43
R78
C46
GND
R166
R167
R168
R180
J123
RS3
3
1
3
C172
R271
C155
R272 R249
R273 C142
3
1
J224
J198
U49
5
R284
C141
R251
AK1
85
R2
2
C158
PCIEXVDD
65
R2
J221
J173
J180
1
R177
L8
PLLFDDRVDDA
R674
R673
R672
R676
R205
C125
Q19
J157
R261 C139
R262 R245
C154
R263
L14
R227
C140
R246 R254
HVDD R252 R253
R257 R258 R233
J181 C156 C157
1
J176
4
3
C138
3
3
C97
C101 C102
L7
2
1
50 MHZ
AK30
R310
J13
D12
1
R202
R192
DS26
C110
C108
R193
R200 R197
DS27
C112
HVDD
C117
C118
R199
C123
C124
C127
TP27
U47
TP28
R208
R209
R210
R211
R222
J163
C136
1
1
C93
1
Y1
3
R175
R176
J139
P24
J141
N26
J144
M27
J146
L29
J155
L28
J159
K30
J162
J27
Su
C137
R190
HVSS
U39
U38
C126
U46
2
J164
J121
5
J113
1
1
5
J137
D13
R216
HVSS
R223
R225
C132
R224 U44
R228
1
3
1
J138
P23
J140
N25
J143
N24
J145
M26
J154
L30
J158
K29
C133 J161
K28
1
J165
J105
J104
1
CR4
U41
W28
R29
R24
C113
1
CR3
R214
C107
R161 R162
TP3
C99
C80
D7
U10
R69
R70
R73
GND_C
J49
A14
C39
Q13
P3LED2
TC2 P3LED3
TC1
TC4 P3LED1
J32 P3LED0 TC3
TC6 P2LED3
P2LED2 TC5
TC7 P2LED0
R121
A1
P14
R28
10
TP5
-
-
1
R196
R198
3
J111
V24
J115
AA29
J119
Y30
J122
M23
J131
T27
J134
T26
J135
V23
J232
U24
U19
P1
REFCLK0_P
REFCLK0_N
SERDES0
4
J107
J108
J106
1
20
4
TP4
U43
R195
3
GND
3
C122
R201
1
R85
R59
TP30
2
C115
C116
C106
R194
R99
J19
J26
GND
rs
J37
J59
U25
C81
C82
U28
U22
A12
J30
1
1
R117
R118
R119
R122
R125
R126
R127
R129
R133
R135
R136
R138
R139
R141
R144
R145
R76
SW6
R58
L4
R64
1
L11
R191
RESET
1
R147
J94
1
ZL RST
12
J4
6
U34
TP10
R29
J12
SW1
R39
R53
R54
R38
U8
J28
1
J38
J43
J55
1
1
R163
U29
1 J93
pe
C83
U30
J91
J99
FP4 HEADER
U32
V22
J110
AA28
J114
W27
J118
TP8
C109
USB MICRO AB
OTG Support
1
9
U69 1
J79
R174
L9
8
J231
J34
J83
J102
J101
J100
R664
J88
J98
J66
R171
J40
J53
J92
R165
GND
REMOTE
PWR ENB
DS23
J60
1
R169 1
U35
J58
J75
J84
J89 J90
1
R164
Q17
J109
J61
J95
M12
GND
R134
10
2
10
J69 J64
J78
J87
J85
J48 J41 J39
L6
J77
J71
1
19 R128
GND
J63
J42
J74
6
1
J62
J68
R156
J73
1
R51
U9
R66
R68
2
GND
SFP CONN
A1 R62
R65
TP11
17
5
R142
J86
J97
J120
7
U12
J27
C55
U17
C64
U24
J57
J96
J65
9
U26
1
5
R140
J72
J76
DB9-CAN2
U21
X1
J45
20
J51
2
19
J50
3
1
1
U18
DS24
1
20 R115
R663
R105
C65
1
R120
J47
TP2
R67
R71
R72
R75
R77
R79
R84
REFP6
ETM HEADER
RS1
J35
1
DS21
GND
J46
J56
P1
1.2V
VDD_REG
J11
R14
SW3
SW4
C35
R44
D8
R98 U11
D9
C56
C47
J36
1
R63
J18
DB9-CAN1
R116
2
1
5
DS20
R124
REFP5
TP15
R101
TP19
C57
U16
J20
3
J21
3
J22
3
J25
3
RVI HEADER
U14
U13
1
J23
C45
3P3V_LDO
J52
C135
Q12
7
20
J5
J17
M1
C34
12
1
Q10
J7
U7
5
1
CR2
FTDI INTERFACE
R96
J24
1
6
17
C20
U4
C27
R37
R33
C25
C26
C23
C24
1.0V
CR1
1
7
C694
SW2
SW5
R13
C13
C17
R41
C30
R42
C31
R43
3
C41
1
1
SW7
TP1
C21
R57
ON
USB MINI B
J6
FMC HEADER
C19
Q11
C10
C18
U5
R34
4
J9
1
1
R31
D1
C16
L3
10
C22
1
Q8
J8
GND
C15
2P5V
1
R40
HPDIFFN4 HPDIFFP4
ed
ed
DS7
DS8
DS9
3P3V
C1
R10
R9
C14
U6
6
J3
C3
C4
3P3V
R17
R18
R19
R20
L2
1P8V
3
Q7
1
C693
D3
R15
D2
D4
C682
R16
C12
TP23
OFF
FMC HEADER
L1
TP17
TP18
DC JACK12V/6A
A1
A40
7
1
7
C11
C9
1
K1
12P0V
DS4
DS5
DS6
5P0V
VDD_REG
R4 2P5V_LDO
R5 2P5V
U1
R12
R11 C2
R669
U3
C8
R6
Q5
GND
R7
R8
5P0V
TP16
Q6
Q4
DS3
R3 3P3V_LDO
R1 1P8V
R2 DDR3-1P5V
DS2
12V_POE
Q3
Q1
Q2
12V
12V_PCIE
R668
C36
C683
R660
TP9
U2
12_DCJACK
Q9
K40
1
J2
1
DS1
Figure 1 shows the jumper locations on the SmartFusion2 Development Kit board.
D19
C205
B49
Figure 1 • SmartFusion2 Development Kit Board Jumper Locations
Note:
•
Jumpers highlighted in red are set by default.
•
Jumpers highlighted in green must be set manually.
•
The location of the jumpers in Figure 1 are searchable.
Revision 1
46
Product Support
Microsemi SoC Products Group backs its products with various support services, including Customer
Service, Customer Technical Support Center, a website, electronic mail, and worldwide sales offices.
This appendix contains information about contacting Microsemi SoC Products Group and using these
support services.
Customer Service
ed
ed
Contact Customer Service for non-technical product support, such as product pricing, product upgrades,
update information, order status, and authorization.
From North America, call 800.262.1060
From the rest of the world, call 650.318.4460
Fax, from anywhere in the world, 408.643.6913
Customer Technical Support Center
rs
Microsemi SoC Products Group staffs its Customer Technical Support Center with highly skilled
engineers who can help answer your hardware, software, and design questions about Microsemi SoC
Products. The Customer Technical Support Center spends a great deal of time creating application
notes, answers to common design cycle questions, documentation of known issues, and various FAQs.
So, before you contact us, please visit our online resources. It is very likely we have already answered
your questions.
Technical Support
pe
Visit the Customer Support website (www.microsemi.com/soc/support/search/default.aspx) for more
information and support. Many answers available on the searchable web resource include diagrams,
illustrations, and links to other resources on the website.
Website
Su
You can browse a variety of technical and non-technical information on the SoC home page, at
www.microsemi.com/soc.
Contacting the Customer Technical Support Center
Highly skilled engineers staff the Technical Support Center. The Technical Support Center can be
contacted by email or through the Microsemi SoC Products Group website.
Email
You can communicate your technical questions to our email address and receive answers back by email,
fax, or phone. Also, if you have design problems, you can email your design files to receive assistance.
We constantly monitor the email account throughout the day. When sending your request to us, please
be sure to include your full name, company name, and your contact information for efficient processing of
your request.
The technical support email address is [email protected].
Revision 1
47
Product Support
My Cases
Microsemi SoC Products Group customers may submit and track technical cases online by going to My
Cases.
Outside the U.S.
Customers needing assistance outside the US time zones can either contact technical support via email
([email protected]) or contact a local sales office. Sales office listings can be found at
www.microsemi.com/soc/company/contact/default.aspx.
ITAR Technical Support
Su
pe
rs
ed
ed
For technical support on RH and RT FPGAs that are regulated by International Traffic in Arms
Regulations (ITAR), contact us via [email protected]. Alternatively, within My Cases, select
Yes in the ITAR drop-down list. For a complete list of ITAR-regulated Microsemi FPGAs, visit the ITAR
web page.
48
R e visio n 1
ed
ed
rs
pe
Su
Microsemi Corporate Headquarters
One Enterprise, Aliso Viejo CA 92656 USA
Within the USA: +1 (800) 713-4113
Outside the USA: +1 (949) 380-6100
Sales: +1 (949) 380-6136
Fax: +1 (949) 215-4996
E-mail: [email protected]
Microsemi Corporation (Nasdaq: MSCC) offers a comprehensive portfolio of semiconductor
and system solutions for communications, defense and security, aerospace, and industrial
markets. Products include high-performance and radiation-hardened analog mixed-signal
integrated circuits, FPGAs, SoCs, and ASICs; power management products; timing and
synchronization devices and precise time solutions, setting the world's standard for time; voice
processing devices; RF solutions; discrete components; security technologies and scalable
anti-tamper products; Power-over-Ethernet ICs and midspans; as well as custom design
capabilities and services. Microsemi is headquartered in Aliso Viejo, Calif. and has
approximately 3,400 employees globally. Learn more at www.microsemi.com.
© 2014 Microsemi Corporation. All rights reserved. Microsemi and the Microsemi logo are trademarks of
Microsemi Corporation. All other trademarks and service marks are the property of their respective owners.
50200547-1/04.14