sOFTWARE GUIDELINES
sOFTWARE GUIDELINES
Abstract
[Draw your reader in with an engaging abstract. It is typically a short summary of the
document. When you’re ready to add your content, just click here and start typing.]
SIVAKUMAR
[Email address]
Table of Contents
1. MODULAR SOFTWARE ARCHITECTURE DESIGN................................................................4
1.1 Design Introduction.....................................................................................................................4
1.2 Benefits of Modular Software Architecture.................................................................................4
1.3 Basic Software Code Structure.....................................................................................................4
1.4 Basic Software Architecture.........................................................................................................5
1.5 Team involved in Development Life Cycle...................................................................................5
1.6 Responsibility and Reusable stack Development.........................................................................6
1.6.1 Routine Practise for Software Engineers...............................................................................6
2. DEVELOPERS TERMS AND CONDITIONS.............................................................................7
3. SOFTWARE DESIGN RULES......................................................................................................8
3.1 Modular Design:........................................................................................................................8
3.2 Clear and Meaningful Names:.................................................................................................8
3.3 Avoid Global Variables:............................................................................................................8
3.4 Parameterize Functions:...........................................................................................................8
3.5 Encapsulation:............................................................................................................................8
3.6 Code Reusability through Functions:......................................................................................8
3.7 Use Libraries and Frameworks:................................................................................................8
3.8 Design for Extensibility:............................................................................................................8
3.9 Document Your Code:..............................................................................................................8
3.10 Version Control:......................................................................................................................8
3.11 Test Driven Development (TDD):...........................................................................................9
3.12 Avoid Hard-Coding Values:...................................................................................................9
3.13 Follow Coding Standards:......................................................................................................9
3.14 Design Patterns:......................................................................................................................9
3.15 Refactoring:..............................................................................................................................9
3.16 Error Handling:........................................................................................................................9
3.17 Dependency Injection:............................................................................................................9
3.18 Use Interfaces and Abstract Classes:.....................................................................................9
3.19 Minimize Coupling:.................................................................................................................9
3.20 Continuous Integration (CI) and Continuous Deployment (CD):.......................................9
4. Embedded C Coding Guidelines..............................................................................................10
4.1 Use Meaningful Names:.........................................................................................................10
4.2 Limit Function Length:............................................................................................................10
4.3 Avoid Global Variables:..........................................................................................................10
4.4 Avoid Magic Numbers:...........................................................................................................10
4.5 Use Enums for Constants:......................................................................................................10
4.6 Pointer Declarations:...............................................................................................................10
4.7 Avoid Hard-Coding:................................................................................................................10
4.8 Check Return Values:..............................................................................................................10
4.9 Use const for Constants:.........................................................................................................10
4.10 Error Handling:......................................................................................................................11
4.11 Modularize Code:..................................................................................................................11
4.12 Use stdint.h Types:................................................................................................................11
4.13 Avoid Busy-Wait Loops:.......................................................................................................11
4.14 Understand Bitwise Operations:..........................................................................................11
4.15 Avoid Dynamic Memory Allocation:...................................................................................11
4.16 Use Inline Functions Sparingly:............................................................................................11
4.17 Avoid Floating Point Arithmetic:.........................................................................................11
4.18 Use Compiler-Specific Directives Judiciously:....................................................................11
4.19 Careful Use of Volatile Keyword:.........................................................................................11
4.20 Avoid Function-like Macros:................................................................................................12
4.21 Consistent Indentation:........................................................................................................12
4.22 Limit Function Parameters:..................................................................................................12
4.23 Use static for Internal Linkage:............................................................................................12
4.24 Use #pragma once for Header Guards:..............................................................................12
4.25 Avoid Unnecessary Type Conversions:...............................................................................12
4.26 Use sizeof for Array Sizes:....................................................................................................12
4.27 Prefer switch over Long Chains of if-else:..........................................................................12
4.28 Use const Correctly with Pointers:......................................................................................13
4.29 Avoid Unnecessary Recursion:.............................................................................................13
4.30 Use #error Directive for Compilation Checks:....................................................................13
4.31 Use snprintf Instead of sprintf:............................................................................................13
4.32 Use NULL Pointer Checks:....................................................................................................14
4.33 Avoid Unnecessary Floating-Point Comparisons:.............................................................14
4.34 Group Related Declarations:................................................................................................14
4.35 Avoid Unnecessary Code Duplication:................................................................................14
4.36 Use volatile for Shared Memory:.........................................................................................14
4.37 Document Hardware Dependencies:..................................................................................14
4.38 Use const Correctly for Function Parameters:...................................................................14
4.39 Limit Line Length:..................................................................................................................14
4.40 Avoid Recursion in Interrupt Service Routines (ISRs):.......................................................14
4.41 Use static for Functions with Internal Linkage:..................................................................15
4.42 Avoid Complex Macros:.......................................................................................................15
4.43 Use const Correctly for Pointers:.........................................................................................15
4.44 Use volatile for Register Access:..........................................................................................15
4.45 Minimize Memory Usage:....................................................................................................15
4.46 Use offsetof for Structure Member Offsets:.......................................................................15
4.47 Prefer enum Over #define for Constants:..........................................................................16
4.48 Avoid Unnecessary Compiler Warnings:............................................................................16
4.49 Use const for Function Parameters Where Appropriate:..................................................16
4.50 Handle Endianness Properly:...............................................................................................16
4.51 Use #pragma Directives Sparingly:.....................................................................................16
4.52 Prefer Bitwise Operations for Flags:....................................................................................16
4.53 Use const for Read-Only Data:............................................................................................16
4.54 Use static inline for Small Helper Functions:......................................................................16
4.55 Avoid Unnecessary Type Casting:.......................................................................................17
4.56 Group Related Functions in Source Files:...........................................................................17
4.57 Use __attribute__((packed)) for Packed Structures:...........................................................17
4.58 Avoid Using rand for Critical Applications:........................................................................17
4.59 Limit the Use of goto:...........................................................................................................17
4.60 Comment Clearly and Concisely:.........................................................................................17
4. AVAILABLE SOFTWARE MODULES / STACKS....................................................................18
5. MODULE OWNERS AND INDIVIDUAL RESPOSIBILITIES.................................................19
6. IQ - EXPERTISE AREAS............................................................................................................19
7 IQ - EXPERTISE AREAS............................................................................................................19
1. MODULAR SOFTWARE ARCHITECTURE DESIGN
Modular Based software architecture can bring many advantages to software projects, such
as reducing the complexity and risk of designing a individual project architecture from
scratch. Also we can reuse the Modular Software Components as Easier, which is portable
with Common Architecture
• Maintainability
• Collaboration
• Reusability
• Portability
• Testability
• Platform Independent
Architecture
Modules
Functions
Statement
1.4 Basic Software Architecture
Bootloader Application
Bootloader
Application
S
C J1939
Middle
H Layer J1939 – 71, 73
J1939
E
D BLE J1939 – 21, 81
J1939 – 71, 73
U
J1939 – 21, 81 L Low Level Layer
E EEP CAN
CAN FLASH R
EEP
MCU IVT Timer
Hardware
Research and Development Team Platform Development Team Application Development Team
Software Architecture
3.5 Encapsulation:
Encapsulate data and functions into classes or structures.
Use access modifiers to control access to class members.
3.15 Refactoring:
Regularly review and refactor your code to improve its structure and maintainability.
Eliminate code smells and improve the design as needed.
Bad: int x;
// Handle error
})
// Function implementation
} // Function implementation }
int array[10];
switch (variable) {
case 1:
// Case 1
break;
case 2:
// Case 2
break;
default:
// Default case
break;
#ifdef MY_MACRO
// Code
#else
#endif
char buffer[20];
if (ptr != NULL) {
void ISR_Handler() {
// Function implementation
}
4.42 Avoid Complex Macros:
Keep macros simple and avoid complex expressions.
*registerPtr = 0x12345678;
#include <stddef.h>
struct ExampleStruct {
int a;
char b;
};
uint8_t statusFlags = 0;
return a + b;
struct PackedStruct {
char a;
int b;
} __attribute__((packed));
S.NO
5. MODULE OWNERS AND INDIVIDUAL RESPOSIBILITIES
6. IQ - EXPERTISE AREAS
S.NO
7 IQ - EXPERTISE AREAS