STM32 driver -Wundef fix

This commit is contained in:
Pavel Kirienko
2015-01-10 01:52:25 +03:00
parent 53ee643480
commit c4c45b995f
10 changed files with 46 additions and 16 deletions
@@ -0,0 +1,32 @@
/*
* Copyright (C) 2015 Pavel Kirienko <pavel.kirienko@gmail.com>
*/
#pragma once
/**
* OS detection
*/
#ifndef UAVCAN_STM32_CHIBIOS
# define UAVCAN_STM32_CHIBIOS 0
#endif
#ifndef UAVCAN_STM32_NUTTX
# define UAVCAN_STM32_NUTTX 0
#endif
/**
* Number of interfaces must be enabled explicitly
*/
#if !defined(UAVCAN_STM32_NUM_IFACES) || (UAVCAN_STM32_NUM_IFACES != 1 && UAVCAN_STM32_NUM_IFACES != 2)
# error "UAVCAN_STM32_NUM_IFACES must be set to either 1 or 2"
#endif
/**
* Any General-Purpose timer (TIM2, TIM3, TIM4, TIM5)
* e.g. -DUAVCAN_STM32_TIMER_NUMBER=2
*/
#ifndef UAVCAN_STM32_TIMER_NUMBER
// In this case the clock driver should be implemented by the application
# define UAVCAN_STM32_TIMER_NUMBER 0
#endif
@@ -5,6 +5,8 @@
#pragma once
#include <uavcan_stm32/build_config.hpp>
#include <uavcan/uavcan.hpp>
#include <stdint.h>
@@ -17,10 +19,6 @@
# define constexpr const
#endif
#if !defined(UAVCAN_STM32_NUM_IFACES) || (UAVCAN_STM32_NUM_IFACES != 1 && UAVCAN_STM32_NUM_IFACES != 2)
# error UAVCAN_STM32_NUM_IFACES
#endif
namespace uavcan_stm32
{
namespace bxcan
@@ -4,6 +4,7 @@
#pragma once
#include <uavcan_stm32/build_config.hpp>
#include <uavcan_stm32/thread.hpp>
#include <uavcan/driver/can.hpp>
#include <uavcan_stm32/bxcan.hpp>
@@ -4,6 +4,7 @@
#pragma once
#include <uavcan_stm32/build_config.hpp>
#include <uavcan/driver/system_clock.hpp>
namespace uavcan_stm32
@@ -4,6 +4,8 @@
#pragma once
#include <uavcan_stm32/build_config.hpp>
#if UAVCAN_STM32_CHIBIOS
# include <ch.hpp>
#elif UAVCAN_STM32_NUTTX
@@ -4,6 +4,8 @@
#pragma once
#include <uavcan_stm32/build_config.hpp>
#if UAVCAN_STM32_CHIBIOS
# include <hal.h>
#elif UAVCAN_STM32_NUTTX
@@ -52,14 +54,6 @@
# endif
#endif
/**
* Any General-Purpose timer (TIM2, TIM3, TIM4, TIM5)
* e.g. -DUAVCAN_STM32_TIMER_NUMBER=2
*/
#ifndef UAVCAN_STM32_TIMER_NUMBER
// In this case the clock driver should be implemented by the application
#endif
/**
* Glue macros
*/
@@ -126,7 +126,7 @@ uavcan::MonotonicTime getMonotonic()
}
usec = time + cnt;
#if !NDEBUG
#ifndef NDEBUG
static uavcan::uint64_t prev_usec = 0; // Self-test
UAVCAN_ASSERT(prev_usec <= usec);
prev_usec = usec;
@@ -40,6 +40,8 @@ UINCDIR += src/sys
SERIAL_CLI_PORT_NUMBER = 2
CPPWARN := -Wundef -Wno-error=undef
RELEASE_OPT = -Os -fomit-frame-pointer
DEBUG_OPT = -Os -g3
#USE_OPT = -flto
@@ -1,4 +1,4 @@
UAVCAN test project for STM32
-----------------------------
Please checkout/symlink https://github.com/Zubax/zubax_chibios into subdirectory `zubax_chibios`; then follow instructions in `zubax_chibios/README.md`.
Please checkout/symlink https://github.com/Zubax/zubax_chibios, branch `stable_v1`, into subdirectory `zubax_chibios`; then follow instructions in `zubax_chibios/README.md`.
@@ -9,7 +9,7 @@
#define CH_USE_HEAP TRUE
#define CH_USE_DYNAMIC FALSE
#if DEBUG_BUILD
#if defined(DEBUG_BUILD) && DEBUG_BUILD
# define CH_OPTIMIZE_SPEED FALSE
# define CH_DBG_SYSTEM_STATE_CHECK TRUE
# define CH_DBG_ENABLE_CHECKS TRUE
@@ -17,7 +17,7 @@
# define CH_DBG_ENABLE_STACK_CHECK TRUE
# define CH_DBG_FILL_THREADS TRUE
# define CH_DBG_THREADS_PROFILING TRUE
#elif RELEASE_BUILD
#elif defined(RELEASE_BUILD) && RELEASE_BUILD
# define CH_DBG_THREADS_PROFILING FALSE
#else
# error "Invalid configuration: Either DEBUG_BUILD or RELEASE_BUILD must be true"