
Write a GNU ld Linker Script for an STM32 From Scratch
Write a complete GNU ld linker script for an STM32F407: MEMORY regions, vector table, .text, .data with AT>, .bss, heap and stack reserve, and link-time checks.
Tag
362 posts

Write a complete GNU ld linker script for an STM32F407: MEMORY regions, vector table, .text, .data with AT>, .bss, heap and stack reserve, and link-time checks.

Detect controllers, read buttons, sticks and triggers with the SDL 3.2 gamepad API in C, apply dead zones, handle hot-plugging and add rumble.

A use-after-free reads or writes memory after free released it. See how it happens in C and C++, how ASan reports it and patterns that stop it.

Compare epoll level-triggered and edge-triggered modes with EPOLLET, see exactly when each reports readiness, and pick the right one for your server.

Name threads with pthread_setname_np so gdb, top -H and /proc show readable names. Covers the 15-character limit, ERANGE, prctl and C++ and Rust.

Run Valgrind Memcheck on your unit tests in CI with exit codes, suppressions and XML output so a new leak or invalid access fails the build before it merges.

Use struct k_work_delayable with k_work_schedule and k_work_reschedule to run work after a delay, then build a debounce, a timeout and a periodic task.

Use the goto cleanup pattern in C to release files, memory and locks on every error path in reverse order, with a worked example and its limits.

Replace the vendor assembly startup file with one C file for a Cortex-M4: vector table, weak aliases, data copy, bss clear and the GCC flags that keep it safe.

A heap buffer overflow writes past a malloc block into the next chunk. Learn the common causes in C, how AddressSanitizer and Valgrind find them, and fixes.

CPUs split execution into user and kernel mode so the OS can protect itself. See how a Linux x86-64 system call crosses over and what a privileged fault does.

Write a single-threaded TCP echo server on Linux with epoll_create1, epoll_ctl and epoll_wait, using non-blocking sockets and a clean accept and read loop.