3D-printed arrow nocks for easton carbon one arrows

Okay, time to introduce the rare reader to a brand new section of this blog: “archery”. Something that you’d never expect, right? And this will be the very first post covering this topic. Everyone who starts archery as a hobby soon has a terrible itch to cut down the costs on it… somehow. Since there aren’t many archers out there archery stuff is quite pricy, especially if you want to to compete on at least amateur level.

img_20160828_112710.jpg

(more…)

Weird Trickery: Compiling verilog VPI extension and unit-testing it using cmake/ctest

A few months ago I needed to write a VPI extension for verilog HDL and (just as I would normally do) I needed a proper buildsystem for that stuff. Unfortunately in terms of build/debug/test tools the folks doing ASIC are living… Well, not in the stone age, but in their own small isolated world and keep reinventing the wheel over and over again. OpenSource iverilog simulator didn’t go far away from the proprietary counterparts that tend to ditch commonly used in linux environments best practices.
Okay, now let’s stop bitching about the way things are and decide how to deal with that kind of stuff. In this note I’ll try to describe how to make a CMakeLists.txt for compiling a VPI extension and unit-testing it with ctest.

(more…)

Tablet guts necromancered into a fancy SBC

It’s been a hell of a summer with loads of work at my dull dayjob so that I’ve almost forgotten about everything including this very blog. However once the hell cooled down a little bit I found myself with a few spare days and my usual itch to tinker for a little bit with something. It happened I also needed another linux single-board computer to do some dull geeky stuff. Instead of ordering one from aliexpress once again I dived into the junk and found this little dead piece of hardware:

IMG_2598

(more…)

SkyForge: Creating Debian root filesystems in a Dockerfile-style

For a handful of projects work and hobby alike I use Debian. However, when you deal with embedded systems (e.g. ARM SoC) you normally don’t have the installer CD or even the disk drive. You end up creating a filesystem, compiling the kernel. Well, pretty much the usual way it goes.

The process can be somehow lengthy if done by hand using debootstrap and multistrap and especially mind-blowing if you are a total newbie. (Alas, I’m already no n00b here. Getting older, heh)
The worst part of it is that you not only need to create a root filesystem for debian, but set it up in a more or less sane way, e.g. set the default password, ssh keys… The usual thing.

In the Big Enterprise ™ we can see tools like vagrant creating us a base box in the VM and chef or puppet actually setting the system up. While we can use, say chef or chef-solo on an armhf board (why not?) we still have to make sure we have some base image it will set things up on, right?

(more…)

CMake + atom + .clang_complete

A few months ago I moved from emacs to atom that looked like a more modern replacement. Most important for me – it had awesome CMake code completion that was very good. I soon made use of automplete and lint with clang. Both were good, but needed a .clang_autocomplete in your project root to work properly. Apparently if your project file get a bunch of compiler flags from the build-system managing this file by hand is not something I wanted, so I ended up with this snipplet in CMake that gets the job done:

message(STATUS "Generarating ${CMAKE_SOURCE_DIR}/.clang_complete")
get_property(dirs DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} PROPERTY INCLUDE_DIRECTORIES)
file(WRITE ${CMAKE_SOURCE_DIR}/.clang_complete "")
foreach(dir ${dirs})
  file(APPEND ${CMAKE_SOURCE_DIR}/.clang_complete "-I${dir}\n")
endforeach()
string(REPLACE "'" "" CMAKE_C_FLAGS_SPLIT ${CMAKE_C_FLAGS})
string(REPLACE " " ";" CMAKE_C_FLAGS_SPLIT ${CMAKE_C_FLAGS_SPLIT})
foreach(flag ${CMAKE_C_FLAGS_SPLIT})
  file(APPEND ${CMAKE_SOURCE_DIR}/.clang_complete "${flag}\n")
endforeach()

If you use C++ in your project you need to use the CMAKE_CXX_FLAGS variable. This code also has the obvious limitation: If you pass via -D directive options that have spaces – this won’t quite work (e.g. -DRELEASE_CODENAME=”Black Burned Cookies”)

Doxygen && gh-pages

Github has a cool feature – it allows you to attach html pages to your repo. And if the web pages designer that brings memories of early 00s is somewhat useless – storing doxygen html docs there is a very cool feature.

However we can’t store any history in gh-pages branch. It would be utterly useless and may heavily bloat the repo (especially if you generate a plenty of diagrams with graphviz). So ideally we should:

  • Make a clean branch each time, commit all the docs we’ve generated
  • Do –force push, so that we’d drop everything on the remote side
  • Do it from our development branch, without switching to gh-pages
  • Potentially integrate with CI/Jenkins: Build succeded, unit-tests passed, static analysis okay – bump the docs!

Can be achieved easier than it sounds. Here’s my quick sniplet for this hackery in GNU/Make:

doxygen: 
	-rm -Rfv doxygen/
	( cat Doxyfile ; echo "PROJECT_NUMBER=0.1" ) | doxygen 
	cd doxygen/html;\
	rm -Rfv .git;\
	git init .; git checkout --orphan gh-pages;\
	git add *;\
	git commit -m "documentation-for-gh-pages";\
	git remote add origin git@github.com:MY_GITHUB_USERNAME/MY_GITHUB_PROJECT.git;\
	git push -u -f origin gh-pages

D-Link DNS-327L NAS now mainlined

Achievement

Yep, something like that. Despite huge amounts of rush at work these days I managed to push both patches into mainline linux, so starting from 4.1 and on you can just grab kernel from kernel.org, compile and boot it on the NAS (Yappee!!)

Just make sure you disable cpuidle ‘deep idle’ state. It causes NAS to hang once every few hours and is likely a problem with either hardware or the bootloader (I’m still too lazy to try out mainline u-boot)

echo 1 > /sys/devices/system/cpu/cpu0/cpuidle/state1/disable

//Template for that achivement logo borrowed from here

Pssst, dude! Wanna some secondhand chips?

There are many wonders in electronics land. Even more await an engineer that stocks up at aliexpress to save a bit on his hobbies. Well, I needed a few RTC chips for some prototype hardware, so I picked DS1307. As usual, placed an order at aliexpress. once in a while shit happens .

No, this time they didn’t write ‘sex toy – 3$” on the customs declaration sticker, as they did on a parcel with a dozen of TRIACs a few weeks ago (Or, did I use TRIACs wrong my whole life! Should have asked them for instructions!)

Anyways this time I received some second-hand chips. Packed in a plastic tube, no flux whatsoever, but small solder blobbies are all over the pins. Without unpacking, I’ve made a few pics. Sorry for the quality, but I put my USB microscope somewhere far and my usual camera doesn’t handle focusing on something that close well.

IMG_2508

(more…)