First, you need an esp32 micro controller. If you do not yet have one, I typically buy these ones from Amazon. If you are reading this because you know I will be at BSidesLV, BlackHat USA and DEFCON, you can ping me on Twitter and Ill hook you up with a pre-flashed on at co$t in Vegas.
The easiest way to get this projects firmware flashed to an ESP32 is to flash the provided pre-compiled binaries. You will need to install esptool Then do the following: Clone the repository
git clone https://github.com/hackgnar/ble_ctf_infinity
Chage directory into the repository
cd ble_ctf_infinity
Flash the pre-compiled binaries
esptool.py --chip esp32 --port /dev/ttyUSB0 \
--baud 115200 --before default_reset --after hard_reset write_flash \
-z --flash_mode dio --flash_freq 40m --flash_size detect \
0x1000 build/bootloader/bootloader.bin \
0x10000 build/gatt_server_service_table_demo.bin \
0x8000 build/partitions_singleapp.bin
If you want to compile the code yourself, but are having issues setting up an environment, you can use the docker build method. This will provide you with a clean uniform build environment each time. To build from docker do the following:
Build your base docker image for development or compiling code
docker build -t blectfi .
Start up a docker instance and mount your code repository to /ble_ctf_infinity
docker run -it -v ./:/ble_ctf_infinity --name blectfi blectfi
Build your project.
cd /ble_ctf_infinity
make codegen
make
Shutdown and kill your docker
exit
docker stop blectfi
docker rm blectfi
Flash the firmware you built (you will need esptool installed)
esptool.py --chip esp32 --port /dev/ttyUSB0 \
--baud 115200 --before default_reset --after hard_reset write_flash \
-z --flash_mode dio --flash_freq 40m --flash_size detect \
0x1000 build/bootloader/bootloader.bin \
0x10000 build/gatt_server_service_table_demo.bin \
0x8000 build/partitions_singleapp.bin
Setup your esp32 build environment by following this documentation. Once complete, you can build and flash the code from this repository just the same as you would from the example bluetooth programs in that project which are located in /esp-idf/examples/bluetooth/
If you need a reminder, do the following once you set up your whole esp build environment from the link above.
cd ble_ctf
make menuconfig
# check Component Config > Bluetooth > Bluetooth
# set Compiler options > Disable new warnings introduced in GCC 6-8
# set Serial Flasher Config > Default serial device
make codegen
make
# plug in your esp32 to usb
make flash