Flash Arduino from another country

Arduino is pretty popular among tinkerers community. Its a solid way of getting into the world of embedded systems as a beginner. Arduino community/ecosystem is quite big with a lot of tools/libraries/hardware components/literature/forums and what not. Everything is open-source, leading to quite a number of…

Memory allocation for the curious

Disclaimer: Beginners' content. There are two ways to understand how memory allocation works: Look at the code of malloc and all the syscalls used. You can find both of these here and here. Or, wonder why the heck do I have to read 8k lines to understand how memory allocation…

Executing an array as a function

Background A few days ago, I went across a fantastic paper shared on HN. There was a section in the paper where a function apparently ran machine code placed somewhere in data memory. static void walk_instrs(unsigned char *pos, unsigned char *end, void (*cb)(unsigned char *, unsigned, void *), void…

WTF GCC, why pad my structs?

Suppose you have a structure in C as follows struct fields { uint8_t f1; uint16_t f2; uint8_t f3; } What do you think the size of this structure is? It should be 4 bytes, right? However if you print the output of sizeof operator on this struct, it will…

Redis is single-threaded

Redis is, mostly, a single-threaded server from the POV of commands execution (actually modern versions of Redis use threads for different things). It is not designed to benefit from multiple CPU cores. Everything between the MULTI and EXEC commands is supposed to be atomic, i.e. a transaction. Redis promises…

Hi!

Tried different blog engines today. Finally got Ghost running here. Lets see how long I can keep it running before doing a rm -rf on it. #include <stdio.h> int main(void) { printf("%s","Hello World!\n"); return 0; }…