
How an RTOS Context Switch Works on Cortex-M With PendSV
Follow a FreeRTOS context switch on Cortex-M4F from the yield request to the PendSV handler, and see which registers hardware stacks and which software saves.
Tag
362 posts

Follow a FreeRTOS context switch on Cortex-M4F from the yield request to the PendSV handler, and see which registers hardware stacks and which software saves.

Get memory aligned to 32, 64 or 4096 bytes with posix_memalign or C11 aligned_alloc, learn their rules and error codes, and pick the right one for SIMD or DMA.

Create an I2C bus with i2c_new_master_bus, attach a device with i2c_master_bus_add_device, and read registers with i2c_master_transmit_receive in ESP-IDF 5.3.

Compile with -fsanitize=address to catch heap overflows, use after free, double free and leaks, and learn to read the report that names the exact line.

Read a TMP102 sensor on a Raspberry Pi Pico with i2c_init, i2c_write_blocking and i2c_read_blocking, using nostop for the repeated start.

Hard, firm and soft real-time differ in what a missed deadline costs, not in how short it is. Learn to classify requirements with examples and a utility test.

Turn Segmentation fault (core dumped) into a line number: compile with -g, enable core files, open the core in gdb, and read the backtrace and variables.

Write an Arduino I2C scanner with Wire.beginTransmission and endTransmission, read the error codes and fix the usual reasons a device does not appear.

Replace hand-written register accessors with regmap: one config for I2C or SPI, read and write, update_bits, caching and a debugfs register dump on Linux 6.12.

Amdahl's law caps parallel speedup at one over the serial fraction. Work the numbers in C and see why a 95 percent parallel program tops out at 20 times.

Install a Yocto SDK, source its environment script, and cross-compile a C program with the CC variable it sets, then check the result before running it.

A superloop is fine until timing, blocking calls and feature count collide. See the signs that bare-metal firmware needs an RTOS and when it still does not.