xref: /btstack/port/esp32/integrate_btstack.py (revision 02bddf72ded804ec650dff99a15cca6ff8460083)
1#!/usr/bin/env python3
2
3#
4# Add btstack component to esp-idf
5#
6
7import os
8import sys
9import shutil
10import create_examples
11
12if not 'IDF_PATH' in os.environ:
13	print('Error: IDF_PATH not defined. Please set IDF_PATH as described here:\nhttp://esp-idf.readthedocs.io/en/latest/get-started/index.html#get-started-get-esp-idf');
14	sys.exit(10)
15
16IDF_PATH=os.environ['IDF_PATH']
17print("IDF_PATH=%s" % IDF_PATH)
18
19IDF_COMPONENTS=IDF_PATH + "/components"
20
21if not os.path.exists(IDF_COMPONENTS):
22	print("Error: No components folder at $IDF_PATH/components, please check IDF_PATH")
23	sys.exit(10)
24
25IDF_BTSTACK=IDF_COMPONENTS+"/btstack"
26
27if os.path.exists(IDF_BTSTACK):
28	print("Deleting old BTstack component %s" % IDF_BTSTACK)
29	shutil.rmtree(IDF_BTSTACK)
30
31# get local dir
32local_dir = os.path.abspath(os.path.dirname(sys.argv[0]))
33
34# create components/btstack
35print("Creating BTstack component at %s" % IDF_COMPONENTS)
36shutil.copytree(local_dir+'/components/btstack', IDF_BTSTACK)
37
38dirs_to_copy = [
39'src',
40'3rd-party/bluedroid',
41'3rd-party/hxcmod-player',
42'3rd-party/lwip/dhcp-server',
43'3rd-party/lc3-google',
44'3rd-party/md5',
45'3rd-party/micro-ecc',
46'3rd-party/yxml',
47'platform/freertos',
48'platform/embedded',
49'platform/lwip',
50'tool'
51]
52
53for dir in dirs_to_copy:
54	print('- %s' % dir)
55	shutil.copytree(local_dir + '/../../' + dir, IDF_BTSTACK + '/' + dir)
56
57# add hci dump stdout
58shutil.copy(local_dir+'/../../platform/embedded/hci_dump_embedded_stdout.c', IDF_BTSTACK)
59
60# create example/btstack
61create_examples.create_examples(local_dir, '')
62