From c3615cd90efe574cd82517591e3f6689d873b3e9 Mon Sep 17 00:00:00 2001 From: Giovanni Di Sirio Date: Sat, 16 Apr 2016 10:44:16 +0000 Subject: [PATCH] Added licensing checks to ports. git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@9289 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- os/common/ports/ARM/compilers/GCC/chcoreasm.s | 1 + os/common/ports/ARMCMx/chcore_v6m.h | 8 ++++ os/common/ports/ARMCMx/chcore_v7m.h | 29 +++++++++++++- .../ARMCMx/compilers/GCC/chcoreasm_v6m.s | 1 + .../ARMCMx/compilers/GCC/chcoreasm_v7m.s | 1 + .../ARMCMx/compilers/IAR/chcoreasm_v6m.s | 1 + .../ARMCMx/compilers/IAR/chcoreasm_v7m.s | 1 + .../ARMCMx/compilers/RVCT/chcoreasm_v6m.s | 1 + .../ARMCMx/compilers/RVCT/chcoreasm_v7m.s | 1 + os/common/ports/e200/chcore.h | 40 +++++++++++++++++++ os/common/ports/e200/compilers/CW/chcoreasm.s | 1 + .../ports/e200/compilers/GCC/chcoreasm.s | 1 + 12 files changed, 85 insertions(+), 1 deletion(-) diff --git a/os/common/ports/ARM/compilers/GCC/chcoreasm.s b/os/common/ports/ARM/compilers/GCC/chcoreasm.s index 7df4ee44b..0409310e8 100644 --- a/os/common/ports/ARM/compilers/GCC/chcoreasm.s +++ b/os/common/ports/ARM/compilers/GCC/chcoreasm.s @@ -26,6 +26,7 @@ */ #define _FROM_ASM_ +#include "chlicense.h" #include "chconf.h" #include "armparams.h" diff --git a/os/common/ports/ARMCMx/chcore_v6m.h b/os/common/ports/ARMCMx/chcore_v6m.h index 06039ecc6..07fb06afa 100644 --- a/os/common/ports/ARMCMx/chcore_v6m.h +++ b/os/common/ports/ARMCMx/chcore_v6m.h @@ -118,6 +118,14 @@ /* Derived constants and error checks. */ /*===========================================================================*/ +#if !defined(CH_CUSTOMER_LICENSED_PORT_CM0) +#error "CH_CUSTOMER_LICENSED_PORT_CM0 not defined" +#endif + +#if CH_CUSTOMER_LICENSED_PORT_CM0 == FALSE +#error "ChibiOS Cortex-M0 port not licensed" +#endif + /** * @name Architecture and Compiler * @{ diff --git a/os/common/ports/ARMCMx/chcore_v7m.h b/os/common/ports/ARMCMx/chcore_v7m.h index bf6a998f3..668d9e3b0 100644 --- a/os/common/ports/ARMCMx/chcore_v7m.h +++ b/os/common/ports/ARMCMx/chcore_v7m.h @@ -192,6 +192,15 @@ * @{ */ #if (CORTEX_MODEL == 3) || defined(__DOXYGEN__) + + #if !defined(CH_CUSTOMER_LICENSED_PORT_CM3) + #error "CH_CUSTOMER_LICENSED_PORT_CM3 not defined" + #endif + + #if CH_CUSTOMER_LICENSED_PORT_CM3 == FALSE + #error "ChibiOS Cortex-M3 port not licensed" + #endif + /** * @brief Macro defining the specific ARM architecture. */ @@ -212,6 +221,15 @@ #endif #elif (CORTEX_MODEL == 4) + + #if !defined(CH_CUSTOMER_LICENSED_PORT_CM4) + #error "CH_CUSTOMER_LICENSED_PORT_CM4 not defined" + #endif + + #if CH_CUSTOMER_LICENSED_PORT_CM4 == FALSE + #error "ChibiOS Cortex-M4 port not licensed" + #endif + #define PORT_ARCHITECTURE_ARM_v7ME #define PORT_ARCHITECTURE_NAME "ARMv7E-M" #if CORTEX_USE_FPU @@ -229,7 +247,16 @@ #endif #elif (CORTEX_MODEL == 7) - #define PORT_ARCHITECTURE_ARM_v7ME + + #if !defined(CH_CUSTOMER_LICENSED_PORT_CM7) + #error "CH_CUSTOMER_LICENSED_PORT_CM7 not defined" + #endif + + #if CH_CUSTOMER_LICENSED_PORT_CM7 == FALSE + #error "ChibiOS Cortex-M7 port not licensed" + #endif + +#define PORT_ARCHITECTURE_ARM_v7ME #define PORT_ARCHITECTURE_NAME "ARMv7E-M" #if CORTEX_USE_FPU #if PORT_ENABLE_GUARD_PAGES == FALSE diff --git a/os/common/ports/ARMCMx/compilers/GCC/chcoreasm_v6m.s b/os/common/ports/ARMCMx/compilers/GCC/chcoreasm_v6m.s index d7ccbcc57..15cb8bdac 100644 --- a/os/common/ports/ARMCMx/compilers/GCC/chcoreasm_v6m.s +++ b/os/common/ports/ARMCMx/compilers/GCC/chcoreasm_v6m.s @@ -34,6 +34,7 @@ #endif #define _FROM_ASM_ +#include "chlicense.h" #include "chconf.h" #include "chcore.h" diff --git a/os/common/ports/ARMCMx/compilers/GCC/chcoreasm_v7m.s b/os/common/ports/ARMCMx/compilers/GCC/chcoreasm_v7m.s index 4c228189c..943892d24 100644 --- a/os/common/ports/ARMCMx/compilers/GCC/chcoreasm_v7m.s +++ b/os/common/ports/ARMCMx/compilers/GCC/chcoreasm_v7m.s @@ -34,6 +34,7 @@ #endif #define _FROM_ASM_ +#include "chlicense.h" #include "chconf.h" #include "chcore.h" diff --git a/os/common/ports/ARMCMx/compilers/IAR/chcoreasm_v6m.s b/os/common/ports/ARMCMx/compilers/IAR/chcoreasm_v6m.s index de4c9f031..81c680bb5 100644 --- a/os/common/ports/ARMCMx/compilers/IAR/chcoreasm_v6m.s +++ b/os/common/ports/ARMCMx/compilers/IAR/chcoreasm_v6m.s @@ -34,6 +34,7 @@ #endif #define _FROM_ASM_ +#include "chlicense.h" #include "chconf.h" #include "chcore.h" diff --git a/os/common/ports/ARMCMx/compilers/IAR/chcoreasm_v7m.s b/os/common/ports/ARMCMx/compilers/IAR/chcoreasm_v7m.s index b30a819f7..c1a19fc29 100644 --- a/os/common/ports/ARMCMx/compilers/IAR/chcoreasm_v7m.s +++ b/os/common/ports/ARMCMx/compilers/IAR/chcoreasm_v7m.s @@ -34,6 +34,7 @@ #endif #define _FROM_ASM_ +#include "chlicense.h" #include "chconf.h" #include "chcore.h" diff --git a/os/common/ports/ARMCMx/compilers/RVCT/chcoreasm_v6m.s b/os/common/ports/ARMCMx/compilers/RVCT/chcoreasm_v6m.s index 892e46361..3a769d49a 100644 --- a/os/common/ports/ARMCMx/compilers/RVCT/chcoreasm_v6m.s +++ b/os/common/ports/ARMCMx/compilers/RVCT/chcoreasm_v6m.s @@ -34,6 +34,7 @@ #endif #define _FROM_ASM_ +#include "chlicense.h" #include "chconf.h" #include "chcore.h" diff --git a/os/common/ports/ARMCMx/compilers/RVCT/chcoreasm_v7m.s b/os/common/ports/ARMCMx/compilers/RVCT/chcoreasm_v7m.s index ebedf6a39..3915313da 100644 --- a/os/common/ports/ARMCMx/compilers/RVCT/chcoreasm_v7m.s +++ b/os/common/ports/ARMCMx/compilers/RVCT/chcoreasm_v7m.s @@ -34,6 +34,7 @@ #endif #define _FROM_ASM_ +#include "chlicense.h" #include "chconf.h" #include "chcore.h" diff --git a/os/common/ports/e200/chcore.h b/os/common/ports/e200/chcore.h index 453f955bb..54fc1535d 100644 --- a/os/common/ports/e200/chcore.h +++ b/os/common/ports/e200/chcore.h @@ -178,13 +178,53 @@ * @brief Name of the architecture variant. */ #if (PPC_VARIANT == PPC_VARIANT_e200z0) || defined(__DOXYGEN__) + +#if !defined(CH_CUSTOMER_LICENSED_PORT_E200Z0) +#error "CH_CUSTOMER_LICENSED_PORT_E200Z0 not defined" +#endif + +#if CH_CUSTOMER_LICENSED_PORT_E200Z0 == FALSE +#error "ChibiOS Power e200z0 port not licensed" +#endif + #define PORT_CORE_VARIANT_NAME "e200z0" + #elif PPC_VARIANT == PPC_VARIANT_e200z2 + +#if !defined(CH_CUSTOMER_LICENSED_PORT_E200Z2) +#error "CH_CUSTOMER_LICENSED_PORT_E200Z2 not defined" +#endif + +#if CH_CUSTOMER_LICENSED_PORT_E200Z2 == FALSE +#error "ChibiOS Power e200z2 port not licensed" +#endif + #define PORT_CORE_VARIANT_NAME "e200z2" + #elif PPC_VARIANT == PPC_VARIANT_e200z3 + +#if !defined(CH_CUSTOMER_LICENSED_PORT_E200Z3) +#error "CH_CUSTOMER_LICENSED_PORT_E200Z3 not defined" +#endif + +#if CH_CUSTOMER_LICENSED_PORT_E200Z3 == FALSE +#error "ChibiOS Power e200z3 port not licensed" +#endif + #define PORT_CORE_VARIANT_NAME "e200z3" + #elif PPC_VARIANT == PPC_VARIANT_e200z4 + +#if !defined(CH_CUSTOMER_LICENSED_PORT_E200Z4) +#error "CH_CUSTOMER_LICENSED_PORT_E200Z4 not defined" +#endif + +#if CH_CUSTOMER_LICENSED_PORT_E200Z4 == FALSE +#error "ChibiOS Power e200z4 port not licensed" +#endif + #define PORT_CORE_VARIANT_NAME "e200z4" + #else #error "unknown or unsupported PowerPC variant specified" #endif diff --git a/os/common/ports/e200/compilers/CW/chcoreasm.s b/os/common/ports/e200/compilers/CW/chcoreasm.s index 875f99a70..edae3f6e4 100644 --- a/os/common/ports/e200/compilers/CW/chcoreasm.s +++ b/os/common/ports/e200/compilers/CW/chcoreasm.s @@ -45,6 +45,7 @@ * Imports the PPC configuration headers. */ #define _FROM_ASM_ +#include "chlicense.h" #include "chconf.h" #include "chcore.h" diff --git a/os/common/ports/e200/compilers/GCC/chcoreasm.s b/os/common/ports/e200/compilers/GCC/chcoreasm.s index beceae2c4..a4016f1ea 100644 --- a/os/common/ports/e200/compilers/GCC/chcoreasm.s +++ b/os/common/ports/e200/compilers/GCC/chcoreasm.s @@ -42,6 +42,7 @@ /*===========================================================================*/ #define _FROM_ASM_ +#include "chlicense.h" #include "chconf.h" #include "chcore.h"