Fixed led and reboot linker challenges in C++ environments

This commit is contained in:
Lorenz Meier 2013-07-28 14:50:27 +02:00
parent 18635c5f5f
commit 4e5eb9740b
8 changed files with 21 additions and 12 deletions

View File

@ -12,6 +12,7 @@ ROMFS_ROOT = $(PX4_BASE)/ROMFS/px4fmu_test
#
MODULES += drivers/device
MODULES += drivers/stm32
MODULES += drivers/led
MODULES += drivers/boards/px4fmuv2
MODULES += systemcmds/perf
MODULES += systemcmds/reboot

View File

@ -92,7 +92,10 @@
#include <nuttx/config.h>
__BEGIN_DECLS
#include <arch/board/board.h>
__END_DECLS
#include <systemlib/systemlib.h>
#include <drivers/device/i2c.h>
#include <sys/types.h>
@ -112,7 +115,6 @@
#include <systemlib/perf_counter.h>
#include <systemlib/err.h>
#include <systemlib/systemlib.h>
#include <poll.h>
#include <uORB/uORB.h>
#include <uORB/topics/vehicle_status.h>
@ -486,15 +488,15 @@ BlinkM::led()
/* get number of used satellites in navigation */
num_of_used_sats = 0;
//for(int satloop=0; satloop<20; satloop++) {
for(int satloop=0; satloop<sizeof(vehicle_gps_position_raw.satellite_used); satloop++) {
for(unsigned satloop=0; satloop<sizeof(vehicle_gps_position_raw.satellite_used); satloop++) {
if(vehicle_gps_position_raw.satellite_used[satloop] == 1) {
num_of_used_sats++;
}
}
if(new_data_vehicle_status || no_data_vehicle_status < 3){
if(num_of_cells == 0) {
if (new_data_vehicle_status || no_data_vehicle_status < 3) {
if (num_of_cells == 0) {
/* looking for lipo cells that are connected */
printf("<blinkm> checking cells\n");
for(num_of_cells = 2; num_of_cells < 7; num_of_cells++) {
@ -831,6 +833,8 @@ BlinkM::get_firmware_version(uint8_t version[2])
return transfer(&msg, sizeof(msg), version, 2);
}
void blinkm_usage();
void blinkm_usage() {
fprintf(stderr, "missing command: try 'start', 'systemstate', 'ledoff', 'list' or a script name {options}\n");
fprintf(stderr, "options:\n");

View File

@ -60,6 +60,6 @@ __BEGIN_DECLS
/*
* Initialise the LED driver.
*/
__EXPORT extern void drv_led_start(void);
__EXPORT void drv_led_start(void);
__END_DECLS

View File

@ -117,4 +117,4 @@ drv_led_start(void)
if (gLED != nullptr)
gLED->init();
}
}
}

View File

@ -141,7 +141,7 @@ int do_state_update(int status_pub, struct vehicle_status_s *current_status, con
current_status->flag_system_armed = false;
mavlink_log_critical(mavlink_fd, "REBOOTING SYSTEM");
usleep(500000);
up_systemreset();
systemreset();
/* SPECIAL CASE: NEVER RETURNS FROM THIS FUNCTION CALL */
} else {

View File

@ -50,6 +50,10 @@
#include "systemlib.h"
__EXPORT extern void systemreset(void) {
up_systemreset();
}
static void kill_task(FAR struct tcb_s *tcb, FAR void *arg);
void killall()

View File

@ -42,11 +42,11 @@
#include <float.h>
#include <stdint.h>
/** Reboots the board */
extern void up_systemreset(void) noreturn_function;
__BEGIN_DECLS
/** Reboots the board */
__EXPORT void systemreset(void) noreturn_function;
/** Sends SIGUSR1 to all processes */
__EXPORT void killall(void);

View File

@ -47,7 +47,7 @@ __EXPORT int reboot_main(int argc, char *argv[]);
int reboot_main(int argc, char *argv[])
{
up_systemreset();
systemreset();
}