xref: /btstack/port/windows-h4/README.md (revision 0af1bfd99dac687afa03d48226d3cf18edec9399)
1c7558746SMatthias Ringwald# BTstack Port for Windows Systems with Bluetooth Controller connected via Serial Port
2c7558746SMatthias Ringwald
3c7558746SMatthias RingwaldThe Windows-H4 port uses the native run loop and allows to use Bluetooth Controllers connected via Serial Port.
4c7558746SMatthias Ringwald
5c7558746SMatthias RingwaldMake sure to manually reset the Bluetooth Controller before starting any of the examples.
6c7558746SMatthias Ringwald
73cda7aedSMatthias Ringwald## Toolchain
83cda7aedSMatthias Ringwald
95b53c16eSMatthias RingwaldThe port requires a Unix-like toolchain. We successfully used [mingw-w64](https://mingw-w64.org/doku.php) to compile and run the examples. mingw64-w64 is based on [MinGW](mingw.org), which '...provides a complete Open Source programming tool set which is suitable for the development of native MS-Windows applications, and which do not depend on any 3rd-party C-Runtime DLLs.'
103cda7aedSMatthias Ringwald
11b5674ee2SMatthias RingwaldWe've used the Msys2 package available from the [downloads page](https://mingw-w64.org/doku.php/download) on Windows 10, 64-bit and use the MSYS2 MinGW 64-bit start menu item to compile 64-bit binaries.
123cda7aedSMatthias Ringwald
13b5674ee2SMatthias RingwaldIn the MSYS2 shell, you can install everything with pacman:
143cda7aedSMatthias Ringwald
153cda7aedSMatthias Ringwald    $ pacman -S git
16b5674ee2SMatthias Ringwald    $ pacman -S make
17b5674ee2SMatthias Ringwald    $ pacman -S mingw-w64-x86_64-toolchain
183cda7aedSMatthias Ringwald    $ pacman -S python
195b53c16eSMatthias Ringwald    $ pacman -S winpty
203cda7aedSMatthias Ringwald
213cda7aedSMatthias Ringwald## Compilation
223cda7aedSMatthias Ringwald
235b53c16eSMatthias RingwaldWith mingw64-w64 installed, just go to the port/windows-winusb directory and run make
243cda7aedSMatthias Ringwald
253cda7aedSMatthias Ringwald    $ cd btstack/port/windows-winusb
263cda7aedSMatthias Ringwald    $ make
273cda7aedSMatthias Ringwald
28*0af1bfd9SMatthias RingwaldNote: When compiling with msys2-32 bit and/or the 32-bit toolchain, compilation fails
29*0af1bfd9SMatthias Ringwaldas `conio.h` seems to be mission. Please use msys2-64 bit with the 64-bit toolchain for now.
30*0af1bfd9SMatthias Ringwald
313cda7aedSMatthias Ringwald## Console Output
323cda7aedSMatthias Ringwald
33c7558746SMatthias RingwaldWhen running the examples in the MSYS2 shell, the console input (via btstack_stdin_support) doesn't work. It works in the older MSYS and also the regular CMD.exe environment. Another option is to install WinPTY and then start the example via WinPTY like this:
34c7558746SMatthias Ringwald
353cda7aedSMatthias Ringwald    $ winpty ./spp_and_le_counter.exe
363cda7aedSMatthias Ringwald
37