Fast string to integer conversion (C/C++)

This article presents a few fast and lightweight implementations of conversion from ASCII string to integer. It can be an interesting fit to use in a small microcontrollers like for example ATtiny13, which resources are very limited. All presented functions are simplified and require a null-terminated array of chars as an argument. Convert string to … Read more

Fast string comparison for microcontrollers (C/C++)

This short article presents trivial but fast and memory efficient function to compare two strings. Function returns “0” (zero) on success (strings are the same), otherwise function returns the position where different characters occurred. Example code #include <stdint.h> #include <assert.h> static int8_t xstrcmp(const char *s1, const char *s2) { while(*s1 != ‘\0’ && *s1 == … Read more

STM32 – dockerized toolchain

Lightweight docker image built on top of alpine:3.10 with installed ARM-none-eabi toolchain and few additional tools: ARM-none-eabi toolchain (2019; GNU Tools for Arm Embedded Processors 8-2019-q3-update) stlink (v1.5) make (v4.2) cmake (v3.14) DockerHub: https://hub.docker.com/r/lpodkalicki/stm32-toolchain Installing Bellow you can find recommended simple one-line installer that pulls the newest docker-image and installs stm32-toolchain script into “/usr/bin/” directory. curl https://raw.githubusercontent.com/lpodkalicki/stm32-toolchain-docker/master/install.sh | bash -s … Read more

How to compile and burn the code to STM32 chip on Linux (Ubuntu)

This is tutorial for beginners that shows how to install tools, compile the code with gcc-arm-none-eabi and send it to the STM32 using st-flash. It also introduce basics of automation of this task by putting all instructions into Makefile. A few, complete code examples can be found on GitHub: stm32f401 stm32f072 stm32f042 Updates [28.10.2019] Take … Read more