- Better array initialization in data.h CANOPEN_NODE_DATA_INITIALIZER macro. Use a little hack with configure and config.h to create the "pure Ansi C" initializer.
- Workaround for the compiler compatibility with empty arrays (i.e. Index 1016).
- Some fixes in Makefile.in
--- a/configure Fri Feb 09 09:36:19 2007 +0100
+++ b/configure Tue Feb 13 16:36:44 2007 +0100
@@ -638,6 +638,19 @@
fi
done
echo "" >> include/config.h
+
+for i in \
+ SDO_MAX_SIMULTANEOUS_TRANSFERTS\
+ NMT_MAX_NODE_ID; do
+ echo "#define REPEAT_"$i"_TIMES(repeat)\\">> include/config.h
+ times=${!i}
+ result=""
+ for (( j=0; j<times; j++ ));do
+ result="$result repeat"
+ done
+ echo $result >> include/config.h
+done
+
echo "#endif /* _CONFIG_H_ */" >> include/config.h
###########################################################################
--- a/examples/TestMasterSlave/Makefile.in Fri Feb 09 09:36:19 2007 +0100
+++ b/examples/TestMasterSlave/Makefile.in Tue Feb 13 16:36:44 2007 +0100
@@ -50,17 +50,28 @@
$(MAKE) -C ../../drivers/$(TARGET) libcanfestival_$(TARGET).a
-TestMasterSlave: $(OBJS)
+TestMasterSlave: TestSlave.c TestMaster.c $(OBJS)
$(CC) $(CFLAGS) $(PROG_CFLAGS) ${PROGDEFINES} $(INCLUDES) -o $@ $(OBJS) $(EXE_CFLAGS)
+
+TestSlave.c: TestSlave.od
+ $(MAKE) -C ../../objdictgen gnosis
+ python ../../objdictgen/objdictgen.py TestSlave.od TestSlave.c
+
+TestMaster.c: TestMaster.od
+ $(MAKE) -C ../../objdictgen gnosis
+ python ../../objdictgen/objdictgen.py TestMaster.od TestMaster.c
%o: %c
$(CC) $(CFLAGS) $(PROG_CFLAGS) ${PROGDEFINES} $(INCLUDES) -o $@ -c $<
clean:
- -rm $(MASTER_OBJS)
- -rm TestMasterSlave
+ rm -f $(MASTER_OBJS)
+ rm -f TestMasterSlave
mrproper: clean
+ rm -f TestSlave.c
+ rm -f TestMaster.c
+
--- a/examples/TestMasterSlave/TestSlave.c Fri Feb 09 09:36:19 2007 +0100
+++ b/examples/TestMasterSlave/TestSlave.c Tue Feb 13 16:36:44 2007 +0100
@@ -127,8 +127,7 @@
/* index 0x1016 : Consumer Heartbeat Time */
UNS8 TestSlave_highestSubIndex_obj1016 = 0;
- UNS32 TestSlave_obj1016[];
- subindex TestSlave_Index1016[];
+ UNS32 TestSlave_obj1016[]={0};
/* index 0x1017 : Producer Heartbeat Time. */
UNS16 TestSlave_obj1017 = 0x3E8; /* 1000 */
--- a/include/data.h Fri Feb 09 09:36:19 2007 +0100
+++ b/include/data.h Tue Feb 13 16:36:44 2007 +0100
@@ -92,6 +92,24 @@
scanIndexOD_t scanIndexOD;
};
+#define NMTable_Initializer Unknown_state,
+
+#define s_transfer_Initializer {\
+ 0, /* nodeId */\
+ 0, /* wohami */\
+ SDO_RESET, /* state */\
+ 0, /* toggle */\
+ 0, /* abortCode */\
+ 0, /* index */\
+ 0, /* subIndex */\
+ 0, /* count */\
+ 0, /* offset */\
+ {0}, /* data (static use, so that all the table is initialize at 0)*/\
+ 0, /* dataType */\
+ -1, /* timer */\
+ NULL /* Callback */\
+ },
+
/* A macro to initialize the data in client app.*/
/* CO_Data structure */
#define CANOPEN_NODE_DATA_INITIALIZER(NODE_PREFIX) {\
@@ -106,23 +124,8 @@
NODE_PREFIX ## _valueRangeTest, /* valueRangeTest */\
\
/* SDO, structure s_transfer */\
- { /* WARNING. Only the first element of the table is well initialized. */\
- /* May be problems for "timer". Is it ok ? (FD) */\
- {\
- 0, /* nodeId */\
- 0, /* wohami */\
- SDO_RESET, /* state */\
- 0, /* toggle */\
- 0, /* abortCode */\
- 0, /* index */\
- 0, /* subIndex */\
- 0, /* count */\
- 0, /* offset */\
- {0}, /* data (static use, so that all the table is initialize at 0)*/\
- 0, /* dataType */\
- -1, /* timer */\
- NULL /* Callback */\
- }\
+ {\
+ REPEAT_SDO_MAX_SIMULTANEOUS_TRANSFERTS_TIMES(s_transfer_Initializer)\
},\
&NODE_PREFIX ## _SDOtimeoutError, /* SDOtimeoutError */\
\
@@ -150,7 +153,7 @@
TIMER_NONE, /* ProducerHeartBeatTimer */\
NODE_PREFIX ## _heartbeatError, /* heartbeatError */\
\
- {Unknown_state}, /* NMTable WARNING : Only the first value */\
+ {REPEAT_NMT_MAX_NODE_ID_TIMES(NMTable_Initializer)},\
/* is well initialized at "Unknown_state". Is it ok ? (FD)*/\
\
/* SYNC */\
--- a/objdictgen/Makefile.in Fri Feb 09 09:36:19 2007 +0100
+++ b/objdictgen/Makefile.in Tue Feb 13 16:36:44 2007 +0100
@@ -43,14 +43,14 @@
chmod 755 $(PREFIX)/objdictgen/objdictgen.py
uninstall:
- -rm -rf $(PREFIX)/objdictgen
- -rm -f $(PREFIX)/bin/objdictedit
- -rm -f $(PREFIX)/bin/objdictgen
+ rm -rf $(PREFIX)/objdictgen
+ rm -f $(PREFIX)/bin/objdictedit
+ rm -f $(PREFIX)/bin/objdictgen
clean:
mrproper: clean
- -rm -f Gnosis_Utils-1.2.1.tar.gz
- -rm -rf gnosis
+ rm -f Gnosis_Utils-1.2.1.tar.gz
+ rm -rf gnosis
--- a/objdictgen/gen_cfile.py Fri Feb 09 09:36:19 2007 +0100
+++ b/objdictgen/gen_cfile.py Tue Feb 13 16:36:44 2007 +0100
@@ -326,8 +326,7 @@
texts["EntryName"] = entry_infos["name"]
indexContents[0x1016] = """\n/* index 0x1016 : %(EntryName)s */
UNS8 %(NodeName)s_highestSubIndex_obj1016 = 0;
- UNS32 %(NodeName)s_obj1016[];
- subindex %(NodeName)s_Index1016[];
+ UNS32 %(NodeName)s_obj1016[]={0};
"""%texts
if texts["nombre"] > 0:
strTimers = "TIMER_HANDLE %(NodeName)s_heartBeatTimers[%(nombre)d] = {TIMER_NONE,};\n"%texts