Please enable JavaScript.
Coggle requires JavaScript to display documents.
[Book] Reusable Firmware Development - Jacob Beningo - Coggle Diagram
[Book]
Reusable
Firmware
Development
- Jacob Beningo
Qualities of portable SW
4 -> 6
Clean interface
Good SW architecture
Has a HAL
Hardware Abstract Layer
Readable & maintainable
1 -> 3
Loosely coupling
file-including graph must not too complex
High cohesion
Modular
Follow a standard
(C99 is common)
Modular
Split into files, based on modules or functionalities
7 -> 9
Data encapsulation & abstract data type
Well documented
Simple
SW portability
a. Challenges of HAL portability
Processor architecture
Bus width
Endianess
b. Evaluate SW portability
c. Suggested steps for
a portable SW development
Get familiar with MISRA C/C++
Apply coding rules
Select a language standard.
Spend 30 min/day to read it
Build SW architecture
Evaluate the SW portability with spider chart
SW architecture
a. HAL issues
Porting to another MCU or toolchain
Copyright violation when used provided libaries
Integration: commercial & open-source libraries integration
[Misc]
AUTOSAR
is a bit convoluted and expensive to use as far as processing power goes and
doesn’t play well
on resource-constrained microcontroller systems running
under 200 MHz
Too many-layer architecture
will increase the no function calls
=>
Slow
b. Good HAL characteristics
Well defined coding standard
Reasonable documents and comments
(comment Why than How it is done)
Apply C99 because of
it is most common
C90 lacks some useful things
C11 is not supported by some compilers
Can compiled with any modern compilers
(GCC, IAR, Keil, ...)
HW features abstraction
Make a must-have features of each peripheral
Easily extend
Contain pre-defined & standard function set for most MCUs
Modular & adaptable
Split driver into files
Deterministic & well-understood behavior
Provide functional & non-functional test
Error handling & diagnostic capabilities
Check params and return a function result
=> Reduce debug time
Integrated regression test
Test for normal & abnormal cases
c. Good API characteristics
Use easy-to-understand naming convention
Well-documented with examples
Use
"const"
for read-only params
Flexible & configurable
Use config file, macros, ...
d. Wrapper interface applying
Wrapper = interface that uses MCU functions
& then provide it to higher layer
Aim: generalize & standardize the API for upper layer
Cons:
Function overhead
Increase call stack size
Device driver fundamental
a. Memory map