9
Search Microchip Search Data Sheets English Welcome, diego gachet [Signout, My Account] Home Products Home Page 16-bit PIC® MCUs & dsPIC ® Digital Signal Controllers Helpful Links Software Libraries Application Notes Code Examples Data Sheets Development Tools MCU & DSC Overview 8-bit 16-bit 32-bit Application Design Centers Getting Started with MPLAB Harmony Integrated Software Framework 6. MPLAB® Harmony is a fully integrated firmware framework with associated libraries, example applications, and related collateral supporting features of PIC32 microcontrollers. Visit http://www.microchip.com/harmony for more information on this new framework. Follow these steps to get started with MPLAB Harmony: • Download and Install MPLAB Harmony • Before You Start • Accessing MPLAB Harmony Documentation • Creating New Application • Configuring New Application Download and Install MPLAB Harmony MPLAB Harmony is a free download available at http://www.microchip.com/harmony. Download and follow the instruction in the installer. Before You Start Install MPLAB Harmony Help and MPLAB Harmony Configurator plugin modules for MPLAB X IDE (if not installed already). Adding these plugin modules allows you to access the MPLAB Harmony Help and MPLAB Harmony Configurator from the MPLAB IDE menus. Installing the Plugin Modules 1. Start MPLAB X IDE and select “Plugins” from the “Tools” menu as shown 2. Click the “Add Plugins…” button, navigate to and open the “com-microchip- harmony_help.nbm” plug in file as shown . It can be found in the installation directory <install-dir>/doc PRODUCTS APPLICATIONS DESIGN SUPPORT Contact Us myMicrochip Login TRAINING SAMPLE & BUY ABOUT US Getting Started with MPLAB Harmony Integrated Software Framework http://www.microchip.com/stellent/idcplg?IdcService=SS_GET_PAG... 1 de 9 22/02/2014 17:42

Getting Started With MPLAB Harmony

Embed Size (px)

DESCRIPTION

mplab-harmony

Citation preview

Page 1: Getting Started With MPLAB Harmony

Search Microchip

Search Data Sheets

English

Welcome, diego gachet [Signout, My Account] Home Products Home Page 16-bit PIC® MCUs & dsPIC® Digital Signal Controllers

Helpful Links

Software Libraries Application Notes Code Examples Data Sheets Development Tools MCU & DSC Overview 8-bit 16-bit 32-bit Application Design Centers

Getting Started with MPLAB Harmony Integrated Software Framework

6.

MPLAB® Harmony is a fully integrated firmware framework with associated libraries, example applications, and related collateral supporting features of PIC32microcontrollers. Visit http://www.microchip.com/harmony for more information on this new framework.

Follow these steps to get started with MPLAB Harmony:

• Download and Install MPLAB Harmony

• Before You Start

• Accessing MPLAB Harmony Documentation

• Creating New Application

• Configuring New Application

Download and Install MPLAB Harmony

MPLAB Harmony is a free download available at http://www.microchip.com/harmony. Download and follow the instruction in the installer.

Before You Start

Install MPLAB Harmony Help and MPLAB Harmony Configurator plugin modules for MPLAB X IDE (if not installed already). Adding these plugin modules allowsyou to access the MPLAB Harmony Help and MPLAB Harmony Configurator from the MPLAB IDE menus.

Installing the Plugin Modules

1. Start MPLAB XIDE and select“Plugins” from the“Tools” menu asshown

2. Click the “AddPlugins…” button,navigate to and open the“com-microchip-harmony_help.nbm” plugin file as shown. It can be found in theinstallation directory<install-dir>/doc

PRODUCTS APPLICATIONS DESIGN SUPPORT Contact Us

myMicrochip Login

TRAINING SAMPLE & BUY ABOUT US

Getting Started with MPLAB Harmony Integrated Software Framework http://www.microchip.com/stellent/idcplg?IdcService=SS_GET_PAG...

1 de 9 22/02/2014 17:42

Page 2: Getting Started With MPLAB Harmony

3. Click the "AddPlugins..." button,navigate to and open the"com-microchip-harmonyconfigurator.nbm"plug in file as show. It can be found in theinstallation directory<install-dir>/utilities/configurator

4. Both check boxes for“MPLAB Harmony Help”and “MPLAB HarnonyConfigurator” should bechecked. Ensure that theyare and click the “Install”button.

5. Follow the prompts from the installation wizard and continue until the installation completes. Just click "continue"). Once the installation wizard has finished ycan close the "Plugins" dialog box.

You should now see a "MPLAB Harmony Configurator" option under the "Tools" menu. This indicates that the MPALB Harmony Configurator has beensuccessfully installed.

Accessing MPLAB Harmony Documentation

A comprehensive help is available for MPLAB Harmony which describes the purpose and interface for each framework component. You will need toreference these sections as needed for integrating libraries in your application. It is recommended that you read all sections in “Start Here”. This willprovide key concepts to understanding MPLAB Harmony, the project layout and the structure and purpose of key source files. The Applications Helpsection describes the demonstration projects and example applications included with the installation.

There are two help file options available:

1. MPLAB Harmony PDF file available in the installation directory <install-dir>/doc

2. MPLABHarmony Help canalso be accessedfrom MPLAB XIDE Help Menu asshown

Getting Started with MPLAB Harmony Integrated Software Framework http://www.microchip.com/stellent/idcplg?IdcService=SS_GET_PAG...

2 de 9 22/02/2014 17:42

Page 3: Getting Started With MPLAB Harmony

Creating New Application

There are two options for creating a new project: Using a supplied template or starting with a new project.

Use a Harmony Supplied Template

The “basic_PIC32” template is located in the <install-dir>/apps/examples/templates/basic_pic32 directory. This template already contains a recommendlogical directory structure and has embedded TODO tags to help you to create your first Harmony Project. If you copy this template to a new location yowill need to update the paths to libraries and directories to match your MPLAB Harmony installation directory. See read me file in the included with thebasic_pic32 project.

Use the MPLAB X IDE New Project Wizard

1. Open MPLAB XIDE, and selectFile > New Projectto open a projectwizard window. InCategories, select“MicrochipEmbedded” and inProjects, select“StandaloneProject”. ClickNext.

2. Next, choosethe device. Thedevice youchoose willdetermine whatperipheral librariesare included inyour MPLABHarmony project

3. Continue in thenew projectWizard, selectingyour hardwareand softwaretools.

Getting Started with MPLAB Harmony Integrated Software Framework http://www.microchip.com/stellent/idcplg?IdcService=SS_GET_PAG...

3 de 9 22/02/2014 17:42

Page 4: Getting Started With MPLAB Harmony

4. When you name and locate your project there are two choices. You can locate it in the ‘apps’ folder of the MPLAB Harmony installation or you canlocate it outside of the Harmony installation. Placing the project in the ‘apps’ folder of MPLAB Harmony will require you to copy it if you install a newversion of MPLAB Harmony. Installing your project outside of the MPLAB Harmony installation will require you to modify your include paths when a newversion of MPLAB Harmony is installed. It is recommend to use relative paths when installing in the ‘apps’ folder in MPLAB Harmony. Make sure that yonew project is set to the main (active) project.

5. Once theMPLAB X IDEproject is created,you should see ascreen similar tothe picture asshown below.

Configuring New Application

There are three steps for configuring a new project: Determine and add required modules, as well as configure these modules.

Determine which MPLAB Harmony Modules are needed for your Application

Modules are divided into four categories; Peripheral Libraries, System Services, Device Drivers and other libraries (commonly called middleware). Todetermine your needs, read the MPLAB Harmony Overview and the Introductory sections for the modules of interest in the help file. Some modules havdependencies while others do not. Peripheral Libraries have no dependencies. Drivers depend on peripheral libraries. System Services depend onPeripheral Libraries and or Drivers. Your application or its middleware will typically use drivers or system services

Add the required Module Source Files to your Project

This can be accomplished by reading the help for each module to determine what source files you need and manually entering them into your project.Alternatively, the MPLAB Harmony Configurator can be used to select the modules from a list or tree and it will automatically insert the source files intoyour project and optionally generate a skeletal template for your project. Note that some modules have multiple implementations each optimized fordifferent purposes. Others may implement optional features in multiple files. Be sure to select the source file right for your implementation and be sure to

Getting Started with MPLAB Harmony Integrated Software Framework http://www.microchip.com/stellent/idcplg?IdcService=SS_GET_PAG...

4 de 9 22/02/2014 17:42

Page 5: Getting Started With MPLAB Harmony

include the pre-built peripheral library binary “.a” file for the processor you selected in your project

Using MPLAB Harmony Project and MPLAB Harmony Configurator

1. The MPLABHarmonyConfigurator canbe found in theTools menu of theMPLAB IDE.

2. “MPLABHarmonyConfigurator” willopen in a newdialogue, asshown below.

3. Browse to theroot directory pathunder "MPLABHarmony RootDirectory" option.This path isremembered bythe Configuratorfor subsequentusage. Check oruncheck the"Relative Path"check box asrequired. Oncethe path is set,click "Next".

Getting Started with MPLAB Harmony Integrated Software Framework http://www.microchip.com/stellent/idcplg?IdcService=SS_GET_PAG...

5 de 9 22/02/2014 17:42

Page 6: Getting Started With MPLAB Harmony

4. Now select therequired modulesfor your project.Peripheral Libraryheaders areselected bydefault by the tool.Select therequiredconfigurationmodules using thetree structure.Click "Next" oncethe selection iscomplete.

5. If selectedlibrary supportsconfiguration viaConfigurator, theLibraryConfigurationPane will appear.As an example,the TCP/IP Libraryconfiguration isshown.

Select the required configurable items of TCP/IP, and click next (Next button in “Library configuration navigation pane)

7. Select toInclude MPLABHarmonyApplicationtemplate files.Tool would addtemplate files(main.c, app.c,system_init.c,system_tasks.c,system_int.c,system_config.hand app.h) toMPLAB X IDEproject. Click"Finish".

Note: If you run the template again, for the purpose of adding the supporting files for other framework libraries, you will not want to check “Include MPLHarmony application template” as it will overwrite your existing project files.

Configure the Modules

With the exceptions of the Peripheral Libraries, every MPLAB Harmony module will require some set of build time configuration options implemented us‘c’ language macros ‘#define’. Descriptions of the supported options are available in the "Configuring the Library" section in the help document for everyMPLAB Harmony library. These options must be defined in the system_config.h header that is part of your project template generated by the MPLABHarmony Configurator. Every MPLAB Harmony source file that supports build time configuration options will include this header. As such, this file must bpart of every MPLAB Harmony Project.

Getting Started with MPLAB Harmony Integrated Software Framework http://www.microchip.com/stellent/idcplg?IdcService=SS_GET_PAG...

6 de 9 22/02/2014 17:42

Page 7: Getting Started With MPLAB Harmony

Initialize System

This task involves completing the system_init.c file.

1. Add thenecessaryconfiguration bitsfor your processor

These are definedin the SpecialFeatures sectionof your device'sdata sheet. InMPLAB X, selectthe Window menu,then PIC MemoryViews and finallyConfiguration Bits.From this windowthe configurationbits can be setand the code canbe generated toadd to yoursystem_init.c file.

Getting Started with MPLAB Harmony Integrated Software Framework http://www.microchip.com/stellent/idcplg?IdcService=SS_GET_PAG...

7 de 9 22/02/2014 17:42

Page 8: Getting Started With MPLAB Harmony

2. Complete the SYS_Initialize function. Finish any necessary processor initialization (wait states, cache control, etc.) MPLAB Harmony may provideservices to accomplish this in the System Services Module. Initialize any features specific to the board that are not initialized by other modules such asdrivers or system services

3. Next, initialize all library modules selected to be used by your application. To do this you must first define the initialization data structure for eachmodule. This can be done statically in the system_init.c file and passed in by pointer to the appropriate initialization function for each library. Neededinitialization structures can be found in the help section for each module.

.

4. Add a call to the initialization function for each library module into the SYS_Initialize function. Each initialization function will return an object handle fothe module instance. These should be captured so that they can be passed to the module task routine. Finally, add the call to APP_Initialize function intthe SYS_Initialize function.

Call System State Machine Tasks

The system must call the various task state machine functions at appropriate times. This is accomplished by either adding the call into the SYS_Tasksfunction for polled modules or adding the call to the interrupt handler for interrupt driven modules. The object handle saved during the initializationprocess is used as an argument for the various task state machine functions. The SYS_Tasks function is typically implemented in the system_tasks.c fiwhile the interrupt handlers are defined in the system_int.c file. Both versions are shown below, however only one is used in your application for each tastate machine

Develop Application State Machine

You are now ready to develop your application. Since Harmony is based on cooperative state machines, your application should also be state machinedriven.

Getting Started with MPLAB Harmony Integrated Software Framework http://www.microchip.com/stellent/idcplg?IdcService=SS_GET_PAG...

8 de 9 22/02/2014 17:42

Page 9: Getting Started With MPLAB Harmony

No documents found. Please check back later You have signed in as diego gachet.

©Copyright 1998-2012 Microchip Technology Inc. All rights reserved.Shanghai ICP Recrdal No.09049794

1. At minimum, the APP_Initialize function must put your application in its initial state. It may perform other initialization as long as it does not have to wafor other modules. Any initialization that depends on other modules should be implemented as part of the application state machine.

2. Finally,complete yourapplicationfunctionality byimplementing theAPP_Tasks statemachine function.

Downloads

Products Applications Design Support Training Sample & Buy About Us Contact Us

Getting Started with MPLAB Harmony Integrated Software Framework http://www.microchip.com/stellent/idcplg?IdcService=SS_GET_PAG...

9 de 9 22/02/2014 17:42