Embedded Software Books

I’m often asked what useful books software engineers should read when they start to work on embedded systems. So here’s a list of books I would recommend as starters. First, nowadays many embedded systems are written in C (although lower end systems using 8-bit MCU are still likely to be written in Assembler), so software engineers had better make themselves very familiar with C/C++ and GNU tools (gcc, libtool. automake…) with a focus on embedded systems (e.g. interrupts handling, real-time capabilities, volatile variables, processes and threads’ stack handling, , cross compilers…).  Programming Embedded Systems: With C and GNU Development Tools, 2nd Edition is just the right book for that purpose. It deals with embedded Linux and eCos and provides useful examples. You may also read part of it online Once you start developing embedded systems you are likely to write device drivers at some points. Linux Device Drivers, 3rd Edition is a must have and is up-date for Linux 2.6. …

Support CNX Software – Donate via PayPal or become a Patron on Patreon

uClinux kernel panic: Stack overflow

If you’re using ucLinux, you may get kernel panic errors  coming out of nowhere. There may be several reasons (buffer overflow, out of memory..), but the most common is stack overflow for the process or one of the threads. To increase the stack size of a flat binary you’ll need to adjust the LDFLAGS as follows: LDFLAGS+=-Wl,-elf2flt=”-s65536″ This will set the stack size to 64KB. To change the stack size of a thread (e.g. 32KB below), you’ll need to set the stack size attribute: pthread_attr_init(&attr); err = pthread_attr_setstacksize(&attr, 32*1024); if (err) { printf(“pthread_attr_setstacksize returned non-zero: %s\n”, strerror(errno)); } err = pthread_create(&pthThread, &attr, thread, NULL); How to detect which thread suffers from stack overflow ? First you can check your code for recursive function calls and local variables (especially arrays) both of which will be added at runtime to the stack to estimate what should be the stack size. So if you have large arrays you may use a pointer + …

Support CNX Software – Donate via PayPal or become a Patron on Patreon