Improved licensing checks for RT.
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@13806 27425a3e-05d8-49a3-a47f-9c15f0e5edd8
This commit is contained in:
parent
91d150f00e
commit
1776899465
|
@ -45,6 +45,21 @@
|
|||
*/
|
||||
#define CH_CUSTOMER_ID_CODE "xxxx-yyyy"
|
||||
|
||||
/**
|
||||
* @brief End-Of-Support date (yyyymm).
|
||||
*/
|
||||
#define CH_CUSTOMER_LICENSE_EOS 209912
|
||||
|
||||
/**
|
||||
* @brief Licensed branch year.
|
||||
*/
|
||||
#define CH_CUSTOMER_LICENSE_VERSION_YEAR 99
|
||||
|
||||
/**
|
||||
* @brief Licensed branch month.
|
||||
*/
|
||||
#define CH_CUSTOMER_LICENSE_VERSION_MONTH 12
|
||||
|
||||
/**
|
||||
* @brief Current license.
|
||||
* @note This setting is reserved to the copyright owner.
|
||||
|
|
|
@ -64,6 +64,7 @@
|
|||
#define CH_LICENSE_PARTNER 7
|
||||
/** @} */
|
||||
|
||||
#include "chversion.h"
|
||||
#include "chcustomer.h"
|
||||
#if CH_LICENSE == CH_LICENSE_PARTNER
|
||||
#include "chpartner.h"
|
||||
|
@ -80,6 +81,106 @@
|
|||
/* Derived constants and error checks. */
|
||||
/*===========================================================================*/
|
||||
|
||||
/* Checks on chversion.h.*/
|
||||
#if !defined(__CHIBIOS__)
|
||||
#error "__CHIBIOS__ not defined in chversion.h"
|
||||
#endif
|
||||
|
||||
#if !defined(CH_VERSION_STABLE)
|
||||
#error "CH_VERSION_STABLE not defined in chversion.h"
|
||||
#endif
|
||||
|
||||
#if !defined(CH_VERSION_YEAR)
|
||||
#error "CH_VERSION_YEAR not defined in chversion.h"
|
||||
#endif
|
||||
|
||||
#if !defined(CH_VERSION_MONTH)
|
||||
#error "CH_VERSION_MONTH not defined in chversion.h"
|
||||
#endif
|
||||
|
||||
#if !defined(CH_VERSION_PATCH)
|
||||
#error "CH_VERSION_PATCH not defined in chversion.h"
|
||||
#endif
|
||||
|
||||
#if !defined(CH_VERSION_NICKNAME)
|
||||
#error "CH_VERSION_NICKNAME not defined in chversion.h"
|
||||
#endif
|
||||
|
||||
#if !defined(CH_VERSION_DATE)
|
||||
#error "CH_VERSION_DATE not defined in chversion.h"
|
||||
#endif
|
||||
|
||||
#if (CH_VERSION_STABLE < 0) || (CH_VERSION_STABLE > 1)
|
||||
#error "invalid CH_VERSION_STABLE value in chversion.h"
|
||||
#endif
|
||||
|
||||
#if (CH_VERSION_YEAR < 12) || (CH_VERSION_YEAR > 99)
|
||||
#error "invalid CH_VERSION_YEAR value in chversion.h"
|
||||
#endif
|
||||
|
||||
#if (CH_VERSION_MONTH < 1) || (CH_VERSION_MONTH > 12)
|
||||
#error "invalid CH_VERSION_MONTH value in chversion.h"
|
||||
#endif
|
||||
|
||||
#if (CH_VERSION_DATE < 201201) || (CH_VERSION_DATE > 209912)
|
||||
#error "invalid CH_VERSION_DATE value in chversion.h"
|
||||
#endif
|
||||
|
||||
/* Checks on chcustomer.h.*/
|
||||
#if !defined(CH_CUSTOMER_ID_STRING)
|
||||
#error "CH_CUSTOMER_ID_STRING not defined in chcustomer.h"
|
||||
#endif
|
||||
|
||||
#if !defined(CH_CUSTOMER_ID_CODE)
|
||||
#error "CH_CUSTOMER_ID_CODE not defined in chcustomer.h"
|
||||
#endif
|
||||
|
||||
#if !defined(CH_CUSTOMER_LICENSE_EOS)
|
||||
#error "CH_CUSTOMER_LICENSE_EOS not defined in chcustomer.h"
|
||||
#endif
|
||||
|
||||
#if !defined(CH_CUSTOMER_LICENSE_VERSION_YEAR)
|
||||
#error "CH_CUSTOMER_LICENSE_VERSION_YEAR not defined in chcustomer.h"
|
||||
#endif
|
||||
|
||||
#if !defined(CH_CUSTOMER_LICENSE_VERSION_MONTH)
|
||||
#error "CH_CUSTOMER_LICENSE_VERSION_MONTH not defined in chcustomer.h"
|
||||
#endif
|
||||
|
||||
#if !defined(CH_LICENSE)
|
||||
#error "CH_LICENSE not defined in chcustomer.h"
|
||||
#endif
|
||||
|
||||
#if (CH_CUSTOMER_LICENSE_EOS < 201201) || \
|
||||
(CH_CUSTOMER_LICENSE_EOS > 209912)
|
||||
#error "invalid CH_CUSTOMER_LICENSE_EOS value in chcustomer.h"
|
||||
#endif
|
||||
|
||||
#if (CH_CUSTOMER_LICENSE_VERSION_YEAR < 12) || \
|
||||
(CH_CUSTOMER_LICENSE_VERSION_YEAR > 99)
|
||||
#error "invalid CH_CUSTOMER_LICENSE_VERSION_YEAR value in chcustomer.h"
|
||||
#endif
|
||||
|
||||
#if (CH_CUSTOMER_LICENSE_VERSION_MONTH < 1) || \
|
||||
(CH_CUSTOMER_LICENSE_VERSION_MONTH > 12)
|
||||
#error "invalid CH_CUSTOMER_LICENSE_VERSION_MONTH value in chcustomer.h"
|
||||
#endif
|
||||
|
||||
/* Checks on licensed versions.*/
|
||||
#if (CH_VERSION_YEAR > CH_CUSTOMER_LICENSE_VERSION_YEAR )
|
||||
#error "ChibiOS version unsupported by this license"
|
||||
#elif (CH_VERSION_YEAR == CH_CUSTOMER_LICENSE_VERSION_YEAR)
|
||||
#if (CH_VERSION_MONTH > CH_CUSTOMER_LICENSE_VERSION_MONTH)
|
||||
#error "ChibiOS version unsupported by this license"
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* Checks on end-of-support date.*/
|
||||
#if CH_VERSION_DATE > CH_CUSTOMER_LICENSE_EOS
|
||||
#error "this ChibiOS version is beyond your End-Of-Support date, see chcustomer.h"
|
||||
#endif
|
||||
|
||||
/* Defaults for GPL license.*/
|
||||
#if (CH_LICENSE == CH_LICENSE_GPL) || defined(__DOXYGEN__)
|
||||
/**
|
||||
* @brief License identification string.
|
||||
|
|
|
@ -37,7 +37,7 @@
|
|||
/**
|
||||
* @brief ChibiOS product identification macro.
|
||||
*/
|
||||
#define _CHIBIOS_
|
||||
#define __CHIBIOS__
|
||||
|
||||
/**
|
||||
* @brief Stable release flag.
|
||||
|
@ -51,17 +51,17 @@
|
|||
/**
|
||||
* @brief ChibiOS version string.
|
||||
*/
|
||||
#define CH_VERSION "0.0.0"
|
||||
#define CH_VERSION "2012.1.0"
|
||||
|
||||
/**
|
||||
* @brief ChibiOS version release year.
|
||||
*/
|
||||
#define CH_VERSION_YEAR 0
|
||||
#define CH_VERSION_YEAR 12
|
||||
|
||||
/**
|
||||
* @brief ChibiOS version release month.
|
||||
*/
|
||||
#define CH_VERSION_MONTH 0
|
||||
#define CH_VERSION_MONTH 1
|
||||
|
||||
/**
|
||||
* @brief ChibiOS version patch number.
|
||||
|
@ -82,6 +82,12 @@
|
|||
/* Derived constants and error checks. */
|
||||
/*===========================================================================*/
|
||||
|
||||
/**
|
||||
* @brief Current version date in numeric form (yyyymm).
|
||||
*/
|
||||
#define CH_VERSION_DATE \
|
||||
(((CH_VERSION_YEAR + 2000) * 100) + CH_CUSTOMER_LICENSE_VERSION_MONTH)
|
||||
|
||||
/*===========================================================================*/
|
||||
/* Module data structures and types. */
|
||||
/*===========================================================================*/
|
||||
|
|
|
@ -86,10 +86,12 @@
|
|||
#endif
|
||||
/** @} */
|
||||
|
||||
/* License.*/
|
||||
#include "chlicense.h"
|
||||
|
||||
/* Configuration headers, checks and licensing restrictions.*/
|
||||
#include "chconf.h"
|
||||
#include "chchecks.h"
|
||||
#include "chlicense.h"
|
||||
#include "chrestrictions.h"
|
||||
|
||||
/* Base kernel headers.*/
|
||||
|
|
Loading…
Reference in New Issue