diff --git a/conf/Makefile.sim b/conf/Makefile.sim index 8097438bdf..b073cba04b 100644 --- a/conf/Makefile.sim +++ b/conf/Makefile.sim @@ -56,6 +56,7 @@ CFLAGS += $(INCLUDES) CFLAGS += $($(TARGET).CFLAGS) CFLAGS += $(LOCAL_CFLAGS) CFLAGS += -O2 +CFLAGS += -g ifneq ($(SIM_TYPE),JSBSIM) CFLAGS += -std=gnu99 @@ -63,9 +64,6 @@ endif LDFLAGS = -lm -ifeq ($(SIM_TYPE),BOOZ) -LDFLAGS += $($(TARGET).LDFLAGS) -endif ifeq ($(SIM_TYPE),JSBSIM) LDFLAGS += $($(TARGET).LDFLAGS) endif @@ -92,11 +90,6 @@ check_jsbsim: # fi -ifeq ($(SIM_TYPE),BOOZ) -$(OBJDIR)/simsitl : $($(TARGET).objs) - @echo LD $@ - $(Q)$(CC) -o $@ $($(TARGET).objs) $(LDFLAGS) -else ifeq ($(SIM_TYPE),JSBSIM) $(OBJDIR)/simsitl : $($(TARGET).objs) @echo LD $@ @@ -106,7 +99,6 @@ $(OBJDIR)/simsitl : $($(TARGET).objs) $(SITLCMA) $(SIMSITLML) @echo LD $@ $(Q)$(OCAMLC) -g -custom $(CAMLINCLUDES) -o $@ unix.cma str.cma xml-light.cma glibivy-ocaml.cma lib-pprz.cma lablgtk.cma $($(TARGET).objs) $(MYGTKINITCMO) $(SITLCMA) $(SIMSITLML) endif -endif # The id of the A/C is hardcoded in the code (to be improved with dynlink ?) @@ -140,9 +132,6 @@ $(OBJDIR)/%.o: %.cpp $(OBJDIR)/../Makefile.ac $(Q)test -d $(dir $@) || mkdir -p $(dir $@) $(Q)$(CC) $(CFLAGS) -c -o $@ $< -avr_clean: - rm -rf $(OBJDIR) - # # Dependencies diff --git a/sw/airborne/arch/sim/mcu_periph/i2c_arch.c b/sw/airborne/arch/sim/mcu_periph/i2c_arch.c index 34b43d9739..d082af4a24 100644 --- a/sw/airborne/arch/sim/mcu_periph/i2c_arch.c +++ b/sw/airborne/arch/sim/mcu_periph/i2c_arch.c @@ -1,9 +1,34 @@ #include "mcu_periph/i2c.h" -void i2c_hw_init ( void ) {} - bool_t i2c_idle(struct i2c_periph *p __attribute__ ((unused))) { return TRUE; } bool_t i2c_submit(struct i2c_periph* p __attribute__ ((unused)), struct i2c_transaction* t __attribute__ ((unused))) { return TRUE;} void i2c_event(void) { } void i2c2_setbitrate(int bitrate __attribute__ ((unused))) { } + +#ifdef USE_I2C0 +struct i2c_errors i2c0_errors; + +void i2c0_hw_init(void) { + i2c0.errors = &i2c0_errors; + ZEROS_ERR_COUNTER(i2c0_errors); +} +#endif + +#ifdef USE_I2C1 +struct i2c_errors i2c1_errors; + +void i2c1_hw_init(void) { + i2c1.errors = &i2c1_errors; + ZEROS_ERR_COUNTER(i2c1_errors); +} +#endif + +#ifdef USE_I2C2 +struct i2c_errors i2c2_errors; + +void i2c2_hw_init(void) { + i2c2.errors = &i2c2_errors; + ZEROS_ERR_COUNTER(i2c2_errors); +} +#endif diff --git a/sw/airborne/arch/sim/mcu_periph/i2c_arch.h b/sw/airborne/arch/sim/mcu_periph/i2c_arch.h index 5e3bee40f7..132953028f 100644 --- a/sw/airborne/arch/sim/mcu_periph/i2c_arch.h +++ b/sw/airborne/arch/sim/mcu_periph/i2c_arch.h @@ -1,21 +1,36 @@ #ifndef SIM_MCU_PERIPH_I2C_ARCH_H #define SIM_MCU_PERIPH_I2C_ARCH_H +#include "mcu_periph/i2c.h" + #define I2cSendStart() {} -//extern void i2c_hw_init(void); -#define i2c0_hw_init() {} -#define i2c1_hw_init() {} -#define i2c2_hw_init() {} -#define I2c0SendStart() {} -#define I2c1SendStart() {} -#define I2c2SendStart() {} +#ifdef USE_I2C0 +extern void i2c0_hw_init(void); +#define i2c0_ev_irq_handler() {} +#define i2c0_er_irq_handler() {} + +#endif /* USE_I2C0 */ + + +#ifdef USE_I2C1 + +extern void i2c1_hw_init(void); #define i2c1_ev_irq_handler() {} -#define i2c1_er_irq_handler() {}; +#define i2c1_er_irq_handler() {} +#endif /* USE_I2C1 */ + + +#ifdef USE_I2C2 + +extern void i2c2_hw_init(void); #define i2c2_ev_irq_handler() {} -#define i2c2_er_irq_handler() {}; +#define i2c2_er_irq_handler() {} + +#endif /* USE_I2C2 */ + #endif /* SIM_MCU_PERIPH_I2C_ARCH_H */ diff --git a/sw/airborne/firmwares/rotorcraft/telemetry.h b/sw/airborne/firmwares/rotorcraft/telemetry.h index abd2b233e5..b5adf02c09 100644 --- a/sw/airborne/firmwares/rotorcraft/telemetry.h +++ b/sw/airborne/firmwares/rotorcraft/telemetry.h @@ -817,11 +817,15 @@ #define PERIODIC_SEND_I2C2_ERRORS(_trans, _dev) {} #endif +#ifndef SITL #define PERIODIC_SEND_I2C_ERRORS(_trans, _dev) { \ PERIODIC_SEND_I2C0_ERRORS(_trans, _dev); \ PERIODIC_SEND_I2C1_ERRORS(_trans, _dev); \ PERIODIC_SEND_I2C2_ERRORS(_trans, _dev); \ } +#else +#define PERIODIC_SEND_I2C_ERRORS(_trans, _dev) {} +#endif // FIXME: still used?? or replace by EXTRA_ADC #define PERIODIC_SEND_BOOZ2_SONAR(_trans, _dev) {} diff --git a/sw/simulator/nps/nps_ivy.c b/sw/simulator/nps/nps_ivy.c index 58409262a0..06dbafbd3c 100644 --- a/sw/simulator/nps/nps_ivy.c +++ b/sw/simulator/nps/nps_ivy.c @@ -9,6 +9,7 @@ #include "nps_autopilot.h" #include "nps_fdm.h" #include "nps_sensors.h" +#include "subsystems/ins.h" #include "firmwares/rotorcraft/navigation.h" #include NPS_SENSORS_PARAMS