mirror of
https://github.com/bluekitchen/btstack.git
synced 2025-03-14 01:27:41 +00:00
renesas-b-s1ja: update create_examples to work in powershell/cmd
This commit is contained in:
parent
23d55d8142
commit
c6c20663b9
@ -1,83 +1,82 @@
|
||||
# BTstack port for Renesas Target Board TB-S1JA with CC256x
|
||||
|
||||
This port uses the Renesas TB-S1JA with TI's CC256XEM ST Adapter Kit that allows to plug in a CC256xB or CC256xC Bluetooth module.
|
||||
Renesas e2 Studio (Eclise-based) was used with the SSP HAL and without an RTOS.
|
||||
For easy debugging, Ozone project files are generated as well.
|
||||
|
||||
## Hardware
|
||||
|
||||
Renesas Target Board TB-S1JA:
|
||||
- [TB-S1JA Target Board Kit](https://www.renesas.com/eu/en/products/synergy/hardware/kits/tb-s1ja.html)
|
||||
|
||||
- CC2564B Bluetooth Controller:
|
||||
1. The best option is to get it as a BoostPack
|
||||
- Info: BOOST-CC2564MODA: http://www.ti.com/tool/BOOST-CC2564MODA
|
||||
2. Alternatively, get the evaluation module together with the EM Wireless Booster pack and a 32.768 kHz oscillator
|
||||
- EM Wireless Booster Pack:
|
||||
- [Info](http://www.ti.com/tool/BOOST-CCEMADAPTER)
|
||||
- [User Guide](http://www.ti.com/lit/pdf/swru338)
|
||||
- CC256x Bluetooth module:
|
||||
- [CC2564B Dual-mode Bluetooth® Controller Evaluation Module](https://store.ti.com/cc2564modnem.aspx)
|
||||
- [CC2564C Dual-mode Bluetooth® Controller Evaluation Module](https://store.ti.com/CC256XCQFN-EM-CC2564C-Dual-Mode-Bluetooth-Controller-Evaluation-Module-P51277.aspx)
|
||||
- The module with the older CC2564B is around USD 20, while the one with the new CC2564C costs around USD 60
|
||||
|
||||
The projects are configured for the CC2564C. When using the CC2564B, *bluetooth_init_cc2564B_1.8_BT_Spec_4.1.c* should be used as cc256x_init_script. You can update this in the create_examples.py script.
|
||||
|
||||
Connct the Target Board to the TI Boosterpack, see Booster Pack Pinout: http://www.ti.com/ww/en/launchpad/dl/boosterpack-pinout-v2.pdf
|
||||
|
||||
|
||||
J2 PIN | S1JA PORT | S1JA Signal | Boosterpack
|
||||
-------|-----------|-------------|------------
|
||||
2 | P301 | RXD0 | 3 (LP1)
|
||||
4 | P302 | TXD0 | 4 (LP1)
|
||||
6 | P304 | CTS0 | 36 (LP2)
|
||||
8 | P303 | RTS0 | 37 (LP2)
|
||||
10 | VCC | VCC | 1 (LP1)
|
||||
12 | VSS | GND | 20 (LP2)
|
||||
14 | P112 | nShutdown | 19 (LP1)
|
||||
|
||||
## Software
|
||||
|
||||
Generate example projects
|
||||
|
||||
$ ./create_examples.py
|
||||
|
||||
This will generate an e2 Studio project for each example.
|
||||
|
||||
|
||||
## Build, Flash And Run The Examples in e2 Studio
|
||||
|
||||
Open the e2 Studio project and press the 'Debug' button. Debug output is only available via SEGGER RTT. You can run SEGGER's JLinkRTTViewer or use Ozone as described below.
|
||||
|
||||
|
||||
## Run Example Project using Ozone
|
||||
|
||||
After compiling the project with e2 Studio, the genereated .elf file can be used with Ozone. In Ozone, the debug output is readily available. A .jdebug file is provided in the project folder.
|
||||
|
||||
|
||||
## Debug output
|
||||
|
||||
All debug output is send via SEGGER RTT.
|
||||
|
||||
In src/btstack_config.h resp. in example/btstack_config.h of the generated projects, additional debug information can be enabled by uncommenting ENABLE_LOG_INFO.
|
||||
|
||||
Also, the full packet log can be enabled in src/port.c The console output can then be converted into .pklg files for OS X PacketLogger or WireShark by running tool/create_packet_log.py
|
||||
|
||||
|
||||
## GATT Database
|
||||
In BTstack, the GATT Database is defined via the .gatt file in the example folder. The Makefile contains rules to update the .h file when the .gatt was modified.
|
||||
|
||||
Note: In theory, this can be integrated into the Eclipse project, in fact, it's easy to configure it as an Eclipse Builder, but it got tricky to get it working with templates.
|
||||
|
||||
|
||||
## ToDo
|
||||
- Implement hal_flash_bank_renesas_ssp
|
||||
|
||||
|
||||
## Notes
|
||||
- HCI UART is set to 2 mbps. Using 3 or 4 mbps causes hang during startup
|
||||
|
||||
|
||||
## Nice to have
|
||||
- Allow compilation using Makefile/CMake on macOS
|
||||
|
||||
# BTstack port for Renesas Target Board TB-S1JA with CC256x
|
||||
|
||||
This port uses the Renesas TB-S1JA with TI's CC256XEM ST Adapter Kit that allows to plug in a CC256xB or CC256xC Bluetooth module.
|
||||
Renesas e2 Studio (Eclise-based) was used with the SSP HAL and without an RTOS.
|
||||
For easy debugging, Ozone project files are generated as well.
|
||||
|
||||
## Hardware
|
||||
|
||||
Renesas Target Board TB-S1JA:
|
||||
- [TB-S1JA Target Board Kit](https://www.renesas.com/eu/en/products/synergy/hardware/kits/tb-s1ja.html)
|
||||
|
||||
- CC2564B Bluetooth Controller:
|
||||
1. The best option is to get it as a BoostPack
|
||||
- Info: BOOST-CC2564MODA: http://www.ti.com/tool/BOOST-CC2564MODA
|
||||
2. Alternatively, get the evaluation module together with the EM Wireless Booster pack and a 32.768 kHz oscillator
|
||||
- EM Wireless Booster Pack:
|
||||
- [Info](http://www.ti.com/tool/BOOST-CCEMADAPTER)
|
||||
- [User Guide](http://www.ti.com/lit/pdf/swru338)
|
||||
- CC256x Bluetooth module:
|
||||
- [CC2564B Dual-mode Bluetooth® Controller Evaluation Module](https://store.ti.com/cc2564modnem.aspx)
|
||||
- [CC2564C Dual-mode Bluetooth® Controller Evaluation Module](https://store.ti.com/CC256XCQFN-EM-CC2564C-Dual-Mode-Bluetooth-Controller-Evaluation-Module-P51277.aspx)
|
||||
- The module with the older CC2564B is around USD 20, while the one with the new CC2564C costs around USD 60
|
||||
|
||||
The projects are configured for the CC2564C. When using the CC2564B, *bluetooth_init_cc2564B_1.8_BT_Spec_4.1.c* should be used as cc256x_init_script. You can update this in the create_examples.py script.
|
||||
|
||||
Connct the Target Board to the TI Boosterpack, see Booster Pack Pinout: http://www.ti.com/ww/en/launchpad/dl/boosterpack-pinout-v2.pdf
|
||||
|
||||
|
||||
J2 PIN | S1JA PORT | S1JA Signal | Boosterpack
|
||||
-------|-----------|-------------|------------
|
||||
2 | P301 | RXD0 | 3 (LP1)
|
||||
4 | P302 | TXD0 | 4 (LP1)
|
||||
6 | P304 | CTS0 | 36 (LP2)
|
||||
8 | P303 | RTS0 | 37 (LP2)
|
||||
10 | VCC | VCC | 1 (LP1)
|
||||
12 | VSS | GND | 20 (LP2)
|
||||
14 | P112 | nShutdown | 19 (LP1)
|
||||
|
||||
## Software
|
||||
|
||||
Generate example projects
|
||||
|
||||
$ python create_examples.py
|
||||
|
||||
This will generate an e2 Studio project for each example.
|
||||
|
||||
|
||||
## Build, Flash And Run The Examples in e2 Studio
|
||||
|
||||
Open the e2 Studio project and press the 'Debug' button. Debug output is only available via SEGGER RTT. You can run SEGGER's JLinkRTTViewer or use Ozone as described below.
|
||||
|
||||
|
||||
## Run Example Project using Ozone
|
||||
|
||||
After compiling the project with e2 Studio, the genereated .elf file can be used with Ozone. In Ozone, the debug output is readily available. A .jdebug file is provided in the project folder.
|
||||
|
||||
|
||||
## Debug output
|
||||
|
||||
All debug output is send via SEGGER RTT.
|
||||
|
||||
In src/btstack_config.h resp. in example/btstack_config.h of the generated projects, additional debug information can be enabled by uncommenting ENABLE_LOG_INFO.
|
||||
|
||||
Also, the full packet log can be enabled in src/port.c The console output can then be converted into .pklg files for OS X PacketLogger or WireShark by running tool/create_packet_log.py
|
||||
|
||||
|
||||
## GATT Database
|
||||
In BTstack, the GATT Database is defined via the .gatt file in the example folder. The create_examples.py script converts the .gatt files into a corresponding .h for the project. After updating a .gatt file, the .h can be updated manually by running the provided update_gatt_db.sh or update_gatt_db.bat scripts.
|
||||
|
||||
Note: In theory, this can be integrated into the e2 Studio/Eclipse project.
|
||||
|
||||
|
||||
## ToDo
|
||||
- Implement hal_flash_bank_renesas_ssp
|
||||
|
||||
|
||||
## Notes
|
||||
- HCI UART is set to 2 mbps. Using 3 or 4 mbps causes hang during startup
|
||||
|
||||
|
||||
## Nice to have
|
||||
- Allow compilation using Makefile/CMake on macOS
|
||||
|
@ -14,11 +14,14 @@ import subprocess
|
||||
# use for CC2564C
|
||||
init_script = 'bluetooth_init_cc2564C_1.3.c'
|
||||
|
||||
gatt_update_template = '''#!/bin/sh
|
||||
gatt_update_bat_template = '''python.exe BTSTACK_ROOT\\tool\\compile_gatt.py BTSTACK_ROOT\\example\\EXAMPLE.gatt PROJECT_SRC\\EXAMPLE.h
|
||||
'''
|
||||
|
||||
gatt_update_sh_template = '''#!/bin/sh
|
||||
DIR=`dirname $0`
|
||||
BTSTACK_ROOT=$DIR/../../../..
|
||||
echo "Creating EXAMPLE.h from EXAMPLE.gatt"
|
||||
$BTSTACK_ROOT/tool/compile_gatt.py $BTSTACK_ROOT/example/EXAMPLE.gatt $DIR/EXAMPLE.h
|
||||
$BTSTACK_ROOT/tool/compile_gatt.py $BTSTACK_ROOT/example/EXAMPLE.gatt $DIR/src/EXAMPLE.h
|
||||
'''
|
||||
|
||||
def fetch_init_script():
|
||||
@ -32,8 +35,12 @@ def create_folder(path):
|
||||
os.makedirs(path)
|
||||
|
||||
def create_examples(port_folder, suffix):
|
||||
|
||||
# btstack root
|
||||
btstack_root = os.path.abspath(port_folder + "/../..")
|
||||
|
||||
# path to examples
|
||||
examples_embedded = port_folder + "/../../example/"
|
||||
examples_embedded = btstack_root + "/example/"
|
||||
|
||||
# path to project template
|
||||
project_template = port_folder + "/template/btstack_example/"
|
||||
@ -41,6 +48,7 @@ def create_examples(port_folder, suffix):
|
||||
# path to example projects
|
||||
example_folder = port_folder + "/example" + suffix + "/"
|
||||
|
||||
|
||||
print("Creating example folder")
|
||||
create_folder(example_folder)
|
||||
|
||||
@ -109,11 +117,17 @@ def create_examples(port_folder, suffix):
|
||||
# generate .h from .gatt
|
||||
gatt_path = examples_embedded + example + ".gatt"
|
||||
if os.path.exists(gatt_path):
|
||||
update_gatt_script = project_folder + "update_gatt_db.sh"
|
||||
with open(update_gatt_script, "wt") as fout:
|
||||
fout.write(gatt_update_template.replace("EXAMPLE", example))
|
||||
os.chmod(update_gatt_script, 0o755)
|
||||
subprocess.call("sh " + update_gatt_script, shell=True)
|
||||
update_gatt_script_sh = project_folder + "update_gatt_db.sh"
|
||||
update_gatt_script_bat = project_folder + "update_gatt_db.bat"
|
||||
with open(update_gatt_script_sh, "wt") as fout:
|
||||
fout.write(gatt_update_sh_template.replace("EXAMPLE", example))
|
||||
os.chmod(update_gatt_script_sh, 0o755)
|
||||
with open(update_gatt_script_bat, "wt") as fout:
|
||||
fout.write(gatt_update_bat_template.replace("EXAMPLE", example).replace("BTSTACK_ROOT", btstack_root).replace("PROJECT_SRC", src_folder))
|
||||
if os.name == "nt":
|
||||
subprocess.run(["python.exe", port_folder + "/../../tool/compile_gatt.py", gatt_path, src_folder + example + ".h" ], shell=True, capture_output=True)
|
||||
else:
|
||||
subprocess.run(update_gatt_script.sh, shell=True, capture_output=True)
|
||||
print("- %s - converting GATT DB" % example)
|
||||
else:
|
||||
print("- %s" % example)
|
||||
|
Loading…
x
Reference in New Issue
Block a user