MPLABX Wizard

From VirtualFabWiki
Jump to: navigation, search

MPLABX integration

For MLA/MLA Legacy (PIC24/dsPIC33) projects, VGDD is capable of directly adding its generated source files and everything is needed to run the GUI into an existing empty MPLABX project.

Notice: For Harmony (PIC32) project, the Wizard has been disabled because you can now use MHC (MPLAB Harmony Configurator) to do the job. See VGDD 10.0 page for details.


MplabxWizardb.png


This allows also the non guru's to create a running GUI onto selected hardware platforms. To see which hardware is currently supported and tested, watch the Tested Hardware Configurations below.

MplabxWizard2b.png


Other compatible hardware will be added in the near future.


The Wizard takes the MplabX projects and adds up every needed source and header files

  • taking them from the Microchip Application Libraries installed on the running PC
  • generating them (like the VGDDmain.c and others)


The Wizard also modifies the project in order to correctly compile your GUI:

  • a heap is automatically added since it is always needed by GOL
  • the INCLUDE paths are automatically filled with relative MAL paths (oh YES!). You are free to put your MplabX project where you want!
  • those modules that need an override are automatically added to the project with the override already set (i.e. the mchpGfxDrvBuffer.c that needs an "Enable large arrays" override)

The source files taken from the MAL are left untouched and simply added to the project, like you would do by yourself by hand.

The generated files are instead injected with the specific code needed by the hardware you selected.

This is a completely different approach from the "all-in-one-hell-of-#if-#endif" we are used to: the resulting code is much smaller and readable and contains only the minimal code needed to run your GUI.

All other code (i.e. to drive a WiFi module or to sample an ADC) should be added by you as before.

But the GUI backbone is already done and ready to go!

How to use it

  • Run MplabX and create an empty project in a folder of your choice.

Choose the right Family and Device for your development board.

  • Start VGDD-Link
  • Run VGDD and Design your GUI
  • Click on Generate Code. Connect to VGDD-Link if it isn't already connected. Your MplabX Project details will be shown.
  • Run the Wizard
  • Choose your Hardware configuration: Development Board, Expansion Board (where applicable) and Display Board.
  • Click on the "Modify Project" Wizard button
  • Switch back to MPLAB X. Your project will have all what is needed to run your GUI.
  • Click "Run -> Project (F6)" and enjoy!


you'll see your GUI on the display within seconds!

GUI development roundtrip

After the creation and modification of the MplabX project, the GUI development roundtrip is just

  • Switch to VGDD and edit GUI
  • Generate Code
  • Switch back to MplabX
  • Click Play

Fun, isn't it?



Technical Details

Here follow some details of which files are generated and added to the project.


Generate Skeleton Files

The files generated by the "Generate Code" phase are always added to the project by the Wizard:

  • VGDD_<ProjectName>_Screens.c the main file with all the code for your screens and the graphic resources they use
  • VGDD_<ProjectName>_Screens.h the header file to be used in the other modules of your project in order to reference the VGDD generated code
  • VGDD_<ProjectName>_EventsHelper.h the header file that VGDD uses to reference code you write in its events.
  • VGDD_<ProjectName>_ScreenStates.h the file (to be included into the main.h) with the enums of VGDD screen states.

If the selected MplabX project doesn't have them (that is true if you just created it the first time) the Generate Skeleton groupbox will be selected by default.


GenerateSkeleton.png


This means that VGDD will generate a general-purpose VGDDmain.c and VGDDmain.h, with all the needed code to run your screens. It consists of a general-purpose code which is basically made by:

  • An InitializeBoard() to set up the hardware
  • A "SuperLoop" to handle GOL events and drawing
  • The needed calls to the GUI event code generated by VGDD (the VGDD_<Projectname>_Screens.c)
  • The Timer ISR to handle ResistiveTouch events
  • The Exception handler to catch exceptions and show them on screen

This code is derived from the Microchip GOL MultiApp Demo, and constitutes a standard screenState message pumping machine, the minimum required to see your VGDD-designed GUI on your hardware.

If you have just started your MPLABX project from scratch, this is a good starting point:

In subsequent runs the Wizard detects which files already exist in your MPLABX project: if the files are already in the project, then the "Generate Skeleton Files" checkboxes will be unselected.

WARNING: If however you manually check them, the relative files will be overwritten and your manually added code will be lost forever


Modify Skeleton Files

For subsequent runs of the Wizard, instead, a simple code injection in the already existing files is sufficient, so leave the "Modify Skeleton Files" boxes checked in order for the Wizard to do that.


ModifySkeleton.png


Options

While building the Project you can enable or disable some option:


WizardOptions.png


  • Include PutImageFromSD support - this causes the Wizard to include all needed code files to support the retrieving of bitmaps from SD (or USB pendrive for those boards that doesn't have a directly SPI-addressable SD/microSD socket)
  • Include Transparent Colour support - This enables the Transparent Colour support in GOL pictures handling
  • Include Flash Memory Programmer support - This enables the Flash Memory Programmer code needed to program the serial flash on the selected hardware (where available)


Demo Video

Take a look to the Demo video in which I explain how to design and run a basic GUI in 5 minutes.

Tested Hardware Configurations

Development Board Expansion Board Display Board Test Result Notes
Olimex Pic32 Maxi-Web
[1]
- Integrated ILI9320 3.2in. 320x240 OK
PIC24FJ256DA210 Development Board
DM240312
- Graphics Display Truly 3.2in. 320x240 Board
AC164127-4
OK
PIC24FJ256DA210 Development Board
DM240312
- Graphics Display Powertip 4.3in. 480x272 Board
AC164127-6
OK
PIC24FJ256DA210 Development Board
DM240312
- Graphics Display Truly 7in. 800x480 Board
AC164127-9
Not fully supported Insufficient frame buffer SDRAM for 16bpp
Can work at 4bpp
PIC32 USB Starter Kit II
DM320003-2
TechToys SSD1963 EVK Ultima 4.1 TechToys 7in. WVGA 800x480
TY700TFT800480_TP_Rev03
OK
PIC32 USB Starter Kit II
DM320003-2
Multimedia Expansion Board
DM320005
Integrated Truly 3.2in. 320x240 OK
PIC32 USB Starter Kit II
DM320003-2
GFX PICtail Plus SSD1926 Board
AC164127-5
Graphics Display Truly 3.2in. 320x240 Board
AC164127-4
OK
PIC32 USB Starter Kit II
DM320003-2
GFX PICtail Plus SSD1926 Board
AC164127-5
Graphics Display Powertip 4.3in. 480x272 Board
AC164127-6
OK
PIC32 USB Starter Kit II
DM320003-2
GFX PICtail Plus SSD1926 Board
AC164127-5
Graphics Display Truly 7in. 800x480 Board
AC164127-9
Work in Progress
PIC32 USB Starter Kit II
DM320003-2
GFX PICtail Plus Epson S1D13517 Board
AC164127-7
Graphics Display Truly 3.2in. 320x240 Board
AC164127-4
Not supported Undefined TCON
PIC32 USB Starter Kit II
DM320003-2
GFX PICtail Plus Epson S1D13517 Board
AC164127-7
Graphics Display Powertip 4.3in. 480x272 Board
AC164127-6
OK
PIC32 USB Starter Kit II
DM320003-2
GFX PICtail Plus Epson S1D13517 Board
AC164127-7
Graphics Display Truly 7in. 800x480 Board
AC164127-9
OK
PIC32 USB Starter Kit II
DM320003-2
Low-Cost Controllerless (LCC) Graphics PICtail Plus Daughter Board
AC164144
Graphics Display Truly 3.2in. 320x240 Board
AC164127-4
OK
PIC32 USB Starter Kit II
DM320003-2
Low-Cost Controllerless (LCC) Graphics PICtail Plus Daughter Board
AC164144
Graphics Display Powertip 4.3in. 480x272 Board
AC164127-6
OK
PIC32 USB Starter Kit II
DM320003-2
Low-Cost Controllerless (LCC) Graphics PICtail Plus Daughter Board
AC164144
Graphics Display Truly 7in. 800x480 Board
AC164127-9
Not compatible Not enough external memory
for frame buffer


PIC32 Ethernet Starter Kit
DM320004
Multimedia Expansion Board
DM320005
Integrated Truly 3.2in. 320x240 OK
PIC32 Ethernet Starter Kit
DM320004
GFX PICtail Plus SSD1926 Board
AC164127-5
Graphics Display Truly 3.2in. 320x240 Board
AC164127-4
Not compatible Unsupported by Microchip
PIC32 Ethernet Starter Kit
DM320004
GFX PICtail Plus SSD1926 Board
AC164127-5
Graphics Display Powertip 4.3in. 480x272 Board
AC164127-6
Not compatible Unsupported by Microchip
PIC32 Ethernet Starter Kit
DM320004
GFX PICtail Plus SSD1926 Board
AC164127-5
Graphics Display Truly 7in. 800x480 Board
AC164127-9
Not compatible Unsupported by Microchip
PIC32 Ethernet Starter Kit
DM320004
GFX PICtail Plus Epson S1D13517 Board
AC164127-7
Graphics Display Truly 3.2in. 320x240 Board
AC164127-4
Not compatible Undefined TCON
PIC32 Ethernet Starter Kit
DM320004
GFX PICtail Plus Epson S1D13517 Board
AC164127-7
Graphics Display Powertip 4.3in. 480x272 Board
AC164127-6
OK Thanks Wolly for the patched SPI init
PIC32 Ethernet Starter Kit
DM320004
GFX PICtail Plus Epson S1D13517 Board
AC164127-7
Graphics Display Truly 7in. 800x480 Board
AC164127-9
OK Thanks Wolly for the patched SPI init
External power is mandatory
PIC32 Ethernet Starter Kit
DM320004
Low-Cost Controllerless (LCC) Graphics PICtail Plus Daughter Board
AC164144
Graphics Display Truly 3.2in. 320x240 Board
AC164127-4
Not compatible Unsupported by Microchip
PIC32 Ethernet Starter Kit
DM320004
Low-Cost Controllerless (LCC) Graphics PICtail Plus Daughter Board
AC164144
Graphics Display Powertip 4.3in. 480x272 Board
AC164127-6
Not compatible Unsupported by Microchip
PIC32 Ethernet Starter Kit
DM320004
Low-Cost Controllerless (LCC) Graphics PICtail Plus Daughter Board
AC164144
Graphics Display Truly 7in. 800x480 Board
AC164127-9
Not compatible Unsupported by Microchip
Explorer 16
DM240001
TechToys SSD1963 EVK Ultima 4.1 TechToys 7in. WVGA 800x480
TY700TFT800480_TP_Rev03
OK OK with PIC32MX795F512L PIM - 8bit only
Explorer 16
DM240001
GFX PICtail Plus SSD1926 Board
AC164127-5
Graphics Display Truly 3.2in. 320x240 Board
AC164127-4
OK OK with PIC24FJ128GA010 PIM - 8bit only

OK with PIC32MX795F512L PIM - 8bit only

Explorer 16
DM240001
GFX PICtail Plus SSD1926 Board
AC164127-5
Graphics Display Powertip 4.3in. 480x272 Board
AC164127-6
OK OK with PIC24FJ128GA010 PIM - 8bit only

OK with dsPIC33EP512MU810 PIM - 8bit only
OK with PIC32MX795F512L PIM - 8bit only

Explorer 16
DM240001
GFX PICtail Plus SSD1926 Board
AC164127-5
Graphics Display Truly 7in. 800x480 Board
AC164127-9
Not compatible Not enough memory for frame buffer
Explorer 16
DM240001
GFX PICtail Plus Epson S1D13517 Board
AC164127-7
Graphics Display Truly 3.2in. 320x240 Board
AC164127-4
Not compatible TCON undefined
Explorer 16
DM240001
GFX PICtail Plus Epson S1D13517 Board
AC164127-7
Graphics Display Powertip 4.3in. 480x272 Board
AC164127-6
OK OK with PIC24FJ128GA010 PIM - 8bit only - SLOW

OK with dsPIC33EP512MU810 PIM - 8bit only
OK with PIC32MX795F512L PIM - 8bit only

Explorer 16
DM240001
GFX PICtail Plus Epson S1D13517 Board
AC164127-7
Graphics Display Truly 7in. 800x480 Board
AC164127-9
OK OK with PIC24FJ128GA010 PIM - 8bit only - VERY SLOW

OK with dsPIC33EP512MU810 PIM - 8bit only
OK with PIC32MX795F512L PIM - 8bit only

Troubleshooting

Possible compilation errors in MplabX after you click on "Modify Project":

  • Target pattern contains no `%'. Stop. - Relative path issue. For example, VGDD Project and the MplabX project are on different drives and you are working on Windows with VGDD and on Linux with MplabX. Solution: keep both projects on same drive, so relative paths make sense.
  • Cannot program a production build to a debug header - Either broken makefile issue or mis-selected debug header. Solution:: go in Project Properties by either
    • right-clicking on Project's name in Project Explorer and choose Properties or
    • opening the Configuration dropdown in the toolbar and choose Customize)

check if any 'Supported Debug Header' is selected by mistake (and eventually de-select it)

and then Confirm with OK. This recreates the makefile and solves the issue.

  • Undefined reference to "main" - Broken makefile - Solution:: same as above