Difference between revisions of "Xtensa"

From Free Pascal wiki
Jump to navigationJump to search
Line 17: Line 17:
 
Change into the fpc directory and run
 
Change into the fpc directory and run
  
   make CPU_TARGET=xtensa OS_TARGET=freertos "CROSSOPT=-Cplx6 -XPxtensa-esp32-elf- -Cfhard" all FPC=fpc
+
   make FPC=fpc CPU_TARGET=xtensa OS_TARGET=freertos "CROSSOPT=-Cplx6 -XPxtensa-esp32-elf- -Cfhard" all
  
to get FPC.
+
to get ppcrossxtensa .
  
Create somewhere a hello world program, compile it with
+
Create a hello world program in the fpc dir and compile it with
  
   fpc/compiler/xtensa/pp -Fu../rtl/units/xtensa-freertos/ -Tfreertos -Cawindowed -XPxtensa-esp32-elf- -al -O3 -Wpesp32 -Fl~/xtensa-esp32-elf-libs  -Fl$HOME/.espressif/tools/xtensa-esp32-elf/esp-2019r2-8.2.0/xtensa-esp32-elf/xtensa-esp32-elf/lib/ hello
+
   compiler/ppcrossxtensa -Furtl/units/xtensa-freertos/ -Tfreertos -Cawindowed -XPxtensa-esp32-elf- -O3 -Wpesp32 -Fl~/xtensa-esp32-elf-libs  -Fl$HOME/.espressif/tools/xtensa-esp32-elf/esp-2019r2-8.2.0/xtensa-esp32-elf/xtensa-esp32-elf/lib/ hello
  
Get partition-table.bin and bootloader.bin from the hello_world example compiled above and copy them into the same dir as the compiled  hello.bin
+
Get partition-table.bin and bootloader.bin from the hello_world example compiled above and copy them into the same dir as the compiled  hello.bin
  
 
Flash with
 
Flash with

Revision as of 21:46, 5 April 2020


Note: the ESP32 support is highly experimental and prone to be broken. This description is work in progress.


Building FPC

Preparations


So far Linux only


Install esp-idf and execute

source ~/eps/esp-idf/export.sh

to get the pathes and environment set (namely tools path and $IDF_PATH are needed)

Change into the fpc directory and run

 make FPC=fpc CPU_TARGET=xtensa OS_TARGET=freertos "CROSSOPT=-Cplx6 -XPxtensa-esp32-elf- -Cfhard" all

to get ppcrossxtensa .

Create a hello world program in the fpc dir and compile it with

 compiler/ppcrossxtensa -Furtl/units/xtensa-freertos/ -Tfreertos -Cawindowed -XPxtensa-esp32-elf- -O3 -Wpesp32 -Fl~/xtensa-esp32-elf-libs  -Fl$HOME/.espressif/tools/xtensa-esp32-elf/esp-2019r2-8.2.0/xtensa-esp32-elf/xtensa-esp32-elf/lib/ hello

Get partition-table.bin and bootloader.bin from the hello_world example compiled above and copy them into the same dir as the compiled hello.bin

Flash with

 esptool.py -p /dev/ttyUSB0 -b 460800 --before default_reset --after hard_reset --chip esp32  write_flash --flash_mode dio --flash_size detect --flash_freq 40m 0x1000 bootloader.bin 0x8000 partition-table.bin 0x10000 hello.bin

Monitor the output with:

 idf_monitor.py  --port /dev/ttyUSB0 hello.elf