Link here

1: Using the IDE Plus
Installing and using the Mosaic IDE Plus C Language Development Environment


The Mosaic IDE Plus™ makes it easy to edit, compile, load and test C programs. Each time you compile, the IDE displays how many pages of memory you are using as well as the location of the .DLF (Download file) which is produced. This guide describes all the steps involved, from creating your project to using the Mosaic Terminal to load and execute your C program.

 

Introduction and quickstart

The Mosaic IDE Plus™ (integrated development environment) provides all the software development tools you need to edit, compile, debug/test, and deploy your embedded application on your Mosaic Industries embedded controller. The Mosaic IDE Plus consists of three main components: The Codeblocks editor, the GNU C compiler targeted to the Freescale 9S12 (HCS12) microcontroller, and the Mosaic Terminal. Codeblocks and GNU C (also called GCC) are well known "open source" software tools that have been customized for use with Mosaic products. This document will refer to the Codeblocks environment as the "Mosaic IDE Plus" for simplicity. The Mosaic Terminal was developed by Mosaic Industries, making it easy to download a program to the embedded controller and to interactively execute commands via your PC’s serial port.

The following sections focus on software development using the Mosaic IDE Plus. This software is much more than a text editor; it helps you manage your software using "projects", each of which can have many source code files. A "project" is a set of related source code files, settings, and templates that enable the creation of an application program.

 

Installing the IDE Plus

The Mosaic IDE Plus has been tested with the following Microsoft Windows operating system versions, and is expected to work on any future version that is backward-compatible with Windows XP:

  • Windows XP
  • Windows Vista
  • Windows 7
  • Windows 8 (Non-RT)
  1. To install the IDE, first insert the provided CD-ROM into your PC computer.
  2. If the CD does not open automatically, simply go to My Computer and open your CD-ROM drive, which will show the volume label "Mosaic IDE Plus", and launch MosaicIDEPlusSetup.exe
  3. Click Next at the welcome screen to display the End User License Agreement.
  4. Please read the entire License Agreement before accepting.
  5. On the next page, select an installation folder and click Next. Your installation folder must not contain spaces or tildes.
  6. The next page asks what to call the Start Menu folder; for clarity leave the default value of "Mosaic IDE Plus" and click Next.
  7. On the next page, click the appropriate check box if you would like to create a shortcut to launch Mosaic IDE Plus from the desktop, and click Next.
    1. The file associations checkboxes should be left checked, though if you have another integrated development environment or text editor used for C programming, you may wish to uncheck the "C Source Code" box.
  8. Click finish to install the Mosaic IDE Plus.
  9. The PDQ Board development kit includes a USB RS-232 adapter needed for communicating with the PDQ Board. Install the driver now by double-clicking the executable file in the USB Serial Adapter folder on the Mosaic IDE Plus CD (revisions greater than 1300).
  10. After the installation is done, launch Mosaic IDE Plus from the start menu, under Mosaic IDE Plus→ Mosaic IDE Plus.
 

Using the Mosaic IDE Plus

The Mosaic IDE Plus allows you to easily compile C programming code for use with your Mosaic PDQ Board. The interface is simple to use, and provides the following features:

  • Color syntax highlighting
  • Ability to use "projects" as containers for build settings and source code
  • Management of multiple source code files and other resources like images
  • An editor optimized for the C language with features such as automatic definitions tracking and the ability to collapse and expand matched braces {} of code
  • A list of well commented demo (demonstration) applications that exercise the various features of the PDQ Board.

Start up Codeblocks by clicking the "Mosaic IDE Plus" icon in your desktop or in the start menu under Mosaic Plus→ Mosaic IDE Plus.

To open the Mosaic IDE Plus, look for this icon on your desktop:

Launch Embedded IDE

This figure shows the "Quick Start" page which is loaded when you first run the IDE Plus. This page can always be accessed by clicking Help→ Quick Start Page.

Embedded IDE Front Panel

Figure 1 Quick Start Page

This page has 3 useful links under the "Quick Links" Section. The first link, "Open a recent project or file", is a quick way to continue working on a project you have opened recently. This link pops up the same list as File→ Reopen does. If this is your first time using the software, this list will be empty.

The second link, "Open the public documentation wiki", links to the Mosaic Industries online wiki where you are probably reading this document.

The third link, "Open the offline documentation wiki", is an offline version of the same documentation wiki. This offline copy was created when you purchased your Mosaic PDQ Board and may be out of date. If you have an internet connection we recommended you use the public wiki for the most up to date information.

There are also three large bubbles under the label "Quick Start:". Click the first bubble to open a dialog box full of demo (demonstration) projects.

 

Hello world

Once you click the first bubble on the Quick Start page, you should see the window in Figure 2. You can also get here by clicking Project→ New Project.

C Language Programming

Figure 2 "New project" window

Choose the demo named "Hello World." Be sure the leave the "Create empty project" box unchecked so that source code will be created for you.

When you click "Create" you will see a "Choose a Foldername" dialog box which allows each project to be kept in its own folder. We will use the default value of "hello_world". Next a "Save as" dialog box will appear where you can choose a name for your project. If you don't like the default location, you may choose a different one now. Although it doesn't matter where you place your work, we recommend that you use the default location of "C:\MosaicPlus\my_projects\hello_world\". After you have clicked "save" the default source code file for "Hello World" (called main.c) will pop open.

To compile and build your program, all you need to do is click Build→ Build (that is, select the Build menu, and then click on the Build item). Note that the system only recompiles files whose file dates indicate that the sources have been modified. If you wish to force a rebuild, simply choose Build→ Rebuild instead. You will see a lot of information scroll past in the messages window. Figure 3 shows the bottom of the message window after the compilation is complete.

Microcontroller C Compiler Log

Figure 3 The final output of a successful compile.

Looking at the output we can see that compiling took 7 seconds to execute (the very first compile after installation may take a bit longer.) We can also see that the compiled code uses 5 of 13 memory pages on the controller board. This may seem like a lot of memory used for a simple hello world program; the reason is that printf() is a massive function and takes up the majority of memory used. Also, displayed between the --> arrows <-- is the full path to the .DLF (download file) file that we just created. Note that the root name you gave your project determines the name of the .DLF file which contains all the necessary components to initialize and run the program on your controller board.

 

Download your program

Start the Mosaic Terminal by choosing Tools→ Mosaic Terminal, or launch it from the "Mosaic Plus" program group in your Start Menu. Once the terminal is open, you should verify communications with your controller by hitting "enter" a few times. For each "enter" you should see a corresponding ‘ok’ prompt in response:

  ok
  ok
  ok

If you do not get this response, check the FAQ, or see the chapter: Installing and Connecting to PDQ Board. Once you have established communications with the controller, select File→ Send File in the Mosaic terminal and set the file type to Download files (*.dlf). Navigate to this directory:

C:\MosaicPlus\my_projects\hello_world\

and send the file hello_world.dlf. Remember that this path was displayed at the bottom of the Build log after your program compiled, see figure 3.

To save time, you can copy the entire path, C:\MosaicPlus\my_projects\hello_world\hello_world.dlf, from the build log and paste it into the "File name:" box in the Terminal's File→ Send File menu item. Then simply click "Open". This method will allow you to send the correct .DLF file without navigating any folders.

Look for this:

  -->  C:\MosaicPlus\my_projects\hello_world\hello_world.dlf  <--    file has been created.

You will see lots of text scrolling and S-record data pass by with a grey foreground color. When the download completes, the text will turn green again. Now, you are ready to run your program. Simply type in the terminal window:

main

You should see the response in the terminal window:

main Hello world!

If the "Hello world!" message appears, then you have successfully compiled, loaded, and run your first C Program.

If you would like to continue learning the features of the Mosaic IDE Plus, see 2: Setting up Your Project. If you want to compile a more complicated C program, using more features of the hardware, see Your First C Program Using Mosaic IDE Plus.



See also →

 
This page is about: Integrated Development Environment (IDE), Edit, Compile, Load and Test C Programs, Create Your Project, Download and Execute Your C Program – The Mosaic IDE Plus™ makes it easy to edit, compile, load and test C programs. This guide describes all the steps involved, from creating your project to using the Mosaic Terminal to download and execute your C program.
 
 
Navigation