Skip to content
This repository was archived by the owner on Jan 14, 2022. It is now read-only.

Update README.md #9

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
234 changes: 117 additions & 117 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ We suggest to choose **Crosstool-ng** as the compiler toolchain. Follow the inst

Step 1. Install the required toolchain packages.
```
sudo apt-get install git autoconf build-essential gperf bison flex texinfo libtool libncurses5-dev wget gawk libc6-dev-i386 python-serial libexpat-dev
sudo apt-get install git autoconf build-essential gperf bison flex texinfo libtool libncurses5-dev wget gawk libc6-dev-i386 python-serial libexpat-dev libtool-bin
```
Step 2. Create a directory (e.g./opt/Espressif) to store the toolchain.
```
Expand All @@ -34,7 +34,7 @@ Step 6. Set the PATH variable to point to the newly compiled toolchain.
```
export PATH=/opt/Espressif/crosstool-NG/builds/xtensa-esp108-elf/bin:$PATH
```
> Notice:
> Notice:
> You need to do Step 6 once you open a new shell, or you can put it inside your .bashrc file

## Project template Compile
Expand Down Expand Up @@ -62,7 +62,7 @@ export SDK_PATH=~/Workspace/ESP32_RTOS_SDK
export BIN_PATH=~/Workspace/ESP32_BIN
```
> Notice:
> Make sure you set the correct paths, or it will occur a compile error.
> Make sure you set the correct paths, or it will occur a compile error.
> `export BIN_PATH` is optional, default BIN_PATH is `./bin`.

Step 6. Start to compile files
Expand All @@ -71,136 +71,136 @@ cd ~/Workspace/project_template
make clean
make
```
> Notice:
> You need to do Step 5 every time you open a new shell, or you can put it inside your .bashrc file.
> Notice:
> You need to do Step 5 every time you open a new shell, or you can put it inside your .bashrc file.

If your project is successfully compiled, the drom0.bin, irom0_flash.bin, and user.ota files will
be generated in BIN_PATH directory.

## Makefile Options
esp.conf in project_template includes makefile supported options, you can modify according to your needs.

### 1. esptool parameters
* serial port, depend on your platform, default /dev/ttyUSB0

```
ESP_PORT = /dev/ttyUSB0
```

* serial baudrate, default 230400

```
ESP_BAUD = 230400
```

* spi flash size: 1MB/2MB/4MB/8MB/16MB, default 1MB

```
ESP_FS = 1MB
```

* spi flash freq: 40m/26m/20m/80m, default 40m

```
ESP_FF = 40m
```

* spi flash mode: qio/qout/dio/dout, default qio

```
ESP_FM = qio
```

### 2. compile & link parameters
* ld folder location choose: 0/1, default 0
- 0: use ld folder at sdk.
- 1: use local ld folder at your project.

> Notice:
> you can copy ld folder from sdk to your project, then do some modifications.

```
ESP_LOCAL_LD = 1
```

* ld file name
> Notice:
> if ESP_LOCAL_LD is set to 1, ESP_LD_NAME MUST be set.

```
ESP_LD_FILE = pro.map.ld
```

* ram map mode, default 1.1
- 1.1: not use app cpu's iram, use drom0(dcache) to store rodata.
- 1.2: not use app cpu's iram, not use drom0(dcache).
- 2.1: use all app cpu's iram as pro cpu's dram, use drom0(dcache) to store rodata.
- 2.2: use all app cpu's iram as pro cpu's dram, not use drom0(dcache).
- 3.1: reverse 16K for app cpu, other as pro cpu's dram, use drom0(dcache) to store rodata.
- 3.2: reverse 16K for app cpu, other as pro cpu's dram, not use drom0(dcache).

> Notice:
> if ESP_LOCAL_LD is set to 0, ESP_MAP_MODE CAN be set.

```
ESP_MAP_MODE = 1.1
```


## Makefile Options
esp.conf in project_template includes makefile supported options, you can modify according to your needs.
### 1. esptool parameters
* serial port, depend on your platform, default /dev/ttyUSB0
```
ESP_PORT = /dev/ttyUSB0
```
* serial baudrate, default 230400
```
ESP_BAUD = 230400
```
* spi flash size: 1MB/2MB/4MB/8MB/16MB, default 1MB
```
ESP_FS = 1MB
```
* spi flash freq: 40m/26m/20m/80m, default 40m
```
ESP_FF = 40m
```
* spi flash mode: qio/qout/dio/dout, default qio
```
ESP_FM = qio
```
### 2. compile & link parameters
* ld folder location choose: 0/1, default 0
- 0: use ld folder at sdk.
- 1: use local ld folder at your project.
> Notice:
> you can copy ld folder from sdk to your project, then do some modifications.
```
ESP_LOCAL_LD = 1
```
* ld file name
> Notice:
> if ESP_LOCAL_LD is set to 1, ESP_LD_NAME MUST be set.
```
ESP_LD_FILE = pro.map.ld
```
* ram map mode, default 1.1
- 1.1: not use app cpu's iram, use drom0(dcache) to store rodata.
- 1.2: not use app cpu's iram, not use drom0(dcache).
- 2.1: use all app cpu's iram as pro cpu's dram, use drom0(dcache) to store rodata.
- 2.2: use all app cpu's iram as pro cpu's dram, not use drom0(dcache).
- 3.1: reverse 16K for app cpu, other as pro cpu's dram, use drom0(dcache) to store rodata.
- 3.2: reverse 16K for app cpu, other as pro cpu's dram, not use drom0(dcache).
> Notice:
> if ESP_LOCAL_LD is set to 0, ESP_MAP_MODE CAN be set.
```
ESP_MAP_MODE = 1.1
```
## Download

### 1. Use Espressif's 'Flash Download tools'

Download addresses:

* For map 1.1/2.1/3.1
Download addresses:
* For map 1.1/2.1/3.1

```
boot.bin---------->0x00000
drom0.bin--------->0x04000
irom0_flash.bin--->0x40000
blank.bin--------->0xfe000(for 1MB SPI Flash)
```

* For map 1.2/2.2/3.2

```
* For map 1.2/2.2/3.2
```
boot.bin---------->0x00000
irom0_flash.bin--->0x04000
blank.bin--------->0xfe000(for 1MB SPI Flash)
```

### 2. Use esptool.py
Prepare: modify esptool options in esp.conf.

makefile supports targets:

* flash_all : upload boot.bin/app.bin/blank.bin

```
make flash_all
```

* flash_boot : upload boot.bin

```
make flash_boot
```
> Notice:
> only needed when boot.bin update

* flash_app : update user application (drom0.bin/irom0_flash.bin)

```
make flash_app
```

* flash_blank : update blank.bin to system parameter address

```
make flash_blank
```
> Notice:
> only needed when the system parameters needed to be restored
```
### 2. Use esptool.py
Prepare: modify esptool options in esp.conf.
makefile supports targets:
* flash_all : upload boot.bin/app.bin/blank.bin
```
make flash_all
```
* flash_boot : upload boot.bin
```
make flash_boot
```
> Notice:
> only needed when boot.bin update
* flash_app : update user application (drom0.bin/irom0_flash.bin)
```
make flash_app
```
* flash_blank : update blank.bin to system parameter address
```
make flash_blank
```
> Notice:
> only needed when the system parameters needed to be restored

For more details, please refer to http://www.esp32.com