[Armadeus-commitlog] armadeus branch, master, updated. armadeus-5.2-148-g70bf788
Brought to you by:
sszy
|
From: Julien B a. A. <ar...@us...> - 2013-02-04 15:25:39
|
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "armadeus".
The branch, master has been updated
via 70bf7884a4fdeed08185f13dbeb556bf5a19b59c (commit)
via b44ae4db894c6f5a9927ea0a72b35d72d3a0e651 (commit)
from 405d4b77be48d55bd340eb50a0fd609f4ce8d532 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit 70bf7884a4fdeed08185f13dbeb556bf5a19b59c
Author: Julien Boibessot <jul...@ar...>
Date: Mon Feb 4 16:24:20 2013 +0100
[AS_DEVICES] Fixes C++ wrapper installation (to have .hpp in staging/ under Buildroot)
commit b44ae4db894c6f5a9927ea0a72b35d72d3a0e651
Author: Julien Boibessot <jul...@ar...>
Date: Mon Feb 4 16:21:54 2013 +0100
[AS_DEVICES] Fixes some build warnings (and indentation while we are at it)
-----------------------------------------------------------------------
Summary of changes:
.../package/armadeus/as_devices/as_devices.mk | 15 +++++-
target/packages/as_devices/Makefile | 1 -
target/packages/as_devices/cpp/Makefile | 32 ++++++++----
target/packages/as_devices/test_c.h | 52 +++++++++-----------
target/packages/as_devices/test_cpp.h | 53 ++++++++------------
5 files changed, 79 insertions(+), 74 deletions(-)
diff --git a/buildroot/package/armadeus/as_devices/as_devices.mk b/buildroot/package/armadeus/as_devices/as_devices.mk
index e619955..845d4ea 100644
--- a/buildroot/package/armadeus/as_devices/as_devices.mk
+++ b/buildroot/package/armadeus/as_devices/as_devices.mk
@@ -29,17 +29,27 @@ ifeq ($(strip $(BR2_PACKAGE_AS_DEVICES_PYTHON)),y)
AS_DEVICES_MAKE_ENV += PYINC="$(STAGING_DIR)/usr/include/python$(PYTHON_VERSION_MAJOR)"
AS_DEVICES_MAKE_ENV += PYLIB="$(STAGING_DIR)/usr/lib/python$(PYTHON_VERSION_MAJOR)"
endif
-#XXX: BR2_TARGET_UBOOT_BOARDNAME is wrong, to be fixed
+#XXX: BR2_TARGET_UBOOT_BOARDNAME is wrong, to be fixed
AS_DEVICES_MAKE_ENV += ARMADEUS_BOARD_NAME=$(BR2_TARGET_UBOOT_BOARDNAME)
+# Build
define AS_DEVICES_BUILD_CMDS
$(MAKE) $(AS_DEVICES_MAKE_ENV) -C $(@D) $(AS_DEVICES_BUILD_TARGET)
endef
+# Install staging/
+ifeq ($(strip $(BR2_PACKAGE_AS_DEVICES_CPP)),y)
+define AS_DEVICES_INSTALL_STAGING_CPP_LIB
+ $(MAKE) INSTALL_DIR=$(STAGING_DIR) -C $(@D)/cpp install
+endef
+endif
+
define AS_DEVICES_INSTALL_STAGING_CMDS
$(MAKE) INSTALL_DIR=$(STAGING_DIR) -C $(@D) install
+ $(AS_DEVICES_INSTALL_STAGING_CPP_LIB)
endef
+# Install target/
ifeq ($(strip $(BR2_PACKAGE_AS_DEVICES_TESTS)),y)
define AS_DEVICES_INSTALL_TEST
cp -rf $(@D)/test_cdevices $(TARGET_DIR)/usr/bin/
@@ -48,7 +58,7 @@ endif
ifeq ($(strip $(BR2_PACKAGE_AS_DEVICES_CPP)),y)
define AS_DEVICES_INSTALL_CPP_LIB
- install -D $(@D)/cpp/libas_devices_cpp.so $(TARGET_DIR)/usr/lib/
+ $(MAKE) INSTALL_DIR=$(TARGET_DIR) -C $(@D)/cpp install-exe
endef
endif
@@ -74,6 +84,7 @@ define AS_DEVICES_INSTALL_TARGET_CMDS
$(AS_DEVICES_INSTALL_PYTHON)
endef
+# Clean
define AS_DEVICES_CLEAN_CMDS
$(MAKE) -C $(@D) clean
endef
diff --git a/target/packages/as_devices/Makefile b/target/packages/as_devices/Makefile
index f59943a..5137497 100644
--- a/target/packages/as_devices/Makefile
+++ b/target/packages/as_devices/Makefile
@@ -63,4 +63,3 @@ clean:
rm -f $(P_WRAPPER)
make -C python/ clean
rm -f $(C_BINARY) $(CPP_BINARY)
-
diff --git a/target/packages/as_devices/cpp/Makefile b/target/packages/as_devices/cpp/Makefile
index c1344fc..9b034f5 100644
--- a/target/packages/as_devices/cpp/Makefile
+++ b/target/packages/as_devices/cpp/Makefile
@@ -18,20 +18,21 @@ OBJS += as_i2c_eeprom.o
OBJS += as_spi.o
-LIBRARY=as_devices_cpp
-LIB_VERS=1
-STAT_LIB=${LIBRARY}.a
-SONAME=lib${LIBRARY}.so
-LIBNAME=${SONAME}.${LIB_VERS}
-ARCHIVE_CMD=ar
-ARCHIVE_OPTS=-cvq
+LIBRARY = as_devices_cpp
+LIB_VERS = 1
+STAT_LIB = ${LIBRARY}.a
+SO_NAME = lib${LIBRARY}.so
+LIBNAME = ${SO_NAME}.${LIB_VERS}
+ARCHIVE_CMD = ar
+ARCHIVE_OPTS = -cvq
C_INCLUDE=../c/
C_LIB=../c/libas_devices.so.1
-${LIBNAME}: ${OBJS}
- ${CXX} -shared -Wl,-soname,${SONAME} -o ${SONAME} ${OBJS} ${C_LIB} -lc
- ln -s ${SONAME} ${LIBNAME}
+.PHONY: install install-exe clean
+
+$(SO_NAME): ${OBJS}
+ ${CXX} -shared -Wl,-soname,${SO_NAME} -o ${SO_NAME} ${OBJS} ${C_LIB} -lc
${STAT_LIB}: ${OBJS}
${ARCHIVE_CMD} ${ARCHIVE_OPTS} ${STAT_LIB} ${OBJS}
@@ -39,6 +40,17 @@ ${STAT_LIB}: ${OBJS}
%.o: %.cpp
$(CXX) -fPIC -o $@ -c $< ${CXXFLAGS} -I${C_INCLUDE} -D__cplusplus
+install: $(SO_NAME)
+ mkdir -p $(INSTALL_DIR)/usr/lib
+ install -D $(SO_NAME) $(INSTALL_DIR)/usr/lib
+ cd $(INSTALL_DIR)/usr/lib/; ln -sf $(SO_NAME) $(LIBNAME)
+ mkdir -p $(INSTALL_DIR)/usr/include/as_devices/cpp
+ cp *.hpp $(INSTALL_DIR)/usr/include/as_devices/cpp
+
+install-exe: $(SO_NAME)
+ install -D $(SO_NAME) $(INSTALL_DIR)/usr/lib
+ cd $(INSTALL_DIR)/usr/lib; ln -sf $(SO_NAME) $(LIBNAME)
+
clean:
rm -f *.o *.so
rm -f ${BINARY} ${STAT_LIB} ${LIBNAME}
diff --git a/target/packages/as_devices/test_c.h b/target/packages/as_devices/test_c.h
index 859118c..fb41a04 100644
--- a/target/packages/as_devices/test_c.h
+++ b/target/packages/as_devices/test_c.h
@@ -76,9 +76,9 @@ void test_pwm(void)
printf(" 7) activate/desactivate\n");
printf(" 8) get state\n");
printf("> ");
- scanf("%s",buffer);
+ scanf("%s", buffer);
- switch(buffer[0])
+ switch (buffer[0])
{
case '1' : printf("Give frequency :");
scanf("%d",&value);
@@ -90,8 +90,8 @@ void test_pwm(void)
pressEnterToContinue();
break;
case '3' : printf("Give period :");
- scanf("%d",&value);
- as_pwm_set_period(pwm_dev,value);
+ scanf("%d", &value);
+ as_pwm_set_period(pwm_dev, value);
pressEnterToContinue();
break;
case '4' : printf("Current period is %d\n",
@@ -99,8 +99,8 @@ void test_pwm(void)
pressEnterToContinue();
break;
case '5' : printf("Give Duty :");
- scanf("%d",&value);
- as_pwm_set_duty(pwm_dev,value);
+ scanf("%d", &value);
+ as_pwm_set_duty(pwm_dev, value);
pressEnterToContinue();
break;
case '6' : printf("Current Duty is %d\n",
@@ -108,24 +108,21 @@ void test_pwm(void)
pressEnterToContinue();
break;
case '7' : printf("Activate 'a' or Desactivate 'd' ?");
- scanf("%s",buffer2);
- if(buffer2[0] == 'a')
- {
- as_pwm_set_state(pwm_dev,1);
+ scanf("%s", buffer2);
+ if (buffer2[0] == 'a') {
+ as_pwm_set_state(pwm_dev, 1);
printf("Pwm activated\n");
pressEnterToContinue();
- }else if(buffer2[0] == 'd')
- {
- as_pwm_set_state(pwm_dev,0);
+ } else if (buffer2[0] == 'd') {
+ as_pwm_set_state(pwm_dev, 0);
printf("Pwm desactivated\n");
pressEnterToContinue();
- }else{
+ } else {
printf("Option %c unknown\n",buffer[0]);
pressEnterToContinue();
}
break;
- case '8' : if(as_pwm_get_state(pwm_dev))
- {
+ case '8' : if (as_pwm_get_state(pwm_dev)) {
printf("pwm is active\n");
pressEnterToContinue();
} else {
@@ -137,7 +134,7 @@ void test_pwm(void)
}
}
ret = as_pwm_close(pwm_dev);
- if(ret < 0){
+ if (ret < 0) {
printf("can't close pwm0\n");
return;
}
@@ -823,18 +820,16 @@ void test_backlight(void)
{
int ret;
char buffer[20];
- char buffer2[20];
int value;
struct as_backlight_device *backlight_dev;
backlight_dev = as_backlight_open();
- if(backlight_dev == NULL){
+ if (backlight_dev == NULL) {
printf("can't init backlight\n");
pressEnterToContinue();
return;
}
- while(buffer[0] != 'q')
- {
+ while (buffer[0] != 'q') {
system("clear");
printf("*********************************\n");
printf("* Testing backlight menu *\n");
@@ -844,7 +839,7 @@ void test_backlight(void)
printf(" 2) get maximum brightness\n");
printf(" 3) set brightness\n");
printf("> ");
- scanf("%s",buffer);
+ scanf("%s", buffer);
switch(buffer[0])
{
@@ -875,7 +870,6 @@ void test_i2c_eeprom()
{
unsigned char page_buffer[500];
char buffer[50];
- int i;
/* defaults values */
int bus_number = 0;
@@ -900,9 +894,9 @@ void test_i2c_eeprom()
if (initialized == 0)
{
printf(" 1) Change I2C bus number (%d)\n", bus_number);
- printf(" 2) Change eeprom address (%d)\n", eeprom_addr);
- printf(" 3) Change eeprom address width (%d)\n", addr_width);
- printf(" 4) Change page write buffer size (%d)\n", page_buffer_size);
+ printf(" 2) Change eeprom address (%lu)\n", eeprom_addr);
+ printf(" 3) Change eeprom address width (%lu)\n", addr_width);
+ printf(" 4) Change page write buffer size (%lu)\n", page_buffer_size);
printf(" 5) Change number of pages (%d)\n", number_pages);
printf(" 6) Change page size (%d)\n", page_size);
printf(" 7) Initialize eeprom\n");
@@ -933,7 +927,7 @@ void test_i2c_eeprom()
case '2' : printf("Give eeprom address: ");
scanf("%d", &value);
eeprom_addr = value;
- printf("Eeprom address changed to %d\n", eeprom_addr);
+ printf("Eeprom address changed to %lu\n", eeprom_addr);
break;
case '3' : printf("Give eeprom address width: ");
scanf("%d", &value);
@@ -943,7 +937,7 @@ void test_i2c_eeprom()
pressEnterToContinue();
} else {
addr_width = value;
- printf("Eeprom address width changed to %d\n", addr_width);
+ printf("Eeprom address width changed to %lu\n", addr_width);
}
break;
case '4' : printf("Give new page write buffer size (16 or 32): ");
@@ -954,7 +948,7 @@ void test_i2c_eeprom()
pressEnterToContinue();
} else {
page_buffer_size = value;
- printf("Page write buffer size changed to %d\n", page_buffer_size);
+ printf("Page write buffer size changed to %lu\n", page_buffer_size);
}
break;
case '5' : printf("Give number of pages: \n");
diff --git a/target/packages/as_devices/test_cpp.h b/target/packages/as_devices/test_cpp.h
index 934b325..b12f406 100644
--- a/target/packages/as_devices/test_cpp.h
+++ b/target/packages/as_devices/test_cpp.h
@@ -780,22 +780,19 @@ void test_93LC(void)
printf("Give value in hexadecimal:");
scanf("%x",&value);
value2 = eeprom_dev->writeAll(value);
- if (value2 < 0)
- {
+ if (value2 < 0) {
printf("Error, can't write value\n");
}
pressEnterToContinue();
break;
case '6' : printf(" Read all\n");
- for(i = 0; i <= max_address(type, word_size); i++)
- {
- if (word_size == 8)
- {
+ for (i = 0; i <= max_address(type, word_size); i++) {
+ if (word_size == 8) {
printf("%03X -> %02X\n",
- i,eeprom_dev->read(i));
- } else{
+ i, (unsigned int)eeprom_dev->read(i));
+ } else {
printf("%03X -> %04X\n",
- i,eeprom_dev->read(i));
+ i, (unsigned int)eeprom_dev->read(i));
}
}
pressEnterToContinue();
@@ -909,7 +906,6 @@ void test_i2c_eeprom()
{
unsigned char page_buffer[500];
char buffer[50];
- int i;
/* defaults values */
int bus_number = 0;
@@ -921,8 +917,8 @@ void test_i2c_eeprom()
AsI2CEeprom* dev = NULL;
- int value, value2;
- int initialized=0;
+ unsigned int value, value2;
+ int initialized = 0;
while(buffer[0] != 'q')
{
@@ -931,12 +927,11 @@ void test_i2c_eeprom()
printf("* Testing I2C EEPROM menu *\n");
printf("*********************************\n");
printf("Choose ('q' to quit):\n");
- if (initialized == 0)
- {
+ if (initialized == 0) {
printf(" 1) Change I2C bus number (%d)\n", bus_number);
- printf(" 2) Change eeprom address (%d)\n", eeprom_addr);
- printf(" 3) Change eeprom address width (%d)\n", addr_width);
- printf(" 4) Change page write buffer size (%d)\n", page_buffer_size);
+ printf(" 2) Change eeprom address (%lu)\n", eeprom_addr);
+ printf(" 3) Change eeprom address width (%lu)\n", addr_width);
+ printf(" 4) Change page write buffer size (%lu)\n", page_buffer_size);
printf(" 5) Change number of pages (%d)\n", number_pages);
printf(" 6) Change page size (%d)\n", page_size);
printf(" 7) Initialize eeprom\n");
@@ -955,8 +950,7 @@ void test_i2c_eeprom()
{
case '1' : printf("Give new I2C bus number (0 or 1): ");
scanf("%d", &value);
- if ( (value != 0) && (value != 1) )
- {
+ if ((value != 0) && (value != 1)) {
printf("Wrong value\n");
pressEnterToContinue();
} else {
@@ -967,34 +961,31 @@ void test_i2c_eeprom()
case '2' : printf("Give eeprom address: ");
scanf("%d", &value);
eeprom_addr = value;
- printf("Eeprom address changed to %d\n", eeprom_addr);
+ printf("Eeprom address changed to %lu\n", eeprom_addr);
break;
case '3' : printf("Give eeprom address width: ");
scanf("%d", &value);
- if ( (value != 8) && (value != 16) )
- {
+ if ((value != 8) && (value != 16)) {
printf("Wrong value\n");
pressEnterToContinue();
} else {
addr_width = value;
- printf("Eeprom address width changed to %d\n", addr_width);
+ printf("Eeprom address width changed to %lu\n", addr_width);
}
break;
case '4' : printf("Give new page write buffer size (16 or 32): ");
scanf("%d", &value);
- if ( (value != 16) && (value != 32) )
- {
+ if ((value != 16) && (value != 32)) {
printf("Wrong value\n");
pressEnterToContinue();
} else {
page_buffer_size = value;
- printf("Page write buffer size changed to %d\n", page_buffer_size);
+ printf("Page write buffer size changed to %lu\n", page_buffer_size);
}
break;
case '5' : printf("Give number of pages: \n");
scanf("%d", &value);
- if ( (value != 1) && (value != 2) && (value != 4) )
- {
+ if ((value != 1) && (value != 2) && (value != 4)) {
printf("Wrong value\n");
pressEnterToContinue();
} else {
@@ -1008,8 +999,7 @@ void test_i2c_eeprom()
printf("Page size changed to %d\n", page_size);
break;
case '7' : dev = new AsI2CEeprom(bus_number, eeprom_addr, addr_width, page_buffer_size, number_pages, page_size);
- if (dev == NULL)
- {
+ if (dev == NULL) {
printf("Error, can't initialize eeprom.\n");
} else {
initialized = 1;
@@ -1031,8 +1021,7 @@ void test_i2c_eeprom()
printf("Give page number (max. %d):",
number_pages);
scanf("%x",&value);
- if (value > number_pages)
- {
+ if (value > number_pages) {
printf(" Error, wrong page number\n");
} else {
value2 = dev->read(value, page_buffer);
hooks/post-receive
--
armadeus
|