Page 2 of 4

Re: ESP32

Posted: Tue Nov 13, 2018 4:15 pm
by avrhack
I'd be interested in ChibiOS on the esp8266 as well as the esp32 - maybe we could do both at the same time? Or do the differences make that impractical ie we really need to treat them as two totally separate ports?

Re: ESP32

Posted: Tue Nov 13, 2018 9:07 pm
by meminyanik
I am not experienced in very low level coding of RTOS. But I have been working on ESP32 running freeRTOS for long time. I would be happy to help for this porting process.

Re: ESP32

Posted: Tue Nov 13, 2018 9:47 pm
by Giovanni
So lets start from the start :)

We need:
1) Core documentation, for the "port layer".
2) Compiler, is GCC available? something else? is it available also for Linux?

Giovanni

Re: ESP32

Posted: Wed Nov 14, 2018 1:43 am
by davidbuzz
59page datasheet is here, including memory map, clocks, ram, pin descriptions, block diagram, and links to other good resources etc)
http://espressif.com/sites/default/file ... eet_en.pdf

More details here:
https://www.espressif.com/en/products/h ... 2/overview

C and c++ compiler definitely available, as this chip already runs FreeRTOS etc and has a port of the Arduino Libraries that is fully featured.

I recommend we start by targeting a well known dev board with an esp32 on it, such as the esp-vroom-32 'devkit v1' .

Re: ESP32

Posted: Wed Nov 14, 2018 3:24 am
by davidbuzz
details of gcc available:
xtensa-esp32-elf-* for linux here: https://dl.espressif.com/doc/esp-idf/la ... setup.html
( windows is also available at a similar place).

xtensa-esp32-elf/bin$ ./xtensa-esp32-elf-gcc --version
xtensa-esp32-elf-gcc (crosstool-NG crosstool-ng-1.22.0-73-ge28a011) 5.2.0

Re: ESP32

Posted: Wed Nov 14, 2018 5:10 am
by davidbuzz
I'd just like to also point out that as I understand it, the "hard" part of a port to a new chip is the context switching ( because the chibios wiki says so ).... and this particular goal ( getting it running on esp32) can benefit heavily from the fact that freeRTOS already runs on the chip, and is already open source, and already does context switching successfully, and is MIT licensed, and thus "GPL compatible" from a license perspective, and so it's proposal that the freertos code be referenced and used freely as much as convenient to achieve this goal, and the resulting code can still be GPLv3 licensed.

references:
https://www.esp32.com/viewtopic.php?t=4296
https://www.freertos.org/a00114.html
https://www.gnu.org/licenses/license-li ... leLicenses

please let me know if anyone disagrees, as IANAL.

Re: ESP32

Posted: Wed Nov 14, 2018 6:09 am
by Giovanni
ChibiOS does context switching differently, not sure if we can use that as reference. In ChibiOS context switch is synchronous and performed within a critical section, only function-preserved registers are switched (port_intctx structure). The other registers are placed into a port_extctx structure which is only saved by ISRs.

What is needed for a port are:
1) Manual of the core architecture (registers, instruction set, exceptions management, stacks etc).
2) ABI of the compiler (registers used for parameters, return values, function-trashed registers, etc).

What needs to be defined are:
- Format of the port_intctx and port_extctx structures.
- How critical sections are implemented (it could be disabling IRQs in its simplest way).
- Conventions for ISRs.
- Assembler thread startup code.
- Assembler context switch code.
- Vectors table.
- Startup files.

See the PowerPC port for a "simple" example.

Giovanni

Re: ESP32

Posted: Wed Nov 14, 2018 7:28 am
by Marco
Hi,

This was also on my todo/wish list :) if I have some free time i’d also like to contribute! Nice to see there are more people interested.
I did the Tiva port long time ago. That one was based on the already existing Cortex-M4 port, so it was mostly writing HAL. Context switching will be most tricky I think.

Marco

Re: ESP32

Posted: Wed Nov 14, 2018 11:15 am
by Giovanni
I just created the forum (icon missing), moving this topic there.

Anybody volunteering as moderator? not much to do anyway, usually I cut problems "at the root".

Giovanni

Re: ESP32

Posted: Wed Nov 14, 2018 2:34 pm
by avrhack
Giovanni wrote:I just created the forum (icon missing), moving this topic there.

Anybody volunteering as moderator? not much to do anyway, usually I cut problems "at the root".

Giovanni


I’m not working at the moment so I have the time potentially. What’s involved in moderation?