GNU GCC Arm and OSX

Get the precompiled toolchain here

Download and extract folder, copy to /usr/local/.
Update link to /usr/local/arm-gcc (ln -s /usr/local/gcc-arm-none-eabi-{version} /usr/local/arm-gcc)

Once only: Add gcc-arm to path:
Edit /etc/paths.d/60-arm-gcc
/usr/local/arm-gcc/bin

Also add man paths
Edit /etc/manpaths.d/60-arm-gcc
/usr/local/arm-gcc/share/doc/gcc-arm-none-eabi/man

A bit of a ‘bug’ in os x is path_helper (run from /etc/profile) doesn’t set MANPATH if it’s not already defined. So A quick hack is to add the following lines in /etc/profile:

MANPATH=
export MANPATH

So the complete file looks like:

# System-wide .profile for sh(1)
MANPATH=
export MANPATH

if [ -x /usr/libexec/path_helper ]; then
eval `/usr/libexec/path_helper -s`
fi

if [ "${BASH-no}" != "no" ]; then
[ -r /etc/bashrc ] && . /etc/bashrc
fi

Then all man paths defined in /etc/manpaths.d will be set

Buliding simavr on OS 10.9 (Mavericks) with CrosspackAVR

A brief howto build simavr using CrosspackAVR avr-gcc toolchain

First download the source to simavr from here

git clone https://github.com/buserror-uk/simavr.git

Using Homebrew install libelf (thanks to post here by Robert Nees):
brew install libelf

I needed to make symbolic links to the libelf header files:
cd /usr/local/include
ln -s libelf/* .

Edit the Makefile.common in the simavr git repo you’ve downloaded and change the following lines:
AVR_ROOT := "/usr/local/CrossPack-AVR/"
AVR_INC := ${AVR_ROOT}/avr/
AVR := ${AVR_ROOT}/bin/avr-
# Thats for MacPorts libelf
ifeq (${shell test -d /usr/local && echo Exists}, Exists)
IPATH += /usr/local/include
LFLAGS = -L/usr/local/lib

Then just make and make install and you are done! Now to figure out how to use it.

For your reference, here’s my make output:
/Library/Developer/CommandLineTools/usr/bin/make -C simavr RELEASE=0
CONF obj-x86_64-apple-darwin13.0.0/cores.deps
WARNING cores/sim_mega324.c did not compile, check your avr-gcc toolchain
/Library/Developer/CommandLineTools/usr/bin/make obj config
make[2]: Nothing to be done for `obj'.
CONF sim_core_decl.h
/Library/Developer/CommandLineTools/usr/bin/make libsimavr run_avr
CC sim/sim_avr.c
CC sim/sim_core.c
CC sim/sim_cycle_timers.c
CC sim/sim_elf.c
CC sim/sim_gdb.c
CC sim/sim_hex.c
CC sim/sim_interrupts.c
CC sim/sim_io.c
CC sim/sim_irq.c
CC sim/sim_vcd_file.c
CC sim/avr_adc.c
CC sim/avr_bitbang.c
CC sim/avr_eeprom.c
CC sim/avr_extint.c
CC sim/avr_flash.c
CC sim/avr_ioport.c
CC sim/avr_lin.c
CC sim/avr_spi.c
CC sim/avr_timer.c
CC sim/avr_twi.c
CC sim/avr_uart.c
CC sim/avr_usb.c
CC sim/avr_watchdog.c
CORE cores/sim_90usb162.c
CORE cores/sim_mega128.c
CORE cores/sim_mega1280.c
CORE cores/sim_mega1281.c
CORE cores/sim_mega1284.c
CORE cores/sim_mega128rfa1.c
CORE cores/sim_mega16.c
CORE cores/sim_mega164.c
CORE cores/sim_mega168.c
CORE cores/sim_mega16m1.c
CORE cores/sim_mega2560.c
CORE cores/sim_mega32.c
CORE cores/sim_mega328.c
CORE cores/sim_mega48.c
CORE cores/sim_mega644.c
CORE cores/sim_mega8.c
CORE cores/sim_mega88.c
CORE cores/sim_megax.c
CORE cores/sim_megax4.c
CORE cores/sim_megax8.c
CORE cores/sim_megaxm1.c
CORE cores/sim_tiny13.c
CORE cores/sim_tiny2313.c
CORE cores/sim_tiny24.c
CORE cores/sim_tiny25.c
CORE cores/sim_tiny44.c
CORE cores/sim_tiny45.c
CORE cores/sim_tiny84.c
CORE cores/sim_tiny85.c
CORE cores/sim_tinyx4.c
CORE cores/sim_tinyx5.c
AR obj-x86_64-apple-darwin13.0.0/libsimavr.a
CC sim/run_avr.c
LD obj-x86_64-apple-darwin13.0.0/run_avr.elf
ln -sf obj-x86_64-apple-darwin13.0.0/run_avr.elf run_avr
/Library/Developer/CommandLineTools/usr/bin/make -C tests RELEASE=0
AVR-CC atmega48_disabled_timer.c
171 0 0 171 ab atmega48_disabled_timer.axf
AVR-CC atmega48_enabled_timer.c
177 0 0 177 b1 atmega48_enabled_timer.axf
AVR-CC atmega48_watchdog_test.c
371 82 6 459 1cb atmega48_watchdog_test.axf
AVR-CC atmega644_adc_test.c
2038 160 22 2220 8ac atmega644_adc_test.axf
AVR-CC atmega88_coroutine.c
703 36 159 898 382 atmega88_coroutine.axf
AVR-CC atmega88_example.c
1746 118 6 1870 74e atmega88_example.axf
AVR-CC atmega88_timer16.c
334 0 2 336 150 atmega88_timer16.axf
AVR-CC atmega88_uart_echo.c
1872 68 88 2028 7ec atmega88_uart_echo.axf
AVR-CC attiny85_crash_gdb.c
97 0 0 97 61 attiny85_crash_gdb.axf
TST obj-x86_64-apple-darwin13.0.0/test_atmega48_disabled_timer.tst
TST obj-x86_64-apple-darwin13.0.0/test_atmega48_enabled_timer.tst
TST obj-x86_64-apple-darwin13.0.0/test_atmega48_watchdog_test.tst
TST obj-x86_64-apple-darwin13.0.0/test_atmega644_adc_test.tst
TST obj-x86_64-apple-darwin13.0.0/test_atmega88_example.tst
TST obj-x86_64-apple-darwin13.0.0/test_atmega88_timer16.tst
TST obj-x86_64-apple-darwin13.0.0/test_atmega88_uart_echo.tst
/Library/Developer/CommandLineTools/usr/bin/make -C examples RELEASE=0
uname: illegal option -- o
usage: uname [-amnprsv]
for bi in board_hd77480 board_i2ctest board_ledramp board_simduino board_timer_64led; do /Library/Developer/CommandLineTools/usr/bin/make -C $bi; done
AVR-CC atmega48_charlcd.c
2073 14 5 2092 82c atmega48_charlcd.axf
CC ../parts/ac_input.c
CC ../parts/hd44780.c
CC ../parts/hd44780_glut.c
charlcd.c:103:5: warning: 'glutSwapBuffers' is deprecated: first deprecated in OS X 10.9 [-Wdeprecated-declarations]
glutSwapBuffers();
^
/System/Library/Frameworks/GLUT.framework/Headers/glut.h:448:22: note: 'glutSwapBuffers' declared here
extern void APIENTRY glutSwapBuffers(void) OPENGL_DEPRECATED(10_0, 10_9);
^
charlcd.c:111:2: warning: 'glutTimerFunc' is deprecated: first deprecated in OS X 10.9 [-Wdeprecated-declarations]
glutTimerFunc(1000/64, timerCB, 0);
^
/System/Library/Frameworks/GLUT.framework/Headers/glut.h:514:22: note: 'glutTimerFunc' declared here
extern void APIENTRY glutTimerFunc(unsigned int millis, void (*func)(int value), int value) OPENGL_DEPRECATED(10...
^
charlcd.c:112:2: warning: 'glutPostRedisplay' is deprecated: first deprecated in OS X 10.9 [-Wdeprecated-declarations]
glutPostRedisplay();
^
/System/Library/Frameworks/GLUT.framework/Headers/glut.h:444:22: note: 'glutPostRedisplay' declared here
extern void APIENTRY glutPostRedisplay(void) OPENGL_DEPRECATED(10_0, 10_9);
^
charlcd.c:125:2: warning: 'glutDisplayFunc' is deprecated: first deprecated in OS X 10.9 [-Wdeprecated-declarations]
glutDisplayFunc(displayCB); /* set window's display callback */
^
/System/Library/Frameworks/GLUT.framework/Headers/glut.h:505:22: note: 'glutDisplayFunc' declared here
extern void APIENTRY glutDisplayFunc(void (*func)(void)) OPENGL_DEPRECATED(10_0, 10_9);
^
charlcd.c:126:2: warning: 'glutKeyboardFunc' is deprecated: first deprecated in OS X 10.9 [-Wdeprecated-declarations]
glutKeyboardFunc(keyCB); /* set window's key callback */
^
/System/Library/Frameworks/GLUT.framework/Headers/glut.h:507:22: note: 'glutKeyboardFunc' declared here
extern void APIENTRY glutKeyboardFunc(void (*func)(unsigned char key, int x, int y)) OPENGL_DEPRECATED(10_0, 10_9);
^
charlcd.c:127:2: warning: 'glutTimerFunc' is deprecated: first deprecated in OS X 10.9 [-Wdeprecated-declarations]
glutTimerFunc(1000 / 24, timerCB, 0);
^
/System/Library/Frameworks/GLUT.framework/Headers/glut.h:514:22: note: 'glutTimerFunc' declared here
extern void APIENTRY glutTimerFunc(unsigned int millis, void (*func)(int value), int value) OPENGL_DEPRECATED(10...
^
charlcd.c:231:2: warning: 'glutInit' is deprecated: first deprecated in OS X 10.9 [-Wdeprecated-declarations]
glutInit(&argc, argv); /* initialize GLUT system */
^
/System/Library/Frameworks/GLUT.framework/Headers/glut.h:431:22: note: 'glutInit' declared here
extern void APIENTRY glutInit(int *argcp, char **argv) OPENGL_DEPRECATED(10_0, 10_9);
^
charlcd.c:237:2: warning: 'glutInitDisplayMode' is deprecated: first deprecated in OS X 10.9 [-Wdeprecated-declarations]
glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE);
^
/System/Library/Frameworks/GLUT.framework/Headers/glut.h:432:22: note: 'glutInitDisplayMode' declared here
extern void APIENTRY glutInitDisplayMode(unsigned int mode) OPENGL_DEPRECATED(10_0, 10_9);
^
charlcd.c:238:2: warning: 'glutInitWindowSize' is deprecated: first deprecated in OS X 10.9 [-Wdeprecated-declarations]
glutInitWindowSize(w * pixsize, h * pixsize); /* width=400pixels height=500pixels */
^
/System/Library/Frameworks/GLUT.framework/Headers/glut.h:437:22: note: 'glutInitWindowSize' declared here
extern void APIENTRY glutInitWindowSize(int width, int height) OPENGL_DEPRECATED(10_0, 10_9);
^
charlcd.c:239:11: warning: 'glutCreateWindow' is deprecated: first deprecated in OS X 10.9 [-Wdeprecated-declarations]
window = glutCreateWindow("Press 'q' to quit"); /* create window */
^
/System/Library/Frameworks/GLUT.framework/Headers/glut.h:441:21: note: 'glutCreateWindow' declared here
extern int APIENTRY glutCreateWindow(const char *title) OPENGL_DEPRECATED(10_0, 10_9);
^
charlcd.c:246:2: warning: 'glutMainLoop' is deprecated: first deprecated in OS X 10.9 [-Wdeprecated-declarations]
glutMainLoop();
^
/System/Library/Frameworks/GLUT.framework/Headers/glut.h:438:22: note: 'glutMainLoop' declared here
extern void APIENTRY glutMainLoop(void) OPENGL_DEPRECATED(10_0, 10_9);
^
11 warnings generated.
CC charlcd.c
LD obj-x86_64-apple-darwin13.0.0/charlcd.elf
charlcd done
AVR-CC atmega1280_i2ctest.c
941 16 12 969 3c9 atmega1280_i2ctest.axf
CC i2ctest.c
CC ../../examples/parts/i2c_eeprom.c
LD obj-x86_64-apple-darwin13.0.0/i2ctest.elf
i2ctest done
AVR-CC atmega48_ledramp.c
1839 32 11 1882 75a atmega48_ledramp.axf
CC ../parts/button.c
ledramp.c:85:5: warning: 'glutSwapBuffers' is deprecated: first deprecated in OS X 10.9 [-Wdeprecated-declarations]
glutSwapBuffers();
^
/System/Library/Frameworks/GLUT.framework/Headers/glut.h:448:22: note: 'glutSwapBuffers' declared here
extern void APIENTRY glutSwapBuffers(void) OPENGL_DEPRECATED(10_0, 10_9);
^
ledramp.c:118:2: warning: 'glutTimerFunc' is deprecated: first deprecated in OS X 10.9 [-Wdeprecated-declarations]
glutTimerFunc(1000/64, timerCB, 0);
^
/System/Library/Frameworks/GLUT.framework/Headers/glut.h:514:22: note: 'glutTimerFunc' declared here
extern void APIENTRY glutTimerFunc(unsigned int millis, void (*func)(int value), int value) OPENGL_DEPRECATED(10...
^
ledramp.c:122:3: warning: 'glutPostRedisplay' is deprecated: first deprecated in OS X 10.9 [-Wdeprecated-declarations]
glutPostRedisplay();
^
/System/Library/Frameworks/GLUT.framework/Headers/glut.h:444:22: note: 'glutPostRedisplay' declared here
extern void APIENTRY glutPostRedisplay(void) OPENGL_DEPRECATED(10_0, 10_9);
^
ledramp.c:214:2: warning: 'glutInit' is deprecated: first deprecated in OS X 10.9 [-Wdeprecated-declarations]
glutInit(&argc, argv); /* initialize GLUT system */
^
/System/Library/Frameworks/GLUT.framework/Headers/glut.h:431:22: note: 'glutInit' declared here
extern void APIENTRY glutInit(int *argcp, char **argv) OPENGL_DEPRECATED(10_0, 10_9);
^
ledramp.c:216:2: warning: 'glutInitDisplayMode' is deprecated: first deprecated in OS X 10.9 [-Wdeprecated-declarations]
glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE);
^
/System/Library/Frameworks/GLUT.framework/Headers/glut.h:432:22: note: 'glutInitDisplayMode' declared here
extern void APIENTRY glutInitDisplayMode(unsigned int mode) OPENGL_DEPRECATED(10_0, 10_9);
^
ledramp.c:217:2: warning: 'glutInitWindowSize' is deprecated: first deprecated in OS X 10.9 [-Wdeprecated-declarations]
glutInitWindowSize(8 * pixsize, 1 * pixsize); /* width=400pixels height=500pixels */
^
/System/Library/Frameworks/GLUT.framework/Headers/glut.h:437:22: note: 'glutInitWindowSize' declared here
extern void APIENTRY glutInitWindowSize(int width, int height) OPENGL_DEPRECATED(10_0, 10_9);
^
ledramp.c:218:11: warning: 'glutCreateWindow' is deprecated: first deprecated in OS X 10.9 [-Wdeprecated-declarations]
window = glutCreateWindow("Glut"); /* create window */
^
/System/Library/Frameworks/GLUT.framework/Headers/glut.h:441:21: note: 'glutCreateWindow' declared here
extern int APIENTRY glutCreateWindow(const char *title) OPENGL_DEPRECATED(10_0, 10_9);
^
ledramp.c:227:2: warning: 'glutDisplayFunc' is deprecated: first deprecated in OS X 10.9 [-Wdeprecated-declarations]
glutDisplayFunc(displayCB); /* set window's display callback */
^
/System/Library/Frameworks/GLUT.framework/Headers/glut.h:505:22: note: 'glutDisplayFunc' declared here
extern void APIENTRY glutDisplayFunc(void (*func)(void)) OPENGL_DEPRECATED(10_0, 10_9);
^
ledramp.c:228:2: warning: 'glutKeyboardFunc' is deprecated: first deprecated in OS X 10.9 [-Wdeprecated-declarations]
glutKeyboardFunc(keyCB); /* set window's key callback */
^
/System/Library/Frameworks/GLUT.framework/Headers/glut.h:507:22: note: 'glutKeyboardFunc' declared here
extern void APIENTRY glutKeyboardFunc(void (*func)(unsigned char key, int x, int y)) OPENGL_DEPRECATED(10_0, 10_9);
^
ledramp.c:229:2: warning: 'glutTimerFunc' is deprecated: first deprecated in OS X 10.9 [-Wdeprecated-declarations]
glutTimerFunc(1000 / 24, timerCB, 0);
^
/System/Library/Frameworks/GLUT.framework/Headers/glut.h:514:22: note: 'glutTimerFunc' declared here
extern void APIENTRY glutTimerFunc(unsigned int millis, void (*func)(int value), int value) OPENGL_DEPRECATED(10...
^
ledramp.c:235:2: warning: 'glutMainLoop' is deprecated: first deprecated in OS X 10.9 [-Wdeprecated-declarations]
glutMainLoop();
^
/System/Library/Frameworks/GLUT.framework/Headers/glut.h:438:22: note: 'glutMainLoop' declared here
extern void APIENTRY glutMainLoop(void) OPENGL_DEPRECATED(10_0, 10_9);
^
11 warnings generated.
CC ledramp.c
LD obj-x86_64-apple-darwin13.0.0/ledramp.elf
ledramp done
AVR-CC atmega328p_dummy_blinky.c
333 66 6 405 195 atmega328p_dummy_blinky.axf
CC ../parts/button.c
CC ../parts/uart_pty.c
simduino.c:94:5: warning: 'glutSwapBuffers' is deprecated: first deprecated in OS X 10.9 [-Wdeprecated-declarations]
glutSwapBuffers();
^
/System/Library/Frameworks/GLUT.framework/Headers/glut.h:448:22: note: 'glutSwapBuffers' declared here
extern void APIENTRY glutSwapBuffers(void) OPENGL_DEPRECATED(10_0, 10_9);
^
simduino.c:127:2: warning: 'glutTimerFunc' is deprecated: first deprecated in OS X 10.9 [-Wdeprecated-declarations]
glutTimerFunc(1000/64, timerCB, 0);
^
/System/Library/Frameworks/GLUT.framework/Headers/glut.h:514:22: note: 'glutTimerFunc' declared here
extern void APIENTRY glutTimerFunc(unsigned int millis, void (*func)(int value), int value) OPENGL_DEPRECATED(10...
^
simduino.c:248:2: warning: 'glutInit' is deprecated: first deprecated in OS X 10.9 [-Wdeprecated-declarations]
glutInit(&argc, argv); /* initialize GLUT system */
^
/System/Library/Frameworks/GLUT.framework/Headers/glut.h:431:22: note: 'glutInit' declared here
extern void APIENTRY glutInit(int *argcp, char **argv) OPENGL_DEPRECATED(10_0, 10_9);
^
simduino.c:250:2: warning: 'glutInitDisplayMode' is deprecated: first deprecated in OS X 10.9
[-Wdeprecated-declarations]
glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE);
^
/System/Library/Frameworks/GLUT.framework/Headers/glut.h:432:22: note: 'glutInitDisplayMode' declared here
extern void APIENTRY glutInitDisplayMode(unsigned int mode) OPENGL_DEPRECATED(10_0, 10_9);
^
simduino.c:251:2: warning: 'glutInitWindowSize' is deprecated: first deprecated in OS X 10.9 [-Wdeprecated-declarations]
glutInitWindowSize(8 * pixsize, 1 * pixsize); /* width=400pixels height=500pixels */
^
/System/Library/Frameworks/GLUT.framework/Headers/glut.h:437:22: note: 'glutInitWindowSize' declared here
extern void APIENTRY glutInitWindowSize(int width, int height) OPENGL_DEPRECATED(10_0, 10_9);
^
simduino.c:252:11: warning: 'glutCreateWindow' is deprecated: first deprecated in OS X 10.9 [-Wdeprecated-declarations]
window = glutCreateWindow("Glut"); /* create window */
^
/System/Library/Frameworks/GLUT.framework/Headers/glut.h:441:21: note: 'glutCreateWindow' declared here
extern int APIENTRY glutCreateWindow(const char *title) OPENGL_DEPRECATED(10_0, 10_9);
^
simduino.c:261:2: warning: 'glutDisplayFunc' is deprecated: first deprecated in OS X 10.9 [-Wdeprecated-declarations]
glutDisplayFunc(displayCB); /* set window's display callback */
^
/System/Library/Frameworks/GLUT.framework/Headers/glut.h:505:22: note: 'glutDisplayFunc' declared here
extern void APIENTRY glutDisplayFunc(void (*func)(void)) OPENGL_DEPRECATED(10_0, 10_9);
^
simduino.c:262:2: warning: 'glutKeyboardFunc' is deprecated: first deprecated in OS X 10.9 [-Wdeprecated-declarations]
glutKeyboardFunc(keyCB); /* set window's key callback */
^
/System/Library/Frameworks/GLUT.framework/Headers/glut.h:507:22: note: 'glutKeyboardFunc' declared here
extern void APIENTRY glutKeyboardFunc(void (*func)(unsigned char key, int x, int y)) OPENGL_DEPRECATED(10_0, 10_9);
^
simduino.c:263:2: warning: 'glutTimerFunc' is deprecated: first deprecated in OS X 10.9 [-Wdeprecated-declarations]
glutTimerFunc(1000 / 24, timerCB, 0);
^
/System/Library/Frameworks/GLUT.framework/Headers/glut.h:514:22: note: 'glutTimerFunc' declared here
extern void APIENTRY glutTimerFunc(unsigned int millis, void (*func)(int value), int value) OPENGL_DEPRECATED(10...
^
simduino.c:269:2: warning: 'glutMainLoop' is deprecated: first deprecated in OS X 10.9 [-Wdeprecated-declarations]
glutMainLoop();
^
/System/Library/Frameworks/GLUT.framework/Headers/glut.h:438:22: note: 'glutMainLoop' declared here
extern void APIENTRY glutMainLoop(void) OPENGL_DEPRECATED(10_0, 10_9);
^
10 warnings generated.
CC simduino.c
LD obj-x86_64-apple-darwin13.0.0/simduino.elf
simduino done
rm atmega328p_dummy_blinky.axf
AVR-CC atmega168_timer_64led.c
1860 20 53 1933 78d atmega168_timer_64led.axf
CC ../parts/button.c
CC ../parts/hc595.c
timer_64led.c:149:5: warning: 'glutSwapBuffers' is deprecated: first deprecated in OS X 10.9 [-Wdeprecated-declarations]
glutSwapBuffers();
^
/System/Library/Frameworks/GLUT.framework/Headers/glut.h:448:22: note: 'glutSwapBuffers' declared here
extern void APIENTRY glutSwapBuffers(void) OPENGL_DEPRECATED(10_0, 10_9);
^
timer_64led.c:183:2: warning: 'glutTimerFunc' is deprecated: first deprecated in OS X 10.9 [-Wdeprecated-declarations]
glutTimerFunc(1000/64, timerCB, 0);
^
/System/Library/Frameworks/GLUT.framework/Headers/glut.h:514:22: note: 'glutTimerFunc' declared here
extern void APIENTRY glutTimerFunc(unsigned int millis, void (*func)(int value), int value) OPENGL_DEPRECATED(10...
^
timer_64led.c:187:3: warning: 'glutPostRedisplay' is deprecated: first deprecated in OS X 10.9
[-Wdeprecated-declarations]
glutPostRedisplay();
^
/System/Library/Frameworks/GLUT.framework/Headers/glut.h:444:22: note: 'glutPostRedisplay' declared here
extern void APIENTRY glutPostRedisplay(void) OPENGL_DEPRECATED(10_0, 10_9);
^
timer_64led.c:335:2: warning: 'glutInit' is deprecated: first deprecated in OS X 10.9 [-Wdeprecated-declarations]
glutInit(&argc, argv); /* initialize GLUT system */
^
/System/Library/Frameworks/GLUT.framework/Headers/glut.h:431:22: note: 'glutInit' declared here
extern void APIENTRY glutInit(int *argcp, char **argv) OPENGL_DEPRECATED(10_0, 10_9);
^
timer_64led.c:340:2: warning: 'glutInitDisplayMode' is deprecated: first deprecated in OS X 10.9
[-Wdeprecated-declarations]
glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE);
^
/System/Library/Frameworks/GLUT.framework/Headers/glut.h:432:22: note: 'glutInitDisplayMode' declared here
extern void APIENTRY glutInitDisplayMode(unsigned int mode) OPENGL_DEPRECATED(10_0, 10_9);
^
timer_64led.c:341:2: warning: 'glutInitWindowSize' is deprecated: first deprecated in OS X 10.9
[-Wdeprecated-declarations]
glutInitWindowSize(w * pixsize, h * pixsize); /* width=400pixels height=500pixels */
^
/System/Library/Frameworks/GLUT.framework/Headers/glut.h:437:22: note: 'glutInitWindowSize' declared here
extern void APIENTRY glutInitWindowSize(int width, int height) OPENGL_DEPRECATED(10_0, 10_9);
^
timer_64led.c:342:11: warning: 'glutCreateWindow' is deprecated: first deprecated in OS X 10.9
[-Wdeprecated-declarations]
window = glutCreateWindow("Press 0, 1, 2 or q"); /* create window */
^
/System/Library/Frameworks/GLUT.framework/Headers/glut.h:441:21: note: 'glutCreateWindow' declared here
extern int APIENTRY glutCreateWindow(const char *title) OPENGL_DEPRECATED(10_0, 10_9);
^
timer_64led.c:351:2: warning: 'glutDisplayFunc' is deprecated: first deprecated in OS X 10.9 [-Wdeprecated-declarations]
glutDisplayFunc(displayCB); /* set window's display callback */
^
/System/Library/Frameworks/GLUT.framework/Headers/glut.h:505:22: note: 'glutDisplayFunc' declared here
extern void APIENTRY glutDisplayFunc(void (*func)(void)) OPENGL_DEPRECATED(10_0, 10_9);
^
timer_64led.c:352:2: warning: 'glutKeyboardFunc' is deprecated: first deprecated in OS X 10.9
[-Wdeprecated-declarations]
glutKeyboardFunc(keyCB); /* set window's key callback */
^
/System/Library/Frameworks/GLUT.framework/Headers/glut.h:507:22: note: 'glutKeyboardFunc' declared here
extern void APIENTRY glutKeyboardFunc(void (*func)(unsigned char key, int x, int y)) OPENGL_DEPRECATED(10_0, 10_9);
^
timer_64led.c:353:2: warning: 'glutTimerFunc' is deprecated: first deprecated in OS X 10.9 [-Wdeprecated-declarations]
glutTimerFunc(1000 / 24, timerCB, 0);
^
/System/Library/Frameworks/GLUT.framework/Headers/glut.h:514:22: note: 'glutTimerFunc' declared here
extern void APIENTRY glutTimerFunc(unsigned int millis, void (*func)(int value), int value) OPENGL_DEPRECATED(10...
^
timer_64led.c:359:2: warning: 'glutMainLoop' is deprecated: first deprecated in OS X 10.9 [-Wdeprecated-declarations]
glutMainLoop();
^
/System/Library/Frameworks/GLUT.framework/Headers/glut.h:438:22: note: 'glutMainLoop' declared here
extern void APIENTRY glutMainLoop(void) OPENGL_DEPRECATED(10_0, 10_9);
^
11 warnings generated.
CC timer_64led.c
LD obj-x86_64-apple-darwin13.0.0/timer_64led.elf
timer_64led done

Syncing the NZ AIP into Air Nav Pro

So I wanted to be lazy and not worry about manually updating the aerodrome charts in Air Nav Pro.
Since there doesn’t seem to be an API in the NZAIP (www.aip.net.nz) I hacked together a python script to scrape the data and download all the plates. I’ve excluded downloading any IFR plates (using a crude word filter) since I’m only interested in VFR. If you want the IFR plates as well, just make the IFR_Keywords list an empty list in getaip.py:
IFR_Keywords = []

I’m running OS X 10.8 so if you want to run these scripts on windows you’ll need to install python at the very least and also rsync.

First I create a list of aerodrome objects and attach a list of assets to each aerodrome object. Each asset is essentially a linked pdf from the AIP web site. Then I create my required directory structure – directory name is the aerodrome ICAO code (for Air Nav Pro) and change the pdf file name to match the required naming convention (must start with ICAO code of aerodrome).
I essentially download all plates every time, since I don’t know which ones have changed.

The two python files need to be in the same directory. You can download all the plates just by running `python getaip.py`
This will create a directory named ‘aip’ in the same directory as the getaip.py script.

You need to mount the web dav server from Air Nav Pro.

Once this is done, then I just use rsync (with the –checksum and –delete) flags to update the plates – the script outputs a sample rsync command. Simple!!

Download the Python Files (Updated to support the Disclaimer page)

Building python-ldap-2.4.10 on QNAP TS-210

I’m using ipkg to install some of the requirements, so check the QNAP site to see how to enable the use of this.

The python-ldap module requires a compile of some modules so you need some headers. These can be installed via ipkg:
ipkg install openldap-libs
This installs the ldap(openldap-libs_2.3.43-2_arm.ipk) and sasl (cyrus-sasl-libs_2.1.23-2_arm.ipk) libs in /opt/lib and /opt/lib/sasl2 and the header files in /opt/include and /opt/include/sasl

Download the python-ldap (Version 2.4.10 as of the time of writing this document) source from https://pypi.python.org/pypi/python-ldap/ and extract to your qnap (I’m using /share/MD0_DATA/lab/)

Edit setup.cfg in the extracted directory, and change the following two lines:
library_dirs = /opt/openldap-RE24/lib /usr/lib
include_dirs = /opt/openldap-RE24/include /usr/include/sasl /usr/include

to be:
library_dirs = /opt/lib /opt/lib/sasl2
include_dirs = /opt/include /opt/include/sasl

Run : python setup.py build

I had an error:
/opt/bin/gcc -DNDEBUG -g -O3 -Wall -Wstrict-prototypes -fPIC -DHAVE_SASL -DHAVE_TLS -DHAVE_LIBLDAP_R -DHAVE_LIBLDAP_R -DLDAPMODULE_VERSION=2.4.10 -IModules -I/opt/include -I/opt/include/sasl -I/opt/include/python2.5 -c Modules/constants.c -o build/temp.linux-armv5tel-2.5/Modules/constants.o
Modules/constants.c: In function 'LDAPinit_constants':
Modules/constants.c:155: error: 'LDAP_OPT_DIAGNOSTIC_MESSAGE' undeclared (first use in this function)
Modules/constants.c:155: error: (Each undeclared identifier is reported only once
Modules/constants.c:155: error: for each function it appears in.)
Modules/constants.c:365: error: 'LDAP_CONTROL_RELAX' undeclared (first use in this function)
error: command '/opt/bin/gcc' failed with exit status 1

Turns out with version of python-ldap (2.4.x), OpenLDAP 2.4 client libs or newer are required. So off to find out where these are. I downloaded the ipkg’s mentioned above (openldap-libs and cyrus-sasl-libs) to try an figure how how to build the newest versions of these. Turns out the cyrus-sasl-libs haven’t been updated for a long time, the latest version is 2.1.25 and the one supplied in ipkg repo currently is 2.1.23-2. python-ldap 2.4.10 needs Cyrus SASL 2.1.x or newer so the supplied ipkg version is fine.

Building openldap-2.4.35 (without slapd) to get the libraries:
untar openldap-2.4.35.tar.gz
cd into openldap source
export PATH=/opt/bin:$PATH
./configure --prefix=/opt --disable-slapd
make depend
cd libraries
make

Now you need to copy them into a directory structure to build the ipkg – I found some instruction for this here http://www.oesf.org/index.php?title=IPKG_Howto (if you want to build the ipkg – if not you can just run make install from the libraries folder).

mkdir -p /share/MD0_DATA/lab/ipkg_build/openldap-libs/ipkgroot/opt/include
mkdir -p /share/MD0_DATA/lab/ipkg_build/openldap-libs/ipkgroot/opt/lib
#(from the openldap libraries folder)
cp liblber/.libs/liblber-2.4.so.2.9.1 /share/MD0_DATA/lab/ipkg_builds/openldap-libs/ipkgroot/opt/lib/
cp libldap/.libs/libldap-2.4.so.2.9.1 /share/MD0_DATA/lab/ipkg_builds/openldap-libs/ipkgroot/opt/lib/
cp libldap_r/.libs/libldap_r-2.4.so.2.9.1 /share/MD0_DATA/lab/ipkg_builds/openldap-libs/ipkgroot/opt/lib/
#create the links
cd /share/MD0_DATA/lab/ipkg_builds/openldap-libs/ipkgroot/opt/lib
ln -s liblber-2.4.so.2.9.1 liblber-2.4.so.2
ln -s liblber-2.4.so.2.9.1 liblber.so
ln -s libldap-2.4.so.2.9.1 libldap-2.4.so.2
ln -s libldap-2.4.so.2.9.1 libldap.so
ln -s libldap_r-2.4.so.2.9.1 libldap_r-2.4.so.2
ln -s libldap_r-2.4.so.2.9.1 libldap_r.so

# now the header files
cd into the openldap source folder
cd include
cp lber.h lber_types.h ldap.h ldap_cdefs.h ldap_features.h ldap_schema.h ldap_utf8.h slapi-plugin.h /share/MD0_DATA/lab/ipkg_builds/openldap-libs/ipkgroot/opt/include/

# create the ipkg control file
cd /share/MD0_DATA/lab/ipkg_builds/openldap-libs/ipkgroot/
mkdir CONTROL
cd CONTROL
vi control
# add the following:
Package: openldap-libs
Architecture: arm
Priority: optional
Section: net
Version: 2.4.35
Maintainer: Your Name
Source: ftp://ftp.openldap.org/pub/OpenLDAP/openldap-release/openldap-2.4.35.tgz
Description: Open Lightweight Directory Access Protocol
Depends: openssl, libdb, gdbm, cyrus-sasl-libs, psmisc
Conflicts:

# save and quit the file

# now you need to compile the python modules:
cd /share/MD0_DATA/lab/ipkg_builds/openldap-libs

# now create the ipkg

# make sure the permissions are correct:
# find all directories and make them readable by everyone
find ipkgroot/ -type d -exec chmod 755 '{}' \;
# find all files and make them readable
find ipkgroot/ -type f -exec chmod og+r '{}' \;

ipkg-build.sh ipkgroot

You should now have a file named ‘openldap-libs_2.4.35_arm.ipk’ in /share/MD0_DATA/lab/ipkg_builds/openldap-libs
You can install this using ipkg:
ipkg install openldap-libs_2.4.35_arm.ipk
I’ve also uploaded this ipkg to http://www.massey.ac.nz/~fherbert/ipkg/optware/cs08q1armel/cross/unstable/openldap-libs_2.4.35_arm.ipk

So now, back to building python-ldap. Change back into the python-ldap source directory and run ‘python setup.py build’ and this time it built, Yay!

Once the build is complete, you can either just run python setup.py install and you are done, or use create an ipkg.

    Creating the python-ldap ipkg


mkdir -p /share/MD0_DATA/lab/ipkg_builds/python-ldap/ipkgroot/opt/lib/python2.5/site-packages
cd /share/MD0_DATA/lab/ipkg_builds/python-ldap
cp -a python-ldap-2.4.10/build/lib.linux-armv5tel-2.5/* ipkgroot/opt/lib/python2.5/site-packages/
# now get the demos
mkdir -p ipkgroot/opt/share/doc/python-ldap-2.4.10
cp -a python-ldap-2.4.10/Demo ipkgroot/opt/share/doc/python-ldap-2.4.10/
# get the licence, readme and todo
cp -a python-ldap-2.4.10/LICENCE python-ldap-2.4.10/README python-ldap-2.4.10/TODO ipkgroot/opt/share/doc/python-ldap-2.4.10/
# finally the egg file
cp -a python-ldap-2.4.10/Lib/python_ldap.egg-info/PKG-INFO ipkgroot/opt/lib/python2.5/site-packages/python-ldap-2.4.10-py2.5.egg-info

# start python from the command line and enter:

import compileall
compileall.compile_dir('site-packages', force=True)

# This will go through the site-packages directory recursively and compile all the .py files.

# create the control file
mkdir ipkgroot/CONTROL
vi ipkgroot/CONTROL/control

# add the following to that file
Package: py25-python-ldap
Architecture: arm
Priority: optional
Section: misc
Version: 2.4.10
Maintainer: Your Name
Source: https://pypi.python.org/packages/source/p/python-ldap/python-ldap-2.4.10.tar.gz
Description: Provides an object-oriented API to access LDAP directory servers from Python programs. Mainly it wraps the OpenLDAP 2.x libs for that purpose. Additionally the package contains modules for other LDAP-related stuff (e.g. processing LDIF, LDAPURLs, LDAPv3 schema, LDAPv3 extended operations and controls, etc.).
Depends: python25
Conflicts:

# write and quit the file
# now create the ipkg
# make sure the permissions are correct:
# find all directories and make them readable by everyone
find ipkgroot/ -type d -exec chmod 755 '{}' \;
# find all files and make them readable
find ipkgroot/ -type f -exec chmod og+r '{}' \;
ipkg-build.sh ipkgroot

You will now have py25-python-ldap_2.4.10_arm.ipk in you current directory which you can do whatever you like with.
I’ve also created packages for python 2.6 and 2.7, they are all available to download from here:
py25-python-ldap_2.4.10_arm.ipk
py26-python-ldap_2.4.10_arm.ipk
py27-python-ldap_2.4.10_arm.ipk

MythTV mythtv-setup and fonts

I kept getting this annoying message when starting mythtv-setup on my QNAP:

MythFontProperties: Failed to load 'Liberation Sans', got 'FreeSans' instead

Turns out the Liberation Sans font is a freely available one, I downloaded mine from here

I then installed the ttf files into /opt/share/mythtv/fonts, restarted mythtv-setup and no more warnings about the fonts.

Getting the EPG using Mythtv on QNAP using xml grabber

I was seeing this in the mythtv-setup log when trying to get it to detect tv_grab_nz.py:

2013-04-27 16:05:07.772632 I XMLTVConfig::Load: Running 'tv_find_grabbers baseline'.
2013-04-27 16:05:08.068895 E XMLTVConfig::Load: Failed to run tv_find_grabbers

So turns out you need the xmltv package to get the 7 day epg working using tv_grab_nz-py from here
Luckly, someone has already created a QPKG for xmltv on the QNAP here

MythWeb and MythTV 0.26

So I had to get MythWeb running on MythTV which is running on my QNAP TS-210.

After going through the setup and changing the config file as required I had a few issues.
The first issue (Failed to open translation file: modules_path/_shared/lang/English.lang in /share/Qweb/mythweb/classes/Translate.php) was resolved by symlinking the modules_path directory in the Mythweb directory to the modules directory (in the same directory).

The second issue (nothing much appearing on screen and a javascript error about recommend_enabled not defined), I had the edit included/db_update.php and set the $db_vers to 4 as Mythweb kept trying to setup myth recommendations something or rather. I’m not interested in this and just wanted to get mythweb working.

MythTV Upnp Samsung TV (AllPlay)

So I finally got MythTV running on my QNAP and tried to connect to the Upnp MythTV service but this just kept failing. Turns out Samsung TV’s send an extra ‘/’ in the POST request – DOH!!

So the hack for mythtv to handle this is here

So I edited my libs/libmythupnp/httprequest.cpp in the mythtv-0.26.0 source on my QNAP. Not wanting to recompile the entire application, I just did:
cd mythtv0.26.0-src
cd libs/libmythupnp/
make
make install

The restarted MythTV, and voila! Upnp is now working on the samsung TV’s!

Installing MythTV 0.26.0 onto QNAP TS-210 and HDHomerun

I have a QNAP TS-210 which has a Marvell 6281 800MHz CPU and 256MB RAM running firmware 3.8.2 Build 20130301

I installed MythTV as per the wiki instructions here

The compile of QT took around 30 hours and the compile of MythTV took around 12 hours!! So don’t try to do this when you’re in a hurry.

I had a few issues with the compiling of MythTV, all of them pretty much were discussed in this forum.
The patches provided for MythTV 0.26 pre patch on the wiki page above worked except for the mythcdrom-linux.cpp one, which I had to apply manually.
After this manual patch was applied, I got errors when trying to configure MythTV due to the system unable to find the libuuid headers. As discussed in the QNAP forum, you need to download the QNAP GPL source and perform the following:

mkdir /opt/include/uuid
cp GPL_TS/src/e2fsprogs-1.41.4/lib/uuid/uuid.h /opt/include/uuid/uuid.h
ln -sf /lib/libuuid.so.1 /lib/libuuid.so

The configure then ran successfully ( I had to leave off the “–cpu=’i686′” option otherwise it refused to configure. Since I am using the HDHomerun network tuner, I didn’t need to build kernel drivers since support for the HDHomerun is included in MythTV.

The make failed, unable to locate some libraries or something, I had to add the path to the opt bin directory:
export PATH=/opt/bin:$PATH

Once I has it all working, I was able to run mythv-setup and configure my HDHomerun with all DVB-T channels.