For code that targets an embedded device or some severely resource-constrained environment.

learn more… | top users | synonyms

8
votes
1answer
6k views

Convert between date/time and time-stamp without using std library routines

I am trying to implement in C two simple convertors, date/time to time-stamp and vice-versa, without any dependencies on time library routines (such as localtime, mktime, etc, mainly due to the fact ...
3
votes
0answers
33 views

Mifare AES-128 symmetric key diversification

I have implemented a symmetric (AES 128-bit) key diversification algorithm for Java following the NXP Notes. It works as expected but am not the best Java programmer around, I guess I have done quite ...
12
votes
1answer
81 views

Embedded FizzBuzz

Recently, I have started to enter the realms of embedded systems programming. And, as my first major project, I thought I'd do the obvious: FizzBuzz. However, this is a little different: this is a ...
25
votes
5answers
1k views

Running Lights - Embedded “Hello World”

I'm getting my feet wet in embedded development, and like all those before me, my first task was to make an LED blink. I went a bit further than that and made a "runner" that lights up each led from 0 ...
12
votes
1answer
87 views

Compile-time data structure generator

In response to another recent question I mentioned that one mechanism to avoid runtime overhead for creating a data structure was to create it at compile time and use it directly. Since there was ...
16
votes
1answer
267 views

Spell Corrector in C

I recently stumbled across this article on how to write a spelling corrector, and figured I'd try to have a go at it in C (mainly because the link at the end of the page for the C code is broken). ...
7
votes
2answers
154 views

Manage multiple file writes in C

I have a very simple C program that continuously reads from a temperature sensor and displays the temperature on two 7-segment LEDs. Reading is simple, but to display the LEDs I need to write to 14 ...
7
votes
1answer
67 views

Adding support to Busybox vi for reading file from stdin

I am writing a patch for Busybox's implementation of vi, the classical command line code editor and predecessor of vim. It can ...
2
votes
1answer
128 views

Very basic shell on microcontroller in C - follow-up

This is a follow-up of: Very basic shell on microcontroller in C A few days back I've asked for a review on a simple shell parser in c. Based on the answers, I've restructured my code to use a ...
6
votes
2answers
185 views

Selecting an algorithm and key for Java Card encryption

I was playing around with Java Card and I try to do one of the examples. P1 is what it has to do (e.g. decrypt, encrypt, etc) and P2 is to select which key to use in P1. Here is what the code looks ...
3
votes
1answer
275 views

Websocket-based server for Raspberry Pi

I am trying to build a websocket server to run on the Raspberry Pi. The websocket server has to push periodic realtime update to a browser. Here is a sample code that I am planning to use. The example ...
1
vote
0answers
61 views

Defining a char device driver protocol over uart at kernel level

My aim is to write a blocking char driver that return to the user space a complete protocol message from the kernel uart driver. Protocol description I'm fighting with a very bad protocol, called ...
2
votes
1answer
280 views

Small, embedded full-stack web server

I did this project last year, under some interesting constraints: it's a thin webserver which lives in a Raspberry Pi, which is networked to an embedded system in an industrial sign which is running a ...
0
votes
1answer
356 views

C for Nios-2 IRQ handling

Related: Please review assembly for Nios 2 interrupts ...
1
vote
1answer
70 views

Blinking LED code at a particular frequency [closed]

I wrote a function for interacting with my PIC16F1788. The code sends pulses out the RC4 port at a specific frequency, to make ...
0
votes
1answer
29 views

Moving between two angles in a set amount of time [closed]

I need to slowly change from one angle to another angle over a certain amount of time, using the shortest path between them. I have a function that accepts four parameters — the start and end angles ...
4
votes
2answers
374 views

Bash CGI Upload File

I'm using the following Bash CGI to upload a file: ...
6
votes
1answer
115 views

Simple dishwasher C++ code

I have a project in embedded systems and I have to write the code in C, and make it simple. This is my first time, and it's only a simulation of how it should work. ...
6
votes
2answers
174 views

Very basic shell on microcontroller in C

Objective: A lightweight shell that runs on a microcontroller (MSP430) and parses incoming data into a command and additional parameters. Requirements: Support of quoting in ...
7
votes
3answers
129 views

Shell Script Image Replication

I have a shell script which is being used on an embedded human machine interface (HMI). This script is used to copy a few files from a USB stick to a different place on the device, but with multiple ...
2
votes
1answer
270 views

Driving 7-segment displays

I made a little JavaScript app here that let people generate bitmap for generating characters. Currently it generate code of a dictionary. But I want to also generate a example that let them play like ...
2
votes
1answer
955 views

Nios 2 interrupt handler

This is homework for which we have prepared Nios 2 assembly: ...
10
votes
2answers
215 views

Embedded C# bitpacked arrays to low-level STM32F4 driver for GE G35 RGB LED Christmas tree light

I'm going to be opensourcing some code I'm working on. I don't need help with the code, I just want to make sure my code is readable and my comments make sense. I have a knack for the esoteric. ...
4
votes
3answers
318 views

Basic Encoding Rules (BER) class for embedded system

I'm implementing a communications protocol in an embedded system and the protocol uses a subset of the ASN.1 BER (Basic Encoding Rules). In a nutshell, this class simply represents a TLV triplet ...
3
votes
0answers
33 views

Using record variant for register mapping in Ada

It is OK to model a double usage register with a record variant: ...
6
votes
1answer
111 views

MicroC task switching

My background for this review is a university course in embedded systems using MicroC and this question. Now my program appears to run ok, but I'd like to know what you think can be improved or if the ...
7
votes
3answers
390 views

Optimizing a loop in C for a microcontroller

I am trying to draw a Checkerboard pattern on a LCD using a GUI library called emWin. I have actually managed to draw it using the following code. But having this many loops in the program body for a ...
10
votes
3answers
463 views

Parsing comma-separated floats and semicolon-delimited commands

I wrote a cstring parser. It has to work with a relatively wide amount of arguments (usually 3 or 4, but maybe in future with a different amount), which are ...
8
votes
3answers
778 views

Hierarchical k-ary tree in C without relying on RAM

I created a k-ary tree in C to be used as an easy and efficient way to organize "UML-like" data in embedded devices. The left node is at the lower logical level (a child) while the right node is at ...
5
votes
1answer
86 views

Better way to write this branch with an exceptional retry in an embedded C environment?

A while back I wrote the following code (target is embedded C code on an 8 bit atmel device): ...
7
votes
4answers
176 views

Writing an interface for networking in an embedded system

I'm writing a driver in C for a WiFi module attached to a PIC18 microcontroller. I want to implement some functions that I'm familiar with in computer application level programming like Window's API ...
8
votes
1answer
190 views

Embedded conditional code compaction

I'm porting some AVR code from PROGMEM/PGM_P to __flash, and I want to reduce the amount of ...