2010-12-23

2010-11-28

Peter Toft: Finde C/C++ fejl med valgrind -> massif finder fejl i allokering/deallokering

Peter Toft: Finde C/C++ fejl med valgrind -> massif finder fejl i allokering/deallokering: "Jeg har haft meget travlt på arbejdet de sidste par uger, især med at få releaset en stor klump kode, hvor mange har deltaget i af kode. Det kommer fra tid til anden fejl ind. Vi diskuterer langt over…"

2010-11-14

Solid principle for SW structuring

Some solid principle for SW structuring: Solid (object-oriented design)

2010-10-05

The internal variable $! in Bash

Great use of a Internal variable in Bash

Using $! for job control:
possibly_hanging_job & { sleep ${TIMEOUT}; eval 'kill -9 $!' &> /dev/null; }
# Forces completion of an ill-behaved program.
# Useful, for example, in init scripts. 

2010-09-22

Eclipse encoding problems in c-build console

Jeg had the problem a bow with eclipse c-build console. I found a solution in this post

The solution is to set the LANG environment variable for gcc to en_US.ISO-8859-1.

2010-09-20

ruby rmodbus serialport

I like to use ruby for make test. On some project I must use a serial modbus for testing. For that rmodbus is a fine lib. However the installation of it on windows can be a little tricky because the serialport lib has to be compiled. Here is how it done.

Install ruby with the one click installer:
http://rubyinstaller.org/

Then install the DevKit for ruby
http://rubyinstaller.org/add-ons/devkit/
http://github.com/oneclick/rubyinstaller/wiki/Development-Kit

run these commands in the directory in which DevKit has been extracted:
ruby dk.rb  init
ruby dk.rb install

The rmodbus lib is located the
http://rmodbus.heroku.com/
http://github.com/flipback/RModBus

Installation is however quite simple:
gem install rmodbus

Nuttx

An Open source RTOS, based on a micro kernel design and licensed under BSD. That sounds cool: http://nuttx.sourceforge.net/

2010-09-17

ifconfig output

What does all the counters in the ifconfig output mean? e.g. frame, dropped... this page describe some of them.

eth1      Link encap:Ethernet  HWaddr 02:83:13:02:24:00
          inet addr:192.168.20.13  Bcast:0.0.0.0  Mask:255.255.255.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:2169 errors:0 dropped:0 overruns:0 frame:0
          TX packets:1769 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:1009774 (986.1 KiB)  TX bytes:210912 (205.9 KiB)

2010-08-30

Remove the Cygwin warning about MS-DOS path

MS-DOS style path detected: C:\wcs\eclipse\pcm51_io_to_mb_app\code\appl
  Preferred POSIX equivalent is: /cygdrive/c/wcs/eclipse/pcm51_io_to_mb_app/code/appl
  CYGWIN environment variable option "nodosfilewarning" turns off this warning.
  Consult the user's guide for more details about POSIX paths:
    http://cygwin.com/cygwin-ug-net/using.html#using-pathnames


Run this command:
set CYGWIN=nodosfilewarning

2010-08-24

How to enable ping response in Window 7

Response to an ping is disabled in Windows 7 by default. I found this post on how to enable it:
How to enable ping response in Windows 7

2010-08-19

cat << EOF

Here is an option for writing several line of text to a file via a the shell.


~ # cat > test << EOF
> this is first line
> this is the second line
> EOF
~ # cat test
this is first line
this is the second line
~ #

Pipe stdout and stderr to one file.

In the Linux shell you can pipe both stdout and stderr to a file with > output_file 2>&1
E.g.:

 memtester 16M 1 > /dev/null 2>&1

Chain linux commands together

In the Linux shell you can chain a number of command together. You can do a number of command after each other without having to wait for each command to end.

e.g.
touch memtester ; memtester 16M 1 ; rm memtester

The commands is here separated with ; which tells the shell to execute the first command and then it is done it should execute the next command etc.

Another example:
touch memtester && memtester 16M 1 && rm memtester

Here the commands are separated with && which tells the shell to execute the first command and if it completes successfully then execute the next command and etc.

2010-06-18

Using ssh to execute remote commands

I wanted to make a "make run" command to download and run my embedded application on target using ssh. Download with scp is no problem, but then I wanted to execute the program with a command like this.

ssh root@target_ip /tmp/myprogram & 

I experienced that the session would hang. It needed a to terminal the connection. I found that it seems to be the output from the program which makes it hang, so I tried piping the output to /dev/null. Something like this:

ssh root@target_ip /tmp/myprogram 2>/dev/null >/dev/null &

And this did the trick. Make now exits fine.

2010-06-14

Using Firefox address bar for translations

Using the Firefox address bar for translating your word can easily made with the help of Google translate. Se below how to set-up this for Danish to English translation.

Handling path with white-spaces in a makefile

Handling path with white-spaces in a makefile is a bit awkward. Here is an example of how to get the path to the makefile it self, independent of the path containing white-spaces or not.


#######################################
# Find the project root directory
#######################################
PWD                       := $(shell pwd)
nullstring :=               # creating a null string
space := $(nullstring) # end of the line

MAKEFILE_DIR := $(subst $(space),\ ,$(PWD))

2010-06-10

test -s

The test -s command behaves a bit different on Cygwin and Linux. In Linux it can be OK to use test -s to test for a directory, because it size if different from 0. But in Cygwin the test fails because directories in Cygwin have the size 0.

2010-06-04

Understanding the Linux load average

I was examine /proc/loadavg today, but how to interpret it? I found this fine post describing the content:
http://juliano.info/en/Blog:Memory_Leak/Understanding_the_Linux_load_average

2010-06-02

SSH login without password

Fine describe on how to make SSH login without password is found in this post.

2010-05-16

Problem calling rake from Cygwin

I can't call my mingw installed (from rubyinstaller) rake and gem from cygwin. See the output below:

sh-3.2$ ruby -v
ruby 1.8.7 (2010-01-10 patchlevel 249) [i386-mingw32]
sh-3.2$ gem --version
C:\Ruby\bin\ruby.exe: No such file or directory -- /cygdrive/c/Ruby/bin/gem (LoadError)
sh-3.2$ rake --version
C:\Ruby\bin\ruby.exe: No such file or directory -- /cygdrive/c/Ruby/bin/rake (LoadError)


The only help I have been able to find is this comment . Which states that I should use rake.bat and gem.bat instead.

sh-3.2$ rake.bat --version
rake, version 0.8.7
sh-3.2$ gem.bat --version
1.3.5

:-( This makes it a bit complicated to call rake from a makefile.

2010-05-15

Cygwin gcc "access denied"

 cygwin gcc outputs "access denied" then called from cmd.exe. The reason for the problem is described in this post. Basically it because cygwin uses symbolic links for configuration of gcc to point at gcc-3.exe or gcc-4.exe and windows don't understand symbolic links. So I will have to replace my calls to gcc.exe with gcc-4.exe to make it work from cmd.exe.

2010-05-12

Building "instant-up" real-time operating systems

How great wouldn't be to have a RTOS that was "instant-up" on a new target. I came across an idea for such RTOS in this article: Building "instant-up" real-time operating systems

Howto make hyperlinks in microsoft word absolute

To make all hyperlinks absolute in a word document. You can set the hyperlink base to x.
"Great usability" :-)

More details on the topic here:
http://support.microsoft.com/kb/903163

2010-04-29

Howto insert unicode charater in MS Windows

I ran across this post on howto insert unicode character in windows

2010-04-18

embedded testing tools

Today I came a cross some interesting tools for embedded testing at this blog: embedded testing tools
 I must have a closer look on them some day.

2010-04-13

welcome

Welcome to my blob about device or embedded software