beautypg.com

Assembling the program – Echelon Neuron User Manual

Page 53

background image

Neuron C compiler to copy the contents of a Neuron assembly file as-is into the

assembly-language output for the program, as shown in Figure 8.

Compiled Neuron C

Program

Included Neuron Assembly

Source Code

Neuron Assembly Output from

the Neuron C Compiler

Neuron C Program File

Neuron Assembly Source

File

#pragma

include_assembly_file file

Source Files

Figure 8. Including Assembly Code in a Neuron C Program

This method exposes the Neuron C application programmer to your assembly

source code. For improved code management, and the option to conceal your

assembly source code from the Neuron C programmer, see Assembling the

Program.
For many general cases where a Neuron C application is supported by one or a

few functions written in Neuron assembly, this method is preferred because of its

simplicity. However, you should consider the following limitations:

If you include assembly source within a function, interrupt task, or when

task, the CODE segment becomes active, and you cannot change the

segment.

If you include assembly source outside a function, interrupt task, or when

task, you must specify the segment to use, because you cannot make

assumptions about the current segment type.

The compiler uses RADIX HEX, and thus assumes the default format for

numerical constants is hexadecimal. Do not change the default radix (or

be sure to change it back to hexadecimal) when including assembly

source files.

The #pragma include_assembly_file compiler directive is available for users of

the IzoT NodeBuilder Development Tool.

Assembling the Program

To assemble a single Neuron assembly file, use the Neuron Assembler command-

line tool (NAS.EXE).
Example: To assemble a file named checksum.ns, use the NAS command, as

shown below:

C:\myDevice> nas --listing checksum.ns

Neuron Assembler, version 5.00.21, build 0

Neuron Assembly Language Reference

43