Friday, May 12, 2017

setuptools - dealing with compiling custom modules on windows

pip install has hugely simplified how python modules are installed and managed but sometimes it simply can't compile custom extensions despite having all the prerequisites. This simply boils down to pip not being able to automatically determine the required visual studio environment. The simplest fix I found and that I keep forgetting is to get to visual studio command prompt and set a couple of environment variables to prevent distutils from auto discovering the visual studio environment.

%path_to%\vcvarsall.bat x64

SET DISTUTILS_USE_SDK=1
SET MSSdk=1


Saturday, December 03, 2016

Pausing...

This thought came up one day when I was in my second job. My first job was all about exciting stuff such as device drivers, firmware for smart card terminals, cryptography and a whole lot of cutting edge technologies, the fancy and glamorous stuff that would be a dream for many aspiring programmers. But I cannot say the same thing about my second job. To my surprise I didn't even realize it till very long into my job. Motorola 68k, serial communication, matrix keypad and text display can’t be called cutting edge even 15 years back, that’s when this thought popped up - What was I doing all these 6 years? Was I in a long hibernation, isolated and lost in the career path? I sure was not idle all these years, rather I was very busy fixing things, so it definitely should have some value addition and learnings that I didn’t realize. That’s when I set out to reflect on my experience working on legacy software and hardware platforms.

Thursday, March 17, 2016

Self driving cars - the Indian dilemma

I read an article about self driving cars which got me thinking about the prospects of such a car in an Indian context. Aside from the general problems that autonomous cars have to tackle, I could instantly think of  a few additional and unique problems of its own in an Indian context.

The direction dilemma: At times when I end up in a new intersection, I have a few problems waiting to be solved before I can proceed towards the destination.
  • Missing signal posts
  • Misaligned signal posts
  • Signal post not visible from the stop line because it's sometimes right over the head and even behind it.
The stop dilemma: On one occasion, the car in front stopped and I stopped behind it as well but later realized that the car has "pulled off" for a break without any indication.

The indicator dilemma: How many times I have driven behind a vehicle with the indicator on assuming that it will take a turn but later realized that it wouldn't because the driver had forgot to switch it off after the last turn.

The pass dilemma: I have wondered for a long time why the switch to blink the headlight is marked as "pass" on my motorcyle. In India this is used for the exactly opposite purpose, i.e. to THREATEN the oncomers to STOP when one wants to take a turn.

The indicator dilemma: Driving on highways, it took me some time to realize that the turn indicator is used by a vehicle in the front to signal it's intention to allow the vehicle behind it to overtake.

The honking dilemma: I am riding and not doing anything wrong and some one honks from behind - what should I do.

These are just a few scenarios that came to my mind instantly. SURPRISES are the norm here, even an experienced driver has to think twice before making a decision, leave alone the self driving cars. Last night I was taken by surprise when I saw the display board on a minibus flashing green LEDs and for a second thought that it was the traffic signal. U-turns, I don't even want to talk about it. Many assumptions that is a starting point for the self driving cars will be rendered untrue, we need to raise to the ground fist before building on top of it. The irony is that, these cars will one day teach us how to behave on the road!

Monday, February 09, 2015

The first Ubuntu Phone

Eagerly awaiting more details to emerge on the first Ubuntu phone - BQ Aquaris E4.5. Especially on the software and how Canonical has managed to build the GUI stack and multimedia playback. Given that the Linux support is not something to cheer about when it comes to graphics drivers and video decoding, the fact that there's now a real consumer device is something interesting and awaiting some real reviews on the device. There has been quite a bit of discussions on the Mir Display Server and libhybris - Waiting to see how these have shaped up for the phone.

Wednesday, January 21, 2015

A tribute to my PC

Back in 2004, I bought my first Personal Computer. It was assembled by a local seller and had a Gigabyte motherboard with a VIA K8M800 chipset and a Socket 754 for AMD Athlon 64 bit processor. I was very excited and was eagerly awaiting the delivery and this was around the Pooja holidays. One fine night it arrived, the PC and it's accompanies - a Samsung CRT monitor, a Samsung PS/2 Keyboard with multimedia keys and a dedicated sleep/shutdown button, a Logictech PS/2 Optical mouse and an APC UPS. It came with Windows XP which I never intended to use and my plan was to have Linux installed.

That was a time when high speed internet meant 64Kbps (Internet cafes proudly advertised that they had high speed ISDN lines at 64Kbps), Cable broadband meant 128Kbps and the only broadband operator was Sify who wouldn't offer me a connection because they didn't have cables running to my neighborhood. All these meant that download a Linux distro over the internet is nearly impossible. There were other other options though - A well known Linux magazine called "Linux For You" provide a companion CD, usually a bootable live CD with latest distros and other free software, and another option was the Local Linux User group http://ilugc.in where we used to maintain a directory with an index of all the CDs each member had so that we could borrow and take a copy. I lost count of all the distros that I had tried - Knoppix, Fedora, Debian, Gentoo, and numerous others. My PC made it an interesting proportion to try the various distros since none of them would work out of the box. GUI being the first bottleneck - The S3 Unichrome onboard GPU is not the mostly widely used that many wouldn't even have heard off. Obviously there were no graphics drivers so many would just fallback to the console, the ones that actually booted up to the GUI would use the vesa driver with a reduced resolution and a not so great GUI experience, then there was the multimedia keyboard that I had to figure the scan code and map them to the specific operations in the X keyboard layout configuration, Then there was this APC UPS which had a USB interface so I can hook it up to the PC and monitor the battery charging/draining status. Initially I had to compile the kernel modules to get this to working but sooner many distros started shipping all the necessary components to make it a  breeze.

Then came the "Warty Warthhog" - the first ever version of the Ubuntu. Canonical, the makers of Ubuntu had a nice program where I could order a set of CDs online and they would ship it to me for FREE. They encouraged to order a pack of CDs instead of singles so that I can give it to my friends and spread Linux. This was a totally nice and refreshing experience, where minimalism was the main theme. That was a Gnome based desktop and the whole desktop looked polished and fresh with an unusual brown theme. I loved the CD pouches with the Ubuntu logo. In fact they even shipped a few Ubuntu decals so that I can have them applied on my PC.

(to be continued...)

Wednesday, December 17, 2014

Flash memory Vs eMMC

Flash memory and eMMC are the two most common non-volatile memory found on embedded systems.

Lets start with Flash - There are two types of them:
1) NOR Flash - Byte addressable (Read a byte, Write a byte (only flip bit:1s to 0s but not vice versa), Erase a sector/block to set all the bits to 1)
2) NAND Flash - Block addressable (Read/Write one block - typically one block is read in to memory before individual bytes in the block can be accessed)

Both types are connected to the system address bus, i.e. they are memory mapped and can be accessed by referencing their memory address.

eMMC:
Embedded Multimedia Controller is basically Flash memory bundled along with a controller. The flash memory can be accessed only via the controller using the eMMC protocol.

Friday, October 10, 2014

Remote debugging a QNX application running on an ARM target

On the target

Make sure pdebug is running and listening on port 8000

On the host

Start the gdb
ntoarm-gdb
Connect to the target
target qnx remote-ip:8000
List all the process running on the target
info pidlist
Attach to a process (Use the above listing to find the pid of the required process)
attach pid
Debug the process
info / step / continue
Kill the process
kill
Detach from the process
detach