NoICE Debugger

HC12 Tutorials

Running NoICE for the first time

Connecting to hardware

Compiling for debugging

Source-level debugging

 
Home Download Purchase Tutorials FAQ NoICE Help

HC12: Compiling for Debugging

Once you have learned a little about NoICE, the next step is to try source-level debugging.

This example uses ImageCraft ICC12. You can follow along even if you don't have this compiler. All files necessary for you to run the NoICE demo will be provided. Setup for other compilers is generally similar.

You can download all the files for this example here: hellofoo.zip.

Using another compiler? The steps are similar. Consult your compiler's documentation to see what debug formats are available and how to select them. Here is the list of what NoICE supports.


Creating a project

In the ImageCraft IDE, select "Project", "New" to create an empty project. We called ours "hellofoo.prj". (You could just open hellofoo.prg from the zip file, but you will learn more if you do it yourself. You probably hate it when people tell you that.)

Select "Project", "Options..." to open the Compiler Options dialog.

In the "Compiler" tab, set "Output Format" to "S19 with Source Level Debugging".

If you have an option for "ImageCraft debug format", (Professional Version only, not shown here), select "V1.1". Structure and union information is only available if V1.1. is selected.

To produce a debug file from the command line or a make file, use the "-g" compiler switch.

ImageCraft Compiler Options

Click on the "Target" tab.

Our example is for an MC9S12DP256, so we select "9S12Dx256 / Ax256 / H256".

Be sure to specify the exact processor and memory configuration appropriate to your target.

The small version of printf is fine for our needs.

We aren't going to be using exapnded (banked) memory

Remember the "linear" setting: it affects how we load this file with NoICE.

ImageCraft Target Options


Adding Source Code

In the ImageCraft IDE, create a new source file, hellofoo.c, and add it to the project.

Add the file "vectors_dp256.c" to the project. Otherwise the reset vector won't point at the startup code, and your program won't start when the processor comes out of reset.

Add the file "myserial.c" to the project. The ImageCraft library by default is built for a non-HCS HC12. Serial I/O won't work unless you add myserial.c or revise the library as described in the ImageCraft help.

Build the project, generating hellofoo.dbg and hellofoo.s19, along with various files that won't concern us further.

(If you don't have the ImageCraft compiler, hellofoo.dbg and .s19 are include in hellofoo.zip.)

Source Code for hellofoo.c


Continue the tutorial with Source-level debugging

 
   
NoICE Debugger • Copyright © 2019 by John Hartman • Revised 11 October 2019