myeeprom.h splitted into dataconstants.h and datastructs.h

This commit is contained in:
Bertrand Songis
2016-03-04 23:54:35 +01:00
parent 7a45b3f71b
commit 55f71f053b
26 changed files with 2252 additions and 1917 deletions
+16 -16
View File
@@ -4,7 +4,7 @@
set -e
set -x
mkdir build
mkdir build || true
cd build
# Companion
@@ -25,25 +25,25 @@ cmake -DCMAKE_BUILD_TYPE=Debug -DPCB=9X -DHELI=YES -DEXT=MAVLINK ..
make -j2 firmware
# OpenTX on Mega2560
# rm -rf *
#cmake -DCMAKE_BUILD_TYPE=Debug -DPCB=MEGA2560 -DHELI=YES ..
#make -j2 firmware
#make -j2 simu
#make -j2 gtests ; ./gtests
rm -rf *
cmake -DCMAKE_BUILD_TYPE=Debug -DPCB=MEGA2560 -DHELI=YES ..
make -j2 firmware
make -j2 simu
make -j2 gtests ; ./gtests
# OpenTX on Mega2560 with Mavlink telemetry
# rm -rf *
#cmake -DCMAKE_BUILD_TYPE=Debug -DPCB=MEGA2560 -DEXT=MAVLINK -DHELI=YES ..
#make -j2 firmware
#make -j2 simu
#make -j2 gtests ; ./gtests
rm -rf *
cmake -DCMAKE_BUILD_TYPE=Debug -DPCB=MEGA2560 -DEXT=MAVLINK -DHELI=YES ..
make -j2 firmware
make -j2 simu
make -j2 gtests ; ./gtests
# OpenTX on gruvin9x board
# rm -rf *
#cmake -DCMAKE_BUILD_TYPE=Debug -DPCB=GRUVIN9X -DHELI=YES ..
#make -j2 firmware
#make -j2 simu
#make -j2 gtests ; ./gtests
rm -rf *
cmake -DCMAKE_BUILD_TYPE=Debug -DPCB=GRUVIN9X -DHELI=YES ..
make -j2 firmware
make -j2 simu
make -j2 gtests ; ./gtests
# OpenTX on Sky9x
rm -rf *
+33
View File
@@ -0,0 +1,33 @@
#!/usr/bin/env python
import sys
import clang.cindex
structs = []
def build_struct(cursor):
structs.append(cursor.spelling)
print "template <class A, class B>\nvoid copy%s(A * dest, B * src)\n{" % cursor.spelling
for c in cursor.get_children():
if c.kind == clang.cindex.CursorKind.FIELD_DECL:
if c.type.get_array_size() > 0:
if c.type.get_array_element_type().spelling in structs:
print " for (int i=0; i<%d; i++) {" % c.type.get_array_size()
print " copy%s(dest->%s[i], src->%s[i]);" % (c.type.get_array_element_type().spelling, c.spelling, c.spelling)
print " }"
else:
print " memcpy(&dest->%s, &src->%s, sizeof(dest->%s));" % (c.spelling, c.spelling, c.spelling)
else:
print " dest->%s = src->%s;" % (c.spelling, c.spelling)
print "}\n"
def build(cursor):
result = []
for c in cursor.get_children():
if c.kind == clang.cindex.CursorKind.STRUCT_DECL:
build_struct(c)
return result
index = clang.cindex.Index.create()
translation_unit = index.parse(sys.argv[1], ['-x', 'c++', '-std=c++11'] + sys.argv[2:])
build(translation_unit.cursor)