AP_DAL: added standalone link test

useful to check for clean linking of EKF2/EKF3

Co-authored-by: Peter Barker <pbarker@barker.dropbear.id.au>
This commit is contained in:
Andrew Tridgell 2020-11-06 10:39:55 +11:00
parent 42d62e138b
commit fa75824948
2 changed files with 91 additions and 0 deletions

View File

@ -0,0 +1,67 @@
//
// Ensure that AP_NavEKF3 can be compiled when not linked to anything
// except the DAL.
//
#include <AP_DAL/AP_DAL.h>
#include <AP_NavEKF3/AP_NavEKF3.h>
#include <AP_Logger/AP_Logger.h>
void AP_Param::setup_object_defaults(void const*, AP_Param::GroupInfo const*) {}
int AP_HAL::Util::vsnprintf(char*, unsigned long, char const*, va_list) { return -1; }
void *nologger = nullptr;
AP_Logger &AP::logger() {
return *((AP_Logger*)nologger); // this is not usually a good idea...
}
void AP_Logger::WriteBlock(void const*, unsigned short) {}
class AP_HAL_DAL_Standalone : public AP_HAL::HAL {
public:
AP_HAL_DAL_Standalone() :
AP_HAL::HAL(
nullptr,
nullptr,
nullptr,
nullptr,
nullptr,
nullptr,
nullptr,
nullptr,
nullptr,
nullptr,
nullptr,
nullptr,
nullptr,
nullptr,
nullptr,
nullptr,
nullptr,
nullptr,
nullptr,
nullptr,
nullptr,
nullptr
) {}
void run(int argc, char* const argv[], Callbacks* callbacks) const override {}
void setup() { }
void loop() { }
};
AP_HAL_DAL_Standalone _hal;
const AP_HAL::HAL &hal = _hal;
NavEKF2 navekf2;
NavEKF3 navekf3;
int main(int argc, const char *argv[])
{
navekf2.InitialiseFilter();
navekf3.InitialiseFilter();
navekf2.UpdateFilter();
navekf3.UpdateFilter();
return navekf2.healthy() && navekf3.healthy()?0:1;
}

View File

@ -0,0 +1,24 @@
#!/usr/bin/env python
# encoding: utf-8
def build(bld):
bld.ap_stlib(
name='AP_DAL' + '_libs',
ap_vehicle='AP_DAL_Standalone',
ap_libraries=[
'AP_NavEKF2',
'AP_NavEKF3',
'AP_NavEKF',
'AP_Common',
'AP_Math',
'AP_DAL',
'AP_InternalError',
'AP_Declination',
'AP_RTC',
],
)
bld.ap_program(
program_groups=['examples'],
use='AP_DAL_libs',
)