diff options
author | Aleksandar Bozhinovski <aleksandar.bozhinovski@seavus.com> | 2012-04-12 14:34:03 +0200 |
---|---|---|
committer | Viktor Mladenovski <viktor.mladenovski@seavus.com> | 2012-05-25 14:45:32 +0200 |
commit | d9f6ac4b324136f8d94f240f8cdf4007751fb4c1 (patch) | |
tree | 95ebebd88bb2a14e51e4c30ee6cd0759386e280b /source | |
parent | 91209946caf8680942ea79166bb209f57ca3e69c (diff) |
Auto-generate LcdVersion.cpp and lcm_version.c
LCD/LCM compatibility check was broken by introducing of
mingw cross compiler. The functionality is brought back
by auto-generating LcdVersion.cpp and lcm_version.c
ST-Ericsson ID: 427380
ST-Ericsson FOSS-OUT ID: STETL-FOSS-OUT-10204
Change-Id: I6c18973d2a38484bdf3003b0edbf3f7b6dd8c34f
Depends-On: I709f594c76bf1d0d0bf88ee205ef94bc772eed10
Reviewed-on: http://gerrit.lud.stericsson.com/gerrit/55202
Reviewed-by: QABUILD
Tested-by: Blaze MILADINOV <blaze.miladinov@seavus.com>
Reviewed-by: Viktor MLADENOVSKI <viktor.mladenovski@stericsson.com>
Diffstat (limited to 'source')
-rw-r--r-- | source/LcdVersion.cpp | 23 | ||||
-rw-r--r-- | source/LcmInterface.cpp | 10 | ||||
-rwxr-xr-x | source/gen_version_files.sh | 136 |
3 files changed, 138 insertions, 31 deletions
diff --git a/source/LcdVersion.cpp b/source/LcdVersion.cpp deleted file mode 100644 index 9e908b0..0000000 --- a/source/LcdVersion.cpp +++ /dev/null @@ -1,23 +0,0 @@ -/******************************************************************************* - * Copyright (C) ST-Ericsson SA 2011 - * License terms: 3-clause BSD license - ******************************************************************************/ -#include "lcdriver_error_codes.h" -#include "LcmInterface.h" -#include "Error.h" -#ifdef _WIN32 -#include "WinApiWrappers.h" -#else -#include "LinuxApiWrappers.h" -#include <dlfcn.h> -#define GetProcAddress dlsym -#endif -/** - * var char *LCD_LCM_CompatibilityList[] - * brief ASCII string list holding the permitted LCM versions. - * This table contains compatibility information for the versions of LCM. - * Current LCM version is defined in file lcm_version.c in LCM code. - */ -const char *LCD_LCM_CompatibilityList[] = {"P5Y", - NULL - }; diff --git a/source/LcmInterface.cpp b/source/LcmInterface.cpp index 516e111..cee1714 100644 --- a/source/LcmInterface.cpp +++ b/source/LcmInterface.cpp @@ -16,7 +16,7 @@ #endif char *LcmInterface::m_pchLCMLibPath = 0; -extern const char *LCD_LCM_CompatibilityList[]; +extern const char LCD_LCM_Compatibility[]; ////////////////////////////////////////////////////////////////////// // Construction/Destruction ////////////////////////////////////////////////////////////////////// @@ -203,21 +203,15 @@ ErrorCode_e LcmInterface::CommunicationCheckVersion(char *LCMVersion_p, LCM_t LC { int ReturnValue = LCM_LOAD_INCOMPATIBLE_PC_VERSION; - int i = 0; if (LCMType == LDR_LCM) { ReturnValue = LCM_LOAD_INCOMPATIBLE_LDR_VERSION; } - do { - if (strcmp(LCMVersion_p, LCD_LCM_CompatibilityList[i]) == 0) { + if (strcmp(LCMVersion_p, LCD_LCM_Compatibility) == 0) { ReturnValue = E_SUCCESS; - break; } - i++; - } while (LCD_LCM_CompatibilityList[i] != NULL); - return static_cast<ErrorCode_e>(ReturnValue); } diff --git a/source/gen_version_files.sh b/source/gen_version_files.sh new file mode 100755 index 0000000..6e7e587 --- /dev/null +++ b/source/gen_version_files.sh @@ -0,0 +1,136 @@ +#!/usr/bin/env bash +# ------------------------------------------------------------------------------ +# Copyright (C) ST-Ericsson SA 2012 +# License terms: 3-clause BSD license +# ------------------------------------------------------------------------------ + +#-------- Global vars init values ----------- + +#script version +SCRIPT_VERSION="v1.0" + +#printout stream channels +error_channel=/dev/stderr +normal_channel=/dev/stdout +stream_channel=$normal_channel + +#git revision info +VERSION="" + +chdir=$3 +path=$2 +LCD_RC_PATH=$path/LcdVersion.cpp +LCM_RC_PATH=$path/lcm_version.c + +# ------------------------------INTERNAL FUNCTIONS ---------------------------- + +function show_err() +{ + cat >> $stream_channel << INLINE_DOC + +Syntax ERROR! +Try reading the script help info +$0 --help + +INLINE_DOC +} + +function get_help() +{ + cat >> $stream_channel << INLINE_DOC +================================ HELP ================================ +The purpose of this script is generating source (.c or .cpp) files +that will hold information for the compatibility of the versions of +LCM and LCD .dll files. First input parameter is --lcm or --lcd +which tells the script which file to be generated. +Second parameter is the path where the file should be generated. +Third parameter is the location of the directory which holds the .git repository. + +INLINE_DOC +} + +function get_init_data() +{ + cd $chdir + VERSION=`git describe --tags --always --long` +} + +# +# Loader Communication module +# +function process_lcm() +{ + cat > $LCM_RC_PATH << INLINE_DOC +/******************************************************************************* + * Copyright (C) ST-Ericsson SA 2012 + * License terms: 3-clause BSD license + ******************************************************************************/ +/** + * @addtogroup ldr_communication_serv + * @{ + */ +/** + * var char LCM_CurrentVersion[] + * brief ASCII string holding the LCM version. + * The LCM_CurrentVersion string is compared with + * LCD_LCM_Compatibility[] in file LcdVersion.cpp in LCD code. + */ + +INLINE_DOC +echo "char LCM_CurrentVersion[] = \"$VERSION\";" >> $LCM_RC_PATH +cat >> $LCM_RC_PATH << INLINE_DOC + +/** @} */ + +INLINE_DOC +} + +# +# Loader Communication Driver +# +function process_lcd() +{ + cat > $LCD_RC_PATH << INLINE_DOC +/******************************************************************************* + * Copyright (C) ST-Ericsson SA 2011 + * License terms: 3-clause BSD license + ******************************************************************************/ +#include "lcdriver_error_codes.h" +#include "LcmInterface.h" +#include "Error.h" +#ifdef _WIN32 +#include "WinApiWrappers.h" +#else +#include "LinuxApiWrappers.h" +#include <dlfcn.h> +#define GetProcAddress dlsym +#endif +/** + * var char LCD_LCM_Compatibility[] + * brief ASCII string holding the LCD version. + * This string is compared with the version of the LCM. + * Current LCM version is defined in file lcm_version.c in LCM code. + */ +INLINE_DOC +echo "char LCD_LCM_Compatibility[] = \"$VERSION\";" >> $LCD_RC_PATH +cat >> $LCD_RC_PATH << INLINE_DOC + +INLINE_DOC +} + +# ------------------------------- main script routine ------------------------- +get_init_data +case $1 in + + --lcm) + process_lcm;; + --lcd) + process_lcd;; + + -h|?|--help) + get_help;; + *) + stream_channel=$error_channel + show_err;; +esac + |