www.ti.com
Coding Standard and Naming Conventions
C.2.2 Function Names
• All functions must begin with their module name in all capital letters, followed by an underscore (‘_’).
• Functions names must be camel case starting with a lowercase letter and should start with a verb
describing the action of the function
– UART_putChar(); PWM_setPeriod(); TIMER_getValue();
C.2.3 Comments
• All comments must use the single line comment delimiter “//” and must be indented to the same level
of the code they document.
C.2.4 Function Prototypes
• All functions must be prototyped in a module’s corresponding header file.
• Prototypes must include Doxygen comments. For more details, see the header files in the software
source in the IEC60730 STL library.
C.2.5 Indentation
• Each indent level is four spaces and all white space only contains spaces (no tabs)
• Continued lines must be indented eight spaces
C.2.6 Bracketed Statements
Bracketed statements must be in one of the following forms:
if (expr) do for(expr; expr; expr) switch (expr)
{ { { {
stmt; stmt; stmt; case CONST:
} } } break;
else if (expr) { case CONST:
stmt; break;
} default:
else { break:
stmt; }
}
C.2.7 File Structure
• All software in a file must reside in one of the following sections. The sections must appear in the
following order within a file:
– - header, includes, defines, typedefs, globals, function prototypes
– For more details, see the header files in the software source in the IEC60730 STL library.
C.2.8 Data Type
Data Types: The following C99 data type must be used:
• _Bool for Boolean types
• (u)int_leastX_t (portable)
• (u)intX_t (architecture specific), where X is 8, 16, 32 and 64
C.2.9 Macro Definitions
• Only single line macros are allowed. Inline functions must be used to optimize functions.
C.2.10 Static Code Coverage
• MISRA and LDRA rule checker is being used to static analysis tools
33
SPRUHI3A–April 2013–Revised August 2013 C2000 MCU IEC60730 Software Safety Development Process
Submit Documentation Feedback
Copyright © 2013, Texas Instruments Incorporated