Skip to main content


Showing posts from 2018

Hacking "ESP8266 Black Board T5" Part 2 - Blinky and Hello World on SDCC

Previous Part:
Hacking "ESP8266 Black Board T5" Part 1 - Blinky on Keil

Lets now move to SDCC, because SDCC is free and the free version of Keil has limitations. We will also move away from Windows to Ubuntu 64 bit
Installing SDCC on your Ubuntu PC Download 64 bit snapshot from:
The archive file would be named something like:

Download it to your ~/Documents directory

Then execute the following commands from the same directory (~/Documents) where you have placed the downloaded archive:
tar xjf ../sdcc-snapshot-amd64-unknown-linux2.5-20180712-10467.tar.bz2 cd sdcc sudo cp -r * /usr/local This will install sdcc binaries into: /usr/local/bin/
header files into: /usr/local/share/sdcc/include/
non-free header files into: /usr/local/share/sdcc/non-free/include/
library files into: /usr/local/share/sdcc/lib/
non-free library files into: /usr/local/share/sdcc/non-free/…

Linux Internals

What happens at boot?Kernel Boot Process by 0xAX at GithubAnalyzing the Linux boot process by Alison Chaiken
What happens when a device is plugged in?What actually happens when you plug in a USB device? by Ian Wienand
What happens when you execute a userspace programm from the command line?How to show all shared libraries used by executables in Linux? Stack OverflowLoading of shared libraries and RAM usage Unix & Linux Stack Exchange
What happens when you compile userspace applications?How to write shared libraries? by Ulrich DrepperStatic, Shared Dynamic and Loadable Linux Libraries YoLinux.comLoad-time relocation of shared libraries eli.thegreenplace.netPosition Independent Code (PIC) in shared libraries eli.thegreenplace.netWhere the top of the stack is on x86
What happens when you compile the kernel?Shrinking the kernel with link-time garbage collection LWN.netShrinking the kernel with link-time optimization LWN.netShrinking the kernel with an axe…

Hacking "ESP8266 Black Board T5" Part 1 - Blinky on Keil

A few months ago, I got my hands on ESP8266 Black cloud features Board T5 which has an ESP8266, an 8051 microcontroller and a few sensors. The 8051 microcontroller acts as a master to the ESP8266 and comes loaded with a demo program which is supposed to work with some android app. ESP8266 can be directly programmed using Arduino, so it would be better if I would reprogram the 8051 to act as a slave connected to ESP8266. The ESP8266 will run an Arduino sketch (that I would write) and ask the 8051 for the sensor readings (over UART). To do that I would need to program the 8051 with come C program that I have written.

So the first step was to learn how to compile a simple blinky program for the 8051 and be able to download and run it on it.


Black Board T5 User guide (in Chinese) explain how to use the android app (Translated version)Reworking the AI Thinker "Black board T5Schematic of Black Board T5 (You will need Batang font to view it)Source code (Keil uVision project) of t…

googletest on Ubuntu

Running gtests on your C++ programs using g++ on Ubuntu:

Install CMake:
sudo apt install cmakeSwitch to home directory and:git clone --depth 1
Build it:
cd ~/googletestmkdir buildcd buildcmake -Dgtest_build_samples=ON -Dgtest_build_tests=ON ~/googletestmakemake test./googlemock/gtest/sample1_unittest

Install the googletest and googlemock .a and .h files: sudo cp -r -v ~/googletest/googletest/include/gtest /usr/local/includesudo cp -r -v ~/googletest/googlemock/include/gmock /usr/local/includesudo cp -v ~/googletest/build/googlemock/lib*.a /usr/local/libsudo cp -v ~/googletest/build/googlemock/gtest/lib*.a /usr/local/lib

TEST() and code in same file - Test Fail To compile and run:
g++ 01sqrt_fail.cpp -lgtest -lpthread -o 01sqrt_fail./01sqrt_fail Output:

TEST() and code in same file - Test Pass To compile and run:
g++ 01sqrt_pass.cpp -lgtest -lpthread -o 01sqrt_pass./01sqrt_pass Output:

TEST_F() and code in same file - Test Pass To compile…

MNO LAN: Use same MNOs SIM card in your IoT devices like GL-MiFi

One of the big issues with IoT is somehow enabling two end nodes to communicate with each other in the presence of Network Address Translation (NAT)
Now days most ISPs (and Mobile Network Operators or MNOs) use NAT by default and assign you local IP addresses in 10.*.*.* subnet. You usually have to pay an extra fee to get static global IP addresses assigned to you - this could be a security concern.
If your end nodes run embedded linux, the following solutions can be used:

Use DDNS and UPnP together
DDNS is not usually free, but the manufacturer of your embedded linux device (routers from goodlife of Vstarcam's IP camera) might provide you this service for free as it uses almost nil resources on the server side. Most ISPs have UPnP support disabled on their gateway. In a home environment, if you have your own static global IP for your home router, you can use UPnP and DDNS to your advantage. An end node will use UPnP to request your WiFi Router to open ad forward certain outward fa…


We all want our smartphone to charge quickly. And different phone manufacturers have either created their own propriety method of charging (Oppo VOOC or MediaTek PumpExpress+ or Motorola's TurboPower or OnePlus's Dash) or have opted to comply with a industry wide standard like Qualcomm's Quick Charge series of standards).
These technology work my allowing a phone to tell the charger to step up the voltage beyond 5 volts so that the power available to the phone for charging the battery is more than what a good 5 volt / 2 ampere wall/car charger can supply.

I have a Moto G4 plus and I wanted to make sure that I had access to fast charging at home/office, in car or while travelling. So I went ahead and got the following accessories

This small device is what allowed me to check at what voltage/current the various chargers were charging my phone or regular devices.It has a USB male and female receptacle so that it can sit between the charger and the USB cable.It shows…

Food Silicone food savers + Glass bottles

Plastics! Cancer! Correlation!
And so we move away from plastic bottles to glass bottles.
But glass bottles pretty but fragile.
So what do we do?

We get food huggers!!!
Food huggers seemed onle somewhat useful to me all this while until now
The silicone rubber food huggers will protect the bottom of the bottles - I was worried that I might end up banging them on the floor when I have a sip in the middle of the night.


 = links: Food huggers/saversGlass bottles Note:

The food huggers come as a set of 4. Only the two larger ones have diameters large enough for the glass bottles linked to above. The smaller two won't fit.
So if you get 6 bottles, you will need to order 3 sets of food huggers. Of the 12 pieces of food huggers, you will end up using only 6 of them.Various sized food huggers seem to be colored differently to match the color of the vegetable/fruit they are supposed to protect. Yellow is for lemons, Purple for onions, Green for capsicum, Red for tomatoes. This is …

Adding new elements to OpenWrt's LuCI on GL-MiFi

If you are an IoT enthusiast who uses devices that run OpenWrt (routers from Goodlife, or MT7688), you would have considered creating a plugin for LuCI so that you can expose the functionality of any sensors/actuators that you may have connected to your OpenWrt box via OpenWrt's builtin web console.

This article on's wiki will tell you exactly how to do that.
As maybe obvious from the page, if you want to create dynamically generated web content, you will need to write lua scripts.

When trying out the steps from the wiki article for my GL-MiFi, I had to modify the file locations for placing various script like so:

new_tab.lua had to be placed in:
cbi_tab.lua had to be placed in:
cbi_file can be put in the same place as mentioned:
view_tab.htm had to be placed in:
/usr/lib/lua/luci/view/myapp-mymoduleOnce I had the placed the files in the right location, I could see them in the web UI: