Working Makefile, fixing HAL bugs