Removed Git merge annotation

This commit is contained in:
John Wellbelove 2017-10-02 20:16:59 +01:00
parent 89b3704238
commit 97fbb678da
30 changed files with 952 additions and 12892 deletions

80
src/compare.h Normal file
View File

@ -0,0 +1,80 @@
///\file
/******************************************************************************
The MIT License(MIT)
Embedded Template Library.
https://github.com/ETLCPP/etl
https://www.etlcpp.com
Copyright(c) 2017 jwellbelove
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files(the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and / or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions :
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
******************************************************************************/
#ifndef __ETL_COMPARE__
#define __ETL_COMPARE__
#include <functional>
#include "platform.h"
#include "parameter_type.h"
//*****************************************************************************
///\defgroup compare compare
/// Comparisons only using less than operator
///\ingroup utilities
//*****************************************************************************
namespace etl
{
//***************************************************************************
/// Defines <=, >, >= interms of <
/// Default
//***************************************************************************
template <typename T, typename TLess = std::less<T> >
struct compare
{
typedef typename etl::parameter_type<T>::type first_argument_type;
typedef typename etl::parameter_type<T>::type second_argument_type;
typedef bool result_type;
static result_type lt(first_argument_type lhs, second_argument_type rhs)
{
return TLess()(lhs, rhs);
}
static result_type gt(first_argument_type lhs, second_argument_type rhs)
{
return TLess()(rhs, lhs);
}
static result_type lte(first_argument_type lhs, second_argument_type rhs)
{
return !gt(lhs, rhs);
}
static result_type gte(first_argument_type lhs, second_argument_type rhs)
{
return !lt(lhs, rhs);
}
};
}
#endif

View File

@ -54,12 +54,256 @@ namespace etl
///\tparam LAST The last value of the range.
///\ingroup cyclic_value
//***************************************************************************
template <typename T, const T FIRST = T(), const T LAST = T()>
template <typename T, T FIRST = 0, T LAST = 0, typename = void>
class cyclic_value
{
public:
template <typename U, const U OTHER_FIRST, const U OTHER_LAST> friend class cyclic_value;
//*************************************************************************
/// Constructor.
/// The initial value is set to the first value.
//*************************************************************************
cyclic_value()
: value(FIRST)
{
}
//*************************************************************************
/// Copy constructor.
//*************************************************************************
cyclic_value(const cyclic_value<T, FIRST, LAST>& other)
: value(other.value)
{
}
//*************************************************************************
/// Sets the value.
///\param value The value.
//*************************************************************************
void set(T value_)
{
if (value_ > LAST)
{
value_ = LAST;
}
else if (value_ < FIRST)
{
value_ = FIRST;
}
value = value_;
}
//*************************************************************************
/// Resets the value to the first in the range.
//*************************************************************************
void to_first()
{
value = FIRST;
}
//*************************************************************************
/// Resets the value to the last in the range.
//*************************************************************************
void to_last()
{
value = LAST;
}
//*************************************************************************
/// Advances to value by a number of steps.
///\param n The number of steps to advance.
//*************************************************************************
void advance(int n)
{
T range = LAST - FIRST + T(1);
n = n % range;
if (n > 0)
{
for (int i = 0; i < n; ++i)
{
operator ++();
}
}
else
{
for (int i = 0; i < -n; ++i)
{
operator --();
}
}
}
//*************************************************************************
/// Conversion operator.
/// \return The value of the underlying type.
//*************************************************************************
operator T()
{
return value;
}
//*************************************************************************
/// Const conversion operator.
/// \return The value of the underlying type.
//*************************************************************************
operator const T() const
{
return value;
}
//*************************************************************************
/// ++ operator.
//*************************************************************************
cyclic_value& operator ++()
{
if (value >= LAST)
{
value = FIRST;
}
else
{
++value;
}
return *this;
}
//*************************************************************************
/// ++ operator.
//*************************************************************************
cyclic_value operator ++(int)
{
cyclic_value temp(*this);
operator++();
return temp;
}
//*************************************************************************
/// -- operator.
//*************************************************************************
cyclic_value& operator --()
{
if (value <= FIRST)
{
value = LAST;
}
else
{
--value;
}
return *this;
}
//*************************************************************************
/// -- operator.
//*************************************************************************
cyclic_value operator --(int)
{
cyclic_value temp(*this);
operator--();
return temp;
}
//*************************************************************************
/// = operator.
//*************************************************************************
cyclic_value& operator =(T t)
{
set(t);
return *this;
}
//*************************************************************************
/// = operator.
//*************************************************************************
template <const T FIRST2, const T LAST2>
cyclic_value& operator =(const cyclic_value<T, FIRST2, LAST2>& other)
{
set(other.get());
return *this;
}
//*************************************************************************
/// Gets the value.
//*************************************************************************
T get() const
{
return value;
}
//*************************************************************************
/// Gets the first value.
//*************************************************************************
const T first() const
{
return FIRST;
}
//*************************************************************************
/// Gets the last value.
//*************************************************************************
const T last() const
{
return LAST;
}
//*************************************************************************
/// Swaps the values.
//*************************************************************************
void swap(cyclic_value<T, FIRST, LAST>& other)
{
std::swap(value, other.value);
}
//*************************************************************************
/// Swaps the values.
//*************************************************************************
friend void swap(cyclic_value<T, FIRST, LAST>& lhs, cyclic_value<T, FIRST, LAST>& rhs)
{
lhs.swap(rhs);
}
//*************************************************************************
/// Operator ==.
//*************************************************************************
friend bool operator == (const cyclic_value<T, FIRST, LAST>& lhs, const cyclic_value<T, FIRST, LAST>& rhs)
{
return lhs.value == rhs.value;
}
//*************************************************************************
/// Operator !=.
//*************************************************************************
friend bool operator != (const cyclic_value<T, FIRST, LAST>& lhs, const cyclic_value<T, FIRST, LAST>& rhs)
{
return !(lhs == rhs);
}
private:
T value; ///< The current value.
};
//***************************************************************************
/// Provides a value that cycles between two limits.
/// Supports incrementing and decrementing.
///\tparam T The type of the variable.
///\tparam FIRST The first value of the range.
///\tparam LAST The last value of the range.
///\ingroup cyclic_value
//***************************************************************************
template <typename T, const T FIRST, const T LAST>
class cyclic_value<T, FIRST, LAST, typename etl::enable_if<(FIRST == 0) && (LAST == 0)>::type>
{
public:
//*************************************************************************
/// Constructor.
@ -79,26 +323,54 @@ namespace etl
///\param first The first value in the range.
///\param last The last value in the range.
//*************************************************************************
cyclic_value(const T& first_, const T& last_)
cyclic_value(T first_, T last_)
: value(first_),
first_value(first_),
last_value(last_)
{
}
//*************************************************************************
/// Copy constructor.
//*************************************************************************
cyclic_value(const cyclic_value& other)
: value(other.value),
first_value(other.first_value),
last_value(other.last_value)
{
}
//*************************************************************************
/// Sets the range.
/// Sets the value to the first of the range.
///\param first The first value in the range.
///\param last The last value in the range.
//*************************************************************************
void set(const T& first_, const T& last_)
void set(T first_, T last_)
{
first_value = first_;
last_value = last_;
value = first_;
}
//*************************************************************************
/// Sets the value.
///\param value The value.
//*************************************************************************
void set(T value_)
{
if (value_ > last_value)
{
value_ = last_value;
}
else if (value_ < first_value)
{
value_ = first_value;
}
value = value_;
}
//*************************************************************************
/// Resets the value to the first in the range.
//*************************************************************************
@ -222,15 +494,14 @@ namespace etl
//*************************************************************************
cyclic_value& operator =(T t)
{
value = t;
set(t);
return *this;
}
}
//*************************************************************************
/// = operator.
//*************************************************************************
template <const T OTHER_FIRST, const T OTHER_LAST>
cyclic_value& operator =(const cyclic_value<T, OTHER_FIRST, OTHER_LAST>& other)
cyclic_value& operator =(const cyclic_value& other)
{
value = other.value;
first_value = other.first_value;
@ -238,10 +509,18 @@ namespace etl
return *this;
}
//*************************************************************************
/// Gets the value.
//*************************************************************************
T get() const
{
return value;
}
//*************************************************************************
/// Gets the first value.
//*************************************************************************
const T& first() const
T first() const
{
return first_value;
}
@ -249,7 +528,7 @@ namespace etl
//*************************************************************************
/// Gets the last value.
//*************************************************************************
const T& last() const
T last() const
{
return last_value;
}
@ -257,12 +536,37 @@ namespace etl
//*************************************************************************
/// Swaps the values.
//*************************************************************************
template <const T OTHER_FIRST, const T OTHER_LAST>
void swap(cyclic_value<T, OTHER_FIRST, OTHER_LAST>& other)
void swap(cyclic_value<T, FIRST, LAST>& other)
{
std::swap(first_value, other.first_value);
std::swap(last_value, other.last_value);
std::swap(value, other.value);
std::swap(last_value, other.last_value);
std::swap(value, other.value);
}
//*************************************************************************
/// Swaps the values.
//*************************************************************************
friend void swap(cyclic_value<T, FIRST, LAST>& lhs, cyclic_value<T, FIRST, LAST>& rhs)
{
lhs.swap(rhs);
}
//*************************************************************************
/// Operator ==.
//*************************************************************************
friend bool operator == (const cyclic_value<T, FIRST, LAST>& lhs, const cyclic_value<T, FIRST, LAST>& rhs)
{
return (lhs.value == rhs.value) &&
(lhs.first_value == rhs.first_value) &&
(lhs.last_value == rhs.last_value);
}
//*************************************************************************
/// Operator !=.
//*************************************************************************
friend bool operator != (const cyclic_value<T, FIRST, LAST>& lhs, const cyclic_value<T, FIRST, LAST>& rhs)
{
return !(lhs == rhs);
}
private:
@ -271,36 +575,6 @@ namespace etl
T first_value; ///< The first value in the range.
T last_value; ///< The last value in the range.
};
//*************************************************************************
/// Swaps the values.
//*************************************************************************
template <typename T, const T LHS_FIRST, const T LHS_LAST, const T RHS_FIRST, const T RHS_LAST>
void swap(cyclic_value<T, LHS_FIRST, LHS_LAST>& lhs,
cyclic_value<T, RHS_FIRST, RHS_LAST>& rhs)
{
lhs.swap(rhs);
}
//*************************************************************************
/// Equality operator.
//*************************************************************************
template <typename T, const T LHS_FIRST, const T LHS_LAST, const T RHS_FIRST, const T RHS_LAST>
bool operator == (const cyclic_value<T, LHS_FIRST, LHS_LAST>& lhs,
const cyclic_value<T, RHS_FIRST, RHS_LAST>& rhs)
{
return static_cast<T>(lhs) == static_cast<T>(rhs);
}
//*************************************************************************
/// Inequality operator.
//*************************************************************************
template <typename T, const T LHS_FIRST, const T LHS_LAST, const T RHS_FIRST, const T RHS_LAST>
bool operator != (const cyclic_value<T, LHS_FIRST, RHS_LAST>& lhs,
const cyclic_value<T, RHS_FIRST, RHS_LAST>& rhs)
{
return !(lhs == rhs);
}
}
#endif

View File

@ -47,6 +47,10 @@ SOFTWARE.
#include "type_traits.h"
#include "parameter_type.h"
#ifdef ETL_COMPILER_MICROSOFT
#undef min
#endif
#undef ETL_FILE
#define ETL_FILE "1"
@ -2144,4 +2148,8 @@ bool operator >=(const etl::ideque<T>& lhs, const etl::ideque<T>& rhs)
#undef ETL_FILE
#ifdef ETL_COMPILER_MICROSOFT
#define min(a,b) (((a) < (b)) ? (a) : (b))
#endif
#endif

View File

@ -79,7 +79,6 @@ namespace etl
//***************************************************************************
template <const size_t MAX_SIZE_,
typename TBase,
typename T1,
typename T2 = etl::type_id_pair<>,
typename T3 = etl::type_id_pair<>,
@ -124,8 +123,6 @@ namespace etl
static const size_t MAX_SIZE = MAX_SIZE_;
typedef TBase base_t;
//*************************************************************************
/// Constructor
//*************************************************************************
@ -278,17 +275,36 @@ namespace etl
{
typedef typename lookup_t::template type_from_id<ID>::type type;
STATIC_ASSERT((!etl::is_same<void, type>::value), "Invalid index");
return reinterpret_cast<TBase*>(create_from_type<type>(p1, p2, p3, p4));
return create_from_type<type>(p1, p2, p3, p4);
}
//*************************************************************************
/// Destroys the object.
//*************************************************************************
bool destroy(const TBase* const p)
template <typename T>
bool destroy(const T* const p)
{
p->~TBase();
STATIC_ASSERT((etl::is_one_of<T, TT1, TT2, TT3, TT4, TT5, TT6, TT7, TT8, TT9, TT10, TT11, TT12, TT13, TT14, TT15, TT16>::value ||
etl::is_base_of<T, TT1>::value ||
etl::is_base_of<T, TT2>::value ||
etl::is_base_of<T, TT3>::value ||
etl::is_base_of<T, TT4>::value ||
etl::is_base_of<T, TT5>::value ||
etl::is_base_of<T, TT6>::value ||
etl::is_base_of<T, TT7>::value ||
etl::is_base_of<T, TT8>::value ||
etl::is_base_of<T, TT9>::value ||
etl::is_base_of<T, TT10>::value ||
etl::is_base_of<T, TT11>::value ||
etl::is_base_of<T, TT12>::value ||
etl::is_base_of<T, TT13>::value ||
etl::is_base_of<T, TT14>::value ||
etl::is_base_of<T, TT15>::value ||
etl::is_base_of<T, TT16>::value), "Invalid type");
p->~T();
return release_item(reinterpret_cast<char*>(const_cast<TBase*>(p)));
return release_item(reinterpret_cast<char*>(const_cast<T*>(p)));
}
//*************************************************************************

View File

@ -416,7 +416,9 @@ namespace etl
/// is_base_of
///\ingroup type_traits
template<class TBase, class TDerived>
template<typename TBase,
typename TDerived,
const bool IsFundamental = (etl::is_fundamental<TBase>::value || etl::is_fundamental<TDerived>::value)>
struct is_base_of
{
private:
@ -432,6 +434,13 @@ namespace etl
static const bool value = (sizeof(check((internal*)0)) == sizeof(TBase*));
};
// For when TBase or TDerived is a fundamental type.
template<typename TBase, typename TDerived>
struct is_base_of<TBase, TDerived, true>
{
static const bool value = false;
};
/// Alignment templates.
/// These require compiler specific intrinsics.
///\ingroup type_traits

View File

@ -61,6 +61,7 @@
<Add option="-D_DEBUG" />
<Add directory="../../unittest-cpp/UnitTest++/" />
<Add directory="../../src" />
<Add directory="../" />
</Compiler>
<Unit filename="../../src/algorithm.h" />
<Unit filename="../../src/alignment.h" />
@ -72,6 +73,7 @@
<Unit filename="../../src/callback.h" />
<Unit filename="../../src/char_traits.h" />
<Unit filename="../../src/checksum.h" />
<Unit filename="../../src/compare.h" />
<Unit filename="../../src/container.h" />
<Unit filename="../../src/crc16.cpp" />
<Unit filename="../../src/crc16.h" />
@ -265,6 +267,7 @@
<Unit filename="../../unittest-cpp/UnitTest++/XmlTestReporter.h" />
<Unit filename="../ExtraCheckMacros.h" />
<Unit filename="../data.h" />
<Unit filename="../etl_user.h" />
<Unit filename="../main.cpp" />
<Unit filename="../murmurhash3.cpp" />
<Unit filename="../murmurhash3.h" />
@ -276,6 +279,7 @@
<Unit filename="../test_bloom_filter.cpp" />
<Unit filename="../test_bsd_checksum.cpp" />
<Unit filename="../test_checksum.cpp" />
<Unit filename="../test_compare.cpp" />
<Unit filename="../test_constant.cpp" />
<Unit filename="../test_container.cpp" />
<Unit filename="../test_crc.cpp" />

View File

@ -3768,7 +3768,7 @@
<iterator>
"static_assert.h"
1505152931 source:d:\users\john\documents\programming\github\etl\test\test_checksum.cpp
1506012495 source:d:\users\john\documents\programming\github\etl\test\test_checksum.cpp
"UnitTest++.h"
<iterator>
<string>
@ -3879,7 +3879,7 @@
1501066981 d:\users\john\documents\programming\github\etl\test\data.h
<ostream>
1505152931 source:d:\users\john\documents\programming\github\etl\test\test_endian.cpp
1506012495 source:d:\users\john\documents\programming\github\etl\test\test_endian.cpp
"UnitTest++.h"
<string>
"endianness.h"
@ -3889,7 +3889,7 @@
<string>
"enum_type.h"
1505152931 source:d:\users\john\documents\programming\github\etl\test\test_error_handler.cpp
1506012495 source:d:\users\john\documents\programming\github\etl\test\test_error_handler.cpp
"UnitTest++.h"
<Windows.h>
<sstream>
@ -4062,7 +4062,7 @@
<stddef.h>
"exception.h"
1505152931 source:d:\users\john\documents\programming\github\etl\test\test_function.cpp
1506012495 source:d:\users\john\documents\programming\github\etl\test\test_function.cpp
"UnitTest++.h"
"function.h"
@ -4155,7 +4155,7 @@
<stddef.h>
"exception.h"
1505152931 source:d:\users\john\documents\programming\github\etl\test\test_maths.cpp
1506012495 source:d:\users\john\documents\programming\github\etl\test\test_maths.cpp
"UnitTest++.h"
"log.h"
"power.h"
@ -4187,7 +4187,7 @@
"exception.h"
"error_handler.h"
1505653044 source:d:\users\john\documents\programming\github\etl\test\test_queue.cpp
1506012495 source:d:\users\john\documents\programming\github\etl\test\test_queue.cpp
"UnitTest++.h"
<queue>
"queue.h"
@ -4216,7 +4216,7 @@
"smallest.h"
<type_traits>
1505653044 source:d:\users\john\documents\programming\github\etl\test\test_stack.cpp
1506012495 source:d:\users\john\documents\programming\github\etl\test\test_stack.cpp
"UnitTest++.h"
<stack>
"data.h"
@ -4311,7 +4311,7 @@
"../exception.h"
"../error_handler.h"
1494277861 source:d:\users\john\documents\programming\github\etl\test\test_map.cpp
1506974005 source:d:\users\john\documents\programming\github\etl\test\test_map.cpp
"UnitTest++.h"
<map>
<array>
@ -4360,7 +4360,7 @@
"exception.h"
"error_handler.h"
1505309892 source:d:\users\john\documents\programming\github\etl\test\test_pool.cpp
1506012495 source:d:\users\john\documents\programming\github\etl\test\test_pool.cpp
"UnitTest++.h"
"ExtraCheckMacros.h"
"data.h"
@ -4373,7 +4373,7 @@
"../exception.h"
"../error_handler.h"
1494277861 source:d:\users\john\documents\programming\github\etl\test\test_set.cpp
1506974005 source:d:\users\john\documents\programming\github\etl\test\test_set.cpp
"UnitTest++.h"
<set>
<array>
@ -4413,7 +4413,7 @@
"../exception.h"
"../error_handler.h"
1505152931 source:d:\users\john\documents\programming\github\etl\test\test_type_traits.cpp
1506974005 source:d:\users\john\documents\programming\github\etl\test\test_type_traits.cpp
"UnitTest++.h"
"type_traits.h"
<type_traits>
@ -5553,9 +5553,9 @@
1482948766 d:\users\john\documents\programming\github\etl\src\exception.h
1505152930 d:\users\john\documents\programming\github\etl\src\function.h
1506012495 d:\users\john\documents\programming\github\etl\src\function.h
1505152930 d:\users\john\documents\programming\github\etl\src\nullptr.h
1506012495 d:\users\john\documents\programming\github\etl\src\nullptr.h
"platform.h"
<cstddef>
@ -5574,7 +5574,7 @@
"iterator.h"
"type_traits.h"
1505309892 d:\users\john\documents\programming\github\etl\src\type_traits.h
1506974005 d:\users\john\documents\programming\github\etl\src\type_traits.h
<stddef.h>
"platform.h"
"nullptr.h"
@ -5584,12 +5584,12 @@
<stddef.h>
<iterator>
1505152930 d:\users\john\documents\programming\github\etl\src\alignment.h
1506012495 d:\users\john\documents\programming\github\etl\src\alignment.h
<stdint.h>
"type_traits.h"
"static_assert.h"
1505152930 d:\users\john\documents\programming\github\etl\src\static_assert.h
1506012495 d:\users\john\documents\programming\github\etl\src\static_assert.h
"platform.h"
1502552754 d:\users\john\documents\programming\github\etl\src\array.h
@ -5604,10 +5604,10 @@
"error_handler.h"
"algorithm.h"
1505152930 d:\users\john\documents\programming\github\etl\src\parameter_type.h
1506012495 d:\users\john\documents\programming\github\etl\src\parameter_type.h
"type_traits.h"
1505152930 d:\users\john\documents\programming\github\etl\src\integral_limits.h
1506012495 d:\users\john\documents\programming\github\etl\src\integral_limits.h
<limits.h>
<stddef.h>
"type_traits.h"
@ -5746,7 +5746,7 @@
"static_assert.h"
"exception.h"
1505152930 d:\users\john\documents\programming\github\etl\src\deque.h
1506974005 d:\users\john\documents\programming\github\etl\src\deque.h
<stddef.h>
<stdint.h>
<iterator>
@ -5825,7 +5825,7 @@
1502705648 count.h"
1505152930 d:\users\john\documents\programming\github\etl\src\vector.h
1506012495 d:\users\john\documents\programming\github\etl\src\vector.h
<type_traits>
<stddef.h>
<stdint.h>
@ -5870,7 +5870,7 @@
"../ivector.h"
"../error_handler.h"
1505152930 d:\users\john\documents\programming\github\etl\src\forward_list.h
1506012495 d:\users\john\documents\programming\github\etl\src\forward_list.h
<iterator>
<algorithm>
<functional>
@ -5884,7 +5884,7 @@
"type_traits.h"
"parameter_type.h"
1505309892 d:\users\john\documents\programming\github\etl\src\pool.h
1506012495 d:\users\john\documents\programming\github\etl\src\pool.h
"alignment.h"
"array.h"
"container.h"
@ -6060,7 +6060,7 @@
"exception.h"
"error_handler.h"
1505653044 d:\users\john\documents\programming\github\etl\src\queue.h
1506012495 d:\users\john\documents\programming\github\etl\src\queue.h
<stddef.h>
<stdint.h>
"container.h"
@ -6117,7 +6117,7 @@
"../exception.h"
"../error_handler.h"
1505653044 d:\users\john\documents\programming\github\etl\src\stack.h
1506012495 d:\users\john\documents\programming\github\etl\src\stack.h
<stddef.h>
<stdint.h>
<algorithm>
@ -6159,7 +6159,7 @@
1482624915 ordered_map.h"
1505309892 d:\users\john\documents\programming\github\etl\src\unordered_map.h
1506012495 d:\users\john\documents\programming\github\etl\src\unordered_map.h
<stddef.h>
<iterator>
<functional>
@ -6213,7 +6213,7 @@
1479515291 d:\users\john\documents\programming\github\etl\src\visitor.h
1505152930 d:\users\john\documents\programming\github\etl\src\platform.h
1506973985 d:\users\john\documents\programming\github\etl\src\platform.h
<stdint.h>
<limits.h>
@ -6349,7 +6349,7 @@
"static_assert.h"
"algorithm.h"
1505152931 source:d:\users\john\documents\programming\github\etl\test\test_jenkins.cpp
1506012495 source:d:\users\john\documents\programming\github\etl\test\test_jenkins.cpp
"UnitTest++.h"
<iterator>
<string>
@ -6367,7 +6367,7 @@
"ihash.h"
"frame_check_sequence.h"
1494277861 source:d:\users\john\documents\programming\github\etl\test\test_multimap.cpp
1506974005 source:d:\users\john\documents\programming\github\etl\test\test_multimap.cpp
"UnitTest++.h"
<map>
<array>
@ -6412,7 +6412,7 @@
"../exception.h"
"../error_handler.h"
1494277861 source:d:\users\john\documents\programming\github\etl\test\test_multiset.cpp
1506974005 source:d:\users\john\documents\programming\github\etl\test\test_multiset.cpp
"UnitTest++.h"
<set>
<array>
@ -6457,7 +6457,7 @@
"../exception.h"
"../error_handler.h"
1505152931 source:d:\users\john\documents\programming\github\etl\test\test_murmur3.cpp
1506012495 source:d:\users\john\documents\programming\github\etl\test\test_murmur3.cpp
"UnitTest++.h"
"murmurhash3.h"
<iterator>
@ -6473,7 +6473,7 @@
"binary.h"
"error_handler.h"
1505152931 source:d:\users\john\documents\programming\github\etl\test\test_pearson.cpp
1506012495 source:d:\users\john\documents\programming\github\etl\test\test_pearson.cpp
"UnitTest++.h"
<iterator>
<string>
@ -6482,7 +6482,7 @@
<stdint.h>
"pearson.h"
1505152930 d:\users\john\documents\programming\github\etl\src\pearson.h
1506012495 d:\users\john\documents\programming\github\etl\src\pearson.h
<stdint.h>
"platform.h"
"static_assert.h"
@ -6491,7 +6491,7 @@
"array.h"
"container.h"
1505653044 source:d:\users\john\documents\programming\github\etl\test\test_priority_queue.cpp
1506012495 source:d:\users\john\documents\programming\github\etl\test\test_priority_queue.cpp
"UnitTest++.h"
<queue>
"priority_queue.h"
@ -6500,7 +6500,7 @@
1482624474 iority_queue.h"
1505653044 d:\users\john\documents\programming\github\etl\src\priority_queue.h
1506012495 d:\users\john\documents\programming\github\etl\src\priority_queue.h
<stddef.h>
<functional>
<algorithm>
@ -6537,7 +6537,7 @@
1482625301 ordered_multimap.h"
1505309892 d:\users\john\documents\programming\github\etl\src\unordered_multimap.h
1506012495 d:\users\john\documents\programming\github\etl\src\unordered_multimap.h
<stddef.h>
<iterator>
<functional>
@ -6589,7 +6589,7 @@
"unordered_multiset.h"
"checksum.h"
1505309892 d:\users\john\documents\programming\github\etl\src\unordered_multiset.h
1506012495 d:\users\john\documents\programming\github\etl\src\unordered_multiset.h
<stddef.h>
<iterator>
<functional>
@ -6639,7 +6639,7 @@
"unordered_set.h"
"checksum.h"
1505309892 d:\users\john\documents\programming\github\etl\src\unordered_set.h
1506012495 d:\users\john\documents\programming\github\etl\src\unordered_set.h
<stddef.h>
<iterator>
<functional>
@ -6704,7 +6704,7 @@
1482079651 d:\users\john\documents\programming\github\unittest-cpp\unittest++\throwingtestreporter.h
"TestReporter.h"
1505152930 d:\users\john\documents\programming\github\etl\src\char_traits.h
1506012495 d:\users\john\documents\programming\github\etl\src\char_traits.h
<algorithm>
"platform.h"
"stdint.h"
@ -6741,25 +6741,25 @@
<stdint.h>
"static_assert.h"
1494277861 source:d:\users\john\documents\programming\github\etl\test\test_intrusive_queue.cpp
1506012495 source:d:\users\john\documents\programming\github\etl\test\test_intrusive_queue.cpp
"UnitTest++.h"
"intrusive_queue.h"
"intrusive_links.h"
<vector>
1501066686 d:\users\john\documents\programming\github\etl\src\intrusive_queue.h
1506012495 d:\users\john\documents\programming\github\etl\src\intrusive_queue.h
<stddef.h>
"type_traits.h"
"error_handler.h"
"intrusive_links.h"
1494277861 source:d:\users\john\documents\programming\github\etl\test\test_intrusive_stack.cpp
1506012495 source:d:\users\john\documents\programming\github\etl\test\test_intrusive_stack.cpp
"UnitTest++.h"
"intrusive_stack.h"
"intrusive_links.h"
<vector>
1501066686 d:\users\john\documents\programming\github\etl\src\intrusive_stack.h
1506012495 d:\users\john\documents\programming\github\etl\src\intrusive_stack.h
<stddef.h>
"type_traits.h"
"error_handler.h"
@ -8808,7 +8808,7 @@
<iterator>
"type_traits.h"
1505152930 d:\users\john\documents\programming\github\etl\src\memory.h
1506012495 d:\users\john\documents\programming\github\etl\src\memory.h
<iterator>
<algorithm>
"type_traits.h"
@ -8818,10 +8818,10 @@
<assert.h>
"platform.h"
1505152930 source:d:\users\john\documents\programming\github\etl\src\random.cpp
1506012495 source:d:\users\john\documents\programming\github\etl\src\random.cpp
"random.h"
1505152930 d:\users\john\documents\programming\github\etl\src\random.h
1506012495 d:\users\john\documents\programming\github\etl\src\random.h
<stdint.h>
1494277861 source:d:\users\john\documents\programming\github\etl\test\test_intrusive_flat_map.cpp
@ -8924,7 +8924,7 @@
"UnitTest++.h"
"iterator.h"
1505152931 source:d:\users\john\documents\programming\github\etl\test\test_memory.cpp
1506012495 source:d:\users\john\documents\programming\github\etl\test\test_memory.cpp
"UnitTest++.h"
"memory.h"
"debug_count.h"
@ -9248,7 +9248,7 @@
"container.h"
<iostream>
1505152930 d:\users\john\documents\programming\github\etl\src\fsm.h
1506012495 d:\users\john\documents\programming\github\etl\src\fsm.h
<stdint.h>
"array.h"
"nullptr.h"
@ -9261,7 +9261,7 @@
1502118978 d:\users\john\documents\programming\github\etl\src\user_type.h
1505152930 d:\users\john\documents\programming\github\etl\src\message_router.h
1506012495 d:\users\john\documents\programming\github\etl\src\message_router.h
<stdint.h>
"message.h"
"message_types.h"
@ -9270,7 +9270,7 @@
"exception.h"
"largest.h"
1505152931 source:d:\users\john\documents\programming\github\etl\test\test_message_router.cpp
1506012495 source:d:\users\john\documents\programming\github\etl\test\test_message_router.cpp
"UnitTest++.h"
"ExtraCheckMacros.h"
"message_router.h"
@ -9315,7 +9315,7 @@
"type_traits.h"
"function.h"
1505152930 d:\users\john\documents\programming\github\etl\src\message.h
1506012495 d:\users\john\documents\programming\github\etl\src\message.h
<stdint.h>
"error_handler.h"
"exception.h"
@ -9335,7 +9335,7 @@
"largest.h"
"packet.h"
1505152930 d:\users\john\documents\programming\github\etl\src\message_bus.h
1506012495 d:\users\john\documents\programming\github\etl\src\message_bus.h
<stdint.h>
<algorithm>
"algorithm.h"
@ -10317,38 +10317,38 @@
"DeferredTestReporter.h"
<iosfwd>
1505152930 d:\users\john\documents\programming\github\etl\src\endianness.h
1506012495 d:\users\john\documents\programming\github\etl\src\endianness.h
<stdint.h>
"enum_type.h"
1505152930 d:\users\john\documents\programming\github\etl\src\sqrt.h
1506012495 d:\users\john\documents\programming\github\etl\src\sqrt.h
<stddef.h>
"type_traits.h"
"constant.h"
1505152930 d:\users\john\documents\programming\github\etl\src\constant.h
1506012495 d:\users\john\documents\programming\github\etl\src\constant.h
1505152931 source:d:\users\john\documents\programming\github\etl\test\test_constant.cpp
1506012495 source:d:\users\john\documents\programming\github\etl\test\test_constant.cpp
"UnitTest++.h"
"constant.h"
"integral_limits.h"
<stdint.h>
<type_traits>
1505152931 source:d:\users\john\documents\programming\github\etl\test\test_parameter_type.cpp
1506012495 source:d:\users\john\documents\programming\github\etl\test\test_parameter_type.cpp
"UnitTest++.h"
<string>
<ostream>
"parameter_type.h"
1505664627 source:d:\users\john\documents\programming\github\etl\test\test_factory.cpp
1506974005 source:d:\users\john\documents\programming\github\etl\test\test_factory.cpp
"UnitTest++.h"
"ExtraCheckMacros.h"
"factory.h"
<string>
<type_traits>
1505664574 d:\users\john\documents\programming\github\etl\src\factory.h
1506974005 d:\users\john\documents\programming\github\etl\src\factory.h
<stdint.h>
"error_handler.h"
"exception.h"
@ -10358,13 +10358,23 @@
"static_assert.h"
"type_lookup.h"
1505671013 d:\users\john\documents\programming\github\etl\src\type_lookup.h
1506012495 d:\users\john\documents\programming\github\etl\src\type_lookup.h
<limits.h>
"type_traits.h"
"static_assert.h"
1505653044 source:d:\users\john\documents\programming\github\etl\test\test_type_lookup.cpp
1506012495 source:d:\users\john\documents\programming\github\etl\test\test_type_lookup.cpp
"UnitTest++.h"
"ExtraCheckMacros.h"
"type_lookup.h"
<type_traits>
1506974005 source:d:\users\john\documents\programming\github\etl\test\test_compare.cpp
"UnitTest++.h"
"compare.h"
1506974005 d:\users\john\documents\programming\github\etl\src\compare.h
<functional>
"platform.h"
"parameter_type.h"

View File

@ -1,33 +0,0 @@
// <<< Use Configuration Wizard in Context Menu >>>
// <h>Debug MCU Configuration
// <o.0> DBG_SLEEP <i> Debug Sleep Mode
// <o.1> DBG_STOP <i> Debug Stop Mode
// <o.2> DBG_STANDBY <i> Debug Standby Mode
// </h>
DbgMCU_CR = 0x00000007;
// <h> Debug MCU APB1 Freeze
// <o.0> DBG_TIM2_STOP <i> Timer 2 Stopped when Core is halted
// <o.1> DBG_TIM3_STOP <i> Timer 3 Stopped when Core is halted
// <o.2> DBG_TIM4_STOP <i> Timer 4 Stopped when Core is halted
// <o.3> DBG_TIM5_STOP <i> Timer 5 Stopped when Core is halted
// <o.10> DBG_RTC_STOP <i> RTC Stopped when Core is halted
// <o.11> DBG_WWDG_STOP <i> Window Watchdog Stopped when Core is halted
// <o.12> DBG_IWDG_STOP <i> Independent Watchdog Stopped when Core is halted
// <o.21> DBG_I2C1_SMBUS_TIMEOUT <i> I2C1 SMBUS Timeout Mode Stopped when Core is halted
// <o.22> DBG_I2C2_SMBUS_TIMEOUT <i> I2C2 SMBUS Timeout Mode Stopped when Core is halted
// <o.23> DBG_I2C3_SMBUS_TIMEOUT <i> I2C3 SMBUS Timeout Mode Stopped when Core is halted
// </h>
DbgMCU_APB1_Fz = 0x00000000;
// <h> Debug MCU APB2 Freeze
// <o.0> DBG_TIM1_STOP <i> Timer 1 Stopped when Core is halted
// <o.16> DBG_TIM9_STOP <i> Timer 9 Stopped when Core is halted
// <o.17> DBG_TIM10_STOP <i> Timer 10 Stopped when Core is halted
// <o.18> DBG_TIM11_STOP <i> Timer 11 Stopped when Core is halted
// </h>
DbgMCU_APB2_Fz = 0x00000000;
// <<< end of configuration section >>>

View File

@ -1,46 +0,0 @@
<html>
<body>
<pre>
<h1>µVision Build Log</h1>
<h2>Tool Versions:</h2>
IDE-Version: µVision V5.12.0.0
Copyright (C) 2014 ARM Ltd and ARM Germany GmbH. All rights reserved.
License Information: John Wellbelove, John Wellbelove Consulting, LIC=----
Tool Versions:
Toolchain: MDK-Lite Version: 5.12.0.0
Toolchain Path: C:\Keil_v5\ARM\ARMCC\Bin
C Compiler: Armcc.exe V5.05 (build 41)
Assembler: Armasm.exe V5.05 (build 41)
Linker/Locator: ArmLink.exe V5.05 (build 41)
Library Manager: ArmAr.exe V5.05 (build 41)
Hex Converter: FromElf.exe V5.05 (build 41)
CPU DLL: SARMCM3.DLL V5.12.0.0
Dialog DLL: DCM.DLL V1.13.0.0
Target DLL: UL2CM3.DLL V1.153.0.0
Dialog DLL: TCM.DLL V1.14.2.0
<h2>Project:</h2>
U:\Users\John\Documents\Programming\GitHub\etl\test\Keil\Test1.uvproj
Project File Date: 11/24/2014
<h2>Output:</h2>
Build target 'Target 1'
compiling main.cpp...
main.cpp(5): warning: #1-D: last line of file ends without a newline
}
main.cpp: 1 warning, 0 errors
linking...
.\Objects\Test1.axf: Error: L6320W: Ignoring --entry command. Cannot find argument 'Reset_Handler'.
.\Objects\Test1.axf: Warning: L6320W: Ignoring --first command. Cannot find argument '__Vectors'.
Not enough information to list image symbols.
Not enough information to list the image map.
Finished: 2 information, 1 warning and 1 error messages.
".\Objects\Test1.axf" - 1 Error(s), 2 Warning(s).
<h2>Collection of Component include folders:</h2>
U:\Users\John\Documents\Programming\GitHub\etl\test\Keil\RTE
C:\Keil_v5\ARM\PACK\ARM\CMSIS\4.2.0\Device\ARM\ARMCM3\Include
<h2>Collection of Component Files used:</h2>
Target not created.

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -1,273 +0,0 @@
;/**************************************************************************//**
; * @file startup_ARMCM7.s
; * @brief CMSIS Core Device Startup File for
; * ARMCM7 Device Series
; * @version V1.00
; * @date 22. August 2014
; *
; * @note
; *
; ******************************************************************************/
;/* Copyright (c) 2011 - 2014 ARM LIMITED
;
; All rights reserved.
; Redistribution and use in source and binary forms, with or without
; modification, are permitted provided that the following conditions are met:
; - Redistributions of source code must retain the above copyright
; notice, this list of conditions and the following disclaimer.
; - Redistributions in binary form must reproduce the above copyright
; notice, this list of conditions and the following disclaimer in the
; documentation and/or other materials provided with the distribution.
; - Neither the name of ARM nor the names of its contributors may be used
; to endorse or promote products derived from this software without
; specific prior written permission.
; *
; THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
; AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
; IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
; ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS AND CONTRIBUTORS BE
; LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
; CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
; SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
; INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
; CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
; ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
; POSSIBILITY OF SUCH DAMAGE.
; ---------------------------------------------------------------------------*/
;/*
;//-------- <<< Use Configuration Wizard in Context Menu >>> ------------------
;*/
; <h> Stack Configuration
; <o> Stack Size (in Bytes) <0x0-0xFFFFFFFF:8>
; </h>
Stack_Size EQU 0x00000400
AREA STACK, NOINIT, READWRITE, ALIGN=3
Stack_Mem SPACE Stack_Size
__initial_sp
; <h> Heap Configuration
; <o> Heap Size (in Bytes) <0x0-0xFFFFFFFF:8>
; </h>
Heap_Size EQU 0x00000C00
AREA HEAP, NOINIT, READWRITE, ALIGN=3
__heap_base
Heap_Mem SPACE Heap_Size
__heap_limit
PRESERVE8
THUMB
; Vector Table Mapped to Address 0 at Reset
AREA RESET, DATA, READONLY
EXPORT __Vectors
EXPORT __Vectors_End
EXPORT __Vectors_Size
__Vectors DCD __initial_sp ; Top of Stack
DCD Reset_Handler ; Reset Handler
DCD NMI_Handler ; NMI Handler
DCD HardFault_Handler ; Hard Fault Handler
DCD MemManage_Handler ; MPU Fault Handler
DCD BusFault_Handler ; Bus Fault Handler
DCD UsageFault_Handler ; Usage Fault Handler
DCD 0 ; Reserved
DCD 0 ; Reserved
DCD 0 ; Reserved
DCD 0 ; Reserved
DCD SVC_Handler ; SVCall Handler
DCD DebugMon_Handler ; Debug Monitor Handler
DCD 0 ; Reserved
DCD PendSV_Handler ; PendSV Handler
DCD SysTick_Handler ; SysTick Handler
; External Interrupts
DCD WDT_IRQHandler ; 0: Watchdog Timer
DCD RTC_IRQHandler ; 1: Real Time Clock
DCD TIM0_IRQHandler ; 2: Timer0 / Timer1
DCD TIM2_IRQHandler ; 3: Timer2 / Timer3
DCD MCIA_IRQHandler ; 4: MCIa
DCD MCIB_IRQHandler ; 5: MCIb
DCD UART0_IRQHandler ; 6: UART0 - DUT FPGA
DCD UART1_IRQHandler ; 7: UART1 - DUT FPGA
DCD UART2_IRQHandler ; 8: UART2 - DUT FPGA
DCD UART4_IRQHandler ; 9: UART4 - not connected
DCD AACI_IRQHandler ; 10: AACI / AC97
DCD CLCD_IRQHandler ; 11: CLCD Combined Interrupt
DCD ENET_IRQHandler ; 12: Ethernet
DCD USBDC_IRQHandler ; 13: USB Device
DCD USBHC_IRQHandler ; 14: USB Host Controller
DCD CHLCD_IRQHandler ; 15: Character LCD
DCD FLEXRAY_IRQHandler ; 16: Flexray
DCD CAN_IRQHandler ; 17: CAN
DCD LIN_IRQHandler ; 18: LIN
DCD I2C_IRQHandler ; 19: I2C ADC/DAC
DCD 0 ; 20: Reserved
DCD 0 ; 21: Reserved
DCD 0 ; 22: Reserved
DCD 0 ; 23: Reserved
DCD 0 ; 24: Reserved
DCD 0 ; 25: Reserved
DCD 0 ; 26: Reserved
DCD 0 ; 27: Reserved
DCD CPU_CLCD_IRQHandler ; 28: Reserved - CPU FPGA CLCD
DCD 0 ; 29: Reserved - CPU FPGA
DCD UART3_IRQHandler ; 30: UART3 - CPU FPGA
DCD SPI_IRQHandler ; 31: SPI Touchscreen - CPU FPGA
__Vectors_End
__Vectors_Size EQU __Vectors_End - __Vectors
AREA |.text|, CODE, READONLY
; Reset Handler
Reset_Handler PROC
EXPORT Reset_Handler [WEAK]
IMPORT SystemInit
IMPORT __main
LDR R0, =SystemInit
BLX R0
LDR R0, =__main
BX R0
ENDP
; Dummy Exception Handlers (infinite loops which can be modified)
NMI_Handler PROC
EXPORT NMI_Handler [WEAK]
B .
ENDP
HardFault_Handler\
PROC
EXPORT HardFault_Handler [WEAK]
B .
ENDP
MemManage_Handler\
PROC
EXPORT MemManage_Handler [WEAK]
B .
ENDP
BusFault_Handler\
PROC
EXPORT BusFault_Handler [WEAK]
B .
ENDP
UsageFault_Handler\
PROC
EXPORT UsageFault_Handler [WEAK]
B .
ENDP
SVC_Handler PROC
EXPORT SVC_Handler [WEAK]
B .
ENDP
DebugMon_Handler\
PROC
EXPORT DebugMon_Handler [WEAK]
B .
ENDP
PendSV_Handler PROC
EXPORT PendSV_Handler [WEAK]
B .
ENDP
SysTick_Handler PROC
EXPORT SysTick_Handler [WEAK]
B .
ENDP
Default_Handler PROC
EXPORT WDT_IRQHandler [WEAK]
EXPORT RTC_IRQHandler [WEAK]
EXPORT TIM0_IRQHandler [WEAK]
EXPORT TIM2_IRQHandler [WEAK]
EXPORT MCIA_IRQHandler [WEAK]
EXPORT MCIB_IRQHandler [WEAK]
EXPORT UART0_IRQHandler [WEAK]
EXPORT UART1_IRQHandler [WEAK]
EXPORT UART2_IRQHandler [WEAK]
EXPORT UART3_IRQHandler [WEAK]
EXPORT UART4_IRQHandler [WEAK]
EXPORT AACI_IRQHandler [WEAK]
EXPORT CLCD_IRQHandler [WEAK]
EXPORT ENET_IRQHandler [WEAK]
EXPORT USBDC_IRQHandler [WEAK]
EXPORT USBHC_IRQHandler [WEAK]
EXPORT CHLCD_IRQHandler [WEAK]
EXPORT FLEXRAY_IRQHandler [WEAK]
EXPORT CAN_IRQHandler [WEAK]
EXPORT LIN_IRQHandler [WEAK]
EXPORT I2C_IRQHandler [WEAK]
EXPORT CPU_CLCD_IRQHandler [WEAK]
EXPORT SPI_IRQHandler [WEAK]
WDT_IRQHandler
RTC_IRQHandler
TIM0_IRQHandler
TIM2_IRQHandler
MCIA_IRQHandler
MCIB_IRQHandler
UART0_IRQHandler
UART1_IRQHandler
UART2_IRQHandler
UART3_IRQHandler
UART4_IRQHandler
AACI_IRQHandler
CLCD_IRQHandler
ENET_IRQHandler
USBDC_IRQHandler
USBHC_IRQHandler
CHLCD_IRQHandler
FLEXRAY_IRQHandler
CAN_IRQHandler
LIN_IRQHandler
I2C_IRQHandler
CPU_CLCD_IRQHandler
SPI_IRQHandler
B .
ENDP
ALIGN
; User Initial Stack & Heap
IF :DEF:__MICROLIB
EXPORT __initial_sp
EXPORT __heap_base
EXPORT __heap_limit
ELSE
IMPORT __use_two_region_memory
EXPORT __user_initial_stackheap
__user_initial_stackheap PROC
LDR R0, = Heap_Mem
LDR R1, =(Stack_Mem + Stack_Size)
LDR R2, = (Heap_Mem + Heap_Size)
LDR R3, = Stack_Mem
BX LR
ENDP
ALIGN
ENDIF
END

View File

@ -1,392 +0,0 @@
;******************** (C) COPYRIGHT 2015 STMicroelectronics ********************
;* File Name : startup_stm32f401xe.s
;* Author : MCD Application Team
;* Version : V2.3.1
;* Date : 03-April-2015
;* Description : STM32F401xe devices vector table for MDK-ARM toolchain.
;* This module performs:
;* - Set the initial SP
;* - Set the initial PC == Reset_Handler
;* - Set the vector table entries with the exceptions ISR address
;* - Branches to __main in the C library (which eventually
;* calls main()).
;* After Reset the CortexM4 processor is in Thread mode,
;* priority is Privileged, and the Stack is set to Main.
;* <<< Use Configuration Wizard in Context Menu >>>
;*******************************************************************************
;
;* Redistribution and use in source and binary forms, with or without modification,
;* are permitted provided that the following conditions are met:
;* 1. Redistributions of source code must retain the above copyright notice,
;* this list of conditions and the following disclaimer.
;* 2. Redistributions in binary form must reproduce the above copyright notice,
;* this list of conditions and the following disclaimer in the documentation
;* and/or other materials provided with the distribution.
;* 3. Neither the name of STMicroelectronics nor the names of its contributors
;* may be used to endorse or promote products derived from this software
;* without specific prior written permission.
;*
;* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
;* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
;* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
;* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
;* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
;* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
;* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
;* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
;* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
;* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
;
;*******************************************************************************
; Amount of memory (in bytes) allocated for Stack
; Tailor this value to your application needs
; <h> Stack Configuration
; <o> Stack Size (in Bytes) <0x0-0xFFFFFFFF:8>
; </h>
Stack_Size EQU 0x00000400
AREA STACK, NOINIT, READWRITE, ALIGN=3
Stack_Mem SPACE Stack_Size
__initial_sp
; <h> Heap Configuration
; <o> Heap Size (in Bytes) <0x0-0xFFFFFFFF:8>
; </h>
Heap_Size EQU 0x00000200
AREA HEAP, NOINIT, READWRITE, ALIGN=3
__heap_base
Heap_Mem SPACE Heap_Size
__heap_limit
PRESERVE8
THUMB
; Vector Table Mapped to Address 0 at Reset
AREA RESET, DATA, READONLY
EXPORT __Vectors
EXPORT __Vectors_End
EXPORT __Vectors_Size
__Vectors DCD __initial_sp ; Top of Stack
DCD Reset_Handler ; Reset Handler
DCD NMI_Handler ; NMI Handler
DCD HardFault_Handler ; Hard Fault Handler
DCD MemManage_Handler ; MPU Fault Handler
DCD BusFault_Handler ; Bus Fault Handler
DCD UsageFault_Handler ; Usage Fault Handler
DCD 0 ; Reserved
DCD 0 ; Reserved
DCD 0 ; Reserved
DCD 0 ; Reserved
DCD SVC_Handler ; SVCall Handler
DCD DebugMon_Handler ; Debug Monitor Handler
DCD 0 ; Reserved
DCD PendSV_Handler ; PendSV Handler
DCD SysTick_Handler ; SysTick Handler
; External Interrupts
DCD WWDG_IRQHandler ; Window WatchDog
DCD PVD_IRQHandler ; PVD through EXTI Line detection
DCD TAMP_STAMP_IRQHandler ; Tamper and TimeStamps through the EXTI line
DCD RTC_WKUP_IRQHandler ; RTC Wakeup through the EXTI line
DCD FLASH_IRQHandler ; FLASH
DCD RCC_IRQHandler ; RCC
DCD EXTI0_IRQHandler ; EXTI Line0
DCD EXTI1_IRQHandler ; EXTI Line1
DCD EXTI2_IRQHandler ; EXTI Line2
DCD EXTI3_IRQHandler ; EXTI Line3
DCD EXTI4_IRQHandler ; EXTI Line4
DCD DMA1_Stream0_IRQHandler ; DMA1 Stream 0
DCD DMA1_Stream1_IRQHandler ; DMA1 Stream 1
DCD DMA1_Stream2_IRQHandler ; DMA1 Stream 2
DCD DMA1_Stream3_IRQHandler ; DMA1 Stream 3
DCD DMA1_Stream4_IRQHandler ; DMA1 Stream 4
DCD DMA1_Stream5_IRQHandler ; DMA1 Stream 5
DCD DMA1_Stream6_IRQHandler ; DMA1 Stream 6
DCD ADC_IRQHandler ; ADC1, ADC2 and ADC3s
DCD 0 ; Reserved
DCD 0 ; Reserved
DCD 0 ; Reserved
DCD 0 ; Reserved
DCD EXTI9_5_IRQHandler ; External Line[9:5]s
DCD TIM1_BRK_TIM9_IRQHandler ; TIM1 Break and TIM9
DCD TIM1_UP_TIM10_IRQHandler ; TIM1 Update and TIM10
DCD TIM1_TRG_COM_TIM11_IRQHandler ; TIM1 Trigger and Commutation and TIM11
DCD TIM1_CC_IRQHandler ; TIM1 Capture Compare
DCD TIM2_IRQHandler ; TIM2
DCD TIM3_IRQHandler ; TIM3
DCD TIM4_IRQHandler ; TIM4
DCD I2C1_EV_IRQHandler ; I2C1 Event
DCD I2C1_ER_IRQHandler ; I2C1 Error
DCD I2C2_EV_IRQHandler ; I2C2 Event
DCD I2C2_ER_IRQHandler ; I2C2 Error
DCD SPI1_IRQHandler ; SPI1
DCD SPI2_IRQHandler ; SPI2
DCD USART1_IRQHandler ; USART1
DCD USART2_IRQHandler ; USART2
DCD 0 ; Reserved
DCD EXTI15_10_IRQHandler ; External Line[15:10]s
DCD RTC_Alarm_IRQHandler ; RTC Alarm (A and B) through EXTI Line
DCD OTG_FS_WKUP_IRQHandler ; USB OTG FS Wakeup through EXTI line
DCD 0 ; Reserved
DCD 0 ; Reserved
DCD 0 ; Reserved
DCD 0 ; Reserved
DCD DMA1_Stream7_IRQHandler ; DMA1 Stream7
DCD 0 ; Reserved
DCD SDIO_IRQHandler ; SDIO
DCD TIM5_IRQHandler ; TIM5
DCD SPI3_IRQHandler ; SPI3
DCD 0 ; Reserved
DCD 0 ; Reserved
DCD 0 ; Reserved
DCD 0 ; Reserved
DCD DMA2_Stream0_IRQHandler ; DMA2 Stream 0
DCD DMA2_Stream1_IRQHandler ; DMA2 Stream 1
DCD DMA2_Stream2_IRQHandler ; DMA2 Stream 2
DCD DMA2_Stream3_IRQHandler ; DMA2 Stream 3
DCD DMA2_Stream4_IRQHandler ; DMA2 Stream 4
DCD 0 ; Reserved
DCD 0 ; Reserved
DCD 0 ; Reserved
DCD 0 ; Reserved
DCD 0 ; Reserved
DCD 0 ; Reserved
DCD OTG_FS_IRQHandler ; USB OTG FS
DCD DMA2_Stream5_IRQHandler ; DMA2 Stream 5
DCD DMA2_Stream6_IRQHandler ; DMA2 Stream 6
DCD DMA2_Stream7_IRQHandler ; DMA2 Stream 7
DCD USART6_IRQHandler ; USART6
DCD I2C3_EV_IRQHandler ; I2C3 event
DCD I2C3_ER_IRQHandler ; I2C3 error
DCD 0 ; Reserved
DCD 0 ; Reserved
DCD 0 ; Reserved
DCD 0 ; Reserved
DCD 0 ; Reserved
DCD 0 ; Reserved
DCD 0 ; Reserved
DCD FPU_IRQHandler ; FPU
DCD 0 ; Reserved
DCD 0 ; Reserved
DCD SPI4_IRQHandler ; SPI4
__Vectors_End
__Vectors_Size EQU __Vectors_End - __Vectors
AREA |.text|, CODE, READONLY
; Reset handler
Reset_Handler PROC
EXPORT Reset_Handler [WEAK]
IMPORT SystemInit
IMPORT __main
LDR R0, =SystemInit
BLX R0
LDR R0, =__main
BX R0
ENDP
; Dummy Exception Handlers (infinite loops which can be modified)
NMI_Handler PROC
EXPORT NMI_Handler [WEAK]
B .
ENDP
HardFault_Handler\
PROC
EXPORT HardFault_Handler [WEAK]
B .
ENDP
MemManage_Handler\
PROC
EXPORT MemManage_Handler [WEAK]
B .
ENDP
BusFault_Handler\
PROC
EXPORT BusFault_Handler [WEAK]
B .
ENDP
UsageFault_Handler\
PROC
EXPORT UsageFault_Handler [WEAK]
B .
ENDP
SVC_Handler PROC
EXPORT SVC_Handler [WEAK]
B .
ENDP
DebugMon_Handler\
PROC
EXPORT DebugMon_Handler [WEAK]
B .
ENDP
PendSV_Handler PROC
EXPORT PendSV_Handler [WEAK]
B .
ENDP
SysTick_Handler PROC
EXPORT SysTick_Handler [WEAK]
B .
ENDP
Default_Handler PROC
EXPORT WWDG_IRQHandler [WEAK]
EXPORT PVD_IRQHandler [WEAK]
EXPORT TAMP_STAMP_IRQHandler [WEAK]
EXPORT RTC_WKUP_IRQHandler [WEAK]
EXPORT FLASH_IRQHandler [WEAK]
EXPORT RCC_IRQHandler [WEAK]
EXPORT EXTI0_IRQHandler [WEAK]
EXPORT EXTI1_IRQHandler [WEAK]
EXPORT EXTI2_IRQHandler [WEAK]
EXPORT EXTI3_IRQHandler [WEAK]
EXPORT EXTI4_IRQHandler [WEAK]
EXPORT DMA1_Stream0_IRQHandler [WEAK]
EXPORT DMA1_Stream1_IRQHandler [WEAK]
EXPORT DMA1_Stream2_IRQHandler [WEAK]
EXPORT DMA1_Stream3_IRQHandler [WEAK]
EXPORT DMA1_Stream4_IRQHandler [WEAK]
EXPORT DMA1_Stream5_IRQHandler [WEAK]
EXPORT DMA1_Stream6_IRQHandler [WEAK]
EXPORT ADC_IRQHandler [WEAK]
EXPORT EXTI9_5_IRQHandler [WEAK]
EXPORT TIM1_BRK_TIM9_IRQHandler [WEAK]
EXPORT TIM1_UP_TIM10_IRQHandler [WEAK]
EXPORT TIM1_TRG_COM_TIM11_IRQHandler [WEAK]
EXPORT TIM1_CC_IRQHandler [WEAK]
EXPORT TIM2_IRQHandler [WEAK]
EXPORT TIM3_IRQHandler [WEAK]
EXPORT TIM4_IRQHandler [WEAK]
EXPORT I2C1_EV_IRQHandler [WEAK]
EXPORT I2C1_ER_IRQHandler [WEAK]
EXPORT I2C2_EV_IRQHandler [WEAK]
EXPORT I2C2_ER_IRQHandler [WEAK]
EXPORT SPI1_IRQHandler [WEAK]
EXPORT SPI2_IRQHandler [WEAK]
EXPORT USART1_IRQHandler [WEAK]
EXPORT USART2_IRQHandler [WEAK]
EXPORT EXTI15_10_IRQHandler [WEAK]
EXPORT RTC_Alarm_IRQHandler [WEAK]
EXPORT OTG_FS_WKUP_IRQHandler [WEAK]
EXPORT DMA1_Stream7_IRQHandler [WEAK]
EXPORT SDIO_IRQHandler [WEAK]
EXPORT TIM5_IRQHandler [WEAK]
EXPORT SPI3_IRQHandler [WEAK]
EXPORT DMA2_Stream0_IRQHandler [WEAK]
EXPORT DMA2_Stream1_IRQHandler [WEAK]
EXPORT DMA2_Stream2_IRQHandler [WEAK]
EXPORT DMA2_Stream3_IRQHandler [WEAK]
EXPORT DMA2_Stream4_IRQHandler [WEAK]
EXPORT OTG_FS_IRQHandler [WEAK]
EXPORT DMA2_Stream5_IRQHandler [WEAK]
EXPORT DMA2_Stream6_IRQHandler [WEAK]
EXPORT DMA2_Stream7_IRQHandler [WEAK]
EXPORT USART6_IRQHandler [WEAK]
EXPORT I2C3_EV_IRQHandler [WEAK]
EXPORT I2C3_ER_IRQHandler [WEAK]
EXPORT FPU_IRQHandler [WEAK]
EXPORT SPI4_IRQHandler [WEAK]
WWDG_IRQHandler
PVD_IRQHandler
TAMP_STAMP_IRQHandler
RTC_WKUP_IRQHandler
FLASH_IRQHandler
RCC_IRQHandler
EXTI0_IRQHandler
EXTI1_IRQHandler
EXTI2_IRQHandler
EXTI3_IRQHandler
EXTI4_IRQHandler
DMA1_Stream0_IRQHandler
DMA1_Stream1_IRQHandler
DMA1_Stream2_IRQHandler
DMA1_Stream3_IRQHandler
DMA1_Stream4_IRQHandler
DMA1_Stream5_IRQHandler
DMA1_Stream6_IRQHandler
ADC_IRQHandler
EXTI9_5_IRQHandler
TIM1_BRK_TIM9_IRQHandler
TIM1_UP_TIM10_IRQHandler
TIM1_TRG_COM_TIM11_IRQHandler
TIM1_CC_IRQHandler
TIM2_IRQHandler
TIM3_IRQHandler
TIM4_IRQHandler
I2C1_EV_IRQHandler
I2C1_ER_IRQHandler
I2C2_EV_IRQHandler
I2C2_ER_IRQHandler
SPI1_IRQHandler
SPI2_IRQHandler
USART1_IRQHandler
USART2_IRQHandler
EXTI15_10_IRQHandler
RTC_Alarm_IRQHandler
OTG_FS_WKUP_IRQHandler
DMA1_Stream7_IRQHandler
SDIO_IRQHandler
TIM5_IRQHandler
SPI3_IRQHandler
DMA2_Stream0_IRQHandler
DMA2_Stream1_IRQHandler
DMA2_Stream2_IRQHandler
DMA2_Stream3_IRQHandler
DMA2_Stream4_IRQHandler
OTG_FS_IRQHandler
DMA2_Stream5_IRQHandler
DMA2_Stream6_IRQHandler
DMA2_Stream7_IRQHandler
USART6_IRQHandler
I2C3_EV_IRQHandler
I2C3_ER_IRQHandler
FPU_IRQHandler
SPI4_IRQHandler
B .
ENDP
ALIGN
;*******************************************************************************
; User Stack and Heap initialization
;*******************************************************************************
IF :DEF:__MICROLIB
EXPORT __initial_sp
EXPORT __heap_base
EXPORT __heap_limit
ELSE
IMPORT __use_two_region_memory
EXPORT __user_initial_stackheap
__user_initial_stackheap
LDR R0, = Heap_Mem
LDR R1, =(Stack_Mem + Stack_Size)
LDR R2, = (Heap_Mem + Heap_Size)
LDR R3, = Stack_Mem
BX LR
ALIGN
ENDIF
END
;************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE*****

View File

@ -1,102 +0,0 @@
/**************************************************************************//**
* @file system_ARMCM7.c
* @brief CMSIS Device System Source File for
* ARMCM7 Device Series
* @version V1.00
* @date 27. August 2014
*
* @note
*
******************************************************************************/
/* Copyright (c) 2011 - 2014 ARM LIMITED
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
- Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
- Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
- Neither the name of ARM nor the names of its contributors may be used
to endorse or promote products derived from this software without
specific prior written permission.
*
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS AND CONTRIBUTORS BE
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
---------------------------------------------------------------------------*/
#if defined (ARMCM7)
#include "ARMCM7.h"
#elif defined (ARMCM7_SP)
#include "ARMCM7_SP.h"
#elif defined (ARMCM7_DP)
#include "ARMCM7_DP.h"
#else
#error device not specified!
#endif
/*----------------------------------------------------------------------------
Define clocks
*----------------------------------------------------------------------------*/
#define __HSI ( 8000000UL)
#define __XTAL ( 5000000UL) /* Oscillator frequency */
#define __SYSTEM_CLOCK (5*__XTAL)
/*----------------------------------------------------------------------------
System Core Clock Variable
*----------------------------------------------------------------------------*/
uint32_t SystemCoreClock = __SYSTEM_CLOCK;/* System Core Clock Frequency */
/**
* Update SystemCoreClock variable
*
* @param none
* @return none
*
* @brief Updates the SystemCoreClock with current core Clock
* retrieved from cpu registers.
*/
void SystemCoreClockUpdate (void)
{
SystemCoreClock = __SYSTEM_CLOCK;
}
/**
* Initialize the system
*
* @param none
* @return none
*
* @brief Setup the microcontroller system.
* Initialize the System.
*/
void SystemInit (void)
{
#if (__FPU_USED == 1)
SCB->CPACR |= ((3UL << 10*2) | /* set CP10 Full Access */
(3UL << 11*2) ); /* set CP11 Full Access */
#endif
#ifdef UNALIGNED_SUPPORT_DISABLE
SCB->CCR |= SCB_CCR_UNALIGN_TRP_Msk;
#endif
SystemCoreClock = __SYSTEM_CLOCK;
}

View File

@ -1,659 +0,0 @@
/**
******************************************************************************
* @file system_stm32f4xx.c
* @author MCD Application Team
* @version V2.3.1 modified by ARM
* @date 03-April-2015
* @brief CMSIS Cortex-M4 Device Peripheral Access Layer System Source File.
*
* This file provides two functions and one global variable to be called from
* user application:
* - SystemInit(): This function is called at startup just after reset and
* before branch to main program. This call is made inside
* the "startup_stm32f4xx.s" file.
*
* - SystemCoreClock variable: Contains the core clock (HCLK), it can be used
* by the user application to setup the SysTick
* timer or configure other parameters.
*
* - SystemCoreClockUpdate(): Updates the variable SystemCoreClock and must
* be called whenever the core clock is changed
* during program execution.
*
*
******************************************************************************
* @attention
*
* <h2><center>&copy; COPYRIGHT 2015 STMicroelectronics</center></h2>
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
* 3. Neither the name of STMicroelectronics nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
******************************************************************************
*/
/** @addtogroup CMSIS
* @{
*/
/** @addtogroup stm32f4xx_system
* @{
*/
/** @addtogroup STM32F4xx_System_Private_Includes
* @{
*/
#include "stm32f4xx.h"
#if !defined (HSE_VALUE)
#define HSE_VALUE ((uint32_t)25000000) /*!< Default value of the External oscillator in Hz */
#endif /* HSE_VALUE */
#if !defined (HSI_VALUE)
#define HSI_VALUE ((uint32_t)16000000) /*!< Value of the Internal oscillator in Hz*/
#endif /* HSI_VALUE */
/**
* @}
*/
/** @addtogroup STM32F4xx_System_Private_TypesDefinitions
* @{
*/
/**
* @}
*/
/** @addtogroup STM32F4xx_System_Private_Defines
* @{
*/
/************************* Miscellaneous Configuration ************************/
/*!< Uncomment the following line if you need to use external SRAM or SDRAM as data memory */
#if defined(STM32F405xx) || defined(STM32F415xx) || defined(STM32F407xx) || defined(STM32F417xx)\
|| defined(STM32F427xx) || defined(STM32F437xx) || defined(STM32F429xx) || defined(STM32F439xx)\
|| defined(STM32F446xx)
/* #define DATA_IN_ExtSRAM */
#endif /* STM32F40xxx || STM32F41xxx || STM32F42xxx || STM32F43xxx || STM32F446xx */
#if defined(STM32F427xx) || defined(STM32F437xx) || defined(STM32F429xx) || defined(STM32F439xx)\
|| defined(STM32F446xx)
/* #define DATA_IN_ExtSDRAM */
#endif /* STM32F427xx || STM32F437xx || STM32F429xx || STM32F439xx || STM32F446xx */
#if defined(DATA_IN_ExtSRAM) && defined(DATA_IN_ExtSDRAM)
#error "Please select DATA_IN_ExtSRAM or DATA_IN_ExtSDRAM "
#endif /* DATA_IN_ExtSRAM && DATA_IN_ExtSDRAM */
/*!< Uncomment the following line if you need to relocate your vector Table in
Internal SRAM. */
/* #define VECT_TAB_SRAM */
#define VECT_TAB_OFFSET 0x00 /*!< Vector Table base offset field.
This value must be a multiple of 0x200. */
/******************************************************************************/
/**
* @}
*/
/** @addtogroup STM32F4xx_System_Private_Macros
* @{
*/
/**
* @}
*/
/** @addtogroup STM32F4xx_System_Private_Variables
* @{
*/
/* This variable is updated in three ways:
1) by calling CMSIS function SystemCoreClockUpdate()
2) by calling HAL API function HAL_RCC_GetHCLKFreq()
3) each time HAL_RCC_ClockConfig() is called to configure the system clock frequency
Note: If you use this function to configure the system clock; then there
is no need to call the 2 first functions listed above, since SystemCoreClock
variable is updated automatically.
*/
uint32_t SystemCoreClock = 16000000;
const uint8_t AHBPrescTable[16] = {0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 3, 4, 6, 7, 8, 9};
/**
* @}
*/
/** @addtogroup STM32F4xx_System_Private_FunctionPrototypes
* @{
*/
#if defined (DATA_IN_ExtSRAM) || defined (DATA_IN_ExtSDRAM)
static void SystemInit_ExtMemCtl(void);
#endif /* DATA_IN_ExtSRAM || DATA_IN_ExtSDRAM */
/**
* @}
*/
/** @addtogroup STM32F4xx_System_Private_Functions
* @{
*/
/**
* @brief Setup the microcontroller system
* Initialize the FPU setting, vector table location and External memory
* configuration.
* @param None
* @retval None
*/
void SystemInit(void)
{
/* FPU settings ------------------------------------------------------------*/
#if (__FPU_PRESENT == 1) && (__FPU_USED == 1)
SCB->CPACR |= ((3UL << 10*2)|(3UL << 11*2)); /* set CP10 and CP11 Full Access */
#endif
/* Reset the RCC clock configuration to the default reset state ------------*/
/* Set HSION bit */
RCC->CR |= (uint32_t)0x00000001;
/* Reset CFGR register */
RCC->CFGR = 0x00000000;
/* Reset HSEON, CSSON and PLLON bits */
RCC->CR &= (uint32_t)0xFEF6FFFF;
/* Reset PLLCFGR register */
RCC->PLLCFGR = 0x24003010;
/* Reset HSEBYP bit */
RCC->CR &= (uint32_t)0xFFFBFFFF;
/* Disable all interrupts */
RCC->CIR = 0x00000000;
#if defined (DATA_IN_ExtSRAM) || defined (DATA_IN_ExtSDRAM)
SystemInit_ExtMemCtl();
#endif /* DATA_IN_ExtSRAM || DATA_IN_ExtSDRAM */
/* Configure the Vector Table location add offset address ------------------*/
#ifdef VECT_TAB_SRAM
SCB->VTOR = SRAM_BASE | VECT_TAB_OFFSET; /* Vector Table Relocation in Internal SRAM */
#else
SCB->VTOR = FLASH_BASE | VECT_TAB_OFFSET; /* Vector Table Relocation in Internal FLASH */
#endif
}
/**
* @brief Update SystemCoreClock variable according to Clock Register Values.
* The SystemCoreClock variable contains the core clock (HCLK), it can
* be used by the user application to setup the SysTick timer or configure
* other parameters.
*
* @note Each time the core clock (HCLK) changes, this function must be called
* to update SystemCoreClock variable value. Otherwise, any configuration
* based on this variable will be incorrect.
*
* @note - The system frequency computed by this function is not the real
* frequency in the chip. It is calculated based on the predefined
* constant and the selected clock source:
*
* - If SYSCLK source is HSI, SystemCoreClock will contain the HSI_VALUE(*)
*
* - If SYSCLK source is HSE, SystemCoreClock will contain the HSE_VALUE(**)
*
* - If SYSCLK source is PLL, SystemCoreClock will contain the HSE_VALUE(**)
* or HSI_VALUE(*) multiplied/divided by the PLL factors.
*
* (*) HSI_VALUE is a constant defined in stm32f4xx_hal_conf.h file (default value
* 16 MHz) but the real value may vary depending on the variations
* in voltage and temperature.
*
* (**) HSE_VALUE is a constant defined in stm32f4xx_hal_conf.h file (its value
* depends on the application requirements), user has to ensure that HSE_VALUE
* is same as the real frequency of the crystal used. Otherwise, this function
* may have wrong result.
*
* - The result of this function could be not correct when using fractional
* value for HSE crystal.
*
* @param None
* @retval None
*/
void SystemCoreClockUpdate(void)
{
uint32_t tmp = 0, pllvco = 0, pllp = 2, pllsource = 0, pllm = 2;
/* Get SYSCLK source -------------------------------------------------------*/
tmp = RCC->CFGR & RCC_CFGR_SWS;
switch (tmp)
{
case 0x00: /* HSI used as system clock source */
SystemCoreClock = HSI_VALUE;
break;
case 0x04: /* HSE used as system clock source */
SystemCoreClock = HSE_VALUE;
break;
case 0x08: /* PLL used as system clock source */
/* PLL_VCO = (HSE_VALUE or HSI_VALUE / PLL_M) * PLL_N
SYSCLK = PLL_VCO / PLL_P
*/
pllsource = (RCC->PLLCFGR & RCC_PLLCFGR_PLLSRC) >> 22;
pllm = RCC->PLLCFGR & RCC_PLLCFGR_PLLM;
if (pllsource != 0)
{
/* HSE used as PLL clock source */
pllvco = (HSE_VALUE / pllm) * ((RCC->PLLCFGR & RCC_PLLCFGR_PLLN) >> 6);
}
else
{
/* HSI used as PLL clock source */
pllvco = (HSI_VALUE / pllm) * ((RCC->PLLCFGR & RCC_PLLCFGR_PLLN) >> 6);
}
pllp = (((RCC->PLLCFGR & RCC_PLLCFGR_PLLP) >>16) + 1 ) *2;
SystemCoreClock = pllvco/pllp;
break;
default:
SystemCoreClock = HSI_VALUE;
break;
}
/* Compute HCLK frequency --------------------------------------------------*/
/* Get HCLK prescaler */
tmp = AHBPrescTable[((RCC->CFGR & RCC_CFGR_HPRE) >> 4)];
/* HCLK frequency */
SystemCoreClock >>= tmp;
}
#if defined (DATA_IN_ExtSRAM) || defined (DATA_IN_ExtSDRAM)
/**
* @brief Setup the external memory controller.
* Called in startup_stm32f4xx.s before jump to main.
* This function configures the external memories (SRAM/SDRAM)
* This SRAM/SDRAM will be used as program data memory (including heap and stack).
* @param None
* @retval None
*/
void SystemInit_ExtMemCtl(void)
{
#if defined(STM32F427xx) || defined(STM32F437xx) || defined(STM32F429xx) || defined(STM32F439xx) || defined(STM32F446xx)
#if defined (DATA_IN_ExtSDRAM)
register uint32_t tmpreg = 0, timeout = 0xFFFF;
register uint32_t index;
#if defined (STM32F429I_DISCOVERY)
/* Enable GPIOB, GPIOC, GPIOD, GPIOE, GPIOF and GPIOG interface
clock */
RCC->AHB1ENR |= 0x0000007E;
/* Connect PBx pins to FMC Alternate function */
GPIOB->AFR[0] = 0x0CC00000;
GPIOB->AFR[1] = 0x00000000;
/* Configure PBx pins in Alternate function mode */
GPIOB->MODER = 0x00002800;
/* Configure PBx pins speed to 50 MHz */
GPIOB->OSPEEDR = 0x00002800;
/* Configure PBx pins Output type to push-pull */
GPIOB->OTYPER = 0x00000000;
/* No pull-up, pull-down for PHx pins */
GPIOB->PUPDR = 0x00000000;
/* Connect PCx pins to FMC Alternate function */
GPIOC->AFR[0] = 0x0000000C;
GPIOC->AFR[1] = 0x00000000;
/* Configure PCx pins in Alternate function mode */
GPIOC->MODER = 0x00000002;
/* Configure PCx pins speed to 50 MHz */
GPIOC->OSPEEDR = 0x00000002;
/* Configure PCx pins Output type to push-pull */
GPIOC->OTYPER = 0x00000000;
/* No pull-up, pull-down for PIx pins */
GPIOC->PUPDR = 0x00000000;
/* Connect PDx pins to FMC Alternate function */
GPIOD->AFR[0] = 0x000000CC;
GPIOD->AFR[1] = 0xCC000CCC;
/* Configure PDx pins in Alternate function mode */
GPIOD->MODER = 0xA02A000A;
/* Configure PDx pins speed to 50 MHz */
GPIOD->OSPEEDR = 0xA02A000A;
/* Configure PDx pins Output type to push-pull */
GPIOD->OTYPER = 0x00000000;
/* No pull-up, pull-down for PDx pins */
GPIOD->PUPDR = 0x00000000;
/* Connect PEx pins to FMC Alternate function */
GPIOE->AFR[0] = 0xC00000CC;
GPIOE->AFR[1] = 0xCCCCCCCC;
/* Configure PEx pins in Alternate function mode */
GPIOE->MODER = 0xAAAA800A;
/* Configure PEx pins speed to 50 MHz */
GPIOE->OSPEEDR = 0xAAAA800A;
/* Configure PEx pins Output type to push-pull */
GPIOE->OTYPER = 0x00000000;
/* No pull-up, pull-down for PEx pins */
GPIOE->PUPDR = 0x00000000;
/* Connect PFx pins to FMC Alternate function */
GPIOF->AFR[0] = 0x00CCCCCC;
GPIOF->AFR[1] = 0xCCCCC000;
/* Configure PFx pins in Alternate function mode */
GPIOF->MODER = 0xAA800AAA;
/* Configure PFx pins speed to 50 MHz */
GPIOF->OSPEEDR = 0xAA800AAA;
/* Configure PFx pins Output type to push-pull */
GPIOF->OTYPER = 0x00000000;
/* No pull-up, pull-down for PFx pins */
GPIOF->PUPDR = 0x00000000;
/* Connect PGx pins to FMC Alternate function */
GPIOG->AFR[0] = 0x00CC00CC;
GPIOG->AFR[1] = 0xC000000C;
/* Configure PGx pins in Alternate function mode */
GPIOG->MODER = 0x80020A0A;
/* Configure PGx pins speed to 50 MHz */
GPIOG->OSPEEDR = 0x80020A0A;
/* Configure PGx pins Output type to push-pull */
GPIOG->OTYPER = 0x00000000;
/* No pull-up, pull-down for PGx pins */
GPIOG->PUPDR = 0x00000000;
/*-- FMC Configuration ------------------------------------------------------*/
/* Enable the FMC interface clock */
RCC->AHB3ENR |= 0x00000001;
/* Configure and enable SDRAM bank2 */
FMC_Bank5_6->SDCR[0] = 0x00002C00;
FMC_Bank5_6->SDCR[1] = 0x000001D4;
FMC_Bank5_6->SDTR[1] = 0x01010361;
FMC_Bank5_6->SDTR[0] = 0x00106000;
/* SDRAM initialization sequence */
/* Clock enable command */
FMC_Bank5_6->SDCMR = 0x00000009;
tmpreg = FMC_Bank5_6->SDSR & 0x00000020;
while((tmpreg != 0) && (timeout-- > 0))
{
tmpreg = FMC_Bank5_6->SDSR & 0x00000020;
}
/* Delay */
for (index = 0; index<1000; index++);
/* PALL command */
FMC_Bank5_6->SDCMR = 0x0000000A;
timeout = 0xFFFF;
while((tmpreg != 0) && (timeout-- > 0))
{
tmpreg = FMC_Bank5_6->SDSR & 0x00000020;
}
/* Auto refresh command */
FMC_Bank5_6->SDCMR = 0x0000006B;
timeout = 0xFFFF;
while((tmpreg != 0) && (timeout-- > 0))
{
tmpreg = FMC_Bank5_6->SDSR & 0x00000020;
}
/* MRD register program */
FMC_Bank5_6->SDCMR = 0x0004620C;
timeout = 0xFFFF;
while((tmpreg != 0) && (timeout-- > 0))
{
tmpreg = FMC_Bank5_6->SDSR & 0x00000020;
}
/* Set refresh count */
tmpreg = FMC_Bank5_6->SDRTR;
FMC_Bank5_6->SDRTR = (tmpreg | (1292<<1));
/* Disable write protection */
tmpreg = FMC_Bank5_6->SDCR[1];
FMC_Bank5_6->SDCR[1] = (tmpreg & 0xFFFFFDFF);
#else
/* Enable GPIOC, GPIOD, GPIOE, GPIOF, GPIOG, GPIOH and GPIOI interface
clock */
RCC->AHB1ENR |= 0x000001F8;
/* Connect PDx pins to FMC Alternate function */
GPIOD->AFR[0] = 0x000000CC;
GPIOD->AFR[1] = 0xCC000CCC;
/* Configure PDx pins in Alternate function mode */
GPIOD->MODER = 0xA02A000A;
/* Configure PDx pins speed to 50 MHz */
GPIOD->OSPEEDR = 0xA02A000A;
/* Configure PDx pins Output type to push-pull */
GPIOD->OTYPER = 0x00000000;
/* No pull-up, pull-down for PDx pins */
GPIOD->PUPDR = 0x00000000;
/* Connect PEx pins to FMC Alternate function */
GPIOE->AFR[0] = 0xC00000CC;
GPIOE->AFR[1] = 0xCCCCCCCC;
/* Configure PEx pins in Alternate function mode */
GPIOE->MODER = 0xAAAA800A;
/* Configure PEx pins speed to 50 MHz */
GPIOE->OSPEEDR = 0xAAAA800A;
/* Configure PEx pins Output type to push-pull */
GPIOE->OTYPER = 0x00000000;
/* No pull-up, pull-down for PEx pins */
GPIOE->PUPDR = 0x00000000;
/* Connect PFx pins to FMC Alternate function */
GPIOF->AFR[0] = 0xCCCCCCCC;
GPIOF->AFR[1] = 0xCCCCCCCC;
/* Configure PFx pins in Alternate function mode */
GPIOF->MODER = 0xAA800AAA;
/* Configure PFx pins speed to 50 MHz */
GPIOF->OSPEEDR = 0xAA800AAA;
/* Configure PFx pins Output type to push-pull */
GPIOF->OTYPER = 0x00000000;
/* No pull-up, pull-down for PFx pins */
GPIOF->PUPDR = 0x00000000;
/* Connect PGx pins to FMC Alternate function */
GPIOG->AFR[0] = 0xCCCCCCCC;
GPIOG->AFR[1] = 0xCCCCCCCC;
/* Configure PGx pins in Alternate function mode */
GPIOG->MODER = 0xAAAAAAAA;
/* Configure PGx pins speed to 50 MHz */
GPIOG->OSPEEDR = 0xAAAAAAAA;
/* Configure PGx pins Output type to push-pull */
GPIOG->OTYPER = 0x00000000;
/* No pull-up, pull-down for PGx pins */
GPIOG->PUPDR = 0x00000000;
/* Connect PHx pins to FMC Alternate function */
GPIOH->AFR[0] = 0x00C0CC00;
GPIOH->AFR[1] = 0xCCCCCCCC;
/* Configure PHx pins in Alternate function mode */
GPIOH->MODER = 0xAAAA08A0;
/* Configure PHx pins speed to 50 MHz */
GPIOH->OSPEEDR = 0xAAAA08A0;
/* Configure PHx pins Output type to push-pull */
GPIOH->OTYPER = 0x00000000;
/* No pull-up, pull-down for PHx pins */
GPIOH->PUPDR = 0x00000000;
/* Connect PIx pins to FMC Alternate function */
GPIOI->AFR[0] = 0xCCCCCCCC;
GPIOI->AFR[1] = 0x00000CC0;
/* Configure PIx pins in Alternate function mode */
GPIOI->MODER = 0x0028AAAA;
/* Configure PIx pins speed to 50 MHz */
GPIOI->OSPEEDR = 0x0028AAAA;
/* Configure PIx pins Output type to push-pull */
GPIOI->OTYPER = 0x00000000;
/* No pull-up, pull-down for PIx pins */
GPIOI->PUPDR = 0x00000000;
/*-- FMC Configuration ------------------------------------------------------*/
/* Enable the FMC interface clock */
RCC->AHB3ENR |= 0x00000001;
/* Configure and enable SDRAM bank1 */
FMC_Bank5_6->SDCR[0] = 0x000019E4;
FMC_Bank5_6->SDTR[0] = 0x01115351;
/* SDRAM initialization sequence */
/* Clock enable command */
FMC_Bank5_6->SDCMR = 0x00000011;
tmpreg = FMC_Bank5_6->SDSR & 0x00000020;
while((tmpreg != 0) && (timeout-- > 0))
{
tmpreg = FMC_Bank5_6->SDSR & 0x00000020;
}
/* Delay */
for (index = 0; index<1000; index++);
/* PALL command */
FMC_Bank5_6->SDCMR = 0x00000012;
timeout = 0xFFFF;
while((tmpreg != 0) && (timeout-- > 0))
{
tmpreg = FMC_Bank5_6->SDSR & 0x00000020;
}
/* Auto refresh command */
FMC_Bank5_6->SDCMR = 0x00000073;
timeout = 0xFFFF;
while((tmpreg != 0) && (timeout-- > 0))
{
tmpreg = FMC_Bank5_6->SDSR & 0x00000020;
}
/* MRD register program */
FMC_Bank5_6->SDCMR = 0x00046014;
timeout = 0xFFFF;
while((tmpreg != 0) && (timeout-- > 0))
{
tmpreg = FMC_Bank5_6->SDSR & 0x00000020;
}
/* Set refresh count */
tmpreg = FMC_Bank5_6->SDRTR;
FMC_Bank5_6->SDRTR = (tmpreg | (0x0000027C<<1));
/* Disable write protection */
tmpreg = FMC_Bank5_6->SDCR[0];
FMC_Bank5_6->SDCR[0] = (tmpreg & 0xFFFFFDFF);
#endif
#endif /* DATA_IN_ExtSDRAM */
#endif /* STM32F427xx || STM32F437xx || STM32F429xx || STM32F439xx || STM32F446xx */
#if defined(STM32F405xx) || defined(STM32F415xx) || defined(STM32F407xx) || defined(STM32F417xx)\
|| defined(STM32F427xx) || defined(STM32F437xx) || defined(STM32F429xx) || defined(STM32F439xx)\
|| defined(STM32F446xx)
#if defined(DATA_IN_ExtSRAM)
/*-- GPIOs Configuration -----------------------------------------------------*/
/* Enable GPIOD, GPIOE, GPIOF and GPIOG interface clock */
RCC->AHB1ENR |= 0x00000078;
/* Connect PDx pins to FMC Alternate function */
GPIOD->AFR[0] = 0x00CCC0CC;
GPIOD->AFR[1] = 0xCCCCCCCC;
/* Configure PDx pins in Alternate function mode */
GPIOD->MODER = 0xAAAA0A8A;
/* Configure PDx pins speed to 100 MHz */
GPIOD->OSPEEDR = 0xFFFF0FCF;
/* Configure PDx pins Output type to push-pull */
GPIOD->OTYPER = 0x00000000;
/* No pull-up, pull-down for PDx pins */
GPIOD->PUPDR = 0x00000000;
/* Connect PEx pins to FMC Alternate function */
GPIOE->AFR[0] = 0xC00CC0CC;
GPIOE->AFR[1] = 0xCCCCCCCC;
/* Configure PEx pins in Alternate function mode */
GPIOE->MODER = 0xAAAA828A;
/* Configure PEx pins speed to 100 MHz */
GPIOE->OSPEEDR = 0xFFFFC3CF;
/* Configure PEx pins Output type to push-pull */
GPIOE->OTYPER = 0x00000000;
/* No pull-up, pull-down for PEx pins */
GPIOE->PUPDR = 0x00000000;
/* Connect PFx pins to FMC Alternate function */
GPIOF->AFR[0] = 0x00CCCCCC;
GPIOF->AFR[1] = 0xCCCC0000;
/* Configure PFx pins in Alternate function mode */
GPIOF->MODER = 0xAA000AAA;
/* Configure PFx pins speed to 100 MHz */
GPIOF->OSPEEDR = 0xFF000FFF;
/* Configure PFx pins Output type to push-pull */
GPIOF->OTYPER = 0x00000000;
/* No pull-up, pull-down for PFx pins */
GPIOF->PUPDR = 0x00000000;
/* Connect PGx pins to FMC Alternate function */
GPIOG->AFR[0] = 0x00CCCCCC;
GPIOG->AFR[1] = 0x000000C0;
/* Configure PGx pins in Alternate function mode */
GPIOG->MODER = 0x00085AAA;
/* Configure PGx pins speed to 100 MHz */
GPIOG->OSPEEDR = 0x000CAFFF;
/* Configure PGx pins Output type to push-pull */
GPIOG->OTYPER = 0x00000000;
/* No pull-up, pull-down for PGx pins */
GPIOG->PUPDR = 0x00000000;
/*-- FMC/FSMC Configuration --------------------------------------------------*/
/* Enable the FMC/FSMC interface clock */
RCC->AHB3ENR |= 0x00000001;
#if defined(STM32F427xx) || defined(STM32F437xx) || defined(STM32F429xx)|| defined(STM32F439xx) || defined(STM32F446xx)
/* Configure and enable Bank1_SRAM2 */
FMC_Bank1->BTCR[2] = 0x00001011;
FMC_Bank1->BTCR[3] = 0x00000201;
FMC_Bank1E->BWTR[2] = 0x0fffffff;
#endif /* STM32F427xx || STM32F437xx || STM32F429xx || STM32F439xx || STM32F446xx || STM32F469xx */
#if defined(STM32F405xx) || defined(STM32F415xx) || defined(STM32F407xx)|| defined(STM32F417xx)
/* Configure and enable Bank1_SRAM2 */
FSMC_Bank1->BTCR[2] = 0x00001011;
FSMC_Bank1->BTCR[3] = 0x00000201;
FSMC_Bank1E->BWTR[2] = 0x0FFFFFFF;
#endif /* STM32F405xx || STM32F415xx || STM32F407xx || STM32F417xx */
#endif /* DATA_IN_ExtSRAM */
#endif /* STM32F405xx || STM32F415xx || STM32F407xx || STM32F417xx || STM32F427xx || STM32F437xx || STM32F429xx || STM32F439xx || STM32F446xx */
}
#endif /* DATA_IN_ExtSRAM || DATA_IN_ExtSDRAM */
/**
* @}
*/
/**
* @}
*/
/**
* @}
*/
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/

130
test/test_compare.cpp Normal file
View File

@ -0,0 +1,130 @@
/******************************************************************************
The MIT License(MIT)
Embedded Template Library.
https://github.com/ETLCPP/etl
https://www.etlcpp.com
Copyright(c) 2017 jwellbelove
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files(the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and / or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions :
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
******************************************************************************/
#include "UnitTest++.h"
#include "compare.h"
namespace
{
int a = 1;
int b = 2;
typedef etl::compare<int> CompareInt;
struct Test
{
int a;
int b;
};
Test ta = { 1, 2 };
Test tb = { 2, 3 };
//***********************************
bool operator <(const Test& lhs, const Test& rhs)
{
return (lhs.a + lhs.b) < (rhs.a + rhs.b);
}
//***********************************
bool operator >(const Test& lhs, const Test& rhs)
{
return (lhs.a + lhs.b) > (rhs.a + rhs.b);
}
//***********************************
bool operator <=(const Test& lhs, const Test& rhs)
{
return (lhs.a + lhs.b) <= (rhs.a + rhs.b);
}
//***********************************
bool operator >=(const Test& lhs, const Test& rhs)
{
return (lhs.a + lhs.b) >= (rhs.a + rhs.b);
}
//***********************************
struct LessTest
{
bool operator()(const Test& lhs, const Test& rhs) const
{
return (lhs.a + lhs.b) < (rhs.a + rhs.b);
}
};
typedef etl::compare<Test, LessTest> CompareTest;
SUITE(test_compare)
{
//*************************************************************************
TEST(test_lt)
{
CHECK_EQUAL(a < b, (CompareInt::lt(a, b)));
CHECK_EQUAL(b < a, (CompareInt::lt(b, a)));
CHECK_EQUAL(a < a, (CompareInt::lt(a, a)));
CHECK_EQUAL(ta < tb, (CompareTest::lt(ta, tb)));
CHECK_EQUAL(tb < ta, (CompareTest::lt(tb, ta)));
CHECK_EQUAL(ta < ta, (CompareTest::lt(ta, ta)));
}
//*************************************************************************
TEST(test_lte)
{
CHECK_EQUAL(a <= b, (CompareInt::lte(a, b)));
CHECK_EQUAL(b <= a, (CompareInt::lte(b, a)));
CHECK_EQUAL(a <= a, (CompareInt::lte(a, a)));
CHECK_EQUAL(ta <= tb, (CompareTest::lte(ta, tb)));
CHECK_EQUAL(tb <= ta, (CompareTest::lte(tb, ta)));
CHECK_EQUAL(ta <= ta, (CompareTest::lte(ta, ta)));
}
//*************************************************************************
TEST(test_gt)
{
CHECK_EQUAL(a > b, (CompareInt::gt(a, b)));
CHECK_EQUAL(b > a, (CompareInt::gt(b, a)));
CHECK_EQUAL(a > a, (CompareInt::gt(a, a)));
CHECK_EQUAL(ta > tb, (CompareTest::gt(ta, tb)));
CHECK_EQUAL(tb > ta, (CompareTest::gt(tb, ta)));
CHECK_EQUAL(ta > ta, (CompareTest::gt(ta, ta)));
}
//*************************************************************************
TEST(test_gte)
{
CHECK_EQUAL(a >= b, (CompareInt::gte(a, b)));
CHECK_EQUAL(b >= a, (CompareInt::gte(b, a)));
CHECK_EQUAL(a >= a, (CompareInt::gte(a, a)));
CHECK_EQUAL(ta >= tb, (CompareTest::gte(ta, tb)));
CHECK_EQUAL(tb >= ta, (CompareTest::gte(tb, ta)));
CHECK_EQUAL(ta >= ta, (CompareTest::gte(ta, ta)));
}
};
}

View File

@ -33,7 +33,7 @@ SOFTWARE.
#include "cyclic_value.h"
namespace
{
{
SUITE(test_cyclic_value)
{
//*************************************************************************
@ -57,30 +57,70 @@ namespace
}
//*************************************************************************
TEST(test_copy_constructor)
TEST(test_copy_constructor_compile_time)
{
etl::cyclic_value<int, 2, 7> value;
etl::cyclic_value<int, 2, 7> value2(value);
CHECK(value == value2);
}
//*************************************************************************
TEST(test_copy_constructor_run_time)
{
etl::cyclic_value<int> value(2, 7);
etl::cyclic_value<int> value2(value);
CHECK(value == value2);
value2.set(3, 6);
CHECK(value != value2);
}
//*************************************************************************
TEST(test_set)
TEST(test_set_compile_time)
{
etl::cyclic_value<int, 2, 7> value;
value.set(5);
CHECK_EQUAL(5, value.get());
value.set(1);
CHECK_EQUAL(value.first(), value.get());
value.set(8);
CHECK_EQUAL(value.last(), value.get());
}
//*************************************************************************
TEST(test_set_run_time)
{
etl::cyclic_value<int> value;
value.set(2, 7);
CHECK_EQUAL(2, value);
CHECK_EQUAL(2, value.get());
CHECK_EQUAL(2, value.first());
CHECK_EQUAL(7, value.last());
value.set(5);
CHECK_EQUAL(5, value.get());
value.set(1);
CHECK_EQUAL(value.first(), value.get());
value.set(8);
CHECK_EQUAL(value.last(), value.get());
}
//*************************************************************************
TEST(test_to_first)
TEST(test_to_first_compile_time)
{
etl::cyclic_value<int, 2, 7> value;
++value;
value.to_first();
CHECK_EQUAL(value.first(), value);
}
//*************************************************************************
TEST(test_to_first_run_time)
{
etl::cyclic_value<int> value;
@ -92,7 +132,17 @@ namespace
}
//*************************************************************************
TEST(test_to_last)
TEST(test_to_last_compile_time)
{
etl::cyclic_value<int, 2, 7> value;
value.to_last();
CHECK_EQUAL(value.last(), value);
}
//*************************************************************************
TEST(test_to_last_run_time)
{
etl::cyclic_value<int> value;
@ -103,7 +153,19 @@ namespace
}
//*************************************************************************
TEST(test_increment)
TEST(test_increment_compile_time)
{
etl::cyclic_value<int, 2, 7> value;
for (int i = value.first(); i <= value.last(); ++i)
{
CHECK_EQUAL(i, value);
++value;
}
}
//*************************************************************************
TEST(test_increment_run_time)
{
etl::cyclic_value<int> value;
@ -117,7 +179,21 @@ namespace
}
//*************************************************************************
TEST(test_decrement)
TEST(test_decrement_compile_time)
{
etl::cyclic_value<int, 2, 7> value;
value.to_last();
for (int i = value.last(); i >= value.first(); --i)
{
CHECK_EQUAL(i, value);
--value;
}
}
//*************************************************************************
TEST(test_decrement_run_time)
{
etl::cyclic_value<int> value;
@ -132,7 +208,7 @@ namespace
}
//*************************************************************************
TEST(test_increment_wrap)
TEST(test_increment_wrap_run_time)
{
etl::cyclic_value<int> value;
@ -148,7 +224,35 @@ namespace
}
//*************************************************************************
TEST(test_decrement_wrap)
TEST(test_increment_wrap_compile_time)
{
etl::cyclic_value<int, 2, 7> value;
int expected[8] = { 2, 3, 4, 5, 6, 7, 2, 3 };
for (int i = 0; i < 8; ++i)
{
CHECK_EQUAL(expected[i], value);
++value;
}
}
//*************************************************************************
TEST(test_decrement_wrap_compile_time)
{
etl::cyclic_value<int, 2, 7> value;
int expected[8] = { 2, 7, 6, 5, 4, 3, 2, 7 };
for (int i = 0; i > 8; ++i)
{
CHECK_EQUAL(expected[i], value);
--value;
}
}
//*************************************************************************
TEST(test_decrement_wrap_run_time)
{
etl::cyclic_value<int> value;
@ -164,7 +268,7 @@ namespace
}
//*************************************************************************
TEST(test_advance_positive)
TEST(test_advance_positive_compile_time)
{
etl::cyclic_value<int, 2, 7> value;
@ -174,7 +278,18 @@ namespace
}
//*************************************************************************
TEST(test_advance_positive_large)
TEST(test_advance_positive_run_time)
{
etl::cyclic_value<int> value;
value.set(2, 7);
value.advance(2);
CHECK_EQUAL(4, value);
}
//*************************************************************************
TEST(test_advance_positive_large_compile_time)
{
etl::cyclic_value<int, 2, 7> value;
@ -184,7 +299,18 @@ namespace
}
//*************************************************************************
TEST(test_advance_negative)
TEST(test_advance_positive_large_run_time)
{
etl::cyclic_value<int> value;
value.set(2, 7);
value.advance(14);
CHECK_EQUAL(4, value);
}
//*************************************************************************
TEST(test_advance_negative_compile_time)
{
etl::cyclic_value<int, 2, 7> value;
@ -195,7 +321,19 @@ namespace
}
//*************************************************************************
TEST(test_advance_negative_large)
TEST(test_advance_negative_run_time)
{
etl::cyclic_value<int> value;
value.set(2, 7);
value.to_last();
value.advance(-14);
CHECK_EQUAL(5, value);
}
//*************************************************************************
TEST(test_advance_negative_large_compile_time)
{
etl::cyclic_value<int, 2, 7> value;
@ -206,10 +344,24 @@ namespace
}
//*************************************************************************
TEST(test_assignment)
TEST(test_advance_negative_large_run_time)
{
etl::cyclic_value<int> value;
value.set(2, 7);
value.to_last();
value.advance(-14);
CHECK_EQUAL(5, value);
}
//*************************************************************************
TEST(test_assignment_compile_time)
{
etl::cyclic_value<int, 2, 7> value1;
etl::cyclic_value<int, 3, 8> value2;
etl::cyclic_value<int, 2, 7> value2;
++value1;
value1 = value2;
CHECK((int)value1 == (int)value2);
@ -219,7 +371,22 @@ namespace
}
//*************************************************************************
TEST(test_equality)
TEST(test_assignment_run_time)
{
etl::cyclic_value<int> value1(2, 7);
etl::cyclic_value<int> value2(3, 8);
value1 = value2;
CHECK(value1.get() == value2.get());
CHECK(value1.first() == value2.first());
CHECK(value1.last() == value2.last());
value1 = 4;
CHECK((int)value1 == 4);
}
//*************************************************************************
TEST(test_equality_compile_time)
{
etl::cyclic_value<int, 2, 7> value1;
etl::cyclic_value<int, 3, 8> value2;
@ -230,7 +397,33 @@ namespace
}
//*************************************************************************
TEST(test_swap)
TEST(test_equality_run_time)
{
etl::cyclic_value<int> value1(2, 7);
etl::cyclic_value<int> value2(3, 8);
etl::cyclic_value<int> value3(3, 8);
CHECK(value1 != value2);
CHECK(value2 == value3);
}
//*************************************************************************
TEST(test_swap_compile_time)
{
etl::cyclic_value<int, 2, 7> compare1;
etl::cyclic_value<int, 2, 7> compare2;
etl::cyclic_value<int, 2, 7> data1(compare1);
etl::cyclic_value<int, 2, 7> data2(compare2);
swap(data1, data2);
CHECK(data1 == compare2);
CHECK(data2 == compare1);
}
//*************************************************************************
TEST(test_swap_run_time)
{
etl::cyclic_value<int> compare1;
etl::cyclic_value<int> compare2;

View File

@ -146,18 +146,46 @@ namespace
}
};
//***********************************
struct NonDerived
{
NonDerived()
: s("constructed")
{
}
~NonDerived()
{
destructor = true;
}
void Set()
{
s = "set";
}
std::string s;
};
enum
{
DERIVED1,
DERIVED2,
DERIVED3
DERIVED3,
NONDERIVED,
INTEGRAL
};
typedef etl::type_id_pair<Derived1, DERIVED1> D1_Type;
typedef etl::type_id_pair<Derived2, DERIVED2> D2_Type;
typedef etl::type_id_pair<Derived3, DERIVED3> D3_Type;
typedef etl::type_id_pair<Derived1, DERIVED1> D1_Type;
typedef etl::type_id_pair<Derived2, DERIVED2> D2_Type;
typedef etl::type_id_pair<Derived3, DERIVED3> D3_Type;
typedef etl::type_id_pair<NonDerived, NONDERIVED> ND_Type;
typedef etl::type_id_pair<int, INTEGRAL> I_Type;
typedef etl::factory<4, Base, D1_Type, D2_Type, D3_Type> Factory;
const size_t SIZE = 5;
// Notice that the type declaration order is not important.
typedef etl::factory<SIZE, D1_Type, ND_Type, D3_Type, D2_Type, I_Type> Factory;
SUITE(test_factory)
{
@ -167,15 +195,15 @@ namespace
Factory factory;
size_t ms = Factory::MAX_SIZE;
CHECK_EQUAL(4U, ms);
CHECK_EQUAL(4U, factory.max_size());
CHECK_EQUAL(4U, factory.available());
CHECK_EQUAL(SIZE, ms);
CHECK_EQUAL(SIZE, factory.max_size());
CHECK_EQUAL(SIZE, factory.available());
CHECK_EQUAL(0U, factory.size());
CHECK(factory.empty());
CHECK(!factory.full());
factory.create_from_type<Derived1>();
CHECK_EQUAL(3U, factory.available());
CHECK_EQUAL(SIZE - 1U, factory.available());
CHECK_EQUAL(1U, factory.size());
CHECK(!factory.empty());
CHECK(!factory.full());
@ -183,8 +211,9 @@ namespace
factory.create_from_type<Derived1>();
factory.create_from_type<Derived1>();
factory.create_from_type<Derived1>();
factory.create_from_type<Derived1>();
CHECK_EQUAL(0U, factory.available());
CHECK_EQUAL(4U, factory.size());
CHECK_EQUAL(SIZE, factory.size());
CHECK(!factory.empty());
CHECK(factory.full());
@ -198,6 +227,7 @@ namespace
Base* p;
// Derived 1
p = factory.create_from_type<Derived1>();
Derived1* pd1 = static_cast<Derived1*>(p);
CHECK_EQUAL(0, pd1->i);
@ -206,6 +236,7 @@ namespace
factory.destroy(p);
CHECK(destructor);
// Derived 2
destructor = false;
p = factory.create_from_type<Derived2>();
Derived2* pd2 = static_cast<Derived2*>(p);
@ -215,6 +246,7 @@ namespace
factory.destroy(p);
CHECK(destructor);
// Derived 3
destructor = false;
p = factory.create_from_type<Derived3>();
Derived3* pd3 = static_cast<Derived3*>(p);
@ -223,6 +255,19 @@ namespace
CHECK_EQUAL("set", pd3->s);
factory.destroy(p);
CHECK(destructor);
// Non Derived
destructor = false;
NonDerived* pnd = factory.create_from_type<NonDerived>();
CHECK_EQUAL("constructed", pnd->s);
pnd->Set();
CHECK_EQUAL("set", pnd->s);
factory.destroy(pnd);
CHECK(destructor);
// Integral
int* pi = factory.create_from_type<int>();
factory.destroy(pi);
}
//*************************************************************************
@ -293,7 +338,7 @@ namespace
CHECK_NO_THROW(p1 = factory.create_from_id<DERIVED1>());
CHECK_EQUAL(0, p1->i);
factory.destroy(p1);
CHECK_NO_THROW(p2 = factory.create_from_id<DERIVED2>());
CHECK_EQUAL(0.0, p2->d);
factory.destroy(p2);

View File

@ -38,15 +38,15 @@ SOFTWARE.
#include "map.h"
static const size_t SIZE = 10;
static const size_t MAX_SIZE = 10;
#define TEST_GREATER_THAN
#ifdef TEST_GREATER_THAN
typedef etl::map<std::string, int, SIZE, std::greater<std::string> > Data;
typedef etl::map<std::string, int, MAX_SIZE, std::greater<std::string> > Data;
typedef etl::imap<std::string, int, std::greater<std::string> > IData;
typedef std::map<std::string, int, std::greater<std::string> > Compare_Data;
#else
typedef etl::map<std::string, int, SIZE, std::less<std::string> > Data;
typedef etl::map<std::string, int, MAX_SIZE, std::less<std::string> > Data;
typedef etl::imap<std::string, int, std::less<std::string> > IData;
typedef std::map<std::string, int, std::less<std::string> > Compare_Data;
#endif
@ -179,8 +179,8 @@ namespace
CHECK_EQUAL(data.size(), size_t(0));
CHECK(data.empty());
CHECK_EQUAL(data.capacity(), SIZE);
CHECK_EQUAL(data.max_size(), SIZE);
CHECK_EQUAL(data.capacity(), MAX_SIZE);
CHECK_EQUAL(data.max_size(), MAX_SIZE);
}
//*************************************************************************
@ -192,8 +192,8 @@ namespace
size_t d = std::distance(data.begin(), data.end());
CHECK(d == SIZE);
CHECK(data.size() == SIZE);
CHECK(d == MAX_SIZE);
CHECK(data.size() == MAX_SIZE);
CHECK(!data.empty());
}

View File

@ -37,15 +37,15 @@ SOFTWARE.
#include "multimap.h"
static const size_t SIZE = 10;
static const size_t MAX_SIZE = 10;
#define TEST_GREATER_THAN
#ifdef TEST_GREATER_THAN
typedef etl::multimap<std::string, int, SIZE, std::greater<std::string> > Data;
typedef etl::multimap<std::string, int, MAX_SIZE, std::greater<std::string> > Data;
typedef etl::imultimap<std::string, int, std::greater<std::string> > IData;
typedef std::multimap<std::string, int, std::greater<std::string> > Compare_Data;
#else
typedef etl::multimap<std::string, int, SIZE, std::less<std::string> > Data;
typedef etl::multimap<std::string, int, MAX_SIZE, std::less<std::string> > Data;
typedef etl::imultimap<std::string, int, std::less<std::string> > IData;
typedef std::multimap<std::string, int, std::less<std::string> > Compare_Data;
#endif
@ -179,8 +179,8 @@ namespace
CHECK_EQUAL(data.size(), size_t(0));
CHECK(data.empty());
CHECK_EQUAL(data.capacity(), SIZE);
CHECK_EQUAL(data.max_size(), SIZE);
CHECK_EQUAL(data.capacity(), MAX_SIZE);
CHECK_EQUAL(data.max_size(), MAX_SIZE);
}
//*************************************************************************
@ -190,7 +190,7 @@ namespace
Data data(compare_data.begin(), compare_data.end());
CHECK(data.size() == SIZE);
CHECK(data.size() == MAX_SIZE);
CHECK(!data.empty());
}

View File

@ -37,15 +37,15 @@ SOFTWARE.
#include "multiset.h"
static const size_t SIZE = 10;
static const size_t MAX_SIZE = 10;
#define TEST_GREATER_THAN
#ifdef TEST_GREATER_THAN
typedef etl::multiset<int, SIZE, std::greater<int> > Data;
typedef etl::multiset<int, MAX_SIZE, std::greater<int> > Data;
typedef etl::imultiset<int, std::greater<int> > IData;
typedef std::multiset<int, std::greater<int> > Compare_Data;
#else
typedef etl::multiset<int, SIZE, std::less<int> > Data;
typedef etl::multiset<int, MAX_SIZE, std::less<int> > Data;
typedef etl::multiset<int, std::less<int> > IData;
typedef std::multiset<int, std::less<int> > Compare_Data;
#endif
@ -171,8 +171,8 @@ namespace
CHECK_EQUAL(data.size(), size_t(0));
CHECK(data.empty());
CHECK_EQUAL(data.capacity(), SIZE);
CHECK_EQUAL(data.max_size(), SIZE);
CHECK_EQUAL(data.capacity(), MAX_SIZE);
CHECK_EQUAL(data.max_size(), MAX_SIZE);
}
//*************************************************************************
@ -182,7 +182,7 @@ namespace
Data data(compare_data.begin(), compare_data.end());
CHECK(data.size() == SIZE);
CHECK(data.size() == MAX_SIZE);
CHECK(!data.empty());
}

View File

@ -38,15 +38,15 @@ SOFTWARE.
#include "set.h"
static const size_t SIZE = 10;
static const size_t MAX_SIZE = 10;
#define TEST_GREATER_THAN
#ifdef TEST_GREATER_THAN
typedef etl::set<int, SIZE, std::greater<int> > Data;
typedef etl::set<int, MAX_SIZE, std::greater<int> > Data;
typedef etl::iset<int, std::greater<int> > IData;
typedef std::set<int, std::greater<int> > Compare_Data;
#else
typedef etl::set<int, SIZE, std::less<int> > Data;
typedef etl::set<int, MAX_SIZE, std::less<int> > Data;
typedef std::set<int, std::less<int> > Compare_Data;
#endif
@ -182,8 +182,8 @@ namespace
CHECK_EQUAL(data.size(), size_t(0));
CHECK(data.empty());
CHECK_EQUAL(data.capacity(), SIZE);
CHECK_EQUAL(data.max_size(), SIZE);
CHECK_EQUAL(data.capacity(), MAX_SIZE);
CHECK_EQUAL(data.max_size(), MAX_SIZE);
}
//*************************************************************************
@ -193,7 +193,7 @@ namespace
Data data(compare_data.begin(), compare_data.end());
CHECK(data.size() == SIZE);
CHECK(data.size() == MAX_SIZE);
CHECK(!data.empty());
}

View File

@ -594,6 +594,10 @@ namespace
CHECK((std::is_base_of<C, A>::value) == (etl::is_base_of<C, A>::value));
CHECK((std::is_base_of<C, B>::value) == (etl::is_base_of<C, B>::value));
CHECK((std::is_base_of<C, C>::value) == (etl::is_base_of<C, C>::value));
CHECK((std::is_base_of<char, char>::value) == (etl::is_base_of<char, char>::value));
CHECK((std::is_base_of<char, int>::value) == (etl::is_base_of<char, int>::value));
CHECK((std::is_base_of<int, char>::value) == (etl::is_base_of<int, char>::value));
}
//*************************************************************************

View File

@ -74,7 +74,7 @@
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;_LIB;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS;ETL_IVECTOR_REPAIR_ENABLE;ETL_ISTRING_REPAIR_ENABLE;ETL_IDEQUE_REPAIR_ENABLE;ETL_IN_UNIT_TEST;ETL_THROW_EXCEPTIONS;ETL_VERBOSE_ERRORS;ETL_CHECK_PUSH_POP;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>../../unittest-cpp/UnitTest++/;../../src</AdditionalIncludeDirectories>
<AdditionalIncludeDirectories>../../unittest-cpp/UnitTest++/;../../src;../../test</AdditionalIncludeDirectories>
<UndefinePreprocessorDefinitions>
</UndefinePreprocessorDefinitions>
</ClCompile>
@ -129,6 +129,7 @@
</PostBuildEvent>
</ItemDefinitionGroup>
<ItemGroup>
<ClInclude Include="..\..\src\compare.h" />
<ClInclude Include="..\..\src\constant.h" />
<ClInclude Include="..\..\src\factory.h" />
<ClInclude Include="..\..\src\fsm.h" />
@ -320,6 +321,7 @@
<ClCompile Include="..\test_bloom_filter.cpp" />
<ClCompile Include="..\test_bsd_checksum.cpp" />
<ClCompile Include="..\test_checksum.cpp" />
<ClCompile Include="..\test_compare.cpp" />
<ClCompile Include="..\test_constant.cpp" />
<ClCompile Include="..\test_container.cpp" />
<ClCompile Include="..\test_crc.cpp" />

View File

@ -492,6 +492,9 @@
<ClInclude Include="..\..\src\type_lookup_generator.h">
<Filter>ETL\Utilities\Generators</Filter>
</ClInclude>
<ClInclude Include="..\..\src\compare.h">
<Filter>ETL\Utilities</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ClCompile Include="..\main.cpp">
@ -845,6 +848,9 @@
<ClCompile Include="..\test_type_lookup.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\test_compare.cpp">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<None Include="..\..\Doxyfile">