BLE CTF: How to flash the ESP32
Hello!
If you want to do Hackgnar's BLE CTF but you've been struggling with flashing the ESP worry not! I have created a vagrant developer environment just for this.
The environment can be found here: https://github.com/dnutiu/esp32-dev-env
To use it you need to have Vagrant and VirtualBox installed.
After you got those installed, clone the repo and run the following commands on the terminal. This will start up the VM and ssh into it.
[code language="bash"] vagrant up && vagrant ssh [/code]
This will take a while, there's a lot of dependencies that have to be installed. After the command has completed you should now be logged in into the vagrant machine. Now plug in your ESP32 and make sure that it's recognised, run lsusb to list all devices and check for /dev/ttyUSB0, if that isn't present then flashing won't work. The last step is to flash.
[code language="bash"] cd ble_ctf make flash [/code]
I only tested this setup on my own machine. It might not detect all boards automatically, because the boards are made by different manufacturers and I did not fingerprint them all (see Vagrantfile). In case your board is not detected, an easy fix is to fire up VirtualBox, login with vagrant:vagrant and right click settings -> USB -> add new usb device.
Check my How to get started with FreeRTOS and ESP8266 post as it has more details on how to do that.
If the board is not seen by your operating system then there are several things you could try:
Try different USB cables. Some cables support only power transfer.
Try installing the driver required by the board's serial communication chip.
Make sure your board is not broken. :/