Difference between revisions of "Xtensa"
Line 7: | Line 7: | ||
So far Linux and Mac only | So far Linux and Mac only | ||
---- | ---- | ||
+ | |||
+ | Native stable FPC must be installed and working on the system. | ||
+ | |||
Install esp-idf based on the instructions given here: | Install esp-idf based on the instructions given here: | ||
Line 27: | Line 30: | ||
to get the path and environment set (namely tools path and $IDF_PATH are needed) | to get the path 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 -j | ||
− | + | ||
+ | If this does not work, try: | ||
+ | ---- | ||
cd compiler | cd compiler | ||
lazbuild ppcxtensa.lpi | lazbuild ppcxtensa.lpi | ||
Line 37: | Line 45: | ||
cd ../rtl/freertos | cd ../rtl/freertos | ||
make FPC=../../compiler/xtensa/pp OS_TARGET=freertos "OPT=-Cplx6 -Cawindowed -XPxtensa-esp32-elf- -Cfhard" clean all | make FPC=../../compiler/xtensa/pp OS_TARGET=freertos "OPT=-Cplx6 -Cawindowed -XPxtensa-esp32-elf- -Cfhard" clean all | ||
+ | ---- | ||
+ | |||
Create a hello world program in the fpc dir and compile it with | Create a hello world program in the fpc dir and compile it with |
Revision as of 22:52, 7 April 2020
Warning: The ESP32 support is highly experimental and prone to be broken. This description is work in progress.
Building FPC
Preparations
So far Linux and Mac only
Native stable FPC must be installed and working on the system.
Install esp-idf based on the instructions given here:
Get Started (for Stable Release)
Follow the instructions to a least step 8 where you build the hello_word demo project.
copy all the freshly compiled .a files from the current project directory to a directory of your choice:
mkdir ~/esp/xtensa-esp32-elf-libs find . -name "*.a" -exec cp {} ~/esp/xtensa-esp32-elf-libs \;
Now you are ready to compile fpc and rtl.
execute
export IDF_PATH=~/esp/esp-idf source ~/esp/esp-idf/export.sh
to get the path 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 -j
If this does not work, try:
cd compiler lazbuild ppcxtensa.lpi
to get pp .
now compile the rtl:
cd ../rtl/freertos make FPC=../../compiler/xtensa/pp OS_TARGET=freertos "OPT=-Cplx6 -Cawindowed -XPxtensa-esp32-elf- -Cfhard" clean all
Create a hello world program in the fpc dir and compile it with
compiler/xtensa/pp -Furtl/units/xtensa-freertos/ -Tfreertos -Cawindowed -XPxtensa-esp32-elf- -O3 -Wpesp32 -Fl~/esp/xtensa-esp32-elf-libs -Fl~/.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