This blog has permanently moved to

Contact Form | Email Address

© 2018 All rights reserved by Boseji

Thank you for all your support.

Thursday, May 31, 2012

Portable Virtual Box: Freedom from Win7 Hassels

As we all know there are several embedded tools and applications that don't work well with Windows 7. We wanted to know if there was a possibility to make some Virtual Machine go to USB pendrive and then we don't need to install any thing on PC.
Initially the thought was that Virtual Machines are big things and they need hard integration with the Host OS to run.
We were proved wrong, Virtual Box can be made Portable.
Portable-Virtual-Box is a project that has made it possible to have portable version of the standard Virtual Box as well as the virtual machines them selves in the USB drives.
  • Supports both 32bit and 64bit Virtual Machines
  • Dynamically loads the needed drivers for the VM to run
  • Full Network Support
  • Supports Standard Serial Port
Presently the version available is Portable-VirtualBox_v4.1.14-Starter_v6.4.9-Win_all.exe.
Although this is slightly older than the present Virtual Box but thats not of hindrance since you have same updates enabled in the portable install. So after installing this you can upgrade your virtual box to the latest version.
The only impediment is installation of the Extensions Pack for USB features in Virtual Box. If you don't install this pack then USB EHCI 2.0 features are not enabled. So you wont be able to access the Pendrives or USB serial or debuggers from your VM.
We are looking out to have a solution for this.

Visit this website for more details: http://www.vbox.me/

Sunday, May 27, 2012

Shortcut shell commands for Linux

We were trying to evaluate if there is any quick way to give some short cut commands in Linux shell. We wanted to have this without the need to create many script files and path jugglery.

Then we found the solution by adding command 'alias' in the local profile for the shell.

We know that the default shell configuration is located at ~/.bashrc
This file executes each time we enter the bash shell. So if you add the alias commands to this file then you can access them any time you use the shell.
It is generally  recommended to add the alias commands to the end of this file.

The syntax for the 'alias' is in the following way:

alias {shortname}='{actual command}'

Let us have a look at the use-case scenarios to shows how useful this can be:
  • Changing to a particular project directory which is long
    • eg: /home/username/Documents/githubrepos/Kicad-tools
    • This needs to be  typed all the time to reach that place
    • add the following:
alias proj='cd /home/username/Documents/githubrepos/Kicad-tools'
  • Error while typing 'cd..' instead of 'cd ..' to change to upper directory
    •  add the following:
alias cd..='cd ..'
  • Emulation of favorite dos commands
    • eg: dir, md, deltree
    • add the following:
alias dir='ls -alh'
alias md='mkdir'
alias deltree='rm -rf'
  • Shortcut commands for git operations 
    • eg: git add transformed to ga or gita
    • eg: gitk --all transformed to greal
    • add the following:
alias ga='git add'
alias greal='gitk --all &'
This list can go on of the single short commands that can be implemented in this manner.

There is a detailed tutorial available from NixCraft site.

Friday, May 18, 2012

Static Storage Class in C

There is something special about the usage of Static type in C programming. We were caught unaware of this and tried to fix the issue, that was the time when we really learned the usage of static in its true sense.

We came across a bug in the firmware for LATHI project. The bug surfaced in the display driver for the Nokia5100 LCD. The display buffer was a normal Auto class variable. In case when there was an emergency situation detected the display driver control is taken over by the corresponding Panic mode task. Due to the inability to use the UI task all the base functions of the GUI have been partially implemented for Panic mode. This means that the Driver context would be altered when it is in use by Panic mode.
While exit from the Panic mode into the normal schedule the display would get corrupted.  In order to avoid this every time on each exit from Panic mode, the display was being completely reinitialized in the code. Hence it was not possible to return to the same view that was before the Panic mode entry.

There were two solutions for us -
1. Rewrite the display driver & UI task to support context saving.
2. Save display state before processing the Panic Mode task.

Both solutions had their merits as well as demerits. We tried out both of them and still the result was the same. This was not good we were not even close to the solution.

Then while debugging we found that the display buffer was being accessed by one of the higher level driver functions.
Although the higher level function was in a separate file we were still able to make direct access using `extern`. This was the cause of the real problem.
We modified this high level function and made the display buffer as `static` solving the real problem.

Thus we would like to summaries when static class becomes imperative. So that you can avoid the problem that we diagnosed.

Here are a few points from Wikipedia:
  • In the C programming language, static is used with global variables and functions to set their scope to the containing file. 
  • In local variables, static is used to store the variable in the statically allocated memory instead of the automatically allocated memory. 
  • While the language does not dictate the implementation of either type of memory, statically allocated memory is typically reserved in data segment of the program at compile time, while the automatically allocated memory is normally implemented as a transient call stack.
 Now detailing the Usage scenarios for Static in C:
  1. Static for Global Variables:
    •  When the global variables need to accessible only in one file
    • Compiler would guarantee that the variable has been declared and not omitted during optimization
  2.  Static for Local Variables:
    • When the values of the variable needs to be retained for every function call. They need file scope and not be allocated in the stack like usual local variables.
    • Useful while saving context of who called the function before the present callee.
    • Also useful for unique ID generation and pointer arithmetic
  3. Static for Functions:
    • The use of static in functions make sure that the function only has the file scope
    • This function even if declared in the header file cant be accessed by other files unless the function is explicitly defined in that file.
    • Very helpful in implementing local Fix in software.
It is essential to note that the behavior of Static in languages such as C++ Java and C# does not comply to the above said use cases.

Thursday, May 17, 2012

PCB quality from Seeedstudio Fusion service

We have recently received the PCBs of our up coming project ADK Picoboard. Initially from few of the blogs that we follow, we got to know about the discrepancies in the PCB quality and 100% E-Test failures from Eastern PCB vendors. We were a bit worried. But from our past experience with Seeedstudio Fusion service we had never faced any issues on the boards.
So this time we decided to perform an inspection of the PCBs ourselves. Here are some snaps of the PCB.
TQFP package with probe marks
Regulators and Caps with probe marks

We can clearly see the Flying-probe marks even on the TQFP package as well as on the regulator side.
This clearly proves that Seeedstudio Fusion PCB service does perform 50% E-test as promised.

We are thankful to Seeed for keeping up their quality promise and commitment to helping Open Source Hardware.