December 31, 2012

Arithmetic encoding (bookmark)

Based on the previous post, I can't stop until I implement my own arithmetic coding. The worse is I don't have my laptop with me, therefore I only have read articles and tried encoding/decoding on the paper. Which is slightly harder if numbers used are fixed point and want to imitate how C program should work. These 3 pages helped me most to understand the problem.

Arithmetic Code [michael.dipperstein.com]
Basic arithmetic coding [arturocampos.com]
Arithmetic coding how to [pdf] [webspace.ulbsibiu.ro/macarie.breazu]

December 26, 2012

Sort 1 milion of 8 digit numbers in 1M RAM (bookmark)

This one caught my attention yesterday, I will share a blog where it's written a solution and an explanation. There's more to read on that blog.

The question seemed to be asked during the interview, one of those which give you no peace until you find a possible approach.

Sort 1 million of 8 digits in 1MB RAM [preshing.com]

December 25, 2012

Books review (C and C++)

I was reading one post about which book you should not buy and realized I have not shared any websites which ultimately can narrow down the search. I normally check some blogs with reviews, accu webpage and amazon rating and google book preview before I purchase a book.

Books review [accu.org]
More than 1800 reviews. I would start with this one.

A few tips for choosing C and C++ books [cs.technion.ac.il/users/yechiel/CS]
Hints for choosing proper book. Links are at the bottom of the page where is list of bad C/C++ books.

I even tried to read some on my kindle but I prefer paper books for this type of reading. More posts about books should arrive.

December 23, 2012

Memory leaks in C

Dangling pointer/ memory leaks topic this time. I would like to dedicate to this topic more time, it might more to come.

Memory leaks [mindcracker.com]
This article is about dangling pointers and memory leaks in C language.

Simple rules to avoid memory leaks in C [mousomer.wordpress.com]
5 rules to avoid memory leaks.

Binary numbers

This post differs a bit. I'll post website about binary numbers, arithmetic and also programming related. Articles are mainly focused on binary numbers - integer and floating conversion as an example.

Exploring binary [exploringbinary.com]

December 22, 2012

Casting in C

I found explained simply The casting in C language with some examples.

Casting [fiendish.demon.co.uk]

December 14, 2012

Debugging make files

There are moments when makefile is not working as expected. I had to develop test suites for new platform and decided to update entire test system which was not probably best idea I had that day :-) It stopped working and I only got one line on the terminal. This article was something I was looking for and I was able to find out the line which cause the trouble.

Debuggin make files [oreilly.com/catalog/make3]

CooCox API

I have been spending my leasure time with CooCox library. They provide CoIDE, CoFlash and Cox library. CoIDE is simple and fast to set up, possible to use J-link, OpenSDA and many more. I was worried in the beginning because of eclipse and some experience with other IDE which I was not fond of :) It turned out great, eventhough it is still under development.
The source code is on GitHub and forum is alive.

CooCox supports Cortex M0 and Cortex M3 so far. Next step is to try their CoOS, but that has to wait a bit. Still many areas to explore in their interface.

CooCox website [coocox.org]

December 10, 2012

Cortex M3 and M4 fault exception

There was one request to explain memory dump which is printed in unexpected ISR. There's published application note from KEIL about how to "decode" memory dump and find out which was last active function and more..

Using cortex m3 and m4 fault exceptions [www.keil.com]

Anyway, great resource to this particular situation is Definite Guide book for Cortex M0 or M3. THat one explained it well.

November 30, 2012

Coding in debugger

There are posted few tips how to change immediate values, skip function call, ... during debugging. Quite helpful and I believe any embedded engineer do it regularly.

Coding in debugger [msinilo.pl/blog/]

November 29, 2012

Impulse and unit step responses

I posted yesterday post about IIR filters but totally missed the topic which I should have started with. It's about systems responses. I had finally some time to document filters we use in code.

The Unit Step Response [lpsa.swarthmore.edu]
Link directs to the unit step response. There's tab also with the impulse response. All explained with introduction and equations followed by pictures.
Website's name is Linear Physical System Analysis. Recommended to read !

November 28, 2012

Digital filters

I've been wondering always how to implement filter in C language. There was a time when I just copied one IIR filter and tuned it to my needs but did not bother with discovering more about it and implement my own one. This springs back when I have to test a part where are few filters applied.

I have started with IIR and low pass filters.

Fixed Point Scaling [rowetel.com/blog]
This one explains simple low pass filter and provides octave file which helps me really weLL.  I will come back with octave topics later.
What is moving avarage filter? [dsprelated.com]
DSPrelated is the one which I visit when I look for digital signal processing. Articles, forum with many experienced users.
Introduction to Digital Filters [rw4.cs.uni-sb.de/~kaestner]

Low pass filter [helpful.knobs-dials.com]
This is moving avarage filter with code. Simple which enables reader to understand it quickly.

November 27, 2012

Goto in C language

Here's another article about using goto in C language and some links to explore more. I have seen in in one RTOS and wondered back then, also with connection to error handling.

Using goto for error handling in C [eli.thegreenplace.net]

November 26, 2012

Embedded projects website

I believe I forgot this website to add to my bookmars, otherwise I would have been checking it regularly. Website has updates often. There are tutorials for AVR and ARM (STM32).

Embedded projects [www.embedds.com]

C Gotchas

I am going to post some links here about C gotchas. This one I digged today:

[spin.atomicobject.com/]

ARM developing with open source tools

Hello all,

my intention was to play with free available tools. I have started with CooCox 1.6.0 and Freedom Board KL25. I've had some problems with examples pregenerated, but they work and IDE works smoothly, quickly. So far not any problem except memory view, but I will figure it out somehow.
I'll post here some links about the development for free on ARM :-)

There is plug-in called Eclipse CDT Manged Build Extension for GNU ARM Toolchains like CodeSourcery G++ Lite, GNUARM, WinARM, Yagarto, devkitPro, Summon.

Free ARM CooCox IDE [www.coocox.org/CoIDE]
Developing with Sourcery CodeBench [www.acmesystems.it]
I am going to test Sourcery as second. I have to touch more peripherals in CooIDE first.

kunen.org [http://www.kunen.org/uC]
Not only IDE to use, just command line and linux is simply enough. Here's tutorial with prerequisities and steps

November 4, 2012

Stack usage

Stack overflow? How to determine stack usage or how much dynamic allocated space does an application use? This article provides answers to those questions.

Mastering stack - Part 1[www.embedded.com]
There are 3 parts of Mastering stack and heap written by IAR employee. Review also links at the end of the article.

Object-oriented design in C language

Time to reduce my drafts messages here. This topic is going to be bond to the object-oriented approach used in C.

Object-oriented design patterns in the kernel, part 1 [lwn.net]
First part of this series is focused on vtable in kernel, NULL pointers as function pointers.

Object-oriented design patterns in the kernel, part 2 [lwn.net]

Inheritance and polymorphism in C [state-machine.com]

October 22, 2012

The Practice of Programming (book worth to have)

I have bought another book - The Practice of Programming from B. W. Kernighan and Rob Pike. I haven't finished reading but so far seems to be pleasant reading

Eli Bendersky [eli.thegreenplace.net/]
I was reading this blog when I discovered what I have missed in my collection and immediately ordered my own copy.

Answers to The Practise of Programming [bamsoftware.com/computers]
Answers to the exercises in the book. Can't confirm about the quality yet.

I'll review it once I finish reading.

October 15, 2012

Keyword register C language

Does register keyword indicates to the compiler it should place the variable into register or that compiler inhibits the access to the variable?

Misconsception register keyword [gustedt.wordpress.com]

Understanding register keyword [www.geeksforgeeks.org]

Why to use VIM !

I have only played with VIM, frankly not much. This post has raised my interest and it's on my TODO list to check out VIM :-)

Why to use VIM ? [http://users.softlab.ntua.gr/~ttsiod]

October 8, 2012

Interview with Brian Kernighan about C language

This deserves own  post, an interview with Brian Kernighan:

An Interview with Brian Kernighan on C and The C Programming Language [www.informit.com]

Blogs about C/C++ language

I am going to update this list from time to time if I find anything relevant to this topic.


Gustedt's blog [https://gustedt.wordpress.com/]
Lately digging about C99.

C/C++ blog [eli.thegreenplace.net]
Various topics about C/C++ with perl/python mixture.

GCC tips [pixelbeat.org/]
Few tips from this blog, signed integer overflow, c string problem

Dave's bookmark [delicious.com/dpt]
Bookmarks which are articles about programming.

Paul Hsieh's programming blog [azillionmonkeys.com]

August 19, 2012

Deep C

Do you have deep knowledge of C/C++ Language?  Test yourself with this presentation. There are question-answer slides with 2 different candidates. First half is dedicated to C language, second one to C++.

I was fond of reading all of the slides and answering those questions.

Deep C [http://www.slideshare.net/olvemaudal]


The International Obfuscated C Code Contest


This contest is crazy but worth to check out. It´s has been around since 1984. If you are under the impression you know C well, check some programs on the homepage.

http://en.wikipedia.org/wiki/International_Obfuscated_C_Code_Contest

http://www.ioccc.org/

July 29, 2012

Multiplication/Division by constant

One application needed to divide the signal to obtain 20 percent of the actual signal. Therefore I post some sites.

Multiplication-by-a-Fixed-Point-Constant [eetimes.com/]
[www.cs.uaf.edu/~cs301/notes/]
Multiplying-normalized-16-bit-numbers [ssp.impulsetrain.com]

Division
Fast-Faster-Fastest-Code-Integer-division [forums.parallax.com]
Division-of-integers-by-constants [embeddedgurus.com]

Reciprocal multiplication [homepage.cs.uiowa.edu]
Well explained how to use fixed point arithmetic

Division [hackersdelight.org] 
Pdf document

C Right-Left Rule

Have a problem to distinguish some declarationsin the code? The rule right to left is what you have been looking for.

C right-left rule [ieng9.ucsd.edu/~cs30x/]

Will it optimize?

This article describes the optimization with GCC compiler and provides few examples with answers.

Will it optimize [ridiculousfish.com/blog/]

Loop unwinding

Loop unwinding might not bring any improvement in the speed because the compilers have been improved . Anyway, it's pleasant reading about the history :)

Loop unwinding [http://en.wikipedia.org]

Detailed explanation of SWITCH statement
Duff's device [tenaciousc.com]

A reusable duff device [drdobbs.com]

Duff device [www.lysator.liu.se/c/]

How does duffs device work [stackoverflow.com]

If - switch - jump table

What is faster at the moment?  If-else , switch or jump table? These 2 documents clarify details about speed and size.

[rmbconsulting.us/Publications]
ESC_Boston_01_304_paper [http://www.open-std.org/jtc1/sc22/wg21]

C language FAQ

Have you ever had a question and spent minutes/hours to get proper answer in C language area? Here's one of the best available FAQ. Great resource !

C FAQ [www.c-faq.com/index.html]

Arrays and pointers

Hello,

I was struggling with 2D dimensional array last week, therefore small research shown the best available explanation why int **array is not same as int array[][]

Arrays and pointers in C [ibiblio.org/pub/languages]

July 1, 2012

Shifting in C

Shifting bits might get unpredictable sometimes.  Shifting unsigned number is defined but for signed numbers, it's implementation defined. Compiler can preserve highest bit set (sign) or fill it with a zero.

Right Shift on signed types [gustedt.wordpress.com]

Shift-Right Versus Divide in the C Language [plunk.org/~grantham]

Bitwise shifting [lispmachine.wordpress.com]

May 5, 2012

Restrict keyword in C

The restrict keyword is a type qualifier for pointers. It is part of the C99 standard. Second link is sufficient explanation to this keyword.

How to use the restrict qualifier in C [developers.sun.com]

Demystifying restrict keyword [cellperformance.beyond3d.com]

Memory Optimization [research.scea.com]
The presentation to this topic.

May 1, 2012

Keyword volatile

Volatile is cv qualifier. Even though Dan Saks has already described in few articles volatile keyword as a promise, still there's more to find out !

Here's more to this topic:

Introduction to the Volatile Keyword [eetimes.com]
Basics explained as a usage by Nogel Jones.

What does volatile mean [blog.regehr.org]
I suggest reading this one which explains volatile with code examples.

Volatiles Are Miscompiled [http://www.cs.utah.edu/~regehr]

Secret life of volatile [codingrelic.geekhold.com]

April 30, 2012

C library

If you don't own a copy of the C library book, there's c standard library site which is not detailed as the book but it's online. Not only declarations but also definition are provided.

C standard library [clc-wiki.net]
It has section with solutions for K&R2 book.

The Open Group Base Specifications [pubs.opengroup.org]
The official definition of a UNIX system. Functions are indexed and quickly retrieved. I use it from time to time as a reference.

Bitfields C - strength and weakness

Bitfields are powerful and widely used (mostly in embedded) although they introduce some limitations.

  • You can't apply address operator to bitfield because they operate on bits not bytes. 
  • They are always converted to the int type for computation.
  • If you use signed int, be aware of the range of values for the defined type. Signed int a:1 has a value 0 or -1 not 1 !
  • C language gives no guarantee of the ordering of fields within machine words. The packing order are implementation defined.

More reading about this topic in following sites:

Understanding bit fields c [linuxforu.com]

C bitfields [cs.cf.ac.uk/Dave]

Working with bits and bitfields [coranac.com]

Bitfields Endianness [mjfrazer.org/mjfrazer]

Bitfields Aligment [keil.com/support]

April 24, 2012

Get ready for an interview

I bet everybody out there went at least once to the interview. There are many sites which could help you with preparation and even though I haven't went to any at least few months, i check some questions sometimes only for fun and to improve the creativity and expand the knowledge.

C programming questions and answers [indiabix.com]

0x10 best interview questions [rmbconsulting.us]
I consider this as a classic in my eyes. I remember i run into the 0x10 list when i was not able to answer few of those if not all :)

Glass Door [glassdoor.com]
This one is a bit different, it contains information about the salaries, job interview questions for an exact position. Worth to register and check it out!

I'll expand this list by time.

Algorithms with bits

 I was playing with code for a decoder today and had to find an algorithm to calculate all bits set in the short integer and find also first bit set (lowest) and last bit set (highest). Certainly simple task with these sites to start with.

Bit Twiddling Hacks [graphics.stanford.edu]
 There are posted many different algorithms which you can choose which suits you.

Aggregate Magic Algorithms [aggregate.org/MAGIC/]
Less, but also useful.

KEIL - Counting set bits in byte [keil.com/support]
Nothing new to mention but it's short in context.

More sources [aggregate.org/MAGIC]
More links for reading found on aggregate magic algorithms.

April 15, 2012

Properties of the compiler and floating point arithmetic test

While i was reading The C library book, i come across two tests which are mentioned in the float chapter.

Enquire tests the properties of a compiler and the machine which is run on. It creates the file with the outputs.

Enquire test written by Steven Pemberton of CWI
More reading at: Enquire details

Paranoia tests the floating point arithmetic used.
Paranoia W.M. Kahan

April 13, 2012

C language books

I've purchased books quite regular since last year.

I include a list of C language book recommendations, I haven't read them all so far, I intend to. I grabbed C puzzle book last weekend and had fun with some exercises which seem to be easy but tricky sometimes. My all-time favorite is K&R which helped me quite a lot.

C language book recommendation

ARM Information center (bookmark)

Everybody who ever have worked with ARM should be familiar with ARM information center. For those who don't, it is informative reference which might help even if you work with different architecture or in the embedded area.

ARM infocenter

April 6, 2012

DSP Filters for touch sensing (bookmark)

I had to correct one IIR filter in touch sensing software because there was potentially one overflow in computing. This pdf from microchip contains few filters with C codes and figures how they affect the signal.
Various filters for touch sensing signals

Various coding standards (bookmark)

I visit CERT C secure coding standard from time to time to check for some complementary solutions.
C secure coding standard

Left hand comparison was brought up during the discussion, here's adaptation from NetBSD coding style page:
C coding standart [users.ece.cmu.edu/~eno]

Google chromium coding style [dev.chromium.org]
This particular was mainly because I was looking for something regarding C++, like macro DISALLOW_COPY_AND_ASSIGN, very informative webpage for developers !

C language pitfalls (bookmark)

Do you know the answer for a following declaration : (*(void(*)())0)()?

C language quirks, few examples which might catch your attention:
C language quirks
C pitfalls book available online:
C Language Traps

Linker command file (bookmark)

I run into a problem with linker command file where was KEEP_SECTIONS defined. I include some links with this topic to get familiar with linkers.

Linker command file (gnu) [delorie.com/gnu/docs/binutils]

Commands and Operators in Linker files

Linker description and an example - Chapter 7 [csapp.cs.cmu.edu]

Linkers and Loaders book
Linker and Loaders book written by John R. Levine published online.

Beginner's guide to Linkers [www.lurklurk.org]
Beginners guide to Linkers is explanatory article about process of linking. It has introduction to C++ and how linkers are changed because of new features of C++ compare to C language.

Linker Script File [bravegnu.org]
The article explains linker script file and in a next chapter how data are placed in RAM.

Preprocessor C/C++ (bookmark)

Preprocessor can be sometimes useful with directives, constants, and macros.

Difference between preprocessor [c-links.blogspot.com]
Description of preprocessor, assembler, linker

The Preprocessor for GCC [www.cs.utah.edu/dept]
Well written guide with many examples.

C preprocessor Tricks [cprogramming.com/tutorial]
C programming tricks with preprocessor.

March 31, 2012

Embedded journals (bookmark)

I needed once a circular buffer and i found this particular journal which has been out since 1997. Author responsible for this journal is Jack Ganssle and he's also own section on embedded.com.
The Embedded Muse

I came across dozen of articles which referred to journal : C/C++ Journal. I found this archive, not completed though.
C/C++ Journal (1990-2006)

Last one today, which is newest from this post, embedded gurus.
Embedded Gurus

Check them out ! If you know any other, share them so I can add them here!

Great C/C++ articles from embedded.com (bookmark)

This deserves a separate post. Here's some C/C++ embedded tutorials from Dan Saks which i really enjoy reading and always get back to them when I have a spare time. I include a link for all articles which he has published on the embedded.com.
Embedded.com - Programming Pointers - Dan Saks

Beginner's corner (collection of articles) short list but worth reading:
Embedded.com - Beginner's Corner

First post

Welcome everyone,

this blog is going to contain mostly links and it serves as a resource of informations which I found quite useful and want to share with the world.
Main topics of this blog are C/C++, embedded development (RTOS, compilers, linkers) and architectures like ARM. I hope it will grow to many more !

Let's start!