Compiling an application for use in highly radioactive environments

Working for about 4-5 years with software/firmware development and environment testing of miniaturized satellites*, I would like to share my experience here. *(miniaturized satellites are a lot more prone to single event upsets than bigger satellites due to its relatively small, limited sizes for its electronic components) To be very concise and direct: there is … Read more

Multiple assignment in one line

Remember that assignment is done right to left, and that they are normal expressions. So from the compilers perspective the line sample1 = sample2 = 0; is the same as sample1 = (sample2 = 0); which is the same as sample2 = 0; sample1 = sample2; That is, sample2 is assigned zero, then sample1 is … Read more

STM32 how to get last reset status

@floppes recommends to: Read RCC_CSR as soon as possible after startup, before initializing any other peripheral. It is safe to initialize your system clocks first (which is done in SystemInit() if you use ST’s libraries). Now, to determine the exact reset cause, here’s a full function to help you. Note that all reset flags can … Read more

Is there a way to convert from UTF8 to ISO-8859-1?

Here is a function you might find useful: utf8_to_latin9(). It converts to ISO-8859-15 (including EURO, which ISO-8859-1 does not have), but also works correctly for the UTF-8->ISO-8859-1 conversion part of a ISO-8859-1->UTF-8->ISO-8859-1 round-trip. The function ignores invalid code points similar to //IGNORE flag for iconv, but does not recompose decomposed UTF-8 sequences; that is, it … Read more