From e632d5c4a0541385c37af6ef9af3373fcc100adf Mon Sep 17 00:00:00 2001
From: Daniel Friesel <derf@finalrewind.org>
Date: Thu, 12 Jul 2018 10:58:56 +0200
Subject: Only include hw i2c drivers if sw i2c is not active

---
 src/app/i2cdetect/Makefile.inc       | 2 ++
 src/arch/arduino-nano/Makefile.inc   | 8 +++++++-
 src/arch/esp8266/Makefile.inc        | 2 +-
 src/arch/msp430fr5969lp/Makefile.inc | 6 ++++--
 4 files changed, 14 insertions(+), 4 deletions(-)
 create mode 100644 src/app/i2cdetect/Makefile.inc

(limited to 'src')

diff --git a/src/app/i2cdetect/Makefile.inc b/src/app/i2cdetect/Makefile.inc
new file mode 100644
index 0000000..43a8bae
--- /dev/null
+++ b/src/app/i2cdetect/Makefile.inc
@@ -0,0 +1,2 @@
+arch_drivers += ,i2c
+drivers += ,lm75
diff --git a/src/arch/arduino-nano/Makefile.inc b/src/arch/arduino-nano/Makefile.inc
index 958eda2..42b743f 100644
--- a/src/arch/arduino-nano/Makefile.inc
+++ b/src/arch/arduino-nano/Makefile.inc
@@ -6,7 +6,8 @@ PORT = /dev/ttyUSB0
 BAUD = 57600
 
 INCLUDES += -Iinclude/arduino-nano
-COMMON_FLAGS += -mmcu=${MCU} -DF_CPU=16000000UL
+COMMON_FLAGS += -mmcu=${MCU} -DF_CPU=16000000UL -DMULTIPASS_ARCH_arduino_nano
+COMMON_FLAGS += -DMULTIPASS_ARCH_HAS_I2C
 
 CC = avr-gcc
 CXX = avr-g++
@@ -23,6 +24,11 @@ TARGETS += src/arch/arduino-nano/driver/gpio.cc
 TARGETS += src/arch/arduino-nano/driver/stdout.cc
 TARGETS += src/arch/arduino-nano/driver/uptime.cc
 
+ifneq ($(findstring softi2c,${drivers}), )
+else ($(findstring i2c,${arch_drivers}), )
+	TARGETS += src/arch/arduino-nano/driver/i2c.cc
+endif
+
 ifneq ($(findstring stdin,${arch_drivers}), )
 	TARGETS += src/arch/arduino-nano/driver/stdin.cc
 endif
diff --git a/src/arch/esp8266/Makefile.inc b/src/arch/esp8266/Makefile.inc
index 82755ce..33df2b2 100644
--- a/src/arch/esp8266/Makefile.inc
+++ b/src/arch/esp8266/Makefile.inc
@@ -16,7 +16,7 @@ ifeq (${aspectc}, 1)
 endif
 
 INCLUDES += -Iinclude/esp8266 -I${SDK_BASE}/include
-COMMON_FLAGS += -nostdlib -mlongcalls -D__ets__ -DICACHE_FLASH
+COMMON_FLAGS += -nostdlib -mlongcalls -D__ets__ -DICACHE_FLASH -DMULTIPASS_ARCH_esp8266
 CXXFLAGS = -std=c++11
 LDFLAGS += -nostdlib -Wl,--no-check-sections -u call_user_start -Wl,-static
 
diff --git a/src/arch/msp430fr5969lp/Makefile.inc b/src/arch/msp430fr5969lp/Makefile.inc
index bb91973..066a152 100644
--- a/src/arch/msp430fr5969lp/Makefile.inc
+++ b/src/arch/msp430fr5969lp/Makefile.inc
@@ -4,7 +4,8 @@ CPU = 430x
 MCU = msp430fr5969
 
 INCLUDES += -Iinclude/msp430fr5969lp -I/opt/msp430/ti/gcc/include
-COMMON_FLAGS += -mcpu=${CPU} -mmcu=${MCU}
+COMMON_FLAGS += -mcpu=${CPU} -mmcu=${MCU} -DMULTIPASS_ARCH_msp430fr5969lp
+COMMON_FLAGS += -DMULTIPASS_ARCH_HAS_I2C
 
 CC = /opt/msp430/ti/gcc/bin/msp430-elf-gcc
 CXX = /opt/msp430/ti/gcc/bin/msp430-elf-g++
@@ -28,7 +29,8 @@ ifneq ($(findstring stdin,${arch_drivers}), )
 	TARGETS += src/arch/msp430fr5969lp/driver/stdin.cc
 endif
 
-ifneq ($(findstring i2c,${arch_drivers}), )
+ifneq ($(findstring softi2c,${drivers}), )
+else ($(findstring i2c,${arch_drivers}), )
 	TARGETS += src/arch/msp430fr5969lp/driver/i2c.cc
 endif
 
-- 
cgit v1.2.3