C Programming
These notes are my working document to C programming. It includes basic concepts
and documentation on items of interest to me.
Style
This nice embedded C coding
standard.
It really helps to use tools such as clangformat
to help with automatic formatting.
Libraries Vs Executables
They are essentially the same thing. However a library is meant to
be run by another program and a exectuable runs on its own.
For example the library <stdio.h> is a dynamic shared library. And
a simple hello world executable that just is meant to be run manually
would be an executable example.
Here are some helpful resources for this
Static Libraries
Linking Libraries
This stackoverflow guide shows how to
link multiple static libraries together.
The command looks like this
|
|
And luckily, it works just fine with the arm5 compiler
|
|
Cmake Build System
There is so much to Cmake that I will create a new page just for cmake.
Shared Libraries
Macros!!
Stringization And Double Stringization
Single stringization can be done with a macro like this. It can be used to get
the name of variables.
|
|
Double stringization can be done with created another macro additional to the
single stringization method. This can be used to stringize the value of the
variable instead of the name. Useful for integers.
|
|
Here is an example where I used this to help create MQTT paths. I wanted to have
a macro for the QoS as a number and as the string form.
|
|
Embed Lua In C
Check out the full page Using_C_With_Lua