Compilation flags update: BOARD=ids01a4/5 SENSORBOARD=iks01a1

ico
Marco Grella 2015-10-27 12:12:59 +01:00
parent 4e81c87c3a
commit e261cda8dc
20 changed files with 101 additions and 97 deletions

View File

@ -2,7 +2,7 @@ CONTIKI_PROJECT = sensor-demo
all: $(CONTIKI_PROJECT)
TARGET=stm32nucleo-spirit1
USE_SENSOR_BOARD=1
SENSORBOARD=iks01a1
CONTIKI = ../../..
include $(CONTIKI)/Makefile.include

View File

@ -9,9 +9,9 @@ must be used. It needs to be connected on top of the NUCLEO-L152RE (MCU) and the
To build the example type:
make TARGET=stm32nucleo-spirit1 USE_SUBGHZ_BOARD=IDS01A4 USE_SENSOR_BOARD=1
make TARGET=stm32nucleo-spirit1 BOARD=ids01a4 SENSORBOARD=iks01a1
or
make TARGET=stm32nucleo-spirit1 USE_SUBGHZ_BOARD=IDS01A5 USE_SENSOR_BOARD=1
make TARGET=stm32nucleo-spirit1 BOARD=ids01a5 SENSORBOARD=iks01a1
depending on the sub GHz board you have.
depending on the X-NUCLEO-IDS01Ax expansion board for sub GHz radio connectivity you have.

View File

@ -44,14 +44,14 @@
#include "st-lib.h"
#ifdef COMPILE_SENSORS
#ifdef X_NUCLEO_IKS01A1
#include "dev/temperature-sensor.h"
#include "dev/humidity-sensor.h"
#include "dev/pressure-sensor.h"
#include "dev/magneto-sensor.h"
#include "dev/acceleration-sensor.h"
#include "dev/gyroscope-sensor.h"
#endif /*COMPILE_SENSORS*/
#endif /*X_NUCLEO_IKS01A1*/
#define DEBUG DEBUG_PRINT
#include "net/ip/uip-debug.h"
@ -75,14 +75,14 @@ PROCESS_THREAD(sensor_demo_process, ev, data)
SENSORS_ACTIVATE(radio_sensor);
#ifdef COMPILE_SENSORS
#ifdef X_NUCLEO_IKS01A1
SENSORS_ACTIVATE(temperature_sensor);
SENSORS_ACTIVATE(humidity_sensor);
SENSORS_ACTIVATE(pressure_sensor);
SENSORS_ACTIVATE(magneto_sensor);
SENSORS_ACTIVATE(acceleration_sensor);
SENSORS_ACTIVATE(gyroscope_sensor);
#endif
#endif /*X_NUCLEO_IKS01A1*/
while(1) {
etimer_set(&etimer, PRINT_INTERVAL);
@ -98,17 +98,17 @@ PROCESS_THREAD(sensor_demo_process, ev, data)
printf("Button state:\t%s (pressed %lu times)\n", button_sensor.value(0) ? "Released" : "Pressed",
_button_pressed);
#ifdef COMPILE_SENSORS
#ifdef X_NUCLEO_IKS01A1
printf("LEDs status:\tRED:n/a GREEN:%s\n", leds_get() & LEDS_GREEN ? "on" : "off");
#else
printf("LEDs status:\tRED:%s GREEN:%s\n", leds_get() & LEDS_RED ? "on" : "off",
leds_get() & LEDS_GREEN ? "on" : "off");
#endif /*COMPILE_SENSORS*/
#endif /*X_NUCLEO_IKS01A1*/
sensor_value = radio_sensor.value(RADIO_SENSOR_LAST_PACKET);
printf("Radio (RSSI):\t%d.%d dBm\n", sensor_value / 10, ABS_VALUE(sensor_value) % 10);
printf("Radio (LQI):\t%d\n", radio_sensor.value(RADIO_SENSOR_LAST_VALUE));
#ifdef COMPILE_SENSORS
#ifdef X_NUCLEO_IKS01A1
sensor_value = temperature_sensor.value(0);
printf("Temperature:\t%d.%d C\n", sensor_value / 10, ABS_VALUE(sensor_value) % 10);
@ -134,7 +134,7 @@ PROCESS_THREAD(sensor_demo_process, ev, data)
printf("Gyroscope:\t%d/%d/%d (X/Y/Z) mdps\n", gyroscope_sensor.value(X_AXIS),
gyroscope_sensor.value(Y_AXIS),
gyroscope_sensor.value(Z_AXIS));
#endif
#endif /*X_NUCLEO_IKS01A1*/
printf("\n");
}

View File

@ -0,0 +1,2 @@
#Simply set the correct flag
CFLAGS += -DX_NUCLEO_IDS01A4

View File

@ -0,0 +1,2 @@
#Simply set the correct flag
CFLAGS += -DX_NUCLEO_IDS01A5

View File

@ -0,0 +1,23 @@
CFLAGS += -DX_NUCLEO_IKS01A1
CONTIKI_TARGET_DIRS += stm32cube-lib/drivers/x_nucleo_iks01a1
CONTIKI_TARGET_DIRS += stm32cube-lib/drivers/sensors/hts221 stm32cube-lib/drivers/sensors/lps25h stm32cube-lib/drivers/sensors/lps25hb\
stm32cube-lib/drivers/sensors/lsm6ds0 stm32cube-lib/drivers/sensors/lsm6ds3 stm32cube-lib/drivers/sensors/lis3mdl
ARCH_DEV_SENSORS = temperature-sensor.c humidity-sensor.c pressure-sensor.c magneto-sensor.c acceleration-sensor.c gyroscope-sensor.c
ARCH_DRIVERS_IKS01A1 = x_nucleo_iks01a1.c x_nucleo_iks01a1_hum_temp.c x_nucleo_iks01a1_imu_6axes.c \
x_nucleo_iks01a1_magneto.c x_nucleo_iks01a1_pressure.c
ARCH_DRIVERS_SENSORS = hts221.c \
lis3mdl.c \
lps25h.c \
lps25hb.c \
lsm6ds0.c \
lsm6ds3.c
ARCH+=$(ARCH_DEV_SENSORS)
ARCH+=$(ARCH_DRIVERS_IKS01A1)
ARCH+=$(ARCH_DRIVERS_SENSORS)

View File

@ -1,30 +1,32 @@
CONTIKI_TARGET_DIRS = .
ifeq ($(USE_SENSOR_BOARD),1)
COMPILE_SENSORS=TRUE
CFLAGS += -DCOMPILE_SENSORS
${info Compiling with Sensor Files}
else
COMPILE_SENSORS=FALSE
${info NOT compiling Sensor Files}
endif
ifeq ($(USE_SUBGHZ_BOARD),IDS01A4)
CFLAGS += -DX_NUCLEO_IDS01A4
ifeq ($(BOARD),ids01a4)
${info Using 868 MHz SPIRIT1 Board}
else ifeq ($(USE_SUBGHZ_BOARD),IDS01A5)
CFLAGS += -DX_NUCLEO_IDS01A5
else ifeq ($(BOARD),ids01a5)
${info Using 915 MHz SPIRIT1 Board}
else
${info You must specify which SPIRIT1 board you use:}
${info make USE_SUBGHZ_BOARD=IDS01A4 for 868 MHz}
${info make USE_SUBGHZ_BOARD=IDS01A5 for 915 MHz}
${info make BOARD=ids01a4 for X-NUCLEO-IDS01A4 (868 MHz)}
${info make BOARD=ids01a5 for X-NUCLEO-IDS01A5 (915 MHz)}
${error }
endif
### Include the board-specific makefile
PLATFORM_ROOT_DIR = $(CONTIKI)/platform/$(TARGET)
-include $(PLATFORM_ROOT_DIR)/Makefile.$(BOARD)
ifeq ($(SENSORBOARD),iks01a1)
${info Compiling with X-NUCLEO-IKS01A1 sensors files}
-include $(PLATFORM_ROOT_DIR)/Makefile.$(SENSORBOARD)
else ifeq ($(SENSORBOARD),)
${info NOT compiling files for any sensors expansion board}
else
${info Error: SENSORBOARD can be: iks01a1}
${error }
endif
#Currently we support only GCC
GCC=1
@ -41,17 +43,8 @@ CONTIKI_TARGET_DIRS += stm32cube-lib/drivers/STM32L1xx_HAL_Driver/Src
CONTIKI_TARGET_DIRS += stm32cube-lib/drivers/STM32L1xx_HAL_Driver/Inc
ifeq ($(COMPILE_SENSORS),TRUE)
CONTIKI_TARGET_DIRS += stm32cube-lib/drivers/x_nucleo_iks01a1
CONTIKI_TARGET_DIRS += stm32cube-lib/drivers/sensors/hts221 stm32cube-lib/drivers/sensors/lps25h stm32cube-lib/drivers/sensors/lps25hb\
stm32cube-lib/drivers/sensors/lsm6ds0 stm32cube-lib/drivers/sensors/lsm6ds3 stm32cube-lib/drivers/sensors/lis3mdl
endif
ARCH_DEV = button-sensor.c leds-arch.c radio-sensor.c
ARCH_DEV_SENSORS = temperature-sensor.c humidity-sensor.c pressure-sensor.c magneto-sensor.c acceleration-sensor.c gyroscope-sensor.c
ARCH_NUCLEOSPIRIT1 = contiki-spirit1-main.c uart-msg.c spirit1-arch.c spirit1.c node-id.c
ARCH_NUCLEOSPIRIT1_STM32CUBEHAL = spirit1_appli.c stm32l1xx_hal_msp.c stm32l1xx_it.c stm32cube_hal_init.c
@ -81,16 +74,6 @@ ARCH_DRIVERS_SPIRIT1 = \
SPIRIT_Timer.c \
SPIRIT_Types.c
ARCH_DRIVERS_IKS01A1 = x_nucleo_iks01a1.c x_nucleo_iks01a1_hum_temp.c x_nucleo_iks01a1_imu_6axes.c \
x_nucleo_iks01a1_magneto.c x_nucleo_iks01a1_pressure.c
ARCH_DRIVERS_SENSORS = hts221.c \
lis3mdl.c \
lps25h.c \
lps25hb.c \
lsm6ds0.c \
lsm6ds3.c
STM32L1XX_HAL =\
stm32l1xx_hal.c\
stm32l1xx_hal_adc_ex.c\
@ -144,12 +127,6 @@ ARCH+=$(ARCH_DRIVERS_IDS01AX)
ARCH+=$(ARCH_DRIVERS_SPIRIT1)
ARCH+=$(STM32L1XX_HAL)
ifeq ($(COMPILE_SENSORS),TRUE)
ARCH+=$(ARCH_DEV_SENSORS)
ARCH+=$(ARCH_DRIVERS_IKS01A1)
ARCH+=$(ARCH_DRIVERS_SENSORS)
endif
CFLAGS += -DUSE_STM32L152_EVAL \
-DSTM32L152xE \
-DUSE_STM32L1XX_NUCLEO \

View File

@ -7,7 +7,7 @@ Port Feature
============
The port supports the following boards from ST:
- NUCLEO-L152RE board, based on the STM32L152RET6 ultra-low power microcontroller
- NUCLEO-L152RE board, based on the STM32L152RET6 ultra-low power microcontroller
- X-NUCLEO-IDS01A4 based on sub-1GHz SPSGRF-868 SPIRIT1 module (operating at 868 MHz)
- X-NUCLEO-IDS01A5 based on sub-1GHz SPSGRF-915 SPIRIT1 module (operating at 915 MHz)
- X-NUCLEO-IKS01A1 featuring motion MEMS and environmental sensors (optional)
@ -102,13 +102,13 @@ For example, go to examples/ipv6/simple-udp-rpl directory.
If the X-NUCLEO-IDS01A4 sub-1GHz RF expansion board is used, the following must be run:
make TARGET=stm32nucleo-spirit1 USE_SUBGHZ_BOARD=IDS01A4 clean
make TARGET=stm32nucleo-spirit1 USE_SUBGHZ_BOARD=IDS01A4
make TARGET=stm32nucleo-spirit1 BOARD=ids01a4 clean
make TARGET=stm32nucleo-spirit1 BOARD=ids01a4
If the X-NUCLEO-IDS01A5 sub-1GHz RF expansion board is used, the following must be run:
make TARGET=stm32nucleo-spirit1 USE_SUBGHZ_BOARD=IDS01A5 clean
make TARGET=stm32nucleo-spirit1 USE_SUBGHZ_BOARD=IDS01A5
make TARGET=stm32nucleo-spirit1 BOARD=ids01a5 clean
make TARGET=stm32nucleo-spirit1 BOARD=ids01a5
This will create executables for UDP sender and receiver nodes.
@ -125,7 +125,7 @@ In case you need to build an example that uses the additional sensors expansion
(for example, considering a system made of NUCLEO-L152RE, X-NUCLEO-IDS01A4 and X-NUCLEO-IKS01A1)
then the command to be run would be:
make TARGET=stm32nucleo-spirit1 USE_SUBGHZ_BOARD=IDS01A4 USE_SENSOR_BOARD=1
make TARGET=stm32nucleo-spirit1 BOARD=ids01a4 SENSORBOARD=iks01a1
System setup
============

View File

@ -68,7 +68,7 @@
#include "net/ipv6/uip-ds6.h"
#endif /*NETSTACK_CONF_WITH_IPV6*/
/*---------------------------------------------------------------------------*/
#if COMPILE_SENSORS
#ifdef X_NUCLEO_IKS01A1
extern const struct sensors_sensor temperature_sensor;
extern const struct sensors_sensor humidity_sensor;
extern const struct sensors_sensor pressure_sensor;
@ -83,10 +83,10 @@ SENSORS(&button_sensor,
&magneto_sensor,
&acceleration_sensor,
&gyroscope_sensor);
#else /*COMPILE_SENSORS*/
#else /*X_NUCLEO_IKS01A1*/
SENSORS(&button_sensor,
&radio_sensor);
#endif /*COMPILE_SENSORS*/
#endif /*X_NUCLEO_IKS01A1*/
/*---------------------------------------------------------------------------*/
extern unsigned char node_mac[8];
/*---------------------------------------------------------------------------*/

View File

@ -37,7 +37,7 @@
* Driver for the stm32nucleo-spirit1 Temperature sensor (on expansion board)
*/
/*---------------------------------------------------------------------------*/
#if COMPILE_SENSORS
#ifdef X_NUCLEO_IKS01A1
/*---------------------------------------------------------------------------*/
#include "lib/sensors.h"
#include "acceleration-sensor.h"
@ -137,6 +137,6 @@ status(int type)
SENSORS_SENSOR(acceleration_sensor, ACCELERATION_SENSOR,
value, configure, status);
/*---------------------------------------------------------------------------*/
#endif /*COMPILE_SENSORS*/
#endif /*X_NUCLEO_IKS01A1*/
/*---------------------------------------------------------------------------*/
/** @} */

View File

@ -37,7 +37,7 @@
* Driver for the stm32nucleo-spirit1 Gyroscope sensor (on expansion board)
*/
/*---------------------------------------------------------------------------*/
#if COMPILE_SENSORS
#ifdef X_NUCLEO_IKS01A1
/*---------------------------------------------------------------------------*/
#include "lib/sensors.h"
#include "gyroscope-sensor.h"
@ -136,6 +136,6 @@ status(int type)
/*---------------------------------------------------------------------------*/
SENSORS_SENSOR(gyroscope_sensor, GYROSCOPE_SENSOR, value, configure, status);
/*---------------------------------------------------------------------------*/
#endif /*COMPILE_SENSORS*/
#endif /*X_NUCLEO_IKS01A1*/
/*---------------------------------------------------------------------------*/
/** @} */

View File

@ -37,7 +37,7 @@
* Driver for the stm32nucleo-spirit1 Humidity sensor (on expansion board)
*/
/*---------------------------------------------------------------------------*/
#if COMPILE_SENSORS
#ifdef X_NUCLEO_IKS01A1
/*---------------------------------------------------------------------------*/
#include "lib/sensors.h"
#include "humidity-sensor.h"
@ -117,6 +117,6 @@ status(int type)
/*---------------------------------------------------------------------------*/
SENSORS_SENSOR(humidity_sensor, HUMIDITY_SENSOR, value, configure, status);
/*---------------------------------------------------------------------------*/
#endif /*COMPILE_SENSORS*/
#endif /*X_NUCLEO_IKS01A1*/
/*---------------------------------------------------------------------------*/
/** @} */

View File

@ -41,13 +41,13 @@
#include "dev/leds.h"
#include "st-lib.h"
/*---------------------------------------------------------------------------*/
#ifndef COMPILE_SENSORS
/* The Red LED (on SPIRIT1 exp board) is exposed only if the sensor board is NOT
* used, becasue of a pin conflict.
#ifndef X_NUCLEO_IKS01A1
/* The Red LED (on SPIRIT1 exp board) is exposed only if the
* X-NUCLEO-IKS01A1 sensor board is NOT used, becasue of a pin conflict.
*/
extern st_lib_gpio_typedef *st_lib_a_led_gpio_port[];
extern const uint16_t st_lib_a_led_gpio_pin[];
#endif /*COMPILE_SENSORS*/
#endif /*X_NUCLEO_IKS01A1*/
extern st_lib_gpio_typedef *st_lib_gpio_port[];
extern const uint16_t st_lib_gpio_pin[];
@ -59,13 +59,13 @@ leds_arch_init(void)
st_lib_bsp_led_init(LED2);
st_lib_bsp_led_off(LED2);
#ifndef COMPILE_SENSORS
/* The Red LED (on SPIRIT1 exp board) is exposed only if the sensor board is NOT
* used, becasue of a pin conflict.
#ifndef X_NUCLEO_IKS01A1
/* The Red LED (on SPIRIT1 exp board) is exposed only if the
* X-NUCLEO-IKS01A1 sensor board is NOT used, becasue of a pin conflict.
*/
st_lib_radio_shield_led_init(RADIO_SHIELD_LED);
st_lib_radio_shield_led_off(RADIO_SHIELD_LED);
#endif /*COMPILE_SENSORS*/
#endif /*X_NUCLEO_IKS01A1*/
}
/*---------------------------------------------------------------------------*/
unsigned char
@ -76,15 +76,15 @@ leds_arch_get(void)
ret |= LEDS_GREEN;
}
#ifndef COMPILE_SENSORS
/* The Red LED (on SPIRIT1 exp board) is exposed only if the sensor board is NOT
* used, becasue of a pin conflict.
#ifndef X_NUCLEO_IKS01A1
/* The Red LED (on SPIRIT1 exp board) is exposed only if the
* X-NUCLEO-IKS01A1 sensor board is NOT used, becasue of a pin conflict.
*/
if(st_lib_hal_gpio_read_pin(st_lib_a_led_gpio_port[RADIO_SHIELD_LED],
st_lib_a_led_gpio_pin[RADIO_SHIELD_LED])) {
ret |= LEDS_RED;
}
#endif /*COMPILE_SENSORS*/
#endif /*X_NUCLEO_IKS01A1*/
return ret;
}
@ -98,16 +98,16 @@ leds_arch_set(unsigned char leds)
st_lib_bsp_led_off(LED2);
}
#ifndef COMPILE_SENSORS
/* The Red LED (on SPIRIT1 exp board) is exposed only if the sensor board is NOT
* used, becasue of a pin conflict.
#ifndef X_NUCLEO_IKS01A1
/* The Red LED (on SPIRIT1 exp board) is exposed only if the
* X-NUCLEO-IKS01A1 sensor board is NOT used, becasue of a pin conflict.
*/
if(leds & LEDS_RED) {
st_lib_radio_shield_led_on(RADIO_SHIELD_LED);
} else {
st_lib_radio_shield_led_off(RADIO_SHIELD_LED);
}
#endif /*COMPILE_SENSORS*/
#endif /*X_NUCLEO_IKS01A1*/
}
/*---------------------------------------------------------------------------*/
/** @} */

View File

@ -37,7 +37,7 @@
* Driver for the stm32nucleo-spirit1 Magneto sensor (on expansion board)
*/
/*---------------------------------------------------------------------------*/
#if COMPILE_SENSORS
#ifdef X_NUCLEO_IKS01A1
/*---------------------------------------------------------------------------*/
#include "lib/sensors.h"
#include "magneto-sensor.h"
@ -132,6 +132,6 @@ status(int type)
/*---------------------------------------------------------------------------*/
SENSORS_SENSOR(magneto_sensor, MAGNETO_SENSOR, value, configure, status);
/*---------------------------------------------------------------------------*/
#endif /*COMPILE_SENSORS*/
#endif /*X_NUCLEO_IKS01A1*/
/*---------------------------------------------------------------------------*/
/** @} */

View File

@ -37,7 +37,7 @@
* Driver for the stm32nucleo-spirit1 Pressure sensor (on expansion board)
*/
/*---------------------------------------------------------------------------*/
#if COMPILE_SENSORS
#ifdef X_NUCLEO_IKS01A1
/*---------------------------------------------------------------------------*/
#include "lib/sensors.h"
#include "pressure-sensor.h"
@ -114,5 +114,5 @@ status(int type)
/*---------------------------------------------------------------------------*/
SENSORS_SENSOR(pressure_sensor, PRESSURE_SENSOR, value, configure, status);
/*---------------------------------------------------------------------------*/
#endif /*COMPILE_SENSORS*/
#endif /*X_NUCLEO_IKS01A1*/
/** @} */

View File

@ -37,7 +37,7 @@
* Driver for the stm32nucleo-spirit1 Temperature sensor (on expansion board)
*/
/*---------------------------------------------------------------------------*/
#if COMPILE_SENSORS
#ifdef X_NUCLEO_IKS01A1
/*---------------------------------------------------------------------------*/
#include "lib/sensors.h"
#include "temperature-sensor.h"
@ -116,6 +116,6 @@ status(int type)
/*---------------------------------------------------------------------------*/
SENSORS_SENSOR(temperature_sensor, TEMPERATURE_SENSOR,
value, configure, status);
#endif /*COMPILE_SENSORS*/
#endif /*X_NUCLEO_IKS01A1*/
/*---------------------------------------------------------------------------*/
/** @} */

View File

@ -55,11 +55,11 @@
#define LEDS_GREEN 1 /*Nucleo LED*/
#define LEDS_RED 2 /*SPIRIT1 LED*/
#ifdef COMPILE_SENSORS
#ifdef X_NUCLEO_IKS01A1
#define LEDS_CONF_ALL 1 /*Can't use SPIRIT1 LED in this case*/
#else
#define LEDS_CONF_ALL 3 /*No sensors -> we can use SPIRIT1 LED in this case*/
#endif /*COMPILE_SENSORS*/
#endif /*X_NUCLEO_IKS01A1*/
/*---------------------------------------------------------------------------*/
#define F_CPU 32000000ul
#define RTIMER_ARCH_SECOND 32768

View File

@ -297,7 +297,7 @@
#define st_lib_hal_gpio_write_pin(...) HAL_GPIO_WritePin(__VA_ARGS__)
/*---------------------------------------------------------------------------*/
#if COMPILE_SENSORS
#ifdef X_NUCLEO_IKS01A1
/*---------------------------------------------------------------------------*/
/* x_nucleo_iks01a1.h */
#include "x_nucleo_iks01a1.h"
@ -340,7 +340,7 @@
#define st_lib_bsp_pressure_get_pressure(...) BSP_PRESSURE_GetPressure(__VA_ARGS__)
/*---------------------------------------------------------------------------*/
/*---------------------------------------------------------------------------*/
#endif /*COMPILE_SENSORS*/
#endif /*X_NUCLEO_IKS01A1*/
/*---------------------------------------------------------------------------*/
/*---------------------------------------------------------------------------*/
#endif /*ST_LIB_H_*/

@ -1 +1 @@
Subproject commit 6ff4221d03963844364616e6499e9401c0321c28
Subproject commit 66b672b5cc25fabc853510cd8ae4db40357d748e

View File

@ -41,7 +41,7 @@ define dooneexample
@echo Building example $(3): $(1) for target $(2)
@((cd $(EXAMPLESDIR)/$(1); \
export STM32W_CPUREV=CC; \
export USE_SUBGHZ_BOARD=IDS01A5; \
export BOARD=ids01a5; \
make TARGET=$(2) clean && make TARGET=$(2)) > \
$(3)-$(subst /,-,$(1))$(2).report 2>&1 && \
(echo $(1) $(2): OK | tee $(3)-$(subst /,-,$(1))$(2).summary) || \