HowTo build the Marlin 3D Printer Firmware on the Raspberry Pi

If you are already running the excellent octoprint as a printserver on a Raspberry Pi it is very convenient to also build Marlin on it. The new Raspberry Pi Zero W with onboard wifi is at only 10$ just perfect for both tasks. If you want to use the camera streaming of octoprint I would recommend a Pi3 though.

I made a script that sets up the necessary build environment and provides commands for building and uploading. It uses the official Arduino toolchain for ARM. Everything is standalone, nothing is installed.

It also works on Linux in general. The script auto detects the build platform architecture. At the moment Linux 32 Bit, 64 Bit and ARM are supported.

Several parameters at the beginning of the script allow to adapt it further to your needs. The script is setup by default to build the Marlin fork “Skynet3D” for the Anet A8 Prusa clone.
Recently Anet A6/A8 support has been merged back into the main Marlin branch. You can find example configurations for Anet printers in the Marlin sources at: github.com/MarlinFirmware/Marlin/tree/1.1.x/Marlin/example_configurations/Anet
If you want to build stock Marlin change the “marlinRepositoryUrl” parameter respectively.

If you build for non Anet platforms you can also set the parameter “hardwareDefintionDirectory” to an empty string, this prevents the script from trying to copy the board definition that is needed for the A8.

If you are running octopi on you Raspberry you need to disconnect it from your printer before uploading otherwise the serial port is blocked.

Code

here on github: https://github.com/mmone/marlintool

or download directly as a zip: https://github.com/mmone/marlintool/archive/master.zip

Commandline parameters

-s  — setup

Download and configure the toolchain and the necessary libraries for building Marlin.

-m  — marlin

Download Marlin sources.

-f –fetch

Update an existing Marlin clone.

-v  — verify

Build without uploading.

-u  — upload

Build and upload Marlin. If you are running octopi on you Raspberry you need to disconnect it before uploading otherwise the serial port is blocked.

-b  –backupConfig  [name]

Backup the Marlin configuration to the named backup.

-r  –restoreConfig [name]

Restore the given configuration into the Marlin directory.

-c  — clean

Cleanup everything. Remove Marlin sources and Arduino toolchain.

-p  — port [port]

Set the serialport for uploading the firmware. Overrides the default set in the script.

-h  — help

Show help.

Tweet about this on TwitterShare on Google+Share on FacebookPin on PinterestShare on RedditShare on LinkedInShare on StumbleUponEmail this to someone

Building a PHP Extension with a specific version

When building a native php extension it’s possible to run into problems when there are different php versions installed on the build system. As the extension is build with the php version / sources that are in the search path.

That is why “configure” allows to pass in a path to the php-config executable of the version /sources your are targeting. Run the configure for your extension like that:

./configure –with-php-config=[path to your php bin directory]/php-config

php-config returns all the necessary information so that configure is able to setup a valid makefile.

Tweet about this on TwitterShare on Google+Share on FacebookPin on PinterestShare on RedditShare on LinkedInShare on StumbleUponEmail this to someone

Building The live555 Streaming Media Framework on Windows with Visual Studio 2012/13

The live555 Streaming Media framework allows to stream content over RTP, and comes with a RTSP server. Below some hints how to build on Windows 7 64Bit with Visual Studio Express 2012 though these should also work with VS 2013.

On the command line

More current versions of Visual Studio IDE do not support building makefile based projects, so you need to build from the command line. Instructions on generating makefiles for the windows command-line can be found in the official documentation.

You can still build the project in the IDE. Check the second part of the post for instructions on how to modify the project for that.

  • From the Windows SDKs include directory copy “NtWin32.Mak” and “Win32.Mak” to the VS include directory eg. “C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include”.
  • Edit win32config and make “TOOLS32” point to the location of your build tools for me that was “C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC”. Change “msvcirt.lib” to “msvcrt.lib” in the “LINK_OPTS_0” param and the “LINKS” param to ‘ “$(TOOLS32)\bin\$(link)” -out:’ (without the ticks).
  • Get the sources from here: http://www.live555.com/liveMedia/public/ and unpack them somewhere. You will also need the Windows Platform SDK.
  • From the start menu launch  “Developer Command Prompt for VS2012” this will give you a console that is configured for building with VS. Go to the directory where you unpacked the sources and execute “genWindowsMakefiles”.
  • Now run “nmake -f file.mak”  in all subdirs. Eg. “nmake -f groupsock.mak” in the groupsock dir. You should proceed in the following order:
  • liveMedia
  • groupsock
  • UsageEnvironment
  • BasicUsageEnvironment
  • testProgs
  • mediaServer

In the IDE

To get the project to build in the VS IDE you need to patch two files:
In “DelayQueue.cpp” after "const DelayInterval ETERNITY(INT_MAX, MILLION-1);" add

const DelayInterval DELAY_MINUTE = 60*DELAY_SECOND;
const DelayInterval DELAY_HOUR = 60*DELAY_MINUTE;
const DelayInterval DELAY_DAY = 24*DELAY_HOUR;

In “DelayQueue.hh” replace
extern DelayInterval const DELAY_ZERO;
extern DelayInterval const DELAY_SECOND;
DelayInterval const DELAY_MINUTE = 60*DELAY_SECOND;
DelayInterval const DELAY_HOUR = 60*DELAY_MINUTE;
DelayInterval const DELAY_DAY = 24*DELAY_HOUR;

with

extern DelayInterval const DELAY_ZERO;
extern DelayInterval const DELAY_SECOND;
extern DelayInterval const DELAY_MINUTE;
extern DelayInterval const DELAY_HOUR;
extern DelayInterval const DELAY_DAY;

Don’t forget to add the live555 libs as dependencies to the project. You will also need “advapi32.lib”.

Tweet about this on TwitterShare on Google+Share on FacebookPin on PinterestShare on RedditShare on LinkedInShare on StumbleUponEmail this to someone