xref: /btstack/port/esp32/integrate_btstack.py (revision f25e60dece291970e0c7612fc7fda3d74ae3ceba)
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/md5',
44'3rd-party/micro-ecc',
45'3rd-party/yxml',
46'platform/freertos',
47'platform/embedded',
48'platform/lwip',
49'tool'
50]
51
52for dir in dirs_to_copy:
53	print('- %s' % dir)
54	shutil.copytree(local_dir + '/../../' + dir, IDF_BTSTACK + '/' + dir)
55
56# add hci dump stdout
57shutil.copy(local_dir+'/../../platform/embedded/hci_dump_embedded_stdout.c', IDF_BTSTACK)
58
59# create example/btstack
60create_examples.create_examples(local_dir, '')
61