2016-11-03 16:05:47 +00:00
|
|
|
#/bin/sh
|
|
|
|
|
|
|
|
ZEPHYR_BASE=../../..
|
|
|
|
|
|
|
|
echo "Adding BTstack sources as subsys/btstack"
|
|
|
|
|
2016-11-11 13:11:04 +00:00
|
|
|
|
2016-11-03 16:05:47 +00:00
|
|
|
# add btstack folder to subsys/Makefile
|
|
|
|
MAKEFILE_ADD_ON='obj-$(CONFIG_BTSTACK) += btstack/'
|
|
|
|
NET_MAKEFILE=${ZEPHYR_BASE}/subsys/Makefile
|
|
|
|
grep -q -F btstack ${NET_MAKEFILE} || echo ${MAKEFILE_ADD_ON} >> ${NET_MAKEFILE}
|
|
|
|
|
|
|
|
# add BTstack KConfig to net/Kconfig
|
|
|
|
SUBSYS_KCONFIG=${ZEPHYR_BASE}/subsys/Kconfig
|
|
|
|
grep -q -F btstack ${SUBSYS_KCONFIG} || echo 'source "subsys/btstack/Kconfig"' >> ${SUBSYS_KCONFIG}
|
|
|
|
|
2016-11-10 20:54:29 +00:00
|
|
|
# set Nordic Semiconductor as manufacturer
|
|
|
|
CTRL_H=${ZEPHYR_BASE}/subsys/bluetooth/controller/ll/ctrl.h
|
|
|
|
sed -i "s|#define RADIO_BLE_COMPANY_ID.*0xFFFF.|#define RADIO_BLE_COMPANY_ID (0x0059) // Nordic Semiconductor ASA|g" ${CTRL_H}
|
|
|
|
|
2016-11-11 13:11:04 +00:00
|
|
|
|
|
|
|
# create subsys/btstack
|
2016-11-03 16:05:47 +00:00
|
|
|
mkdir -p ${ZEPHYR_BASE}/subsys/btstack
|
|
|
|
|
|
|
|
# copy sources
|
|
|
|
rsync -a ../../src/ ${ZEPHYR_BASE}/subsys/btstack
|
|
|
|
|
|
|
|
# copy embedded run loop
|
|
|
|
rsync -a ../../platform/embedded/hal_cpu.h ${ZEPHYR_BASE}/subsys/btstack
|
|
|
|
rsync -a ../../platform/embedded/hal_time_ms.h ${ZEPHYR_BASE}/subsys/btstack
|
|
|
|
rsync -a ../../platform/embedded/hal_tick.h ${ZEPHYR_BASE}/subsys/btstack
|
|
|
|
rsync -a ../../platform/embedded/btstack_run_loop_embedded.h ${ZEPHYR_BASE}/subsys/btstack
|
|
|
|
rsync -a ../../platform/embedded/btstack_run_loop_embedded.c ${ZEPHYR_BASE}/subsys/btstack
|
|
|
|
|
2016-11-11 13:11:04 +00:00
|
|
|
# copy bludroid
|
|
|
|
rsync -a ../../3rd-party/bluedroid ${ZEPHYR_BASE}/subsys/btstack
|
|
|
|
|
2016-11-03 16:05:47 +00:00
|
|
|
# copy btstack_config.h
|
|
|
|
rsync -a btstack_config.h ${ZEPHYR_BASE}/subsys/btstack
|
|
|
|
|
|
|
|
# copy Kconfig
|
|
|
|
rsync -a Kconfig ${ZEPHYR_BASE}/subsys/btstack
|
|
|
|
|
|
|
|
# copy Makefiles
|
|
|
|
rsync -a Makefile.src ${ZEPHYR_BASE}/subsys/btstack/Makefile
|
2016-11-11 13:11:04 +00:00
|
|
|
rsync -a Makefile.classic ${ZEPHYR_BASE}/subsys/btstack/classic/Makefile
|
2016-11-03 16:05:47 +00:00
|
|
|
rsync -a Makefile.ble ${ZEPHYR_BASE}/subsys/btstack/ble/Makefile
|
2016-11-11 13:11:04 +00:00
|
|
|
rsync -a Makefile.gatt-service ${ZEPHYR_BASE}/subsys/btstack/ble/gatt-service/Makefile
|
|
|
|
rsync -a Makefile.bluedroid ${ZEPHYR_BASE}/subsys/btstack/bluedroid/Makefile
|
|
|
|
rsync -a Makefile.bluedroid-encoder ${ZEPHYR_BASE}/subsys/btstack/bluedroid/encoder/srce/Makefile
|
|
|
|
rsync -a Makefile.bluedroid-decoder ${ZEPHYR_BASE}/subsys/btstack/bluedroid/decoder/srce/Makefile
|
2016-11-10 20:54:29 +00:00
|
|
|
|
2016-11-03 16:05:47 +00:00
|
|
|
# create samples/btstack
|
|
|
|
./create_examples.py
|
|
|
|
|
2016-11-10 20:54:29 +00:00
|
|
|
|
|
|
|
## Additonal changes for HCI Controller firmware in samples/bluetooth/hci-uart
|
2016-11-10 21:39:59 +00:00
|
|
|
HCI_UART=${ZEPHYR_BASE}/samples/bluetooth/hci_uart
|
2016-11-10 20:54:29 +00:00
|
|
|
|
|
|
|
# add flash scripts to hci-uart
|
|
|
|
rsync -a flash_nrf51_pca10028.sh ${HCI_UART}/flash_nrf51_pca10028.sh
|
|
|
|
rsync -a flash_nrf52_pca10040.sh ${HCI_UART}/flash_nrf52_pca10040.sh
|
|
|
|
|
|
|
|
# use 115200 baud
|
|
|
|
sed -i 's|CONFIG_UART_NRF5_BAUD_RATE=1000000|CONFIG_UART_NRF5_BAUD_RATE=115200|g' ${HCI_UART}/nrf5.conf
|
|
|
|
|
|
|
|
# provide static random address to host via hci read bd addr
|
2016-11-15 09:35:04 +00:00
|
|
|
grep -q -F ll_address_set ${HCI_UART}/src/main.c || cat hci_uart.patch | patch -d ${ZEPHYR_BASE} -p1
|