From 17568deeebb4fbca885e7c74b69edbda96cfb368 Mon Sep 17 00:00:00 2001 From: Lorenz Meier Date: Wed, 12 Nov 2014 10:47:08 +0100 Subject: Aerocore: update driver API --- src/drivers/boards/aerocore/aerocore_init.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'src/drivers/boards/aerocore/aerocore_init.c') diff --git a/src/drivers/boards/aerocore/aerocore_init.c b/src/drivers/boards/aerocore/aerocore_init.c index 1ce235da8..e370fa983 100644 --- a/src/drivers/boards/aerocore/aerocore_init.c +++ b/src/drivers/boards/aerocore/aerocore_init.c @@ -53,11 +53,11 @@ #include #include -#include +#include #include #include #include -#include +#include #include #include "board_config.h" @@ -191,7 +191,7 @@ stm32_boardinitialize(void) stm32_spiinitialize(); /* configure LEDs */ - up_ledinit(); + board_led_initialize(); } /**************************************************************************** @@ -264,7 +264,7 @@ __EXPORT int nsh_archinitialize(void) spi3 = up_spiinitialize(3); if (!spi3) { message("[boot] FAILED to initialize SPI port 3\n"); - up_ledon(LED_AMBER); + board_led_on(LED_AMBER); return -ENODEV; } /* Default: 1MHz, 8 bits, Mode 3 */ @@ -281,7 +281,7 @@ __EXPORT int nsh_archinitialize(void) spi4 = up_spiinitialize(4); if (!spi4) { message("[boot] FAILED to initialize SPI port 4\n"); - up_ledon(LED_AMBER); + board_led_on(LED_AMBER); return -ENODEV; } /* Default: ~10MHz, 8 bits, Mode 3 */ -- cgit v1.2.3 From 0c22068bb8cced8df8c996b8a236e4be699d835f Mon Sep 17 00:00:00 2001 From: David Sidrane Date: Thu, 22 Jan 2015 12:28:18 -1000 Subject: Added Support for C++ static initializers for all boards. Including compile time checking for proper C++ configuration and not calling up_cxxinitialize redundantly --- makefiles/toolchain_gnu-arm-eabi.mk | 2 +- src/drivers/boards/aerocore/aerocore_init.c | 15 +++++++++++++++ src/drivers/boards/aerocore/module.mk | 6 ++++++ src/drivers/boards/px4fmu-v1/module.mk | 6 ++++++ src/drivers/boards/px4fmu-v1/px4fmu_init.c | 14 ++++++++++++++ src/drivers/boards/px4fmu-v2/px4fmu2_init.c | 6 ++++++ src/drivers/boards/px4io-v1/module.mk | 6 ++++++ src/drivers/boards/px4io-v2/module.mk | 6 ++++++ src/modules/px4iofirmware/px4io.c | 11 +++++++++++ 9 files changed, 71 insertions(+), 1 deletion(-) (limited to 'src/drivers/boards/aerocore/aerocore_init.c') diff --git a/makefiles/toolchain_gnu-arm-eabi.mk b/makefiles/toolchain_gnu-arm-eabi.mk index 75a611fee..d1c534e22 100644 --- a/makefiles/toolchain_gnu-arm-eabi.mk +++ b/makefiles/toolchain_gnu-arm-eabi.mk @@ -149,7 +149,7 @@ ARCHWARNINGS = -Wall \ -Wdouble-promotion \ -Wshadow \ -Wfloat-equal \ - -Wframe-larger-than=2560 \ + -Wframe-larger-than=1024 \ -Wpointer-arith \ -Wlogical-op \ -Wmissing-declarations \ diff --git a/src/drivers/boards/aerocore/aerocore_init.c b/src/drivers/boards/aerocore/aerocore_init.c index e370fa983..91dbe4b81 100644 --- a/src/drivers/boards/aerocore/aerocore_init.c +++ b/src/drivers/boards/aerocore/aerocore_init.c @@ -228,6 +228,21 @@ __EXPORT int nsh_archinitialize(void) stm32_configgpio(GPIO_ADC1_IN12); /* J1 breakout */ stm32_configgpio(GPIO_ADC1_IN13); /* J1 breakout */ +#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 + + /* configure the high-resolution time/callout interface */ hrt_init(); diff --git a/src/drivers/boards/aerocore/module.mk b/src/drivers/boards/aerocore/module.mk index 0a2d91009..05e3d878d 100644 --- a/src/drivers/boards/aerocore/module.mk +++ b/src/drivers/boards/aerocore/module.mk @@ -7,4 +7,10 @@ SRCS = aerocore_init.c \ aerocore_spi.c \ aerocore_led.c +ENABLE_CXXINITIALIZE=$(call check_nuttx_config ,"CONFIG_HAVE_CXX 1", $(NUTTX_CONFIG_H)) +ENABLE_CXXINITIALIZE+=$(call check_nuttx_config ,"CONFIG_HAVE_CXXINITIALIZE 1", $(NUTTX_CONFIG_H)) +ifeq ("$(ENABLE_CXXINITIALIZE)",$(nuttx_config_2true)) +SRCS += ../../../modules/systemlib/up_cxxinitialize.c +endif + MAXOPTIMIZATION = -Os diff --git a/src/drivers/boards/px4fmu-v1/module.mk b/src/drivers/boards/px4fmu-v1/module.mk index 5e1a27d5a..ff717fe92 100644 --- a/src/drivers/boards/px4fmu-v1/module.mk +++ b/src/drivers/boards/px4fmu-v1/module.mk @@ -9,4 +9,10 @@ SRCS = px4fmu_can.c \ px4fmu_usb.c \ px4fmu_led.c +ENABLE_CXXINITIALIZE=$(call check_nuttx_config ,"CONFIG_HAVE_CXX 1", $(NUTTX_CONFIG_H)) +ENABLE_CXXINITIALIZE+=$(call check_nuttx_config ,"CONFIG_HAVE_CXXINITIALIZE 1", $(NUTTX_CONFIG_H)) +ifeq ("$(ENABLE_CXXINITIALIZE)",$(nuttx_config_2true)) +SRCS += ../../../modules/systemlib/up_cxxinitialize.c +endif + MAXOPTIMIZATION = -Os diff --git a/src/drivers/boards/px4fmu-v1/px4fmu_init.c b/src/drivers/boards/px4fmu-v1/px4fmu_init.c index 0e22aaee0..c9d4cce1e 100644 --- a/src/drivers/boards/px4fmu-v1/px4fmu_init.c +++ b/src/drivers/boards/px4fmu-v1/px4fmu_init.c @@ -145,6 +145,20 @@ __EXPORT int nsh_archinitialize(void) stm32_configgpio(GPIO_ADC1_IN11); /* IN12 and IN13 further below */ +#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 + /* configure the high-resolution time/callout interface */ hrt_init(); diff --git a/src/drivers/boards/px4fmu-v2/px4fmu2_init.c b/src/drivers/boards/px4fmu-v2/px4fmu2_init.c index 7fc1cd1df..e32c18759 100644 --- a/src/drivers/boards/px4fmu-v2/px4fmu2_init.c +++ b/src/drivers/boards/px4fmu-v2/px4fmu2_init.c @@ -245,6 +245,12 @@ __EXPORT int nsh_archinitialize(void) 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 /* configure the high-resolution time/callout interface */ diff --git a/src/drivers/boards/px4io-v1/module.mk b/src/drivers/boards/px4io-v1/module.mk index a7a14dd07..52f17f3f2 100644 --- a/src/drivers/boards/px4io-v1/module.mk +++ b/src/drivers/boards/px4io-v1/module.mk @@ -5,4 +5,10 @@ SRCS = px4io_init.c \ px4io_pwm_servo.c +ENABLE_CXXINITIALIZE=$(call check_nuttx_config ,"CONFIG_HAVE_CXX 1", $(NUTTX_CONFIG_H)) +ENABLE_CXXINITIALIZE+=$(call check_nuttx_config ,"CONFIG_HAVE_CXXINITIALIZE 1", $(NUTTX_CONFIG_H)) +ifeq ("$(ENABLE_CXXINITIALIZE)",$(nuttx_config_2true)) +SRCS += ../../../modules/systemlib/up_cxxinitialize.c +endif + MAXOPTIMIZATION = -Os diff --git a/src/drivers/boards/px4io-v2/module.mk b/src/drivers/boards/px4io-v2/module.mk index 3f0e9a0b3..5613ad405 100644 --- a/src/drivers/boards/px4io-v2/module.mk +++ b/src/drivers/boards/px4io-v2/module.mk @@ -5,4 +5,10 @@ SRCS = px4iov2_init.c \ px4iov2_pwm_servo.c +ENABLE_CXXINITIALIZE=$(call check_nuttx_config ,"CONFIG_HAVE_CXX 1", $(NUTTX_CONFIG_H)) +ENABLE_CXXINITIALIZE+=$(call check_nuttx_config ,"CONFIG_HAVE_CXXINITIALIZE 1", $(NUTTX_CONFIG_H)) +ifeq ("$(ENABLE_CXXINITIALIZE)",$(nuttx_config_2true)) +SRCS += ../../../modules/systemlib/up_cxxinitialize.c +endif + MAXOPTIMIZATION = -Os diff --git a/src/modules/px4iofirmware/px4io.c b/src/modules/px4iofirmware/px4io.c index c31342262..a2f8965bd 100644 --- a/src/modules/px4iofirmware/px4io.c +++ b/src/modules/px4iofirmware/px4io.c @@ -226,9 +226,20 @@ calculate_fw_crc(void) int user_start(int argc, char *argv[]) { +#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)); -- cgit v1.2.3