Presentation is loading. Please wait.

Presentation is loading. Please wait.

Writing Portable and Robust Firmware in C

Similar presentations


Presentation on theme: "Writing Portable and Robust Firmware in C"— Presentation transcript:

1 Writing Portable and Robust Firmware in C
Embedded System Design Techniques™ Writing Portable and Robust Firmware in C Class 2: Doxygen and PC-Lint September 1, 2015 Jacob Beningo, CSDP

2 Course Overview Portable C Concepts Doxygen and PC-Lint
Uart Driver and Stm32CubeMx Assertions and printf Robust Firmware Concepts

3 Session Overview Doxygen Commenting Code Advanced outputs Lint
Taming the beast MISRA-C

4 Introduction to Doxygen

5 Doxygen Setup Download at http://www.stack.nl/~dimitri/doxygen/
FULL_PATH_NAMES unchecked SHORT_NAMES checked OPTIMIZE_OUTPUT_FOR_C checked RECURSIVE checked CALL_GRAPH checked CALLER_GRAPH checked HAVE_DOT checked?

6 Commenting Syntax Doxygen Block /**
* Defines the value of PI as */ #define PI * Defines possible system commands typedef enum { COMMAND_1; /**< Command 1 Identifier */ COMMAND_MAX; /**< End of commands Identifier */ }Command_t; Doxygen Block

7 Structure Comment Example
/** * Defines the data structure for the EPS telemetry */ typedef struct { uint16_t VBatt_I; /**< Current on VBatt */ uint16_t VBatt_V; /**< Voltage on VBatt */ uint16_t V_5VBus; /**< 5V Bus Voltage */ uint16_t Temperature_Battery1; /**< Battery temperature #1 */ uint16_t V_3_3VBus; /**< 3.3V Bus Voltage */ uint16_t Temperature_Board1; /**< Battery Board Temperature #1 }BatteryData_t; Doxygen Block Comment Before

8 Example Code (Not Executable)
Commenting Functions /********************************************************************* * Function : I2C_BufferStateSet() *//** * \b Description: * This function is used to get the current state of the I2C buffer * I2CBufferState_t – New buffer state TRUE if state change successful, FALSE otherwise * \b Example: * StateStatus = I2C_BufferStateSet(I2C_DISABLE); Doxygen Block NOT Included HTML Bold Tag Example Code (Not Executable)

9 Advanced Outputs

10 Lint Ways to Perform Code Analysis Complexity Measurements
Lines of Code Comment Density Assertion Density Static Code Analysis Dynamic Code Analysis Worst Case Stack Usage Automated Tools (i.e. Code Standard Compliance)

11 Why use Lint? Syntax Errors Internal Errors Fatal Errors Warnings
Informational Elective Notes

12 PC-Lint Setup Keil PC-Lint Setup Project Include Paths Lint Path
Config Path

13 Configuring Lint for a Project
1 2 5 Select Compiler as Keil ARMC Select the Memory Model Find include files Identify Keil path to includes Set the environment 3 4

14 Lint Output Std.lnt 332 Lines of OUTPUT!
Warning 537 – Repeated include files Info 716: while(1) Error 129: declaration expected __STATIC_INLINE Error 14: Symbol previously defined Info 830: See previous message Warning 534: Ignoring return value of function

15 Taming the Beast 102 Lines of OUTPUT Issue? Implicit Cast

16 Configuring for MISRA-C

17 Additional Resources Download Course Material for
Updated C Doxygen Templates (May 2015) Example source code Templates Microcontroller API Standard EDN Embedded Basics Articles Embedded Bytes Newsletter From under - Blog and Articles > Software Techniques > CEC Writing Portable and Robust Firmware in C

18 Jacob Beningo Newsletters P.O. Box 400 Embedded Bytes
Linden, Michigan 48451 Newsletters Embedded Bytes Training MicroPython Bootloaders Low Power Design Real-time Software C/C++ Embedded : : : Jacob_Beningo : Beningo Engineering : JacobBeningo : Embedded Basics Jacob Beningo Principal Consultant


Download ppt "Writing Portable and Robust Firmware in C"

Similar presentations


Ads by Google