Ok, you are probably new to Eclipse, and want to do the fun part: Creating an Eclipse Processor Expert project in CodeWarrior for MCU10.2. Cool! Here are some steps and tips to make it smooth from the beginning…
First, download and install CodeWarrior from here. Yep, that’s a big file to download and install. So better plan to do some other work in parallel…. Well, you could continue reading so you will be ready.
The first time you launch the IDE, it asks you to select a workspace:
Go with the default or select a new folder. Press OK.
This launches the Eclipse IDE. Once loaded, it shows the Welcome View. Select ‘Go to Workbench’:
Now it is time to create a new Processor Expert Project with the Wizard. Use the menu File > New > Bareboard Project:
In the wizard, give a project name and select the device you want to use. If you don’t care, simply select the MCF51JM128.
Tip: Use filtering, e.g. *mcf51jm
Specify what method for debugging you want to use (depending on what you have). Go through the wizard with the default settings, except for this one:
Here select the Processor Expert option, and press Next. Depending on the microcontroller selected you will be offered a dialog asking for the pin variant and configuration: select what fits best for you.
Press Finish, and the project will be created for you. If this is the first time you use Processor Expert, this might now take a little bit longer. Once you project has been created, it should you see something like this:
You can show/hide the Processor Expert views using this menu:
Time to inspect the Processor Expert Components in the project. Go to the Project Panel View and unfold the ProcessorExpert.pe group (this is actually an XML file in the root of your project):
Let’s add a component to toggle a LED or an I/O pin. For this go to the Components Library view and select the Alphabetical tab:
To add a component to a project, check first that the right project is active. You can see this on the bottom of the Components Library view. Otherwise first select the project. Then select the component to add and press the ‘add’ icon in the Components Library Toolbar.
Select the newly added component and choose the Inspector from the context menu:
This opens the Component Inspector View. Specify a Pin for your I/O:
Tip: Notice the little star (*) in the Component Inspector. This means that things are not save yet. Select the Tab and Press CTRL-S to save the settings, and the * goes away.
Unfold the BitIO you have added. It will show all the methods. Notice that some methods are disabled and marked with an X. Enable the NegVal() method with the context menu:
To use the Processor Expert method, simply drag&drop the Method into your source. To learn more about drag&drop with Processor Expert, see this post.
This gives you now the code in the main():
Tip: Notice again little star (*) in view. This means that things are not save yet. Use CTRL-S to save the file.
To generate Processor Expert code, select the project folder and press the Generate Processor Expert Code button:
After code has been generated, we need to build it. Here again, eclipse is using the ‘current project’ approach. Select the project folder and use the ‘hammer’ button:
The Problems View should show no error:
Tip: An case you get a “mingw32-make: *** No rule to make target” error: Use the menu Project > Clean… to recreate the make files.
And the Console View should just show what the compiler and linker had to say:
Same ‘have a project selected’ theme for debugging: make sure you have a project selected and press the ‘debug’ button:
This then (hopefully) downloads the binary to the target board. Eclipse might ask you if you want to switch to the Debug Perspective. Say Yes. The Debug Perspective is for debugging (ah, that was obvious!):
In the Debug View you have toolbar icons to resume, stop, disconnect and stepping. Hoover over the toolbar buttons to find out more:
Use the Terminate button in the Debug View Toolbar to terminate the debugging session:
To switch back to the C/C++ Perspective use the C/C++ button. In case the button is not visible, simply use your mouse to enlarge the button area:
Now you are back to your project, and ready to start coding….
Happy Experting 🙂