How to add an include file to inline assembly

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

How to add an include file to inline assembly

Jump to solution
550 Views
snickface
Contributor I

I want to use inline assembly, within a 'C' environment to implement some functions. I need to add an "include file" so that I don't get undefined errors. How do I include an "include file" in inline assembly? I'm using CodeWarrior 10.2 for microcontrollers and an MC12311CHN chip which contains an HCS08 microcontroller.

Example:

void foo (void)

{

  asm

  {

sta FCMD ; command the flash

  }

}

Without an include file such as mc9s08qe32.inc, FCMD is undefined.

Labels (1)
Tags (1)
0 Kudos
1 Solution
299 Views
bigmac
Specialist III

Hello, and welcome to the forum.

 

For a .c file that references any hardware registers, you should

#include "derivative.h"

 

or alternatively

#include <mc9s08qe32.h>

 

The first file is created by the project wizard, and references the header file for the device.  For the second method, you are doing this directly.  The first method is preferred - should you ever change the device used for a project, derivative.h will be automatically updated by the wizard.

 

There is a macro for FCMD within the device header file.

 

Regards,

Mac

 

View solution in original post

0 Kudos
1 Reply
300 Views
bigmac
Specialist III

Hello, and welcome to the forum.

 

For a .c file that references any hardware registers, you should

#include "derivative.h"

 

or alternatively

#include <mc9s08qe32.h>

 

The first file is created by the project wizard, and references the header file for the device.  For the second method, you are doing this directly.  The first method is preferred - should you ever change the device used for a project, derivative.h will be automatically updated by the wizard.

 

There is a macro for FCMD within the device header file.

 

Regards,

Mac

 

0 Kudos