Posts

Showing posts from 2022

Secure Communication for Embedded Devices: Best Practices for Bootloader and Application

Image
Communication between the microcontroller's (MCU's) bootloader (BL) and server (SRV) that run at some online virtual machine can be secured. There is only one secret that needs to be properly secure and that is Preshared Key on both sides. Here I'll explain how we implemented secure communication between IMBootloader and our servers. I'll start with Preshared Key . It is a key that is stored at the SRV and the BL. It is only a preshared piece of information that will make sure both BL and SRV can communicate securely with each other. The Preshared Key is the same on both sides. On the SRV side, there are many different methods to secure the key, and only the person who has access to the server can get to it. The more problematic part is BL which will arrive to users at Hardware device. This is when Preshared Key is exposed. This is where FLASH read protections get in handy. For STM32 MCUs there is LEVEL2 protection that will make sure everything that is

PX4 Autopilot developer tips & tricks part 1

Image
Hardware setup  If you didn't already seen here are two tutorial how to work with PX4 Autopilot: PX4 development - building, flashing and debugging with debugger (like a PRO) PX4 development - building, flashing and debugging without debugger (Arduino developers style) If you work or you are planning to work with PX4 and if you didn't use debug serial console connection before, I recommend it. The advantage is that you will be able to see if everything boots properly after your changes. Another thing is you can write direct commands over it so you don't need to use QGroundcontrol and MAVLink console. It is useful to have one of those boards:

PX4 development - building, flashing and debugging with debugger (like a PRO)

Image
 This is the next tutorial that brings a bit more expertise into PX4 Autopilot debugging from an embedded software developer perspective. It will explain how to use J-Link debugger to debug PX4 Autopilot code in Eclipse IDE. If you didn't already see the previous tutorial, please go there, first phase of PREPARING is mandatory to be done so we can continue here. Link to previous tutorial: https://igor-misic.blogspot.com/2022/06/px4-development-building-flashing-and.html Everything in this tutorial is tested and reproduced at Kubuntu 22.04 LTS (It works the same for Ubuntu as well).

PX4 development - building, flashing and debugging without debugger (Arduino developers style)

Image
 This is a short tutorial that will explain how to build PX4 Autopilot, flash and debug it at the PX4 FMU (Flight Management Unit) without a debugger. Everything in this tutorial is tested and reproduced at Kubuntu 22.04 LTS (It works the same for Ubuntu as well). Preparation Let's start with cloning PX4 Autopilot > git clone https://github.com/PX4/PX4-Autopilot.git After the repository is cloned make sure you initialize all submodules. You would like to keep using this GIT commands when you jump between branches in PX4, otherwise, you can experience issues like missing modules while building. > cd PX4-Autopilot > git submodule sync > git submodule update --init --recursive And that is it we are almost ready to build our PX4 firmware. You need to know what board (FMU) you possess. Let's guess you have Pixracer. Pixracer is fmu-v4 board. Figure 1 - px4_fmu-v4 board source tree

MatLab CRC8 SAE J1850

Image
 I got unexpected request for help of porting  CRC8 SAE J1850 to MatLab code. So I decided to publish it also here if anyone else needs it. Code is here: Screenshot from MatLab online: I hope this can help you.  Best Regards, Igor Mišić

Fastest automotive Base64 encoder and decoder

Image
 Base64 will probably not be used in the safety-critical parts of code, but if needed for some other segment, why not use the fastest and most secure and safe one? Background story We started IMProject back in 2021. It is in general Bootloader and Flasher ecosystem. Soon we figured out that we would like to use JSON for easy human readability of some identification and this is where we introduced Base64 into our project.  Since we are writing our code following MISRA C:2012 we were searching for an automotive or avionic Base64 code but without luck. We figured out that we will need to do it by ourselves. This is where Juraj jumped in and reused the algorithm of the fastest open-source Base64 encoder and decoder to rewrite it in C by MISRA C:2012 coding guidance. What did we use? There is a guy Gaspard Petit who tested probably all available base64 algorithms. He went to the conclusion that the fastest base64 encoder is jounimalinen  and polfosol  decoder. The original StackOverflow