Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions libs/drivers/comm/comm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -301,7 +301,7 @@ bool CommObject::RemoveFrameInternal(AggregatedErrorCounter& resultAggregator)

bool CommObject::GetReceiverTelemetryInternal(ReceiverTelemetry& telemetry, AggregatedErrorCounter& resultAggregator)
{
memset(&telemetry, 0, sizeof(ReceiverTelemetry));
telemetry = {};

bool result = true;

Expand Down Expand Up @@ -372,7 +372,7 @@ bool CommObject::GetReceiverTelemetry(ReceiverTelemetry& telemetry)

bool CommObject::GetTransmitterTelemetryInternal(TransmitterTelemetry& telemetry, AggregatedErrorCounter& resultAggregator)
{
memset(&telemetry, 0, sizeof(TransmitterTelemetry));
telemetry = {};

bool result = true;

Expand Down
4 changes: 2 additions & 2 deletions libs/efm_support/Include/efm_support/clock.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ namespace efm
*
* @ingroup efm_support
*/
constexpr CMU_Clock_TypeDef Clock(const USART_TypeDef* hw)
inline CMU_Clock_TypeDef Clock(const USART_TypeDef* hw)
{
if (hw == USART0)
return cmuClock_USART0;
Expand All @@ -34,7 +34,7 @@ namespace efm
*
* @ingroup efm_support
*/
constexpr CMU_Clock_TypeDef Clock(const TIMER_TypeDef* hw)
inline CMU_Clock_TypeDef Clock(const TIMER_TypeDef* hw)
{
if (hw == TIMER0)
return cmuClock_TIMER0;
Expand Down
4 changes: 2 additions & 2 deletions libs/efm_support/Include/efm_support/dma.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ namespace efm
*/
template <DMASignalUSART Signal> constexpr DMADRV_PeripheralSignal_t DMASignal(const USART_TypeDef* peripheral) = delete;

template <> constexpr DMADRV_PeripheralSignal_t DMASignal<DMASignalUSART::RXDATAV>(const USART_TypeDef* peripheral)
template <> inline DMADRV_PeripheralSignal_t DMASignal<DMASignalUSART::RXDATAV>(const USART_TypeDef* peripheral)
{
if (peripheral == USART0)
return dmadrvPeripheralSignal_USART0_RXDATAV;
Expand All @@ -36,7 +36,7 @@ namespace efm
return static_cast<DMADRV_PeripheralSignal_t>(-1);
}

template <> constexpr DMADRV_PeripheralSignal_t DMASignal<DMASignalUSART::TXBL>(const USART_TypeDef* peripheral)
template <> inline DMADRV_PeripheralSignal_t DMASignal<DMASignalUSART::TXBL>(const USART_TypeDef* peripheral)
{
if (peripheral == USART0)
return dmadrvPeripheralSignal_USART0_TXBL;
Expand Down
2 changes: 1 addition & 1 deletion libs/experiments/camera/camera_exp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ namespace experiment
_controller.SetPhotoFilesBaseName(this->_fileName);
}

CameraCommissioningExperiment::CameraCommissioningExperiment(CameraCommissioningExperiment&& other)
CameraCommissioningExperiment::CameraCommissioningExperiment(CameraCommissioningExperiment&& other) noexcept
: _time(other._time), _fileSystem(other._fileSystem), _experimentFile(std::move(other._experimentFile)),
_photoService(other._photoService), _controller(_experimentFile, _photoService), _currentStep(other._currentStep)
{
Expand Down
4 changes: 2 additions & 2 deletions libs/experiments/fs/ExperimentFile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ ExperimentFile::~ExperimentFile()
}
}

ExperimentFile::ExperimentFile(ExperimentFile&& other)
ExperimentFile::ExperimentFile(ExperimentFile&& other) noexcept
: _buffer(other._buffer), _time(other._time), _writer(_buffer), _hasPayloadInFrame(other._hasPayloadInFrame),
onFlush(OnFlushDelegate::make_delegate<ExperimentFile, &ExperimentFile::DoNothing>(this))
{
Expand All @@ -29,7 +29,7 @@ ExperimentFile::ExperimentFile(ExperimentFile&& other)
_writer.Reserve(other._writer.GetDataLength());
}

ExperimentFile& ExperimentFile::operator=(ExperimentFile&& other)
ExperimentFile& ExperimentFile::operator=(ExperimentFile&& other) noexcept
{
ExperimentFile tmp(std::move(other));

Expand Down
2 changes: 1 addition & 1 deletion libs/experiments/payload/payload_exp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ namespace experiment
_cameraCommisioningController.SetPhotoFilesBaseName(this->_fileName);
}

PayloadCommissioningExperiment::PayloadCommissioningExperiment(PayloadCommissioningExperiment&& other)
PayloadCommissioningExperiment::PayloadCommissioningExperiment(PayloadCommissioningExperiment&& other) noexcept
: _payload(other._payload), _time(other._time), _fileSystem(other._fileSystem), _powerControl(other._powerControl),
_experimentalSunS(other._experimentalSunS), _photoService(other._photoService),
_experimentFile(std::move(other._experimentFile)), _telemetryProvider(other._telemetryProvider),
Expand Down
2 changes: 1 addition & 1 deletion libs/experiments/suns/suns.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ namespace experiment
strsafecpy(this->_primaryFileName, baseName);

strsafecpy(this->_secondaryFileName, this->_primaryFileName, sizeof(this->_primaryFileName));
std::strncat(this->_secondaryFileName, "_sec", 4);
std::strncat(this->_secondaryFileName, "_sec", 5);
}

ExperimentCode SunSExperiment::Type()
Expand Down
13 changes: 10 additions & 3 deletions libs/scrubber/Include/scrubber/ram.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,9 @@ namespace scrubber

private:
/** @brief Pointer to first byte of memory */
static constexpr auto MemoryStart = reinterpret_cast<std::uint32_t*>(Start);
static std::uint32_t* const MemoryStart;
/** @brief Pointer to first byte after memory */
static constexpr auto MemoryEnd = reinterpret_cast<std::uint32_t*>(Start + Size);
static std::uint32_t* const MemoryEnd;
/** @brief Pointer increment in single cycle */
static constexpr auto PointerIncrement = CycleSize / 4;
/** @brief Pointer to next byte to be scrubbed */
Expand All @@ -64,7 +64,14 @@ namespace scrubber
template <std::size_t Start, std::size_t Size, std::size_t CycleSize>
std::uint32_t* RAMScrubber<Start, Size, CycleSize>::_current(MemoryStart);

template <std::size_t Start, std::size_t Size, std::size_t CycleSize> inline void RAMScrubber<Start, Size, CycleSize>::Scrub()
template <std::size_t Start, std::size_t Size, std::size_t CycleSize>
std::uint32_t* const RAMScrubber<Start, Size, CycleSize>::MemoryStart = reinterpret_cast<std::uint32_t*>(Start);

template <std::size_t Start, std::size_t Size, std::size_t CycleSize>
std::uint32_t* const RAMScrubber<Start, Size, CycleSize>::MemoryEnd = reinterpret_cast<std::uint32_t*>(Start + Size);

template <std::size_t Start, std::size_t Size, std::size_t CycleSize>
inline void RAMScrubber<Start, Size, CycleSize>::Scrub()
{
INT_Disable();

Expand Down
2 changes: 1 addition & 1 deletion libs/state/Include/state/LockablePersistentState.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ namespace state
return false;
}

object = state.Get<Object>();
object = state.template Get<Object>();

return true;
}
Expand Down
9 changes: 5 additions & 4 deletions platforms/mcu/EngModel/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
set(SOURCES

variables.cpp
)

add_library(platform INTERFACE ${SOURCES})
add_library(platform STATIC ${SOURCES})

target_link_libraries(platform INTERFACE base)
target_link_libraries(platform PUBLIC base)
target_link_libraries(platform PRIVATE emlib)

target_include_directories (platform INTERFACE ${CMAKE_CURRENT_LIST_DIR}/Include)
target_include_directories (platform PUBLIC ${CMAKE_CURRENT_LIST_DIR}/Include)
20 changes: 10 additions & 10 deletions platforms/mcu/EngModel/Include/mcu/io_map.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ namespace io_map
struct SPI : public SPIPins<SPI>
{
static constexpr std::uint32_t Baudrate = 20_MHz;
static constexpr USART_TypeDef* Peripheral = USART0;
static USART_TypeDef* const Peripheral;
static constexpr std::uint8_t Location = 1;
using MOSI = PinLocation<gpioPortE, 7>;
using MISO = PinLocation<gpioPortE, 6>;
Expand All @@ -48,7 +48,7 @@ namespace io_map
struct UART_0 : public UARTPins<UART_0>
{
static constexpr std::uint8_t Id = 0;
static constexpr USART_TypeDef* Peripheral = UART0;
static USART_TypeDef* const Peripheral;

static constexpr CMU_Clock_TypeDef Clock = cmuClock_UART0;
static constexpr std::uint32_t Baudrate = 57600;
Expand All @@ -61,12 +61,12 @@ namespace io_map
static constexpr std::uint32_t Location = UART_ROUTE_LOCATION_LOC0;
using TX = PinLocation<gpioPortF, 6>;
using RX = PinLocation<gpioPortF, 7>;
};
};

struct UART_1 : public UARTPins<UART_1>
{
static constexpr std::uint8_t Id = 1;
static constexpr USART_TypeDef* Peripheral = UART1;
static USART_TypeDef* const Peripheral;

static constexpr CMU_Clock_TypeDef Clock = cmuClock_UART1;
static constexpr std::uint32_t Baudrate = 115200;
Expand Down Expand Up @@ -118,13 +118,13 @@ namespace io_map

struct ProgramFlash
{
static constexpr std::uint8_t* FlashBase = reinterpret_cast<std::uint8_t*>(0x84000000);
static constexpr std::uint8_t* ApplicatonBase = reinterpret_cast<std::uint8_t*>(0x00080000);
static std::uint8_t* const FlashBase;
static std::uint8_t* const ApplicatonBase;
};

struct RAMScrubbing
{
static constexpr auto TimerHW = TIMER0;
static TIMER_TypeDef* const TimerHW;
static constexpr auto Prescaler = timerPrescale1024;
static constexpr auto TimerTop = 468;
static constexpr auto IRQ = IRQn_Type::TIMER0_IRQn;
Expand Down Expand Up @@ -180,7 +180,7 @@ namespace io_map

struct Latchup
{
static constexpr auto HW = ACMP0;
static ACMP_TypeDef* const HW;
using SRAM1 = PinLocation<gpioPortC, 2>;
using SRAM2 = PinLocation<gpioPortC, 8>;

Expand All @@ -203,7 +203,7 @@ namespace io_map
using Control = PinLocation<gpioPortE, 2>;
using Buffer = PinLocation<gpioPortC, 14>;
using Power = PinLocation<gpioPortC, 0>;
static constexpr decltype(auto) Comparator = ACMP0;
static ACMP_TypeDef* const Comparator;

struct Group
{
Expand All @@ -216,7 +216,7 @@ namespace io_map
using Control = PinLocation<gpioPortE, 3>;
using Buffer = PinLocation<gpioPortC, 15>;
using Power = PinLocation<gpioPortC, 1>;
static constexpr decltype(auto) Comparator = ACMP1;
static ACMP_TypeDef* const Comparator;

struct Group
{
Expand Down
6 changes: 5 additions & 1 deletion platforms/mcu/EngModel/settings.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,12 @@ if(ENABLE_LTO)
set(LTO_SWITCH "-flto")
endif()

set (EIGEN_WARN_FIX "-Wno-int-in-bool-context")
set (RAPID_CHECK_WARN_FIX "-Wno-shift-negative-value")

set (CWARN "-Wall -Wstrict-prototypes -Wextra -Werror")
set (CXXWARN "-Wall -Wextra -Werror")
set (CXXWARN "-Wall -Wextra -Werror ${EIGEN_WARN_FIX} ${RAPID_CHECK_WARN_FIX}")

set (CTUNING "-ggdb -pedantic -fomit-frame-pointer -ffunction-sections -fdata-sections")
set (CMCU "-mtune=cortex-m3 -MMD -MP -mcpu=cortex-m3 -mthumb -march=armv7-m -mlittle-endian -mfix-cortex-m3-ldrd -mno-thumb-interwork")
set (CMAKE_C_FLAGS "-std=gnu11 ${CWARN} ${CTUNING} ${CMCU} ${CCOVERAGE}")
Expand Down
14 changes: 14 additions & 0 deletions platforms/mcu/EngModel/variables.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#include "mcu/io_map.h"

namespace io_map
{
USART_TypeDef* const SPI::Peripheral = USART0;
USART_TypeDef* const UART_0::Peripheral = UART0;
USART_TypeDef* const UART_1::Peripheral = UART1;
std::uint8_t* const ProgramFlash::FlashBase = reinterpret_cast<std::uint8_t*>(0x84000000);
std::uint8_t* const ProgramFlash::ApplicatonBase = reinterpret_cast<std::uint8_t*>(0x00080000);
TIMER_TypeDef* const RAMScrubbing::TimerHW = TIMER0;
ACMP_TypeDef* const BSP::Latchup::HW = ACMP0;
ACMP_TypeDef* const MemoryModule<1>::Comparator = ACMP0;
ACMP_TypeDef* const MemoryModule<2>::Comparator = ACMP1;
}
9 changes: 5 additions & 4 deletions platforms/mcu/FlightModel/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
set(SOURCES

variables.cpp
)

add_library(platform INTERFACE ${SOURCES})
add_library(platform STATIC ${SOURCES})

target_link_libraries(platform INTERFACE base)
target_link_libraries(platform PUBLIC base)
target_link_libraries(platform PRIVATE emlib)

target_include_directories (platform INTERFACE ${CMAKE_CURRENT_LIST_DIR}/Include)
target_include_directories (platform PUBLIC ${CMAKE_CURRENT_LIST_DIR}/Include)
18 changes: 9 additions & 9 deletions platforms/mcu/FlightModel/Include/mcu/io_map.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ namespace io_map
struct SPI : public SPIPins<SPI>
{
static constexpr std::uint32_t Baudrate = 20_MHz;
static constexpr USART_TypeDef* Peripheral = USART0;
static USART_TypeDef* const Peripheral;
static constexpr std::uint8_t Location = 1;
using MOSI = PinLocation<gpioPortE, 7>;
using MISO = PinLocation<gpioPortE, 6>;
Expand All @@ -48,7 +48,7 @@ namespace io_map
struct UART_0 : public UARTPins<UART_0>
{
static constexpr std::uint8_t Id = 0;
static constexpr USART_TypeDef* Peripheral = UART0;
static USART_TypeDef* const Peripheral;

static constexpr CMU_Clock_TypeDef Clock = cmuClock_UART0;
static constexpr std::uint32_t Baudrate = 57600;
Expand All @@ -66,7 +66,7 @@ namespace io_map
struct UART_1 : public UARTPins<UART_1>
{
static constexpr std::uint8_t Id = 1;
static constexpr USART_TypeDef* Peripheral = UART1;
static USART_TypeDef* const Peripheral;

static constexpr CMU_Clock_TypeDef Clock = cmuClock_UART1;
static constexpr std::uint32_t Baudrate = 115200;
Expand Down Expand Up @@ -118,13 +118,13 @@ namespace io_map

struct ProgramFlash
{
static constexpr std::uint8_t* FlashBase = reinterpret_cast<std::uint8_t*>(0x84000000);
static constexpr std::uint8_t* ApplicatonBase = reinterpret_cast<std::uint8_t*>(0x00080000);
static std::uint8_t* const FlashBase;
static std::uint8_t* const ApplicatonBase;
};

struct RAMScrubbing
{
static constexpr auto TimerHW = TIMER0;
static TIMER_TypeDef* const TimerHW;
static constexpr auto Prescaler = timerPrescale1024;
static constexpr auto TimerTop = 468;
static constexpr auto IRQ = IRQn_Type::TIMER0_IRQn;
Expand Down Expand Up @@ -180,7 +180,7 @@ namespace io_map

struct Latchup
{
static constexpr auto HW = ACMP0;
static ACMP_TypeDef* const HW;
using SRAM1 = PinLocation<gpioPortC, 2>;
using SRAM2 = PinLocation<gpioPortC, 8>;

Expand All @@ -203,7 +203,7 @@ namespace io_map
using Control = PinLocation<gpioPortE, 2>;
using Buffer = PinLocation<gpioPortC, 14>;
using Power = PinLocation<gpioPortC, 0>;
static constexpr decltype(auto) Comparator = ACMP0;
static ACMP_TypeDef* const Comparator;

struct Group
{
Expand All @@ -216,7 +216,7 @@ namespace io_map
using Control = PinLocation<gpioPortE, 3>;
using Buffer = PinLocation<gpioPortC, 15>;
using Power = PinLocation<gpioPortC, 1>;
static constexpr decltype(auto) Comparator = ACMP1;
static ACMP_TypeDef* const Comparator;

struct Group
{
Expand Down
6 changes: 5 additions & 1 deletion platforms/mcu/FlightModel/settings.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,12 @@ if(ENABLE_LTO)
set(LTO_SWITCH "-flto")
endif()

set (EIGEN_WARN_FIX "-Wno-int-in-bool-context")
set (RAPID_CHECK_WARN_FIX "-Wno-shift-negative-value")

set (CWARN "-Wall -Wstrict-prototypes -Wextra -Werror")
set (CXXWARN "-Wall -Wextra -Werror")
set (CXXWARN "-Wall -Wextra -Werror ${EIGEN_WARN_FIX} ${RAPID_CHECK_WARN_FIX} -Wno-unused-function")

set (CTUNING "-ggdb -pedantic -fomit-frame-pointer -ffunction-sections -fdata-sections")
set (CMCU "-mtune=cortex-m3 -MMD -MP -mcpu=cortex-m3 -mthumb -march=armv7-m -mlittle-endian -mfix-cortex-m3-ldrd -mno-thumb-interwork")
set (CMAKE_C_FLAGS "-std=gnu11 ${CWARN} ${CTUNING} ${CMCU} ${CCOVERAGE}")
Expand Down
14 changes: 14 additions & 0 deletions platforms/mcu/FlightModel/variables.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#include "mcu/io_map.h"

namespace io_map
{
USART_TypeDef* const SPI::Peripheral = USART0;
USART_TypeDef* const UART_0::Peripheral = UART0;
USART_TypeDef* const UART_1::Peripheral = UART1;
std::uint8_t* const ProgramFlash::FlashBase = reinterpret_cast<std::uint8_t*>(0x84000000);
std::uint8_t* const ProgramFlash::ApplicatonBase = reinterpret_cast<std::uint8_t*>(0x00080000);
TIMER_TypeDef* const RAMScrubbing::TimerHW = TIMER0;
ACMP_TypeDef* const BSP::Latchup::HW = ACMP0;
ACMP_TypeDef* const MemoryModule<1>::Comparator = ACMP0;
ACMP_TypeDef* const MemoryModule<2>::Comparator = ACMP1;
}
2 changes: 1 addition & 1 deletion src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -310,7 +310,7 @@ extern "C" void __libc_init_array(void);

int main(void)
{
memset(&Main, 0, sizeof(Main));
memset(reinterpret_cast<void*>(&Main), 0, sizeof(Main));

__libc_init_array();

Expand Down
4 changes: 1 addition & 3 deletions test/generate_exp_data/suns_data.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,7 @@ using experiments::fs::ExperimentFile;

void GenerateSunSData(IFileSystem& fs)
{
experiment::suns::DataPoint data;

memset(&data, 0, sizeof(data));
experiment::suns::DataPoint data = {};

data.Timestamp = 1234ms;

Expand Down
Loading