diff --git a/os/license/chcustomer.h b/os/license/chcustomer.h index f51951169..5dcf2d8e5 100644 --- a/os/license/chcustomer.h +++ b/os/license/chcustomer.h @@ -57,7 +57,6 @@ */ #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 diff --git a/os/nil/include/ch.h b/os/nil/include/ch.h index e517b9551..31ec8bfe3 100644 --- a/os/nil/include/ch.h +++ b/os/nil/include/ch.h @@ -30,8 +30,9 @@ #ifndef CH_H #define CH_H -#include "chconf.h" #include "chtypes.h" +#include "chconf.h" +#include "chlicense.h" /*===========================================================================*/ /* Module constants. */ @@ -353,6 +354,52 @@ /* Derived constants and error checks. */ /*===========================================================================*/ +#if CH_CUSTOMER_LICENSED_NIL == FALSE +#error "ChibiOS/NIL not licensed" +#endif + +#if (CH_LICENSE_FEATURES != CH_FEATURES_FULL) && \ + (CH_LICENSE_FEATURES != CH_FEATURES_INTERMEDIATE) && \ + (CH_LICENSE_FEATURES == CH_FEATURES_BASIC) +#error "invalid CH_LICENSE_FEATURES setting" +#endif + +/* Restrictions in basic and intermediate modes.*/ +#if (CH_LICENSE_FEATURES == CH_FEATURES_INTERMEDIATE) || \ + (CH_LICENSE_FEATURES == CH_FEATURES_BASIC) + +/* System tick limited to 1000hz.*/ +#if CH_CFG_ST_FREQUENCY > 1000 +#undef CH_CFG_ST_FREQUENCY +#define CH_CFG_ST_FREQUENCY 1000 +#endif + +/* Restricted subsystems.*/ +#undef CH_CFG_USE_MAILBOXES + +#define CH_CFG_USE_MAILBOXES FALSE + +#endif /* (CH_LICENSE_FEATURES == CH_FEATURES_INTERMEDIATE) || + (CH_LICENSE_FEATURES == CH_FEATURES_BASIC) */ + +/* Restrictions in basic mode.*/ +#if CH_LICENSE_FEATURES == CH_FEATURES_BASIC + +/* Tick-Less mode restricted.*/ +#undef CH_CFG_ST_TIMEDELTA +#define CH_CFG_ST_TIMEDELTA 0 + +/* Restricted subsystems.*/ +#undef CH_CFG_USE_MEMCORE +#undef CH_CFG_USE_MEMPOOLS +#undef CH_CFG_USE_HEAP + +#define CH_CFG_USE_MEMCORE FALSE +#define CH_CFG_USE_MEMPOOLS FALSE +#define CH_CFG_USE_HEAP FALSE + +#endif /* CH_LICENSE_FEATURES == CH_FEATURES_BASIC */ + #if !defined(_CHIBIOS_NIL_CONF_) #error "missing or wrong configuration file" #endif diff --git a/os/rt/include/chchecks.h b/os/rt/include/chchecks.h index 2b663df55..60f2b4c51 100644 --- a/os/rt/include/chchecks.h +++ b/os/rt/include/chchecks.h @@ -40,6 +40,10 @@ /* Derived constants and error checks. */ /*===========================================================================*/ +#if CH_CUSTOMER_LICENSED_RT == FALSE +#error "ChibiOS/RT not licensed" +#endif + #if (CH_LICENSE_FEATURES != CH_FEATURES_FULL) && \ (CH_LICENSE_FEATURES != CH_FEATURES_INTERMEDIATE) && \ (CH_LICENSE_FEATURES == CH_FEATURES_BASIC) @@ -56,7 +60,7 @@ #define CH_CFG_ST_FREQUENCY 1000 #endif -/* Statistics and trace buffer restricted.*/ +/* Restricted subsystems.*/ #undef CH_DBG_STATISTICS #undef CH_DBG_TRACE_MASK @@ -73,7 +77,7 @@ #undef CH_CFG_ST_TIMEDELTA #define CH_CFG_ST_TIMEDELTA 0 -/* Several subsystems restricted.*/ +/* Restricted subsystems.*/ #undef CH_CFG_USE_TM #undef CH_CFG_USE_MUTEXES #undef CH_CFG_USE_CONDVARS