samv71-xplained-atwilc3000: build all examples

This commit is contained in:
Matthias Ringwald 2017-08-08 10:48:30 +02:00
parent 7d0ceef158
commit 0af04ee4d3
8 changed files with 287 additions and 19 deletions

View File

@ -0,0 +1,11 @@
.phony: examples
all: examples
examples:
scripts/create_examples.py
clean:
scripts/delete_examples.py
@rm -rf example/Makefile
@echo "Deleting CC2564B Init Script in src folder"
@rm -rf src/cc256x* bluetooth_init*

View File

@ -15,6 +15,7 @@
#define ENABLE_LOG_INFO
#define ENABLE_LOG_ERROR
#define ENABLE_LE_PERIPHERAL
#define ENABLE_LE_CENTRAL
#define HCI_ACL_PAYLOAD_SIZE 1021

View File

@ -0,0 +1,30 @@
Makefile
a2dp_sink_demo/
a2dp_source_demo/
ancs_client_demo/
gap_dedicated_bonding/
gap_inquiry/
gap_le_advertisements/
gatt_battery_query/
gatt_browser/
hfp_ag_demo/
hfp_hf_demo/
hid_keyboard_demo/
hsp_ag_demo/
hsp_hs_demo/
le_counter/
le_streamer/
le_streamer_client/
led_counter/
pbap_client_demo/
sdp_bnep_query/
sdp_general_query/
sdp_rfcomm_query/
sm_pairing_central/
sm_pairing_peripheral/
spp_and_le_counter/
spp_and_le_streamer/
spp_counter/
spp_flowcontrol/
spp_streamer/
spp_streamer_client/

View File

@ -46,10 +46,19 @@
# \asf_license_stop
#
BTSTACK_ROOT_MAKEFILE=../../../..
# enforce .gatt compilation if needed
all: le_counter.h
le_counter.h: ${BTSTACK_ROOT_MAKEFILE}/example/le_counter.gatt
python ${BTSTACK_ROOT_MAKEFILE}/tool/compile_gatt.py $< $@
flash: $(TARGET_FLASH)
openocd -f interface/cmsis-dap.cfg -f board/atmel_samv71_xplained_ultra.cfg -f upload.cfg
# Include the common Makefile, which will also include the project specific
# config.mk file.
MAKEFILE_PATH = ../../ASF/sam/utils/make/Makefile.sam.in
include $(MAKEFILE_PATH)
flash: $(TARGET_FLASH)
openocd -f interface/cmsis-dap.cfg -f board/atmel_samv71_xplained_ultra.cfg -f upload.cfg

View File

@ -47,12 +47,15 @@ PART = samv71q21
# Application target name. Given with suffix .a for library and .elf for a
# standalone application.
TARGET_FLASH = le_counter_flash.elf
TARGET_SRAM = le_counter_sram.elf
TARGET_FLASH=le_counter_flash.elf
TARGET_SRAM=le_counter_sram.elf
# template main file
CSRCS+=${BTSTACK_ROOT}/example/le_counter.c
# List of C source files.
CSRCS = \
../main \
CSRCS+= \
../main.c \
common/services/clock/samv71/sysclk.c \
common/services/serial/usart_serial.c \
common/utils/interrupt/interrupt_sam_nvic.c \
@ -106,7 +109,7 @@ INC_PATH = \
thirdparty/CMSIS/Lib/GCC \
..
BTSTACK_ROOT = ../../..
BTSTACK_ROOT = ../../../
INC_PATH += ${BTSTACK_ROOT}/src/ble
INC_PATH += ${BTSTACK_ROOT}/src/ble/gatt-service
INC_PATH += ${BTSTACK_ROOT}/src/classic
@ -114,6 +117,12 @@ INC_PATH += ${BTSTACK_ROOT}/src
INC_PATH += ${BTSTACK_ROOT}/3rd-party/micro-ecc
INC_PATH += ${BTSTACK_ROOT}/platform/embedded
INC_PATH += ${BTSTACK_ROOT}/chipset/atwilc3000
INC_PATH += ${BTSTACK_ROOT}/port/samv71-xplained-atwilc3000/example/le_counter
INC_PATH += ${BTSTACK_ROOT}/3rd-party/hxcmod-player
INC_PATH += ${BTSTACK_ROOT}/3rd-party/hxcmod-player/mods
INC_PATH += ${BTSTACK_ROOT}/3rd-party/bluedroid/encoder/include
INC_PATH += ${BTSTACK_ROOT}/3rd-party/bluedroid/decoder/include
# VPATH += ${BTSTACK_ROOT}/src
# VPATH += ${BTSTACK_ROOT}/src/ble
@ -124,35 +133,86 @@ INC_PATH += ${BTSTACK_ROOT}/chipset/atwilc3000
# VPATH += ${BTSTACK_ROOT}/3rd-party/micro-ecc
CSRCS += \
${BTSTACK_ROOT}/3rd-party/hxcmod-player/hxcmod.c \
${BTSTACK_ROOT}/3rd-party/hxcmod-player/mods/nao-deceased_by_disease.c \
${BTSTACK_ROOT}/chipset/atwilc3000/btstack_chipset_atwilc3000.c \
${BTSTACK_ROOT}/chipset/atwilc3000/wilc3000_bt_firmware.c \
${BTSTACK_ROOT}/example/sco_demo_util.c \
${BTSTACK_ROOT}/platform/embedded/btstack_run_loop_embedded.c \
${BTSTACK_ROOT}/platform/embedded/btstack_uart_block_embedded.c \
${BTSTACK_ROOT}/src/ad_parser.c \
${BTSTACK_ROOT}/src/ble/ancs_client.c \
${BTSTACK_ROOT}/src/ble/att_db.c \
${BTSTACK_ROOT}/src/ble/att_dispatch.c \
${BTSTACK_ROOT}/src/ble/att_server.c \
${BTSTACK_ROOT}/src/ble/gatt-service/battery_service_server.c \
${BTSTACK_ROOT}/src/ble/gatt-service/device_information_service_server.c \
${BTSTACK_ROOT}/src/ble/gatt_client.c \
${BTSTACK_ROOT}/src/ble/le_device_db_memory.c \
${BTSTACK_ROOT}/src/ble/sm.c \
${BTSTACK_ROOT}/src/btstack_linked_list.c \
${BTSTACK_ROOT}/src/btstack_memory.c \
${BTSTACK_ROOT}/src/btstack_memory_pool.c \
${BTSTACK_ROOT}/src/btstack_ring_buffer.c \
${BTSTACK_ROOT}/src/btstack_run_loop.c \
${BTSTACK_ROOT}/platform/embedded/btstack_run_loop_embedded.c \
${BTSTACK_ROOT}/platform/embedded/btstack_uart_block_embedded.c \
${BTSTACK_ROOT}/src/btstack_util.c \
${BTSTACK_ROOT}/src/ble/gatt-service/device_information_service_server.c \
${BTSTACK_ROOT}/src/ble/gatt_client.c \
${BTSTACK_ROOT}/src/classic/a2dp_sink.c \
${BTSTACK_ROOT}/src/classic/a2dp_source.c \
${BTSTACK_ROOT}/src/classic/avdtp.c \
${BTSTACK_ROOT}/src/classic/avdtp_acceptor.c \
${BTSTACK_ROOT}/src/classic/avdtp_initiator.c \
${BTSTACK_ROOT}/src/classic/avdtp_sink.c \
${BTSTACK_ROOT}/src/classic/avdtp_source.c \
${BTSTACK_ROOT}/src/classic/avdtp_util.c \
${BTSTACK_ROOT}/src/classic/avrcp.c \
${BTSTACK_ROOT}/src/classic/avrcp_controller.c \
${BTSTACK_ROOT}/src/classic/avrcp_target.c \
${BTSTACK_ROOT}/src/classic/btstack_sbc_bludroid.c \
${BTSTACK_ROOT}/src/classic/btstack_sbc_plc.c \
${BTSTACK_ROOT}/src/classic/hfp.c \
${BTSTACK_ROOT}/src/classic/hfp_ag.c \
${BTSTACK_ROOT}/src/classic/hfp_hf.c \
${BTSTACK_ROOT}/src/classic/hfp_msbc.c \
${BTSTACK_ROOT}/src/classic/hfp_gsm_model.c \
${BTSTACK_ROOT}/src/classic/hsp_hs.c \
${BTSTACK_ROOT}/src/classic/hsp_ag.c \
${BTSTACK_ROOT}/src/classic/goep_client.c \
${BTSTACK_ROOT}/src/classic/obex_iterator.c \
${BTSTACK_ROOT}/src/classic/pbap_client.c \
${BTSTACK_ROOT}/src/classic/rfcomm.c \
${BTSTACK_ROOT}/src/classic/sdp_client.c \
${BTSTACK_ROOT}/src/classic/sdp_client_rfcomm.c \
${BTSTACK_ROOT}/src/classic/sdp_server.c \
${BTSTACK_ROOT}/src/classic/sdp_util.c \
${BTSTACK_ROOT}/src/classic/spp_server.c \
${BTSTACK_ROOT}/src/hci.c \
${BTSTACK_ROOT}/src/hci_cmd.c \
${BTSTACK_ROOT}/src/hci_dump.c \
${BTSTACK_ROOT}/src/hci_transport_h4.c \
${BTSTACK_ROOT}/src/l2cap.c \
${BTSTACK_ROOT}/src/l2cap_signaling.c \
${BTSTACK_ROOT}/src/ble/le_device_db_memory.c \
${BTSTACK_ROOT}/src/ble/sm.c \
${BTSTACK_ROOT}/example/le_counter.c \
${BTSTACK_ROOT}/chipset/atwilc3000/btstack_chipset_atwilc3000.c \
${BTSTACK_ROOT}/chipset/atwilc3000/wilc3000_bt_firmware.c \
# ${BTSTACK_ROOT}/3rd-party/micro-ecc/uECC.c \
${BTSTACK_ROOT}/3rd-party/bluedroid/decoder/srce/alloc.c \
${BTSTACK_ROOT}/3rd-party/bluedroid/decoder/srce/bitalloc-sbc.c \
${BTSTACK_ROOT}/3rd-party/bluedroid/decoder/srce/bitalloc.c \
${BTSTACK_ROOT}/3rd-party/bluedroid/decoder/srce/bitstream-decode.c \
${BTSTACK_ROOT}/3rd-party/bluedroid/decoder/srce/decoder-oina.c \
${BTSTACK_ROOT}/3rd-party/bluedroid/decoder/srce/decoder-private.c \
${BTSTACK_ROOT}/3rd-party/bluedroid/decoder/srce/decoder-sbc.c \
${BTSTACK_ROOT}/3rd-party/bluedroid/decoder/srce/dequant.c \
${BTSTACK_ROOT}/3rd-party/bluedroid/decoder/srce/framing-sbc.c \
${BTSTACK_ROOT}/3rd-party/bluedroid/decoder/srce/framing.c \
${BTSTACK_ROOT}/3rd-party/bluedroid/decoder/srce/oi_codec_version.c \
${BTSTACK_ROOT}/3rd-party/bluedroid/decoder/srce/synthesis-8-generated.c \
${BTSTACK_ROOT}/3rd-party/bluedroid/decoder/srce/synthesis-dct8.c \
${BTSTACK_ROOT}/3rd-party/bluedroid/decoder/srce/synthesis-sbc.c \
${BTSTACK_ROOT}/3rd-party/bluedroid/encoder/srce/sbc_analysis.c \
${BTSTACK_ROOT}/3rd-party/bluedroid/encoder/srce/sbc_dct.c \
${BTSTACK_ROOT}/3rd-party/bluedroid/encoder/srce/sbc_dct_coeffs.c \
${BTSTACK_ROOT}/3rd-party/bluedroid/encoder/srce/sbc_enc_bit_alloc_mono.c \
${BTSTACK_ROOT}/3rd-party/bluedroid/encoder/srce/sbc_enc_bit_alloc_ste.c \
${BTSTACK_ROOT}/3rd-party/bluedroid/encoder/srce/sbc_enc_coeffs.c \
${BTSTACK_ROOT}/3rd-party/bluedroid/encoder/srce/sbc_encoder.c \
${BTSTACK_ROOT}/3rd-party/bluedroid/encoder/srce/sbc_packing.c \
# Additional search paths for libraries.
LIB_PATH = \
@ -217,3 +277,4 @@ LDFLAGS = \
# Pre- and post-build commands
PREBUILD_CMD =
POSTBUILD_CMD =

View File

@ -1,5 +1,5 @@
// le_counter.h generated from ../../example/le_counter.gatt for BTstack
// le_counter.h generated from ../../../../example/le_counter.gatt for BTstack
// binary representation
// attribute size in bytes (16), flags(16), handle (16), uuid (16/128), value(...)

View File

@ -0,0 +1,125 @@
#!/usr/bin/env python
#
# Create project files for all BTstack embedded examples in WICED/apps/btstack
import os
import re
import shutil
import subprocess
import sys
# build all template
build_all = '''
SUBDIRS = \\
%s
all:
\techo Building all examples
\tfor dir in $(SUBDIRS); do \\
\t$(MAKE) -C $$dir || exit 1; \\
\tdone
clean:
\techo Cleaning all ports
\tfor dir in $(SUBDIRS); do \\
\t$(MAKE) -C $$dir clean; \\
\tdone
'''
# get script path
script_path = os.path.abspath(os.path.dirname(sys.argv[0])) + '/../'
# get btstack root
btstack_root = script_path + '../../'
## pick correct init script based on your hardware
# - init script for ATWILC300 SHIELD
subprocess.call("make -C ../../chipset/atwilc3000", shell=True)
# path to examples
examples_embedded = btstack_root + 'example/'
# path to generated example projects
projects_path = script_path + "example/"
# path to template
template_path = script_path + 'example/template/'
print("Creating example projects:")
# iterate over btstack examples
example_files = os.listdir(examples_embedded)
examples = []
for file in example_files:
if not file.endswith(".c"):
continue
if file in ['panu_demo.c', 'sco_demo_util.c']:
continue
example = file[:-2]
examples.append(example)
# create folder
project_folder = projects_path + example + "/"
if not os.path.exists(project_folder):
os.makedirs(project_folder)
# check if .gatt file is present
gatt_path = examples_embedded + example + ".gatt"
gatt_h = ""
if os.path.exists(gatt_path):
gatt_h = example+'.h'
# create Makefile
shutil.copyfile(template_path + 'Makefile', project_folder + 'Makefile')
# create upload.cfg
with open(project_folder + 'upload.cfg', 'wt') as fout:
with open(template_path + 'upload.cfg', 'rt') as fin:
for line in fin:
if 'flash write_image erase le_counter_flash.elf' in line:
fout.write('flash write_image erase %s_flash.elf\n' % example)
continue
fout.write(line)
# create Makefile
with open(project_folder + 'Makefile', 'wt') as fout:
with open(template_path + 'Makefile', 'rt') as fin:
for line in fin:
if 'le_counter.h: ${BTSTACK_ROOT_MAKEFILE}/example/le_counter.gatt' in line:
fout.write('%s.h: ${BTSTACK_ROOT_MAKEFILE}/example/%s.gatt\n' % (example,example))
continue
if 'all: le_counter.h' in line:
if len(gatt_h):
fout.write("all: %s.h\n" % example)
else:
fout.write("all:\n")
continue
fout.write(line)
# create config.mk
with open(project_folder + 'config.mk', 'wt') as fout:
with open(template_path + 'config.mk', 'rt') as fin:
for line in fin:
if 'CSRCS+=${BTSTACK_ROOT}/example/le_counter.c' in line:
fout.write('CSRCS+=${BTSTACK_ROOT}/example/%s.c\n' % example)
continue
if 'TARGET_FLASH=le_counter_flash.elf' in line:
fout.write('TARGET_FLASH=%s_flash.elf\n' % example)
continue
if 'TARGET_SRAM=le_counter_sram.elf' in line:
fout.write('TARGET_SRAM=%s_sram.elf\n' % example)
continue
if 'INC_PATH += ${BTSTACK_ROOT}/port/samv71-xplained-atwilc3000/example/le_counter' in line:
fout.write('INC_PATH += ${BTSTACK_ROOT}/port/samv71-xplained-atwilc3000/example/%s\n' % example)
continue
fout.write(line)
print("- %s" % example)
with open(projects_path+'Makefile', 'wt') as fout:
fout.write(build_all % ' \\\n'.join(examples))
print("Projects are ready for compile in example folder. See README for details.")

View File

@ -0,0 +1,31 @@
#!/usr/bin/env python
#
# Delete project files for all BTstack embedded examples in local port/esp32 folder
import os
import shutil
import sys
import time
import subprocess
# get script path
script_path = os.path.abspath(os.path.dirname(sys.argv[0]))
# path to examples
examples_embedded = script_path + "/../../../example/"
# path to port/esp32
apps_btstack = "example/"
print("Deleting examples in local folder")
# iterate over btstack examples
for file in os.listdir(examples_embedded):
if not file.endswith(".c"):
continue
example = file[:-2]
apps_folder = apps_btstack + example + "/"
if os.path.exists(apps_folder):
shutil.rmtree(apps_folder)
print("- %s" % example)