How to add an include file to inline assembly

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 
已解决

How to add an include file to inline assembly

跳至解决方案
557 次查看
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.

标签 (1)
标记 (1)
0 项奖励
1 解答
306 次查看
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 项奖励
1 回复
307 次查看
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 项奖励