전체 글에 해당하는 글 128

ESP32 AT command 펌웨어 직접 빌드 하기

ESPRESSIF|2024. 1. 22. 17:53

ESP32 AT command용 펌웨어를 빌드하는 방법입니다.

우선, 개발 환경은  Linux 계열을 사용하기를 추천드립니다.

Window도 가능하나, AT command는 자체 Python script가 있고, IDF를 SDK내부에 불러와서 이래 저래 Window에서 의존성 문제등 발생 할 수 있습니다. 속 편하게 처음 부터 Linux환경으로 하는 것을 추천합니다.

 

1. VirtualBox 설치 : 버추얼 박스는 Window상에서 Linux를 구동하기 위하여 설치 합니다. 다른 프로그램도 가능하나 공개된 Virtual box로 하였습니다. 

https://www.virtualbox.org/

 

2. 리눅스 설치 : Ubuntu desktop을 설치 

버추얼 박스 + Ubuntu설치는 Google 검색을 하시면 많이 나옵니다.

버추얼 박스 Extention도 설치하고, 윈도우와 폴더를 share하게 설치 합니다. 

https://ubuntu.com/download/desktop

 

3. 툴 설치 

Ubuntu terminal에서 아래 툴 들을 설치 합니다. 

설치이후에 Python 3버젼이 동작되는지 확인 해야 합니다. 

https://docs.espressif.com/projects/esp-idf/en/latest/esp32/get-started/linux-macos-setup.html

sudo apt-get install git wget flex bison gperf python3 python3-pip python3-venv cmake ninja-build ccache libffi-dev libssl-dev dfu-util libusb-1.0-0

 

 

4. IDF를 설치 할 필요 없이 Git에서 AT+SDK를 불러 옵니다. 

 

Master branch불러오기 : 

git clone --recursive https://github.com/espressif/esp-at.git

 

특정 Branch를 불러 오려면 아래와 같이 해줍니다.  아래 그림은 branch종류 입니다. 

git clone -b  release/v3.2.0.0 --recursive https://github.com/espressif/esp-at.git

 

5. esp-at 폴더에 보면 다운로드가 되어 있습니다.

이제 환경을 설치 합니다. 

esp-at폴더에서 아래 명령을 하면 설치가 됩니다. 약 15~20분 정도 소요 됩니다. 

./build.py install

 

6. Path설정 : esp-at/esp-idf 폴더에서 아래와 같이 Path를 설정 합니다. 

 

7. Menuconfig

프로젝트 폴더에서 menuconfig를 이동 합니다. 

AT관련 component를 수정합니다. 

./build.py menuconfig

 

8. 빌드하고 라이팅 합니다.

./build.py build    //  build  만 진행
./build.py build flash monitor   //  build+flash+모니터링 진행

 

9. Flash하기전 Serial 포트가 연결되어 있는지 확인 해야 합니다. 

 

https://docs.espressif.com/projects/esp-idf/en/latest/esp32/get-started/establish-serial-connection.html

 

10.  build.py 명령어 option, command 관련 내용

 

 ESP-IDF CLI build management tool. For commands that are not known to idf.py an attempt to execute it as a
  build system target will be made. Selected target: esp32

Options:
  --version                       Show IDF version and exit.
  --list-targets                  Print list of supported targets and exit.
  -C, --project-dir PATH          Project directory.
  -B, --build-dir PATH            Build directory.
  -w, --cmake-warn-uninitialized / -n, --no-warnings
                                  Enable CMake uninitialized variable warnings for CMake files inside the
                                  project directory. (--no-warnings is now the default, and doesn't need to be
                                  specified.) The default value can be set with the
                                  IDF_CMAKE_WARN_UNINITIALIZED environment variable.
  -v, --verbose                   Verbose build output.
  --preview                       Enable IDF features that are still in preview.
  --ccache / --no-ccache          Use ccache in build. Disabled by default. The default value can be set with
                                  the IDF_CCACHE_ENABLE environment variable.
  -G, --generator [Ninja|Unix Makefiles]
                                  CMake generator.
  --no-hints                      Disable hints on how to resolve errors and logging.
  -D, --define-cache-entry TEXT   Create a cmake cache entry. This option can be used at most once either
                                  globally, or for one subcommand.
  -b, --baud INTEGER              Baud rate for flashing. It can imply monitor baud rate as well if it hasn't
                                  been defined locally. The default value can be set with the ESPBAUD
                                  environment variable. This option can be used at most once either globally,
                                  or for one subcommand.
  -p, --port TEXT                 Serial port. The default value can be set with the ESPPORT environment
                                  variable. This option can be used at most once either globally, or for one
                                  subcommand.
  --help                          Show this message and exit.

Commands:
  add-dependency               Add dependency to the manifest file.
  all                          Aliases: build. Build the project.
  app                          Build only the app.
  app-flash                    Flash the app only.
  bootloader                   Build only bootloader.
  bootloader-flash             Flash bootloader only.
  build-system-targets         Print list of build system targets.
  clean                        Delete build output files from the build directory.
  confserver                   Run JSON configuration server.
  create-component             Create a new component.
  create-manifest              Create manifest for specified component.
  create-project               Create a new project.
  create-project-from-example  Create a project from an example.
  delete-version               (Deprecated) Deprecated! New CLI command: "compote component delete". Delete
                               specified version of the component from the component registry.
  docs                         Open web browser with documentation for ESP-IDF
  efuse-common-table           Generate C-source for IDF's eFuse fields.
  efuse-custom-table           Generate C-source for user's eFuse fields.
  encrypted-app-flash          Flash the encrypted app only.
  encrypted-flash              Flash the encrypted project.
  erase-flash                  Erase entire flash chip.
  erase-otadata                Erase otadata partition.
  flash                        Flash the project.
  fullclean                    Delete the entire build directory contents.
  gdb                          Run the GDB.
  gdbgui                       GDB UI in default browser.
  gdbtui                       GDB TUI mode.
  menuconfig                   Run "menuconfig" project configuration tool.
  monitor                      Display serial output.
  openocd                      Run openocd from current path
  pack-component               (Deprecated) Deprecated! New CLI command: "compote component pack". Create
                               component archive and store it in the dist directory.
  partition-table              Build only partition table.
  partition-table-flash        Flash partition table only.
  post-debug                   Utility target to read the output of async debug action and stop them.
  python-clean                 Delete generated Python byte code from the IDF directory
  read-otadata                 Read otadata partition.
  reconfigure                  Re-run CMake.
  save-defconfig               Generate a sdkconfig.defaults with options different from the default ones
  set-target                   Set the chip target to build.
  show-efuse-table             Print eFuse table.
  size                         Print basic size information about the app.
  size-components              Print per-component size information.
  size-files                   Print per-source-file size information.
  uf2                          Generate the UF2 binary with all the binaries included
  uf2-app                      Generate an UF2 binary for the application only
  update-dependencies          Update dependencies of the project
  upload-component             (Deprecated) Deprecated! New CLI command: "compote component upload". Upload
                               component to the component registry. If the component doesn't exist in the
                               registry it will be created automatically.
  upload-component-status      (Deprecated) Deprecated! New CLI command: "compote component upload-status".
                               Check the component uploading status by the job ID