Skip to content

Commit

Permalink
AP_Common: allow build for bootloader
Browse files Browse the repository at this point in the history
  • Loading branch information
tridge committed May 27, 2024
1 parent 0d1dd8b commit 061ea49
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 1 deletion.
4 changes: 4 additions & 0 deletions libraries/AP_Common/AP_ExpandingArray.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
#include "AP_ExpandingArray.h"
#include <AP_HAL/AP_HAL.h>

#ifndef HAL_BOOTLOADER_BUILD

extern const AP_HAL::HAL& hal;

AP_ExpandingArrayGeneric::~AP_ExpandingArrayGeneric(void)
Expand Down Expand Up @@ -75,3 +77,5 @@ bool AP_ExpandingArrayGeneric::expand_to_hold(uint16_t num_items)
uint16_t chunks_required = ((num_items - max_items()) / chunk_size) + 1;
return expand(chunks_required);
}

#endif // HAL_BOOTLOADER_BUILD
5 changes: 4 additions & 1 deletion libraries/AP_Common/ExpandingString.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,10 @@
*/

#include "ExpandingString.h"

#include <AP_HAL/AP_HAL.h>

#ifndef HAL_BOOTLOADER_BUILD

extern const AP_HAL::HAL& hal;

#define EXPAND_INCREMENT 512
Expand Down Expand Up @@ -127,3 +128,5 @@ void ExpandingString::set_buffer(char *s, uint32_t total_len, uint32_t used_len)
allocation_failed = false;
external_buffer = true;
}

#endif // HAL_BOOTLOADER_BUILD
4 changes: 4 additions & 0 deletions libraries/AP_Common/Location.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@

#include "Location.h"

#ifndef HAL_BOOTLOADER_BUILD

#include <AP_AHRS/AP_AHRS.h>
#include <AP_Terrain/AP_Terrain.h>

Expand Down Expand Up @@ -527,3 +529,5 @@ void Location::linearly_interpolate_alt(const Location &point1, const Location &
// new target's distance along the original track and then linear interpolate between the original origin and destination altitudes
set_alt_cm(point1.alt + (point2.alt - point1.alt) * constrain_float(line_path_proportion(point1, point2), 0.0f, 1.0f), point2.get_alt_frame());
}

#endif // HAL_BOOTLOADER_BUILD
5 changes: 5 additions & 0 deletions libraries/AP_Common/MultiHeap.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@

#include "MultiHeap.h"

#ifndef HAL_BOOTLOADER_BUILD

/*
on ChibiOS allow up to 4 heaps. On other HALs only allow a single
heap. This is needed as hal.util->heap_realloc() needs to have the
Expand Down Expand Up @@ -141,3 +143,6 @@ void *MultiHeap::change_size(void *ptr, uint32_t old_size, uint32_t new_size)
*/
return hal.util->heap_realloc(heaps[0], ptr, old_size, new_size);
}

#endif // HAL_BOOTLOADER_BUILD

0 comments on commit 061ea49

Please sign in to comment.