Skip to content

toolchain for ESP32 added#45

Merged
jia200x merged 1 commit intoRIOT-OS:masterfrom
gschorcht:esp32
Oct 15, 2018
Merged

toolchain for ESP32 added#45
jia200x merged 1 commit intoRIOT-OS:masterfrom
gschorcht:esp32

Conversation

@gschorcht
Copy link
Contributor

@gschorcht gschorcht commented Jul 30, 2018

I have added the installation of the ESP32 toolchain as required for the ESP32 port of RIOT, PR RIOT-OS/RIOT#9426.

The toolchain is installed in /opt/esp and requires about 181 MB after cleanup. All path variables in the makefiles of the ESP32 port point to this directory.

@gschorcht
Copy link
Contributor Author

Can we proceed with this PR to get murdock working for ESP32? Furthermore, I would like to reference riotdocker as possible toolchain option in the board documentation I'm writing for the ESP32 port.

@waehlisch waehlisch requested a review from smlng September 4, 2018 11:00
@kaspar030
Copy link
Contributor

looks ok. just one thing: why is python-serial and the dialout group needed? The container up to now has only be used for building. Flashing and terminal should be executed on the host.

@gschorcht
Copy link
Contributor Author

@kaspar030
Ok I see, the intention of riotdocker was only to build the ELF file and not flash it.

Hm, before RIOT can be flashed, the ELF file has to be converted into a special binary image format using esptool.py which requires python-serial. Flashing is also done with esptool.py. Not having the flashing capability in riotdocker would require that the user has to install esptool.py on the host system.

Since older Linux distributions, e.g. Ubuntu 16.4, not offering it as a package, the user would have to start to install toolchain components. Sure, it's a documentation problem, but it does not seem to be comfortable.

@kaspar030
Copy link
Contributor

Hm, before RIOT can be flashed, the ELF file has to be converted into a special binary image format using esptool.py which requires python-serial. Flashing is also done with esptool.py. Not having the flashing capability in riotdocker would require that the user has to install esptool.py on the host system.

Ok, having the tools in the container won't hurt.

But the dialout group thing I don't quite get - the gid of the dialout group will certainly be container-specific, it won't (necessarily) match the dialout group of the host system. If the intention was that a dialout-owned host serial device can be used by the riotbuild user within the container, it will probably not work. (maybe with ubuntu host, ubuntu docker base image...)

@gschorcht
Copy link
Contributor Author

@kaspar030 Of course you are right. I'm too blinded by Linux, where it's quite common for serial devices to be owned by group dialout.

@miri64
Copy link
Member

miri64 commented Sep 4, 2018

I think what usually happens with other devices that the user is required to configure this properly on their host system (e.g. using udev and/or by joining whatever group the system assigns to the device).

@gschorcht
Copy link
Contributor Author

@kaspar030 What do we do next? Should I remove the addition of the riotbuild user to the dialout group?

At least for my ESP ports, I've documented that using riotdocker consists of two steps

  1. making the RIOT application in Docker with command make BOARD= ...
  2. flashing the RIOT application on the host computer with command make flash-only BOARD=...

where step 2 requires that the flasher program is installed on the host and how esptool.py has to be installed.

@gschorcht
Copy link
Contributor Author

@kaspar030 I removed adding the user to the group dial.

I also had to change the download procedure for the Xtensa ESP32 Toolchain. I replaced the original Espressif toolchain with a version that I created myself using crosstool-NG. This was necessary because Espressif's original toolchain uses a newlib version that printf for floats does not support.

I know Riotdocker is currently blocked by issue #46. I also went into this problem. I hope PR #47 can be merged soon and we can continue with this PR to get murdock working for ESP32.

@gschorcht gschorcht force-pushed the esp32 branch 2 times, most recently from 0255815 to c5870ca Compare September 28, 2018 18:23
RUN echo 'Installing ESP32 toolchain' >&2 && \
mkdir -p /opt/esp && \
cd /opt/esp && \
git clone --recursive https://github.com/espressif/esp-idf.git && \
Copy link
Contributor

@cladmi cladmi Oct 4, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a reason to not update to https://github.com/espressif/esp-idf/releases/tag/v3.1 now that it is released?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@cladmi Yes, the reason is that the ESP32 port is realized for the version that is checkout out in the docker file. The problem is that I couldn't simply use the ESP-IDF as it was, but had to change a lot of files, a number of them only because of compile errors like function prototype warnings, for others I had to make real changes. All the files you can find in https://github.com/gschorcht/RIOT-Xtensa-ESP/tree/esp32/cpu/esp32/vendor/esp-idf are modified to get them working with RIOT.

The version I used is a snapshot of v3.1 branch from July 27th.

I will try to update it later, but for the moment I would prefer to leave it as it currently is to integrate the port into the master. Since my time is currently very limited, I fear that the merge would otherwise delayed further. I spent a lot of time porting RIOT to ESP32 in the last half year and the ESP32 port has been completely tested and works very stably with this version of ESP-IDF.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the precision, so yeah there is a reason to stay with is one for the moment.

@leandrolanzieri
Copy link
Contributor

The MIPS toolchain is now working. Please rebase

@gschorcht
Copy link
Contributor Author

The MIPS toolchain is now working. Please rebase

@leandrolanzieri Done

@jia200x
Copy link
Member

jia200x commented Oct 11, 2018

I'm testing it against RIOT-OS/RIOT#9426

@jia200x
Copy link
Member

jia200x commented Oct 11, 2018

Toolchain works:

Building application "hello-world" for "esp32-olimex-evb" with MCU "esp32".

"make" -C /data/riotbuild/riotbase/core
"make" -C /data/riotbuild/riotbase/drivers
"make" -C /data/riotbuild/riotbase/drivers/mtd
"make" -C /data/riotbuild/riotbase/drivers/periph_common
"make" -C /data/riotbuild/riotbase/sys
"make" -C /data/riotbuild/riotbase/sys/auto_init
"make" -C /data/riotbuild/riotbase/sys/div
"make" -C /data/riotbuild/riotbase/sys/isrpipe
"make" -C /data/riotbuild/riotbase/sys/log
"make" -C /data/riotbuild/riotbase/sys/luid
"make" -C /data/riotbuild/riotbase/sys/newlib_syscalls_default
"make" -C /data/riotbuild/riotbase/sys/posix/pthread
"make" -C /data/riotbuild/riotbase/sys/ps
"make" -C /data/riotbuild/riotbase/sys/random
"make" -C /data/riotbuild/riotbase/sys/random/tinymt32
"make" -C /data/riotbuild/riotbase/sys/stdio_uart
"make" -C /data/riotbuild/riotbase/sys/timex
"make" -C /data/riotbuild/riotbase/sys/tsrb
"make" -C /data/riotbuild/riotbase/sys/xtimer
"make" -C /data/riotbuild/riotboard/esp32-olimex-evb
"make" -C /data/riotbuild/riotboard/common/esp32
"make" -C /data/riotbuild/riotcpu/esp32
"make" -C /data/riotbuild/riotcpu/esp32/freertos
"make" -C /data/riotbuild/riotcpu/esp32/periph
"make" -C /data/riotbuild/riotcpu/esp32/vendor
"make" -C /data/riotbuild/riotcpu/esp32/vendor/esp-idf
"make" -C /data/riotbuild/riotcpu/esp32/vendor/esp-idf/driver
"make" -C /data/riotbuild/riotcpu/esp32/vendor/esp-idf/esp32
"make" -C /data/riotbuild/riotcpu/esp32/vendor/esp-idf/heap
"make" -C /data/riotbuild/riotcpu/esp32/vendor/esp-idf/soc
"make" -C /data/riotbuild/riotcpu/esp32/vendor/esp-idf/spi_flash
"make" -C /data/riotbuild/riotcpu/esp32/vendor/esp-idf/wpa_supplicant
"make" -C /data/riotbuild/riotcpu/esp32/vendor/xtensa
   text    data     bss     dec     hex filename
  75281    4616    8640   88537   159d9 /data/riotbuild/riotproject/examples/hello-world/bin/esp32-olimex-evb/hello-world.elf

@jia200x
Copy link
Member

jia200x commented Oct 11, 2018

ACK on my side. @kaspar030, @cladmi ?

@cladmi
Copy link
Contributor

cladmi commented Oct 11, 2018

Question, in the ESP32 PR you updated your a repository to have float printfs working.
RIOT-OS/RIOT#9426 (comment)

Has it been included here ? I did not receive github updates about it, maybe it is just me, but I want to be sure it is included.

@gschorcht
Copy link
Contributor Author

@cladmi Yes

git clone https://github.com/gschorcht/xtensa-esp32-elf.git 

is the Xtensa compiler suite I prepared which includes the newlib that supports printf for floats.

@MrKevinWeiss
Copy link

So @cladmi is there anything else or can we go?

@cladmi
Copy link
Contributor

cladmi commented Oct 12, 2018

Good for me on my concern. But I did not tested it or the referenced PR so I can't approve.

But this PR still need to receive a reviewed ack before merging.
It is not enforced here for the moment but the RIOT rule still applies.

@miri64
Copy link
Member

miri64 commented Oct 12, 2018

It is not enforced here for the moment but the RIOT rule still applies.

I activated the according branch protection for this repo's master branch.

@cladmi
Copy link
Contributor

cladmi commented Oct 12, 2018

@miri64 Thanks

Copy link
Member

@jia200x jia200x left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok, comments were addressed and the toolchain is working as expected in Docker.

Tested ACK.

@jia200x
Copy link
Member

jia200x commented Oct 15, 2018

& GO

@jia200x jia200x merged commit 23531bc into RIOT-OS:master Oct 15, 2018
@jia200x jia200x mentioned this pull request Oct 15, 2018
@gschorcht
Copy link
Contributor Author

@jia200x Thanks

@ZetaR60 ZetaR60 mentioned this pull request Oct 15, 2018
@gschorcht gschorcht deleted the esp32 branch September 4, 2019 18:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants