CodeWarrior

From emboxit
Jump to: navigation, search

Call C from Assembly

Calling conventions (which parameter in which register) may differ.
An easy way to find out is to call the function in C and then have a look at the assembler output that the compiler generates to make the call.
What you also need to know is which registers a C function will preserve and which not. This should be documented in the compiler manual.


MPR083 Demo with MC9S08GT16A [tested]

DEMOMPR083.jpg

// ****************************************************************************************************************************
// NikosChalikias_2011.07.02
// WORKS WITH BDM
// Board: 9S08GT16A based [MPR083 demo] with touch sensor and leds, 
// TOOL: USB MULTILINK version B
// Operation of environment at debugging is SUPERIOR to mon08
// NAMES of port registers are different than used in GZ60_LED project
// 2 environment variables had to be defined in the project-properties-C/C++Build-environment:ProjDirPath and MCUToolBaseDirEnv
// It was mentioned during Build attempt.
// Also Flash File to Target works from inside eclipse.
// Nice and professional to work with BDM and Codewarrior-Eclipse
// Familiarity with Eclipse is very useful.
// Forget HC08, go with HCS08!
//
#include <hidef.h> 			/* EnableInterrupts macro */
#include "derivative.h" /* include peripheral declarations */
/*
// ---------------------------------------------------------------------------
// Peripheral Initialization Routine
// ---------------------------------------------------------------------------
*/
void PeriphInit(void)
{
   PTADD = 0x80;			 
   PTADD = 0x04;          
   PTAD_PTAD7=1;
   PTAD_PTAD2=1;			
}
 unsigned int i=0; 
/*
// ---------------------------------------------------------------------------
// Main
// ---------------------------------------------------------------------------
*/
void main(void) 
{
	PeriphInit();			/* Microcontroller initialization  */	  	
	for (;;) {   		
   	__RESET_WATCHDOG(); /* Kicks the dog  */    	
   	i++;    	    	
   	if (i < 2000){
   		PTAD_PTAD7 = 0;
   		PTAD_PTAD2 = 0;
   	} 
   	if (i>2000) {
   		PTAD_PTAD7 = 1;
   		PTAD_PTAD2 = 1;
   	}    	
   	if (i>4000) {
   	  i = 0;    	
   	}   	  				
	}/* Loop forever */	
}/* end main(void) */




CodeWarrior

CodeWarrior is the Freescale Software development environment. There is a CodeWarrior suite for every Freescale microprocessor family.

CodeWarrior Product Summary Page

CodeWarrior-Special edition for 08 series has code limit for C programs at 32KB. There are 2 versions.

  • The Eclipse-Hosted supports the newest devices and features. Can NOT create new projects with (the old series) HC08. Only with (the new series) HCS08.
  • The Windows hosted (Classic) is the traditional IDE. Use it for existing projects with HC08 but NOT to create a new HCS08 project.
  • It is very easy to download and install both.

CodeWarrior Download special editions


Test Project

Codewarrior is fast and reliable. MON08 just works. Not for serious development debugging from inside Codewarrior. PEmicro Standalone Programming utility works good with MON08. But still behind JTAG or BDM style.

To continue the test with Codewarrior HCS08 and PEmicro USB BDM MULTILINK, targeting efficient-debugging!


HCS08 (BDM) Debug and Flash-programming Tools

SPYDER under-test

Spyder.png SOFTEC SPYDER Low Cost BDM tool is EOL (Freescale Status End Of Life completed].
DO NOT USE IT 


USBDM

USBDM Is open source, supported by CodeWarrior, Easy to make as many as you like, easy to buy. 

It is the physical successor of previous open-source BDM tools: TBDML, OSBDM.

Supports HCS08, HCS12, ColdFire-V1. Does NOT support HC08

Standalone FlashProgrammer Utility

USBDM minimal.png The minimal version is based on 20SOIC USB device MC9S08JS16CWJ (Mouser $1.92 @ 1pc) + 74LV125AD +12MHZ xtal + PESD5V0S2UA protection + passive. * FREE *

Flashgenie.png Buy Commercial-version USBDM in Europe: Flashgenie USBDM JM60 Programmer / Background Debug Module . AT 37EU


USB BDM MULTILINK [TESTED]

Part Number USB-ML-12 USB-ML-12.png
From PE-micro and Freescale For HCS08,HC12,HCS12,ColdfireV1. Older version blue-colored, current version magenta. At $99.

Nice to work with. [forget mon08 :) ]


CYCLONE-PRO

CYCLONE-PRO.png PE-micro CYCLONE-PRO Standalone toll. At $499.


HC08 (MON08) Debug and Flash-programming Tools

MANUAL HC08 Mon08 Target Interface

Mon08 sch.png  MON08 schematic example From Freescale forum thread 

In-Circuit Programming of FLASH Memory Using the Monitor Mode for the MC68HC908JL/JK

From ranchbots.com, PE free programing software for the first time document

Some MON08 details: MON08 at www.eckhard-gosch.de

Some HC08 projects at www.kevinmfodor.com

PROG08SZ Interactive Programmer [tested]

Works nice and fast on HC908GZ16 Freitag board with their MONI8LC. :) :)

Get PE-micro PROG08SZ Interactive Programmer. Includes algorithms for: AB32, AS32A, AP64, AS32A, AS60, AS60A, AZ32A, AZ60, AZ60A, BD48, EY16, GP20, GP32, GR4, GR8, GR16, GT8, GT16, GZ16, JB8, JB16, JG16, JK1, JK3, JK8, JL3, JL8, KX2, KX8, LJ12, LJ24, MR8, MR16, MR24, MR32, QT1, QT2, QT4, QY1, QY2, QY4, RF2, RK2, SR12


MONIF08LC [tested]

MONI08LC.png Jan Freitag tool for MON08 MONIF08LC 
Yes it works. PE-connection-manager: class-II, baud 4330. No need to power-of the board, tested with Freitag HC08GZ16 (xtal=5MHz) board. :) 

MONI08LC Connector
1
N.C.
2
N.C.
3
HC08_RxD
4
HC08_TxD
5
GND
6
+5V
7
HC08_IRQ
8
HC08_PTA0
9
N.C
10
HC08 Reset


PK-HC08QY4 [tested]

Softec PK-HC08QY4.png PK-HC08QY4 Starter Kit for Freescale MC68HC908QY4. At 230EU
Veeeeeeeeeeery slow. Have to de-solder the CPU and solder wires to use it with other target-board :(


USB-ML-MON08

USB-ML-MON08.png Usb-ml-mon08-pinout.png PE-micro USB-ML-MON08. At $99


M68DEMO908QT4: Demonstration Board [tested]

M68DEMO908QT4 demo.pngM68DEMO908QT4: Demonstration Board A workaround needed due to error in monitor firmware:

From EB615 page 3

Another option is to modify the demo board so that 9 V (from the battery) is placed on IRQ/pin5. OSC1/pin2 must be supplied by a 9.8304-MHz external signal. 
If this is done, the board can enter normal monitor mode with aminimum amount of external hardware.
Once the demo board has been brought into normal monitor mode, the software that is downloadable with AN2305/D should be programmed into the MC68HC908QT4. 
Afterwards, user monitor mode can be entered and the user monitor CONFIG1 register error will be corrected.
It worked with PE-connection-manager: IRQ(pin5) at 9V, OSC(pin2) at 9.83MHz, baud 9600, classII, power-off when prompted for enough time. Not so convenient :( :( :(