mirror of
https://github.com/bluekitchen/btstack.git
synced 2025-03-29 04:20:20 +00:00
wiced-h5: support WICED Studio (incl. 5.2)
This commit is contained in:
parent
0b793fdf21
commit
d4def6f450
@ -21,6 +21,8 @@ GLOBAL_INCLUDES += .
|
|||||||
$(NAME)_SOURCES := ../../../libraries/btstack/example/EXAMPLE.c
|
$(NAME)_SOURCES := ../../../libraries/btstack/example/EXAMPLE.c
|
||||||
$(NAME)_COMPONENTS += btstack/port/wiced-h5
|
$(NAME)_COMPONENTS += btstack/port/wiced-h5
|
||||||
$(NAME)_CFLAGS += ADDITIONAL_CFLAGS
|
$(NAME)_CFLAGS += ADDITIONAL_CFLAGS
|
||||||
|
|
||||||
|
BT_FIRMWARE_FILE := BLUETOOTH_FIRMWARE_FILE
|
||||||
'''
|
'''
|
||||||
|
|
||||||
gatt_update_template = '''#!/bin/sh
|
gatt_update_template = '''#!/bin/sh
|
||||||
@ -35,18 +37,29 @@ script_path = os.path.abspath(os.path.dirname(sys.argv[0]))
|
|||||||
|
|
||||||
# validate WICED root by reading version.txt
|
# validate WICED root by reading version.txt
|
||||||
wiced_root = script_path + "/../../../../"
|
wiced_root = script_path + "/../../../../"
|
||||||
wiced_version = ""
|
wiced_version_txt = ""
|
||||||
try:
|
try:
|
||||||
with open(wiced_root + 'version.txt', 'r') as fin:
|
with open(wiced_root + 'version.txt', 'r') as fin:
|
||||||
wiced_version = fin.read() # Read the contents of the file into memory.
|
wiced_version_txt = fin.read() # Read the contents of the file into memory.
|
||||||
except:
|
except:
|
||||||
pass
|
pass
|
||||||
if not "WICED Version" in wiced_version:
|
if not "WICED Version" in wiced_version_txt:
|
||||||
print("Cannot find WICED root. Make sure BTstack is checked out in WICED-SDK-X/libraries")
|
print("Cannot find WICED root. Make sure BTstack is checked out in WICED-SDK-X/libraries")
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
|
# check for 5.2+ version syntax
|
||||||
|
if 'Wiced_' in wiced_version_txt:
|
||||||
|
wiced_version_string = (wiced_version_txt.split()[2]).split('_')[1]
|
||||||
|
wiced_version_major = int(wiced_version_string.split('.')[0])
|
||||||
|
wiced_version_minor = int(wiced_version_string.split('.')[1])
|
||||||
|
else:
|
||||||
|
wiced_version = wiced_version_txt.split()[2]
|
||||||
|
wiced_version_major = int(wiced_version.split('.')[0])
|
||||||
|
wiced_version_minor = int(wiced_version.split('.')[1])
|
||||||
|
|
||||||
|
wiced_version = "%u.%u" % (wiced_version_major, wiced_version_minor)
|
||||||
|
|
||||||
# show WICED version
|
# show WICED version
|
||||||
wiced_version = wiced_version.split()[2]
|
|
||||||
print("Found WICED SDK version: %s" % wiced_version)
|
print("Found WICED SDK version: %s" % wiced_version)
|
||||||
|
|
||||||
additional_cflags = ""
|
additional_cflags = ""
|
||||||
@ -54,6 +67,14 @@ if wiced_version < "3.4.0":
|
|||||||
print("Adding WICED_UART_READ_DOES_NOT_RETURN_BYTES_READ for SDK < 3.4.0")
|
print("Adding WICED_UART_READ_DOES_NOT_RETURN_BYTES_READ for SDK < 3.4.0")
|
||||||
additional_cflags = "-DWICED_UART_READ_DOES_NOT_RETURN_BYTES_READ"
|
additional_cflags = "-DWICED_UART_READ_DOES_NOT_RETURN_BYTES_READ"
|
||||||
|
|
||||||
|
# NOTE: it would be more robust to check for files on disk
|
||||||
|
|
||||||
|
# bluetooth firmware image name changed in 5.2
|
||||||
|
if wiced_version < "5.2":
|
||||||
|
bluetooth_firmware_file = 'bt_firmware_image.c'
|
||||||
|
else:
|
||||||
|
bluetooth_firmware_file = 'bt_firmware_controller.c'
|
||||||
|
print("Bluetooth Firmware name: %s" % bluetooth_firmware_file)
|
||||||
|
|
||||||
# path to examples
|
# path to examples
|
||||||
examples_embedded = script_path + "/../../example/"
|
examples_embedded = script_path + "/../../example/"
|
||||||
@ -76,7 +97,7 @@ for file in os.listdir(examples_embedded):
|
|||||||
|
|
||||||
# create .mk file
|
# create .mk file
|
||||||
with open(apps_folder + example + ".mk", "wt") as fout:
|
with open(apps_folder + example + ".mk", "wt") as fout:
|
||||||
fout.write(mk_template.replace("EXAMPLE", example).replace("TOOL", script_path).replace("ADDITIONAL_CFLAGS", additional_cflags).replace("DATE",time.strftime("%c")))
|
fout.write(mk_template.replace("EXAMPLE", example).replace("TOOL", script_path).replace("ADDITIONAL_CFLAGS", additional_cflags).replace("DATE",time.strftime("%c")).replace('BLUETOOTH_FIRMWARE_FILE', bluetooth_firmware_file))
|
||||||
|
|
||||||
# create update_gatt.sh if .gatt file is present
|
# create update_gatt.sh if .gatt file is present
|
||||||
gatt_path = examples_embedded + example + ".gatt"
|
gatt_path = examples_embedded + example + ".gatt"
|
||||||
|
@ -66,7 +66,7 @@ $(NAME)_SOURCES += \
|
|||||||
../../chipset/bcm/btstack_chipset_bcm_download_firmware.c \
|
../../chipset/bcm/btstack_chipset_bcm_download_firmware.c \
|
||||||
|
|
||||||
ifeq ($(BT_CHIP_XTAL_FREQUENCY),)
|
ifeq ($(BT_CHIP_XTAL_FREQUENCY),)
|
||||||
$(NAME)_SOURCES += ../../../drivers/bluetooth/firmware/$(BT_CHIP)$(BT_CHIP_REVISION)/bt_firmware_image.c
|
$(NAME)_SOURCES += ../../../drivers/bluetooth/firmware/$(BT_CHIP)$(BT_CHIP_REVISION)/$(BT_FIRMWARE_FILE)
|
||||||
else
|
else
|
||||||
$(NAME)_SOURCES += ../../../drivers/bluetooth/firmware/$(BT_CHIP)$(BT_CHIP_REVISION)/$(BT_CHIP_XTAL_FREQUENCY)/bt_firmware_image.c
|
$(NAME)_SOURCES += ../../../drivers/bluetooth/firmware/$(BT_CHIP)$(BT_CHIP_REVISION)/$(BT_CHIP_XTAL_FREQUENCY)/$(BT_FIRMWARE_FILE)
|
||||||
endif
|
endif
|
||||||
|
Loading…
x
Reference in New Issue
Block a user