Re: [Tinycc-devel] Porting tcc to Xtensa and running it on the ESP32

2019-02-14 Thread Daniel Glöckner
Hello Lars,

On Thu, Feb 14, 2019 at 05:39:06PM +0100, Lars Hochstetter wrote:
> I (newbie) was wondering how difficult it would be to
> 
> 1. port tcc to the Tensilica Xtensa platform

one difficulty is that Xtensa processors are very configurable. When
someone synthesizes an Xtensa processor, the Tensilica tools generate
a bunch of C header files that tell you f.ex. which instructions are
enabled, which coprocessors exist and how many registers there are.
You might remember that it took some time for GCC to be ported to the
ESP8266. That was because it uses the uncommon call0 ABI variant as
Espressif did not enable register windows (XCHAL_HAVE_WINDOWS == 0).

But if you stick to the ESP32 and don't want to support all Xtensa
variants, this should not be a problem.

> Point 4 sounds pretty ambiguous - I don't know if I should use the
> FreeRTOS port for the ESP32 (tcc could run as a FreeRTOS task and
> receive input through e.g. the serial interface) or use an
> bare-metal approach.

I don't see where FreeRTOS would help you with tcc. Last time I
checked, FreeRTOS was only about task management and IPC. On the
other hand it takes just a few lines of code to put a bare metal
program that does not access peripherals into a FreeRTOS task.

RAM might become a problem. I have no idea how much RAM tcc needs.
You might want to do some experiments with valgrind --tool=massif
before trying to run it on the ESP32.

Best regards,

  Daniel

___
Tinycc-devel mailing list
Tinycc-devel@nongnu.org
https://lists.nongnu.org/mailman/listinfo/tinycc-devel


[Tinycc-devel] Porting tcc to Xtensa and running it on the ESP32

2019-02-14 Thread Lars Hochstetter

Hi everyone,

I (newbie) was wondering how difficult it would be to

1. port tcc to the Tensilica Xtensa platform
2. run the port on the ESP32 (e.g. as a JIT compiler in a 
Read-Eval-Print Loop)


Would 2. be possible at all?

Assuming both points are possible, I would attempt to realize them as 
follows:


1. port tcc to the Tensilica Xtensa variant used in the ESP32 (I would 
probably take a look at the gcc Xtensa port or similar)
2. verify that it actually produces the appropriate code (i.e. write 
some programms / use the ESP-IDF SDK examples)

3. recompile tcc using the port
4. "somehow" get it to run on the ESP32

Point 4 sounds pretty ambiguous - I don't know if I should use the 
FreeRTOS port for the ESP32 (tcc could run as a FreeRTOS task and 
receive input through e.g. the serial interface) or use an bare-metal 
approach.


Kind regards,

lhochstetter

___
Tinycc-devel mailing list
Tinycc-devel@nongnu.org
https://lists.nongnu.org/mailman/listinfo/tinycc-devel