> For the complete documentation index, see [llms.txt](https://libooogo.gitbook.io/esplane/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://libooogo.gitbook.io/esplane/developer-guide/00esplane-kai-fa-zhi-yin.md).

# 01 ESPlane Developer Get Started

## Step 1. Setup ESP-IDF Environment

1. [Setup toolchain](https://docs.espressif.com/projects/esp-idf/en/release-v3.3/get-started/index.html#setup-toolchain)
2. [Get ESP-IDF](https://docs.espressif.com/projects/esp-idf/en/release-v3.3/get-started/index.html#get-esp-idf) :**This project based on `release / v3.3`**

   ```
    git clone -b release/v3.3 --recursive https://github.com/espressif/esp-idf.git
   ```
3. [Setup Path to ESP-IDF](https://docs.espressif.com/projects/esp-idf/en/release-v3.3/get-started/index.html#setup-path-to-esp-idf)
4. [Install the Required Python Packages](https://docs.espressif.com/projects/esp-idf/en/release-v3.3/get-started/index.html#install-the-required-python-packages)

   ```
    python -m pip install --user -r $IDF_PATH/requirements.txt
   ```

## Step 2. Get ESPlane2.0 Source Code

```
  git clone https://github.com/qljz1993/ESPlane2.git
```

## Step 3. Configure ESP-IDF (Optional)

**Note:** The ESPlane2.0 code comes with components `esp32` and`freertos`, which already configured can cover the corresponding components of ESP-IDF.

> These two components come from `release / v3.3` and were recently updated to commit:`6f9a7264ce20c6132fbd8309112630d0eb490fe4`. If you use the same version ESP-IDF, you can `ignore the following configuration process`. The following configuration process is only referenced when the two components `esp32` and`freertos` are updated.

### Config ESP32 Link Script

Purpose: Place variables with `param` or`log` tags in the esplane firmware in a continuous address area

Find the `drom0_0_seg` section in the`{IDF_PATH} / components / esp32 / ld / esp32.project.ld.in` file and add the following:

```
    /* Parameters and log system datas >drom0_0_seg*/
    _param_start = .;
    KEEP(*(.param))
    KEEP(*(.param.*))
    _param_stop = .;
    . = ALIGN(4);
    _log_start = .;
    KEEP(*(.log))
    KEEP(*(.log.*))
    _log_stop = .;
    . = ALIGN(4);
```

It will look like this after changing:

```
  .flash.rodata :
  {
    _rodata_start = ABSOLUTE(.);

    *(.rodata_desc .rodata_desc.*)               /* Should be the first.  App version info.        DO NOT PUT ANYTHING BEFORE IT! */
    *(.rodata_custom_desc .rodata_custom_desc.*) /* Should be the second. Custom app version info. DO NOT PUT ANYTHING BEFORE IT! */

    mapping[flash_rodata]

    *(.irom1.text) /* catch stray ICACHE_RODATA_ATTR */
    *(.gnu.linkonce.r.*)
    *(.rodata1)
    __XT_EXCEPTION_TABLE_ = ABSOLUTE(.);
    *(.xt_except_table)
    *(.gcc_except_table .gcc_except_table.*)
    *(.gnu.linkonce.e.*)
    *(.gnu.version_r)
    . = (. + 3) & ~ 3;
    __eh_frame = ABSOLUTE(.);
    KEEP(*(.eh_frame))
    . = (. + 7) & ~ 3;
    /*  C++ constructor and destructor tables, properly ordered:  */
    __init_array_start = ABSOLUTE(.);
    KEEP (*crtbegin.*(.ctors))
    KEEP (*(EXCLUDE_FILE (*crtend.*) .ctors))
    KEEP (*(SORT(.ctors.*)))
    KEEP (*(.ctors))
    __init_array_end = ABSOLUTE(.);
    KEEP (*crtbegin.*(.dtors))
    KEEP (*(EXCLUDE_FILE (*crtend.*) .dtors))
    KEEP (*(SORT(.dtors.*)))
    KEEP (*(.dtors))
    /*  C++ exception handlers table:  */
    __XT_EXCEPTION_DESCS_ = ABSOLUTE(.);
    *(.xt_except_desc)
    *(.gnu.linkonce.h.*)
    __XT_EXCEPTION_DESCS_END__ = ABSOLUTE(.);
    *(.xt_except_desc_end)
    *(.dynamic)
    *(.gnu.version_d)
    /* Addresses of memory regions reserved via
       SOC_RESERVE_MEMORY_REGION() */
    soc_reserved_memory_region_start = ABSOLUTE(.);
    KEEP (*(.reserved_memory_address))
    soc_reserved_memory_region_end = ABSOLUTE(.);
    _rodata_end = ABSOLUTE(.);
    /* Literals are also RO data. */
    _lit4_start = ABSOLUTE(.);
    *(*.lit4)
    *(.lit4.*)
    *(.gnu.linkonce.lit4.*)
    _lit4_end = ABSOLUTE(.);
    . = ALIGN(4);
    _thread_local_start = ABSOLUTE(.);
    *(.tdata)
    *(.tdata.*)
    *(.tbss)
    *(.tbss.*)
    _thread_local_end = ABSOLUTE(.);
    . = ALIGN(4);
    /* Parameters and log system datas */
    _param_start = .;
    KEEP(*(.param))
    KEEP(*(.param.*))
    _param_stop = .;
    . = ALIGN(4);
    _log_start = .;
    KEEP(*(.log))
    KEEP(*(.log.*))
    _log_stop = .;
    . = ALIGN(4);

  } >drom0_0_seg
```

### Improve PHY gain

1. Enter:`Component config>>PHY>>Max WiFi TX power (dBm)`
2. Set `Max WiFi TX power` value to `20`

### Config FreeRTOS

1. Modify the followings in the `FreeRTOSConfig.h`:

   ```
   //change configMINIMAL_STACK_SIZE value to 2048,default 768
   #define configMINIMAL_STACK_SIZE        2048  

   //change INCLUDE_vTaskCleanUpResources value to 1,default 0
   #define INCLUDE_vTaskCleanUpResources        1  

   //Add the following macro define
   #define configUSE_APPLICATION_TASK_TAG  1  
   #define configENABLE_TASK_SNAPSHOT  1
   ```
2. Change freertos tick rate use `menuconfig`:

Enter:`Component config>>freertos>> Tick rate (Hz)` Change `Tick rate` value to `1000`


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://libooogo.gitbook.io/esplane/developer-guide/00esplane-kai-fa-zhi-yin.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
