Customize Bluetooth LE Services Tools


ESP-AT provides python script to convert customized Bluetooth LE services into ble_data.bin. For more information on customizing Bluetooth LE services, please refer to How to Customize Bluetooth® LE Services.

Generate Bin File

Select one of the following ways to generate ble_data.bin.

Script Generation

The path of is tools/ You can get help information of the script through the -h option. You can also generate ble_data.bin directly through the following commands.

python <SCRIPT_PATH> [-t TARGET_FILE_NAME] <source_file>
  • SCRIPT_PATH: the path the script. If you’re in “tools” folder of ESP-AT project, SCRIPT_PATH is

  • TARGET_FILE_NAME: the target file which you want to save the generated bin (absolute address or relative address of the target file); if not specified, it will generate ATBleService.bin in the same directory with source_file.

  • source_file: the source file which you defines your Bluetooth LE GATT services (absolute address or relative address of the source file).

For example, you can execute the following directory to generate ble_data.bin in the tools directory:

python -t ble_data.bin ../components/customized_partitions/raw_data/ble_data/example.csv

Generation During Compilation

The storage path of Bluetooth LE GATT service files in ESP-AT is components/customized_partitions/raw_data/ble_data/example.csv.

For how to customize Bluetooth LE services, you can refer to How to Customize Bluetooth® LE Services.

For how to compile ESP-AT project, you can refer to Compile ESP-AT Project.

Download or Update Bin File

The script is only responsible for converting example.csv file to bin file. You can download bin files to the corresponding flash partition in the following ways:

  1. Download bin file with tools

  1. Windows

    Please download Flash Download Tools for Windows.

    For more details about the Tools, please see readme.pdf or the doc folder in the zip folder.

  2. Linux or macOS

    Please use

    You can refer to How to Customize Bluetooth® LE Services for more details. --chip auto --port PORTNAME --baud 921600 --before default_reset --after hard_reset write_flash -z --flash_mode dio --flash_freq 40m --flash_size 4MB ADDRESS FILEDIRECTORY

    Replace PORTNAME with your port name. Replace ADDRESS with the the download address. Replace FILEDIRECTORY with the file directory of the bin.

  1. Update bin file with commands


    Taking ESP32 module as an example, you can execute the following command to upgrade the ble_data partition. Please refer to AT+SYSFLASH for more details.

    1. Query user partitions in flash




    1. Erase ble_data sector




    1. Update ble_data sector





    If the operator is write, wrap return > after the write command, then you can send the data that you want to write. The length should be parameter <length>. When the write operation is completed, the system will prompt the following information.


    For example, you can execute the following command to upgrade the ble_data partition (The premise is that you must use the Wi-Fi function). Please refer to AT+CIUPDATE for more details.


    If you want to update the ble_data partition in this way, you must implement your own OTA device, please refer to How to Implement OTA Upgrade.



You must ensure that the download address is correct, otherwise the ESP-AT firmware may not work. The simplest way to view the download address is to execute the command AT+SYSFLASH?.