Control Builder C development using Sublime Text and GCC

Recently I started a project using ABB Control Builder to program a AC500 PM573 PLC.

I need to write a collection of C functions that can be used in CoDeSys as functions & function blocks so the end user (PLC Programmer) doesn’t need to use Structured Text (ST) to write what would be complicated Pascal.

Control Builder doesn’t provide a C editor, so I chose something light as I don’t need a full IDE – Sublime Text 2. This is the first time I’ve used it.

Control Builder is also a bit dated and doesn’t seem to have keyboard shortcuts for compiling, so I created my own build system for AC500 C development. This is the sublime-build file I used, thanks to sublimetext.info:

C.sublime-build

{
    "cmd" : [
    	"C:\\GCC\\4.7.0\\bin\\powerpc-elf-eabi-gcc.exe",
    	"-I", "C:\\Program Files (x86)\\Common Files\\CAA-Targets\\ABB_AC500\\AC500_FWAPI",
    	"-mcpu=860",
    	"-fno-common",
    	"-msdata=none",
    	"-fno-jump-tables",
    	"-fno-section-anchors",
    	"-fno-merge-constants",
    	"-fno-builtin",
    	"-nostdlib",
    	"-Werror-implicit-function-declaration",
    	"-Wconversion",
    	"-std=c99",
    	"-c", "C_Code_App_Shell.c",
    	"-o", "C_Code_App.obj"
	],
    "shell" : true,
    "working_dir" : "$file_path",
    "path" : "C:\\GCC\\4.7.0\\bin"
}

You’ll notice the following things about this build definition:

  • It won’t work with the “automatic” setting as I don’t want it picking up any other C projects
  • It compiles a specific file only – C_Code_App_Shell.c – which is the same file compiled by Control Builder so your other included files should be included properly

Use at your own risk, and I recommend using Control Builder to finally build your code when ready for testing and production, but this is a handy way of using a modern editor in the meantime.

OpenVPN Client and Windows 8

So I decided to take Windows 8 for a test drive and installed the Consumer Preview.

I also installed Visual Studio 2012 RC and all my usual dev tools.

Unexpectedly the whole environment is quite stable and all my favourite tools seem to be happy with the new OS.

The only exception is OpenVPN Connect, it installs without problems and even connects to the VPN Server, but routing is not working.

Tried multiple things like running under compatibility mode, setting delays in the configuration file, using the OpenVPN GUI, installing the 64bit beta version. But to no avail.

I then came across this forum thread where someone suggests opening the Network Adapter Applet (Control PanelNetwork and InternetNetwork Connections) before connecting the VPN Client. And guess what…it works.

Some obscure service must start when the applet opens that allows the client to connect. Hopefully this will be fixed before Windows 8 is out, but for now this workaround works great.

UPDATE:

As Yaniv Kunda pointed out in the comments the “obscure” service that starts when you run the applet is “Network Connections” service (Netman), so set it to Automatic startup and it should fix the problem.