<div dir="ltr">On Sun, Mar 29, 2020 at 8:38 AM Christo Crause <<a href="mailto:christo.crause@gmail.com">christo.crause@gmail.com</a>> wrote:<br><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Sat, Mar 28, 2020 at 11:04 PM Florian Klämpfl <<a href="mailto:florian@freepascal.org" target="_blank">florian@freepascal.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Am 28.03.20 um 21:33 schrieb Christo Crause via fpc-devel:<br>
> When building the xtensa rtl with<br>
> <br>
> make rtl FPC=~/fpc/3.3.1/compiler/ppcrossxtensa CROSSOPT=-Cacall0 <br>
> CPU_TARGET=xtensa OS_TARGET=embedded SUBARCH=esp8266 <br>
> BINUTILSPREFIX=xtensa-lx106-elf-<br>
> <br>
> the following errors are returned by as:<br>
> /home/christo/fpc/3.3.1/rtl/units/xtensa-embedded/system.s: Assembler <br>
> messages:<br>
> /home/christo/fpc/3.3.1/rtl/units/xtensa-embedded/system.s:203: Error: <br>
> unknown opcode or format name 'sext'<br>
> /home/christo/fpc/3.3.1/rtl/units/xtensa-embedded/system.s:204: Error: <br>
> unknown opcode or format name 'sext'<br>
> <br>
> When building with CROSSOPT=-Cawindowed as complains about other errors:<br>
> /home/christo/fpc/3.3.1/rtl/units/xtensa-embedded/system.s: Assembler <br>
> messages:<br>
> /home/christo/fpc/3.3.1/rtl/units/xtensa-embedded/system.s:11: Error: <br>
> unknown opcode or format name 'retw'<br>
> <br>
> Any tips on how to build the xtensa rtl?<br>
<br>
I didn't care about the call0 abi yet. Is it used by the esp8266?<br></blockquote><div><br></div><div>Inspecting some C examples I've compiled with PlatformIO for ESP8266 shows use of callx0 for the non-rtos SDK. My goal was just to test the cross compiler, but the RTL failed with error 2020031404 (in tcpuparamanager.init_values) which seems to suggest an ABI must be specified.  Neither of the options I tried satisfied the assembler however.<br></div></div></div></blockquote><div><br></div><div>According to the Xtensa ISA 4.3.8 the SEXT instruction is optional (and some others too) and apparently not implemented for ESP8266 according to core-isa.h in ESP8266_RTOS_SDK (<a href="https://github.com/espressif/ESP8266_RTOS_SDK/blob/master/components/esp8266/include/xtensa/config/core-isa.h">https://github.com/espressif/ESP8266_RTOS_SDK/blob/master/components/esp8266/include/xtensa/config/core-isa.h</a>).  This explains why xtensa-lx106-elf-as does not recognise the SEXT instruction.</div><div><br></div><div>It seems that a different instruction sequence should be used for sign extension for the lx106 subarch.</div><div><br></div><div>Also core-isa.h indicates XCHAL_HAVE_WINDOWED = 0, which I take to mean that the LX106 toolchain doesn't know/implement the windowed ABI, which explains why setting the FPC ABI to windowed caused as to flag retw as unknown.<br></div></div></div>