General Programming


  1. Child Pages

Child Pages

Automated Code Analysis
ContentsOverviewStatic vs. DynamicCode Analysis Program ReviewClangStatic AnalyserCppcheckFlawfinderFrama-CPC LintOverview Automated code analysis is when code reviews other code. It can also be called static analysis, as most programs which do this check the source code without actually running the program (which is where the term static comes from). Static vs. Dynamic Static analysis involves checking a programs source … Continue reading Automated Code Analysis
ContentsOverviewChild PagesGolden ImageOverview Bootloaders are typically loaded by the devices ROM or BIOS. Child Pages Golden Image A golden image is a firmware application with minimal support for firmware updating. If updating over-the-air (OTA), than this image must include basic wireless comms support. It is usually stored either in external flash or in a protected area … Continue reading Bootloaders
Character-Seperated Value (CSV) Files
ContentsTerminologyGeneral RulesStandardsTerminology A CSV file is made up of many records, where a record is a single entire line in the file. Each new line is signified with the record delimiter (typically a carriage return and line feed character, CRLF or \r\n). A record is made up of many fields, each which a seperated by … Continue reading Character-Seperated Value (CSV) Files
ContentsFletcher’s ChecksumFletcher’s Checksum Transmitter Methodology Calculate checksum on raw  data Using the raw data and the newly found checksum, calculate the checkbytes Add the checkbytes to the end of the data packet Transmit data Receiver Methodology Receive data packet Calculate checksum (including the checkbytes) Make sure checksum equals 0, if so, data passed the checksum … Continue reading Checksums
Code Licenses
ContentsOverviewThe BSD 3-Clause LicenseGPLGPLv3Overview If you have been working with code for a while, you’ve probably come across licensing, and terms like “Free as in Speech”, or “Free as in Beer”. What does it all mean? The BSD 3-Clause License URL: GPL URL: The GNU General Public License (or GPL) is a license maintained by … Continue reading Code Licenses
Command-line Interfaces
ContentsOverviewCommand Description (Help) SyntaxOverview A command-line interface is a way of interacting (sending instructions, receiving info) with programs on a computer. NOTE: For a C++ command-line interpreter, that can run on both embedded and P.C. architectures, see clide-cpp on Github. See C->Processing Command-Line Input for how to write C code for dealing with command-line arguments … Continue reading Command-line Interfaces
Continuous Integration
ContentsTravis CIThe .yml FileTravis CI Travis CI is a free (for public repositories), online, hosted continuous integration service. Website: Travis CI is closely tied in with GitHub, allowing Travis CI to automatically manage the CI process for projects that are hosted on GitHub. All you have to do is add a yml file (see below), … Continue reading Continuous Integration
Control Methodology
ContentsOverviewState Machines (single process)A Big switch() StatementReal Time Operating Systems (RTOS, multiple process)ExamplesFrameworksOther External LinksOverview You may think that after writing the state machine for flashing a few LEDs and a buzzer that control metholody is a simple task that doesn’t require further discussion. However, add in a multi-threaded operating system, asynchronous events, more objects … Continue reading Control Methodology
CRCs (Cyclic Redundancy Checks)
ContentsOverviewGenerator PolynomialStart ValueMSB-first vs. LSB-firstProperties Of CRCsCRC CalculatorsSome Common CRC AlgorithmsCRC-8-ATMCRC-16 (CCITT-FALSE)External Resources Overview “Everything you wanted to know about CRC algorithms, but were afraid to ask for fear that errors in your understanding might be detected.” – Ross N. Williams.   Generator Polynomial The hexadecimal representation of the polynomial is what you end up exclusively-ORing the … Continue reading CRCs (Cyclic Redundancy Checks)
Debugging On An Embedded System
The differences between computer/microcontroller debugging, code examples for powerful printf()-style microcontroller debugging and more info on debugging in an embedded system.
Overview, quick reference (cheat sheet), file headers, function documentation, grouping, the main page, Doxywizard, code examples and more info on using Doxygen, an in-code method for generating software/firmware documentation.
ContentsCheat SheetCheat Sheet Ctrl + Tab Switch between source and header files. F3 Switch between declaration and definition (for functions/methods/variables e.t.c). Like this:Like Loading...
ELF Files
ContentsWhat Is The Difference Between BIN and ELF Files?Programs That Operate On ELF FilesELF Code LibrariesELFIOELF is an initialism for executable and linkable format. ELF files are binary object files. There are three different types of object files that an ELF could be: Type Of Object File Description Relocatable File A relocatable object file holds … Continue reading ELF Files
ContentsOverviewHash FunctionsTypes Of AttacksBrute-Force AttackSide-Channel AttacksMan-In-The-Middle AttacksTEMPESTTraffic AnalysisOverview There are two basic types of encryption used widely in computer science, symmetric and asymmetric algorithms. Symmetric algorithms use two identical or very similar keys to both encrypt and decrypt the information. Their main problem is that the sender and receiver need to share these keys securely … Continue reading Encryption
File Systems
ContentsOpen-Source File SystemsFatFsOpen-Source File Systems FatFs URL: A generic file-system module designed for embedded systems which supports a Windows-compatible FAT file structure. It is written in compliance with ANSI C and is separated from the disk I/O layer, therefore is independent of hardware. Supports RTOS (i.e. supports threading/tasks). Sample projects exists (with the driver layer … Continue reading File Systems
Fixed Point Mathematics
ContentsOverviewNotationHow We Store Them In SoftwareThe Range Of Fixed-Point NumbersThe Precision Of Fixed-Point NumbersConverting To Fixed-PointMathematical Operations On Fixed-Point NumbersAdding/Subtracting Fixed-Point NumbersMultiplying/Dividing Fixed-Point NumbersModulus/ModuloInverseEmbedded C++ Fixed-Point LibraryExternal Resources Overview Fixed-point mathematics is a method for representing numbers on a binary computer architecture. It allows the storage numbers with decimal points, similar to the float and … Continue reading Fixed Point Mathematics
ContentsOverviewThe Simplest Possible MakefileAdding VariablesWildcardsAutomatic VariablesIncluding One Makefile In AnotherCalling One Makefile From AnotherDebuggingMore ReadingOverview Makefiles are a way of making a “one touch” build solution for source code. They are a type of file used by the GNU command make. They take multiple file inputs, do some part or all of the code build … Continue reading Makefiles
ContentsWhat To Do With Unused MemoryWhat To Do With Unused Memory When writing code for microcontrollers, it can be advantageous to fill unused memory with particular code. For example, you may wish to fill unused flash memory with “jump to safe place” instructions, which will redirect the program if the CPU program counter goes to … Continue reading Memory
Microcontroller IDE Comparison
ContentsOverviewAVR StudioEclipseKeil uVisionOverview Below is a comparison of some of the more popular microcontroller IDEs (integrated development environments). The results from the 2012 embedded survey were interesting… AVR Studio Cost Free Supported Operating Systems Recent Windows Supported Architectures All 8-bit and 32-bit ATMEL micro-controllers… ATmega ARM AT91 Supported Languages C C++ Supported Compilers WinAVR Supported … Continue reading Microcontroller IDE Comparison
Naming Conventions
See the C Naming Conventions page. Like this:Like Loading...
NMR Quadrupolar Splitting Control Theory
ContentsGoverning EquationPerturb And ObserveSolid-State NMR Governing Equation $$ f_{split} = \lvert 3\cos^2 \theta – 1 \rvert $$ where: \( f_{split} \) = the normalised split frequency (between 0-2) \( \theta \) = the spin angle (between 0-90 degrees) This equation shows that a split frequency can potentially have two possible spin angles (when the split … Continue reading NMR Quadrupolar Splitting Control Theory
PID Control
ContentsOverviewHow PID WorksThe MathsTuning MethodsIntegral WindupWorked ExampleFirmwave ModulesExternal Links Overview PID control is a very common technique for controlling a system in which you have a desired set-point for the system to be in, and are able to control this with one variable. PID is an acronym for proportional-derivative-integral, and describes the three mathematical processes … Continue reading PID Control
ContentsOverviewInstalling.proto FilesValid Scalar (Primitive) TypesReading From A ProtobufC++Writing To A ProtobufC++Serialization/DeserializationProtobuf And CMakeApplicationsOverview protobuf is an open-source, multi-language library from Google for serialising/deserialising data. It is designed as an efficient, language agnostic way of sending data over messaging protocols such as TCP/UDP, or UART/SPI/I2C e.t.c. Source code and downloads can be found at Installing The installation … Continue reading protobuf
Time Measurement Systems
ContentsUTCUnix TimeYear 2038 BugLeap YearsWhat Are Leap Seconds?Trivial SecondsLeap SmearsOther Time SystemsIridiumUTC UTC (coordinated universal time) is a standardised measure of time that most people use in their day-to-day lives. Time zones around the world are expressed as an offset relative to UTC. UTC is not very programmer friendly. To calculate the interval between two UTC dates, … Continue reading Time Measurement Systems
Unit Testing
Information on the purpose of unit tests and the various unit test frameworks available.

Posted: September 15th, 2011 at 7:32 pm
Last Updated on: July 6th, 2017 at 12:01 pm

Leave a Reply