Conventions
µC/CPU and µC/OS-III are provided in source form and include template files (C and assembly language) which contain instructions about what code needs to be inserted and where. Specifically, you will need to search the source files for four dollar signs (i.e., $$$$) which are used as placeholders and replace those with the necessary code.
It is assumed that assembly language code use a file extension of .asm
. Other assembler might require that the extension be .s
or .src
. If that’s the case with your tools, simply name the assembly language files using the proper extension.
It is assumed that comments in an assembly language file starts with a semicolon, ‘;
’.
In assembly language, there are a number of ‘directives’ that tell the assembler how to process certain pieces of information. Below is a list of such directives and their meaning. The assembler you use may use different syntax for these directives but overall, they should work and mean the same.
- The
PUBLIC
directive indicates that you are declaring a symbol to be globally available. In other words, it’s public for all files to see. - The
EXTERN
directive indicates that the definition of a symbol is found in another file (external to this file). - The
CODE
directive indicates that what follows needs to be linked with the rest of your executable code. In other words, we are not declaring any variables. - The
MACRO
directive is used to define an assembly language macro. A macro is basically a series of assembly language instructions that will be replacing the macro name. In other words, when the assembler sees the macro name being invoked in your code, it will replace the macro name with the instructions that are associated with the macro. Macros are useful to avoid repeating sequences of assembly language instructions. - The
END
directive is generally the last assembly language statement in an assembly language file. The END directive should not appear at the end of a file that defines macros because macro files are generally included in other assembly language files.