Skip to content
This repository was archived by the owner on Aug 5, 2022. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,7 @@ env:

compiler:
- gcc
# clang not supported yet
# - clang
- clang

# Install a recent gcc and gcov,
# it will not be necessary once travis worker is based on ubuntu > 12.04.
Expand Down
33 changes: 28 additions & 5 deletions bindings/python/Android.mk
Original file line number Diff line number Diff line change
Expand Up @@ -47,17 +47,20 @@ LOCAL_32_BIT_ONLY := true
LOCAL_SHARED_LIBRARIES := libparameter_host
LOCAL_STATIC_LIBRARIES := libxmlserializer_host

# python is only available in 32bits for now, thus arch is forced to 32bits
PYTHON_INSTALL_PATH := prebuilts/python/$(HOST_OS)-x86/2.7.5/
PYTHON_INCLUDES_PATH := $(PYTHON_INSTALL_PATH)/include/python2.7
PYTHON_BIN_PATH := $(PYTHON_INSTALL_PATH)/bin

LOCAL_C_INCLUDES := \
prebuilts/python/linux-x86/2.7.5/include/python2.7 \
$(PYTHON_INCLUDES_PATH) \
$(HOST_OUT_HEADERS)/parameter

# The 'unused-but-set-variable' warning must be disabled because SWIG generates
# files that do not respect that constraint.
# '-DSWIG_PYTHON_SILENT_MEMLEAK' is needed because the "memleak" warning
# pollutes the standard output. At the time of writing, the only warning is
# spurious anyway, as it relates to "ILogger *" which is an abstract
# class/interface class and as such cannot be destroyed.
LOCAL_CFLAGS := -Wno-unused-but-set-variable -fexceptions -DSWIG_PYTHON_SILENT_MEMLEAK
LOCAL_CFLAGS := -fexceptions -DSWIG_PYTHON_SILENT_MEMLEAK

# Undefined symbols will be resolved at runtime
LOCAL_ALLOW_UNDEFINED_SYMBOLS := true
Expand All @@ -74,6 +77,26 @@ LOCAL_GENERATED_SOURCES := $(generated-sources-dir)/pfw_wrap.cxx $(generated-sou

LOCAL_EXPORT_C_INCLUDE_DIRS := $(generated-sources-dir)

# Get the interpreter ld options.
ifeq ($(HOST_OS), darwin)
# Contrary to linux, on darwin, a python 64 bit executable is installed
# in the x86 prebuild directory,
# As all host libraries are 32 bit in android. We can not link and host
# python module against the prebuild python library.
#
# As a *dirty* workaround, use the system's python configuration and hope
# it will be compatible with the prebuild python interpreter used at runtime.
# To summarize the prebuild python (64 bit?) interpreter will load a
# python native module (32bit) linked with the host (32 bit ?) python library.
LOCAL_LDLIBS += $(shell python-config --ldflags)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like this variable should be LOCAL_LDFLAGS.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The only differences between LDFLAGS and LDLIBS is there place in ld command line. As you can see in build/core/definitions.mk L1370 and L1380 LDFLAGS is added a the be beginning and LDLIBS is added at the end.
As python-config flags must have precedence, add them at the end.

else
# Careful, we need to invoke the android python config not the host's one.
# Unfortunately, the internal install directory of python is hardcoded to a dummy value,
# As a workaround, we need to manually add the correct path to libs to the library list.
LOCAL_LDLIBS += $(shell $(PYTHON_BIN_PATH)/python $(PYTHON_BIN_PATH)/python-config --ldflags) \
-L $(PYTHON_INSTALL_PATH)/lib/
endif

$(generated-sources-dir)/pfw_wrap.h: $(generated-sources-dir)/pfw_wrap.cxx

# The PyPfw.py file is generated in the directory given by -outdir switch, thus
Expand All @@ -82,7 +105,7 @@ $(generated-sources-dir)/pfw_wrap.cxx: $(LOCAL_PATH)/pfw.i
@echo "Generating Python binding files"
mkdir -p $(dir $@) # surprisingly, path is not generated by build system
mkdir -p $(HOST_LIBRARY_PATH)
prebuilts/misc/linux-x86_64/swig/swig \
prebuilts/misc/$(HOST_OS)-$(HOST_ARCH)/swig/swig \
-Iprebuilts/misc/common/swig/include/2.0.11/python/ \
-Iprebuilts/misc/common/swig/include/2.0.11/ \
-Wall -Werror -v -python -c++ -outdir $(HOST_LIBRARY_PATH)/ -o $@ $^
Expand Down
6 changes: 3 additions & 3 deletions bindings/python/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -54,13 +54,13 @@ swig_link_libraries(PyPfw parameter ${PYTHON_LIBRARIES})
# ${CMAKE_CURRENT_BINARY_DIR}.
set_property(TARGET _PyPfw PROPERTY LIBRARY_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})

# The 'unused-but-set-variable' warning must be disabled because SWIG generates
# files that do not respect that contraint.
# '-DSWIG_PYTHON_SILENT_MEMLEAK' is needed because the "memleak" warning
# pollutes the standard output. At the time of writing, the only warning is
# spurious anyway, as it relates to "ILogger *" which is an abstract
# class/interface class and as such cannot be destroyed.
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-unused-but-set-variable -DSWIG_PYTHON_SILENT_MEMLEAK")
# -Wno-error is set to prevent compilation failure in case of the code
# generated by swig generates warnings
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DSWIG_PYTHON_SILENT_MEMLEAK -Wno-error")


# Find the python modules install path.
Expand Down
40 changes: 4 additions & 36 deletions parameter/Android.mk
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,8 @@ include $(CLEAR_VARS)
LOCAL_COPY_HEADERS_TO := $(common_copy_headers_to)
LOCAL_COPY_HEADERS := $(common_copy_headers)

LOCAL_EXPORT_C_INCLUDE_DIRS := $(LOCAL_PATH)

LOCAL_CFLAGS := $(common_cflags)

LOCAL_SRC_FILES := $(common_src_files)
Expand All @@ -158,7 +160,6 @@ LOCAL_STATIC_LIBRARIES := libxmlserializer libpfw_utility libxml2

LOCAL_REQUIRED_MODULES := libremote-processor

LOCAL_CLANG := false
include external/stlport/libstlport.mk
include $(BUILD_SHARED_LIBRARY)

Expand All @@ -170,6 +171,8 @@ include $(CLEAR_VARS)
LOCAL_COPY_HEADERS_TO := $(common_copy_headers_to)
LOCAL_COPY_HEADERS := $(common_copy_headers)

LOCAL_EXPORT_C_INCLUDE_DIRS := $(LOCAL_PATH)

LOCAL_CFLAGS := $(common_cflags) -O0 -ggdb

LOCAL_SRC_FILES := $(common_src_files)
Expand All @@ -186,39 +189,4 @@ LOCAL_STATIC_LIBRARIES := libxmlserializer_host libpfw_utility_host libxml2

LOCAL_LDLIBS += -ldl

LOCAL_CLANG := false
include $(BUILD_HOST_SHARED_LIBRARY)

################################
# Export includes for plugins (Target build)

include $(CLEAR_VARS)

LOCAL_MODULE := $(common_module)_includes
LOCAL_MODULE_OWNER := intel

LOCAL_EXPORT_C_INCLUDE_DIRS := $(LOCAL_PATH)

LOCAL_STATIC_LIBRARIES := \
libxmlserializer \
libpfw_utility \
libxml2

include $(BUILD_STATIC_LIBRARY)

################################
# Export includes for plugins (Host build)

include $(CLEAR_VARS)

LOCAL_MODULE := $(common_module)_includes_host
LOCAL_MODULE_OWNER := intel

LOCAL_EXPORT_C_INCLUDE_DIRS := $(LOCAL_PATH)

LOCAL_STATIC_LIBRARIES := \
libxmlserializer_host \
libpfw_utility_host \
libxml2

include $(BUILD_HOST_STATIC_LIBRARY)
8 changes: 5 additions & 3 deletions parameter/ArrayParameter.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2011-2014, Intel Corporation
* Copyright (c) 2011-2015, Intel Corporation
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
Expand Down Expand Up @@ -34,6 +34,7 @@
#include "ParameterAccessContext.h"
#include "ConfigurationAccessContext.h"
#include "ParameterBlackboard.h"
#include "Utility.h"
#include <assert.h>

#define base CParameter
Expand Down Expand Up @@ -62,7 +63,7 @@ void CArrayParameter::showProperties(string& strResult) const

// Array length
strResult += "Array length: ";
strResult += toString(getArrayLength());
strResult += CUtility::toString(getArrayLength());
strResult += "\n";
}

Expand Down Expand Up @@ -281,7 +282,8 @@ bool CArrayParameter::setValues(uint32_t uiStartIndex, uint32_t uiBaseOffset, co
if (!doSetValue(astrValues[uiValueIndex], uiOffset, parameterAccessContext)) {

// Append parameter path to error
parameterAccessContext.appendToError(" " + getPath() + "/" + toString(uiValueIndex + uiStartIndex));
parameterAccessContext.appendToError(" " + getPath() + "/" +
CUtility::toString(uiValueIndex + uiStartIndex));

return false;
}
Expand Down
4 changes: 2 additions & 2 deletions parameter/BitParameter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ bool CBitParameter::accessAsBoolean(bool& bValue, bool bSet, CParameterAccessCon
}

// Rely on integer access
uint64_t uiValue;
uint32_t uiValue;

if (bSet) {

Expand All @@ -108,7 +108,7 @@ bool CBitParameter::accessAsBoolean(bool& bValue, bool bSet, CParameterAccessCon
}

// Integer Access
bool CBitParameter::accessAsInteger(uint64_t& uiValue, bool bSet, CParameterAccessContext& parameterAccessContext) const
bool CBitParameter::accessAsInteger(uint32_t& uiValue, bool bSet, CParameterAccessContext& parameterAccessContext) const
{
uint32_t uiOffset = getOffset();

Expand Down
2 changes: 1 addition & 1 deletion parameter/BitParameter.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ class CBitParameter : public CBaseParameter
virtual bool accessAsBoolean(bool& bValue, bool bSet, CParameterAccessContext& parameterAccessContext) const;

// Integer Access
virtual bool accessAsInteger(uint64_t& uiValue, bool bSet, CParameterAccessContext& parameterAccessContext) const;
virtual bool accessAsInteger(uint32_t& uiValue, bool bSet, CParameterAccessContext& parameterAccessContext) const;

// AreaConfiguration creation
virtual CAreaConfiguration* createAreaConfiguration(const CSyncerSet* pSyncerSet) const;
Expand Down
5 changes: 3 additions & 2 deletions parameter/BitParameterBlockType.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2011-2014, Intel Corporation
* Copyright (c) 2011-2015, Intel Corporation
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
Expand Down Expand Up @@ -29,6 +29,7 @@
*/
#include "BitParameterBlockType.h"
#include "BitParameterBlock.h"
#include "Utility.h"

#define base CTypeElement

Expand Down Expand Up @@ -74,7 +75,7 @@ CInstanceConfigurableElement* CBitParameterBlockType::doInstantiate() const
void CBitParameterBlockType::toXml(CXmlElement& xmlElement, CXmlSerializingContext& serializingContext) const
{
// Size
xmlElement.setAttributeString("Size", toString(_uiSize * 8));
xmlElement.setAttributeString("Size", CUtility::toString(_uiSize * 8));

base::toXml(xmlElement, serializingContext);
}
17 changes: 9 additions & 8 deletions parameter/BitParameterType.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2011-2014, Intel Corporation
* Copyright (c) 2011-2015, Intel Corporation
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
Expand Down Expand Up @@ -33,6 +33,7 @@
#include <sstream>
#include "ParameterAccessContext.h"
#include "BitParameterBlockType.h"
#include "Utility.h"

#define base CTypeElement

Expand All @@ -55,17 +56,17 @@ void CBitParameterType::showProperties(string& strResult) const

// Bit Pos
strResult += "Bit pos: ";
strResult += toString(_uiBitPos);
strResult += CUtility::toString(_uiBitPos);
strResult += "\n";

// Bit size
strResult += "Bit size: ";
strResult += toString(_uiBitSize);
strResult += CUtility::toString(_uiBitSize);
strResult += "\n";

// Max
strResult += "Max: ";
strResult += toString(_uiMax);
strResult += CUtility::toString(_uiMax);
strResult += "\n";
}

Expand Down Expand Up @@ -191,7 +192,7 @@ bool CBitParameterType::toBlackboard(uint64_t uiUserValue, uint64_t& uiValue, CP
return true;
}

void CBitParameterType::fromBlackboard(uint64_t& uiUserValue, uint64_t uiValue, CParameterAccessContext& parameterAccessContext) const
void CBitParameterType::fromBlackboard(uint32_t& uiUserValue, uint64_t uiValue, CParameterAccessContext& parameterAccessContext) const
{
(void)parameterAccessContext;

Expand Down Expand Up @@ -245,13 +246,13 @@ bool CBitParameterType::isEncodable(uint64_t uiData) const
void CBitParameterType::toXml(CXmlElement& xmlElement, CXmlSerializingContext& serializingContext) const
{
// Position
xmlElement.setAttributeString("Pos", toString(_uiBitPos));
xmlElement.setAttributeString("Pos", CUtility::toString(_uiBitPos));

// Size
xmlElement.setAttributeString("Size", toString(_uiBitSize));
xmlElement.setAttributeString("Size", CUtility::toString(_uiBitSize));

// Maximum
xmlElement.setAttributeString("Max", toString(_uiMax));
xmlElement.setAttributeString("Max", CUtility::toString(_uiMax));

base::toXml(xmlElement, serializingContext);

Expand Down
2 changes: 1 addition & 1 deletion parameter/BitParameterType.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ class CBitParameterType : public CTypeElement
void fromBlackboard(std::string& strValue, const uint64_t& uiValue, CParameterAccessContext& parameterAccessContext) const;
// Integer
bool toBlackboard(uint64_t uiUserValue, uint64_t& uiValue, CParameterAccessContext& parameterAccessContext) const;
void fromBlackboard(uint64_t& uiUserValue, uint64_t uiValue, CParameterAccessContext& parameterAccessContext) const;
void fromBlackboard(uint32_t& uiUserValue, uint64_t uiValue, CParameterAccessContext& parameterAccessContext) const;
// Access from area configuration
uint64_t merge(uint64_t uiOriginData, uint64_t uiNewData) const;

Expand Down
2 changes: 1 addition & 1 deletion parameter/ConfigurableDomain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -847,7 +847,7 @@ void CConfigurableDomain::validate(const CParameterBlackboard* pMainBlackboard)
// Ensure validity on areas related to configurable element
void CConfigurableDomain::validateAreas(const CConfigurableElement* pConfigurableElement, const CParameterBlackboard* pMainBlackboard)
{
log_info("Validating domain \"" + getName() + "\" against main blackboard for configurable element \"" + pConfigurableElement->getPath() + "\"");
log_info("Validating domain \"%s\" against main blackboard for configurable element \"%s\"", getName().c_str(), pConfigurableElement->getPath().c_str());

// Propagate
size_t uiNbConfigurations = getNbChildren();
Expand Down
4 changes: 2 additions & 2 deletions parameter/ConfigurableDomains.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ bool CConfigurableDomains::addDomain(CConfigurableDomain& domain, bool bOverwrit
deleteDomain(*pExistingDomain);
}

log_info("Adding configurable domain \"" + strDomainName + "\"");
log_info("Adding configurable domain \"%s\"", strDomainName.c_str());

addChild(&domain);

Expand All @@ -154,7 +154,7 @@ bool CConfigurableDomains::addDomain(CConfigurableDomain& domain, bool bOverwrit

void CConfigurableDomains::deleteDomain(CConfigurableDomain& configurableDomain)
{
log_info("Deleting configurable domain \"" + configurableDomain.getName() + "\"");
log_info("Deleting configurable domain \"%s\"", configurableDomain.getName().c_str() );

removeChild(&configurableDomain);

Expand Down
5 changes: 3 additions & 2 deletions parameter/ConfigurableElement.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2011-2014, Intel Corporation
* Copyright (c) 2011-2015, Intel Corporation
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
Expand Down Expand Up @@ -34,6 +34,7 @@
#include "ConfigurationAccessContext.h"
#include "ConfigurableElementAggregator.h"
#include "AreaConfiguration.h"
#include "Utility.h"
#include <assert.h>

#define base CElement
Expand Down Expand Up @@ -360,7 +361,7 @@ bool CConfigurableElement::isRogue() const
std::string CConfigurableElement::getFootprintAsString() const
{
// Get size as string
return toString(getFootPrint()) + " byte(s)";
return CUtility::toString(getFootPrint()) + " byte(s)";
}

// Matching check for no domain association
Expand Down
Loading