diff --git a/src/modules/px4iofirmware/px4io.c b/src/modules/px4iofirmware/px4io.c index 5d6991a691..b20a6e1f06 100644 --- a/src/modules/px4iofirmware/px4io.c +++ b/src/modules/px4iofirmware/px4io.c @@ -1,6 +1,6 @@ /**************************************************************************** * - * Copyright (c) 2012-2014 PX4 Development Team. All rights reserved. + * Copyright (c) 2012-2015 PX4 Development Team. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -54,6 +54,7 @@ #include #include +#include #include @@ -62,8 +63,6 @@ __EXPORT int user_start(int argc, char *argv[]); -extern void up_cxxinitialize(void); - struct sys_state_s system_state; static struct hrt_call serial_dma_call; @@ -238,9 +237,20 @@ user_start(int argc, char *argv[]) /* configure the first 8 PWM outputs (i.e. all of them) */ up_pwm_servo_init(0xff); +#if defined(CONFIG_HAVE_CXX) && defined(CONFIG_HAVE_CXXINITIALIZE) + /* run C++ ctors before we go any further */ + up_cxxinitialize(); +# if defined(CONFIG_EXAMPLES_NSH_CXXINITIALIZE) +# error CONFIG_EXAMPLES_NSH_CXXINITIALIZE Must not be defined! Use CONFIG_HAVE_CXX and CONFIG_HAVE_CXXINITIALIZE. +# endif + +#else +# error platform is dependent on c++ both CONFIG_HAVE_CXX and CONFIG_HAVE_CXXINITIALIZE must be defined. +#endif + /* reset all to zero */ memset(&system_state, 0, sizeof(system_state)); @@ -259,7 +269,7 @@ user_start(int argc, char *argv[]) #endif /* print some startup info */ - lowsyslog("\nPX4IO: starting\n"); + syslog(LOG_INFO, "\nPX4IO: starting\n"); /* default all the LEDs to off while we start */ LED_AMBER(false); @@ -301,7 +311,7 @@ user_start(int argc, char *argv[]) perf_counter_t loop_perf = perf_alloc(PC_INTERVAL, "loop"); struct mallinfo minfo = mallinfo(); - lowsyslog("MEM: free %u, largest %u\n", minfo.mxordblk, minfo.fordblks); + syslog(LOG_INFO, "MEM: free %u, largest %u\n", minfo.mxordblk, minfo.fordblks); /* initialize PWM limit lib */ pwm_limit_init(&pwm_limit); @@ -321,7 +331,7 @@ user_start(int argc, char *argv[]) */ if (minfo.mxordblk < 600) { - lowsyslog("ERR: not enough MEM"); + syslog(LOG_ERR, "ERR: not enough MEM"); bool phase = false; while (true) { diff --git a/src/modules/px4iofirmware/px4io.h b/src/modules/px4iofirmware/px4io.h index e50315415d..566c31635a 100644 --- a/src/modules/px4iofirmware/px4io.h +++ b/src/modules/px4iofirmware/px4io.h @@ -69,7 +69,7 @@ #ifdef DEBUG # include -# define debug(fmt, args...) lowsyslog(fmt "\n", ##args) +# define debug(fmt, args...) syslog(LOG_DEBUG,fmt "\n", ##args) #else # define debug(fmt, args...) do {} while(0) #endif