1
0
Fork 0
mirror of https://github.com/opentx/opentx.git synced 2025-07-14 20:10:08 +03:00

Bsongis/modules sync issue 7288 (#7296)

This commit is contained in:
Bertrand Songis 2020-01-14 17:18:34 +01:00 committed by 3djc
parent 8c3f226a6e
commit 27d88bfb93
7 changed files with 88 additions and 26 deletions

View file

@ -22,7 +22,9 @@
#define _WIDGET_H_
#include <list>
#include <string.h>
#include "zone.h"
#include "debug.h"
#define MAX_WIDGET_OPTIONS 5

View file

@ -10,6 +10,7 @@ endmacro(add_lua_export_target)
set(LUA_INCLUDES
-DCPUARM -DLUA -DLUA_INPUTS -DLUA_EXPORT_GENERATION -DSIMU
-I${RADIO_SRC_DIRECTORY}
-I${RADIO_SRC_DIRECTORY}/targets/${TARGET_DIR}
-I${RADIO_SRC_DIRECTORY}/thirdparty
-I${RADIO_SRC_DIRECTORY}/targets/common/arm/stm32

View file

@ -227,11 +227,46 @@ set(STM32LIB_SRC
STM32F4xx_StdPeriph_Driver/src/stm32f4xx_dma2d.c
)
MACRO(GET_GCC_INCLUDE_PATH gcc_include_path)
if (WIN32)
execute_process(COMMAND arm-none-eabi-gcc -v -x c -E NUL ERROR_VARIABLE _gcc_output OUTPUT_QUIET)
else()
execute_process(COMMAND arm-none-eabi-gcc -v -x c -E - INPUT_FILE /dev/null ERROR_VARIABLE _gcc_output OUTPUT_QUIET)
endif()
# Build an array of string from the GCC output
string(REPLACE "\n" ";" _gcc_output "${_gcc_output}")
set(_capture_include FALSE)
set(_include_path "")
# Go through the lines and capture between '"#include <...> search starts here:"' and 'End of search list.'
foreach(_line ${_gcc_output})
if(${_line} STREQUAL "End of search list.")
set(_capture_include FALSE)
endif()
if(_capture_include)
# Remove the leading and trailing empty characters
string(REPLACE "\r" "" _line ${_line})
string(SUBSTRING "${_line}" 1 -1 _line)
set(_include_path "${_include_path}" "-I${_line}")
endif()
if(${_line} STREQUAL "#include <...> search starts here:")
set(_capture_include TRUE)
endif()
endforeach()
set(${gcc_include_path} ${_include_path})
ENDMACRO()
if(PYTHONINTERP_FOUND)
GET_GCC_INCLUDE_PATH(arm_gcc_include_path)
add_custom_command(
OUTPUT ${PROJECT_BINARY_DIR}/radio/src/datacopy.cpp
WORKING_DIRECTORY ${RADIO_DIRECTORY}/src
COMMAND ${PYTHON_EXECUTABLE} ${RADIO_DIRECTORY}/util/generate_datacopy.py datastructs.h -DPCBHORUS -DPCBX10 -DCPUARM -DCOLORLCD -DBACKUP -Itargets/horus > ${PROJECT_BINARY_DIR}/radio/src/datacopy.cpp
COMMAND ${PYTHON_EXECUTABLE} ${RADIO_DIRECTORY}/util/generate_datacopy.py datastructs.h -DPCBHORUS -DPCBX10 -DCPUARM -DSTM32F4 -DSTM32F429_439xx -DCOLORLCD -DBACKUP -DSIMU -I. -Itargets/horus -Itargets/common/arm/stm32 -I${THIRDPARTY_DIR} -I${THIRDPARTY_DIR}/STM32F4xx_DSP_StdPeriph_Lib_V1.4.0/Libraries/CMSIS/Device/ST/STM32F4xx/Include ${arm_gcc_include_path} > ${PROJECT_BINARY_DIR}/radio/src/datacopy.cpp
DEPENDS ${RADIO_DIRECTORY}/src/datastructs.h ${RADIO_DIRECTORY}/util/generate_datacopy.py
)
add_custom_target(datacopy

View file

@ -21,8 +21,8 @@
#ifndef _BOARD_H_
#define _BOARD_H_
#include "../definitions.h"
#include "../opentx_constants.h"
#include "definitions.h"
#include "opentx_constants.h"
#include "board_common.h"
#include "hal.h"

View file

@ -22,8 +22,8 @@
#define _BOARD_H_
#include <inttypes.h>
#include "../definitions.h"
#include "../opentx_constants.h"
#include "definitions.h"
#include "opentx_constants.h"
#include "board_common.h"
#include "hal.h"

View file

@ -21,9 +21,9 @@
#ifndef _FRSKY_H_
#define _FRSKY_H_
#include "../definitions.h"
#include "../../definitions.h"
#include "telemetry_holders.h"
#include "../io/frsky_pxx2.h"
#include "../../io/frsky_pxx2.h"
// Receive buffer state machine state enum
enum FrSkyDataState {

View file

@ -1,30 +1,33 @@
#!/usr/bin/env python
from __future__ import print_function
import sys
import clang.cindex
import time
import os
if sys.platform == "darwin":
if os.path.exists('/usr/local/Cellar/llvm/6.0.0/lib/libclang.dylib'):
clang.cindex.Config.set_library_file('/usr/local/Cellar/llvm/6.0.0/lib/libclang.dylib')
elif os.path.exists('/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/libclang.dylib'):
clang.cindex.Config.set_library_file('/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/libclang.dylib')
elif os.path.exists('/Library/Developer/CommandLineTools/usr/lib/libclang.dylib'):
clang.cindex.Config.set_library_file('/Library/Developer/CommandLineTools/usr/lib/libclang.dylib')
elif sys.platform.startswith("linux"):
for version in ("7", "6.0", "3.8"):
libclang = "/usr/lib/x86_64-linux-gnu/libclang-%s.so.1" % version
if os.path.exists(libclang):
clang.cindex.Config.set_library_file(libclang)
break
structs = []
extrastructs = []
def find_libclang():
if sys.platform == "darwin":
for path in ("/usr/local/Cellar/llvm/6.0.0/lib/libclang.dylib",
"/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/libclang.dylib",
"/Library/Developer/CommandLineTools/usr/lib/libclang.dylib"):
if os.path.exists(path):
return path
elif sys.platform.startswith("linux"):
for version in ("7", "6.0", "3.8"):
path = "/usr/lib/x86_64-linux-gnu/libclang-%s.so.1" % version
if os.path.exists(path):
return path
for path in ("/usr/local/lib/libclang.so",
"/usr/lib/libclang.so"):
if os.path.exists(path):
return path
def build_struct(cursor, anonymousUnion=False):
if not anonymousUnion:
structs.append(cursor.spelling)
@ -98,7 +101,28 @@ def header():
print("// This file was auto-generated by %s script on %s. Do not edit this file!\n\n\n" % (os.path.basename(sys.argv[0]), time.asctime()))
index = clang.cindex.Index.create()
translation_unit = index.parse(sys.argv[1], ['-x', 'c++', '-std=c++11'] + sys.argv[2:])
header()
build(translation_unit.cursor)
def print_translation_unit_diags(diags, prefix=''):
for diag in diags:
print(prefix + str(diag), file=sys.stderr)
print_translation_unit_diags(diag.children, ' ' + prefix)
def main():
libclang = find_libclang()
if libclang:
# print(libclang, file=sys.stderr)
clang.cindex.Config.set_library_file(libclang)
index = clang.cindex.Index.create()
translation_unit = index.parse(sys.argv[1], ['-x', 'c++', '-std=c++11'] + sys.argv[2:])
if translation_unit.diagnostics:
print_translation_unit_diags(translation_unit.diagnostics)
sys.exit(-1)
header()
build(translation_unit.cursor)
if __name__ == "__main__":
main()