diff --git a/os/common/startup/ARM/compilers/GCC/rules.mk b/os/common/startup/ARM/compilers/GCC/rules.mk index b585a277f..583e2b88c 100644 --- a/os/common/startup/ARM/compilers/GCC/rules.mk +++ b/os/common/startup/ARM/compilers/GCC/rules.mk @@ -9,6 +9,9 @@ OPT = $(USE_OPT) COPT = $(USE_COPT) CPPOPT = $(USE_CPPOPT) +# Enforced search paths +INCDIR := $(CHIBIOS)/os/license $(INCDIR) + # Garbage collection ifeq ($(USE_LINK_GC),yes) OPT += -ffunction-sections -fdata-sections -fno-common diff --git a/os/common/startup/ARMCMx/compilers/GCC/rules.mk b/os/common/startup/ARMCMx/compilers/GCC/rules.mk index 4ea7768ec..93191415d 100644 --- a/os/common/startup/ARMCMx/compilers/GCC/rules.mk +++ b/os/common/startup/ARMCMx/compilers/GCC/rules.mk @@ -9,6 +9,9 @@ OPT := $(USE_OPT) COPT := $(USE_COPT) CPPOPT := $(USE_CPPOPT) +# Enforced search paths +INCDIR := $(CHIBIOS)/os/license $(INCDIR) + # Garbage collection ifeq ($(USE_LINK_GC),yes) OPT += -ffunction-sections -fdata-sections -fno-common diff --git a/os/common/startup/SIMIA32/compilers/GCC/rules.mk b/os/common/startup/SIMIA32/compilers/GCC/rules.mk index 47262a27b..b7e2a5500 100644 --- a/os/common/startup/SIMIA32/compilers/GCC/rules.mk +++ b/os/common/startup/SIMIA32/compilers/GCC/rules.mk @@ -9,6 +9,9 @@ OPT = $(USE_OPT) COPT = $(USE_COPT) CPPOPT = $(USE_CPPOPT) +# Enforced search paths +INCDIR := $(CHIBIOS)/os/license $(INCDIR) + # Garbage collection ifeq ($(USE_LINK_GC),yes) OPT += -ffunction-sections -fdata-sections -fno-common diff --git a/os/common/startup/e200/compilers/GCC/rules.mk b/os/common/startup/e200/compilers/GCC/rules.mk index 9e5fd8fb8..e9d839966 100644 --- a/os/common/startup/e200/compilers/GCC/rules.mk +++ b/os/common/startup/e200/compilers/GCC/rules.mk @@ -9,6 +9,9 @@ OPT = $(USE_OPT) COPT = $(USE_COPT) CPPOPT = $(USE_CPPOPT) +# Enforced search paths +INCDIR := $(CHIBIOS)/os/license $(INCDIR) + # Garbage collection ifeq ($(USE_LINK_GC),yes) OPT += -ffunction-sections -fdata-sections -fno-common diff --git a/os/license/chcustomer.h b/os/license/chcustomer.h new file mode 100644 index 000000000..f51951169 --- /dev/null +++ b/os/license/chcustomer.h @@ -0,0 +1,99 @@ +/* + ChibiOS - Copyright (C) 2006..2016 Giovanni Di Sirio. + + This file is part of ChibiOS. + + ChibiOS is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + ChibiOS is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +*/ + +/** + * @file chcustomer.h + * @brief Customer-related info. + * + * @addtogroup customer + * @{ + */ + +#ifndef CHCUSTOMER_H +#define CHCUSTOMER_H + +/*===========================================================================*/ +/* Module constants. */ +/*===========================================================================*/ + +/** + * @brief Customer readable identifier. + */ +#define CH_CUSTOMER_ID_STRING "Santa, North Pole" + +/** + * @brief Customer code. + */ +#define CH_CUSTOMER_ID_CODE "xxxx-yyyy" + +/** + * @brief Current license. + * @note This setting is reserved to the copyright owner. + * @note Changing this setting invalidates the license. + * @note The license statement in the source headers is valid, applicable + * and binding regardless this setting. + */ +#define CH_LICENSE CH_LICENSE_GPL + +/** + * @name Licensed Products + * @{ + */ +#define CH_CUSTOMER_LICENSED_RT TRUE +#define CH_CUSTOMER_LICENSED_NIL TRUE +#define CH_CUSTOMER_LICENSED_HAL TRUE +#define CH_CUSTOMER_LICENSED_EX TRUE +#define CH_CUSTOMER_LICENSED_PORT_CM0 TRUE +#define CH_CUSTOMER_LICENSED_PORT_CM3 TRUE +#define CH_CUSTOMER_LICENSED_PORT_CM4 TRUE +#define CH_CUSTOMER_LICENSED_PORT_CM7 TRUE +#define CH_CUSTOMER_LICENSED_PORT_ARM79 TRUE +#define CH_CUSTOMER_LICENSED_PORT_E200Z0 TRUE +#define CH_CUSTOMER_LICENSED_PORT_E200Z2 TRUE +#define CH_CUSTOMER_LICENSED_PORT_E200Z3 TRUE +#define CH_CUSTOMER_LICENSED_PORT_E200Z4 TRUE +/** @} */ + +/*===========================================================================*/ +/* Module pre-compile time settings. */ +/*===========================================================================*/ + +/*===========================================================================*/ +/* Derived constants and error checks. */ +/*===========================================================================*/ + +/*===========================================================================*/ +/* Module data structures and types. */ +/*===========================================================================*/ + +/*===========================================================================*/ +/* Module macros. */ +/*===========================================================================*/ + +/*===========================================================================*/ +/* External declarations. */ +/*===========================================================================*/ + +/*===========================================================================*/ +/* Module inline functions. */ +/*===========================================================================*/ + +#endif /* CHCUSTOMER_H */ + +/** @} */ diff --git a/os/rt/include/chlicense.h b/os/license/chlicense.h similarity index 69% rename from os/rt/include/chlicense.h rename to os/license/chlicense.h index 8d51ab3cf..a0c8ed2c7 100644 --- a/os/rt/include/chlicense.h +++ b/os/license/chlicense.h @@ -60,19 +60,15 @@ #define CH_LICENSE_PARTNER 5 /** @} */ +#include "chcustomer.h" +#if CH_LICENSE == CH_LICENSE_PARTNER +#include "chpartner.h" +#endif + /*===========================================================================*/ /* Module pre-compile time settings. */ /*===========================================================================*/ -/** - * @brief Current license. - * @note This setting is reserved to the copyright owner. - * @note Changing this setting invalidates the license. - * @note The license statement in the source headers is valid, applicable - * and binding regardless this setting. - */ -#define CH_LICENSE CH_LICENSE_GPL - /*===========================================================================*/ /* Derived constants and error checks. */ /*===========================================================================*/ @@ -105,26 +101,6 @@ /** * @brief Code functionality restrictions. - * @details This setting defines which features are available under the - * current licensing scheme. The possible settings are: - * - @p CH_FEATURES_FULL if all features are available. - * - @p CH_FEATURES_INTERMEDIATE means that the following - * functionalities are disabled: - * - High Resolution mode. - * - Time Measurement. - * - Statistics. - * . - * - @p CH_FEATURES_BASIC means that the following functionalities - * are disabled: - * - High Resolution mode. - * - Time Measurement. - * - Statistics. - * - Tickless mode. - * - Recursive Mutexes. - * - Condition Variables. - * - Dynamic threading. - * . - * . */ #define CH_LICENSE_FEATURES CH_FEATURES_FULL @@ -152,7 +128,6 @@ #define CH_LICENSE_MAX_DEPLOY 500 #elif CH_LICENSE == CH_LICENSE_COMMERCIAL_DEVELOPER -#include "chcustomer.h" #define CH_LICENSE_TYPE_STRING "Developer-Only Commercial License" #define CH_LICENSE_ID_STRING CH_CUSTOMER_ID_STRING #define CH_LICENSE_ID_CODE CH_CUSTOMER_ID_CODE @@ -161,7 +136,6 @@ #define CH_LICENSE_DEPLOY_LIMIT 5000 #elif CH_LICENSE == CH_LICENSE_COMMERCIAL_FULL -#include "chcustomer.h" #define CH_LICENSE_TYPE_STRING "Full Commercial License" #define CH_LICENSE_ID_STRING CH_CUSTOMER_ID_STRING #define CH_LICENSE_ID_CODE CH_CUSTOMER_ID_CODE @@ -170,57 +144,17 @@ #define CH_LICENSE_MAX_DEPLOY CH_DEPLOY_UNLIMITED #elif CH_LICENSE == CH_LICENSE_PARTNER -#include "chpartner.h" #define CH_LICENSE_TYPE_STRING "Partners Special Commercial License" -#define CH_LICENSE_ID_STRING CH_PARTNER_ID_STRING -#define CH_LICENSE_ID_CODE CH_PARTNER_ID_CODE +#define CH_LICENSE_ID_STRING CH_CUSTOMER_ID_STRING +#define CH_LICENSE_ID_CODE CH_CUSTOMER_ID_CODE #define CH_LICENSE_MODIFIABLE_CODE CH_PARTNER_MODIFIABLE_CODE -#define CH_LICENSE_FEATURES CH_PARTNER_FEATURES_FULL +#define CH_LICENSE_FEATURES CH_PARTNER_FEATURES #define CH_LICENSE_MAX_DEPLOY CH_PARTNER_MAX_DEPLOY #else #error "invalid licensing option" #endif -/* Checks on the enabled features.*/ -#if CH_LICENSE_FEATURES == CH_FEATURES_FULL - /* No restrictions in full mode.*/ - -#elif (CH_LICENSE_FEATURES == CH_FEATURES_INTERMEDIATE) || \ - (CH_LICENSE_FEATURES == CH_FEATURES_BASIC) - /* Restrictions in basic and intermediate modes.*/ - #if CH_CFG_ST_TIMEDELTA > 2 - #error "CH_CFG_ST_TIMEDELTA > 2, High Resolution Time functionality restricted" - #endif - - #if CH_DBG_STATISTICS == TRUE - #error "CH_DBG_STATISTICS == TRUE, Statistics functionality restricted" - #endif - - #if CH_LICENSE_FEATURES == CH_FEATURES_BASIC - /* Restrictions in basic mode.*/ - #if CH_CFG_ST_TIMEDELTA > 0 - #error "CH_CFG_ST_TIMEDELTA > 0, Tick-Less functionality restricted" - #endif - - #if CH_CFG_USE_TM == TRUE - #error "CH_CFG_USE_TM == TRUE, Time Measurement functionality restricted" - #endif - - #if CH_CFG_USE_MUTEXES == TRUE - #error "CH_CFG_USE_MUTEXES == TRUE, Recursive Mutexes functionality restricted" - #endif - - #if CH_CFG_USE_CONDVARS == TRUE - #error "CH_CFG_USE_CONDVARS == TRUE, Condition Variables functionality restricted" - #endif - - #endif /* CH_LICENSE_FEATURES == CH_FEATURES_BASIC */ - -#else - #error "invalid feature settings" -#endif - /*===========================================================================*/ /* Module data structures and types. */ /*===========================================================================*/ diff --git a/os/rt/include/ch.h b/os/rt/include/ch.h index a19f812b5..81062f673 100644 --- a/os/rt/include/ch.h +++ b/os/rt/include/ch.h @@ -75,6 +75,7 @@ #endif #include "chlicense.h" +#include "chchecks.h" #include "chsystypes.h" #include "chalign.h" #include "chcore.h"