Assembler Interface Development

This chapter describes how to generate an assembler interface code using the ofasmif tool in OpenFrame ASM.

1. Interface Specification File

ofasmif creates a cpp interface source file from an interface specification file. An interface is needed to make an asm to non-asm call or a non-asm to asm call.

An interface specification (version 3) has the following structure:

{
"entry_list":
[
    {
        "entry_name" : "ENTRYNAME1",
        "fixed_parameter_list" :
        [
            {
                "param_size" : (PARASIZE),
                "param_type" : (PARATYPE)
            },
            ...
        ]
    },
    {
        "entry_name" : "ENTRYNAME2",
        "variable_parameter_list" :
        {
            "max_length" : (MAXLEN)
        }
    }
    ...
    ..
    .
],
"program_name" : "PROGNAME",
"version" : 3
}
  • entry_list

    A JSON array of entry specifications of a program.

    Each entry defines an entry_name corresponding to the program entry point and the parameters, fixed_parameter_list and variable_parameter_list, that are passed into the program.

    • entry_name

      Name of the entry point (different from the program name).

    • fixed_parameter_list

      A JSON array of fixed number of parameters for the entry.

      Each parameter consists of a param_size and param_type.

      Parameter Description

      param_size

      Parameter size in bytes.

      param_type

      Parameter type.

      • P: pointer type

      • NP: non-pointer type

      • V: variable length type

    • variable_paramter_list

      A JSON object to hold a variable number of parameters for the entry.

      Parameter Description

      max_length

      Maximum allowed number of parameters.

  • program_name

    Assembler program name. An assembler program has an asmo file extension.

  • version

    Interface specification version (same as the version of the ofasmif command).

2. ofasmif Command

The following describes how to use the ofasmif command.

ofasmif [command option...]
  • Basic ofasmif command options

    Option Description

    -i filename

    Sets an input file. Must have the json extension to be recognized as an interface specification file.

    -o filename

    Sets an output file.

    -p

    Enables auto indentation.

    -h

    Displays help.