Questions tagged [xtensa]

Xtensa is a customizable 32-bit RISC ISA found in Tensilica's Xtensa chips, mostly used as DSPs. (Now owned by Cadence). Use [esp32] or [esp8266] for questions about their SDKs.

Use this tag for questions about the Xtensa ISA, assembly language, or Xtensa-specific C/C++ intrinsics.

Use or for questions about their SDKs (like problems compiling with their headers or linking with their libraries).


See https://en.wikipedia.org/wiki/Tensilica

The Xtensa instruction set is a 32-bit architecture with a compact 16- and 24-bit instruction set. The base instruction set has 80 RISC instructions and includes a 32-bit ALU, up to 64 general-purpose 32-bit registers, and six special-purpose registers

The Xtensa architecture offers a user-customizable instruction set through automated customization tools that can extend the Xtensa base instruction set, including SIMD instructions, new register files.

Wikipedia also adds that specific Xtensa chips range from low-power cacheless microcontrollers to "16-way SIMD processors, 3-issue VLIW DSP cores" or "1 TMAC/sec neural network processors" (multiply-accumulate)


Related tag: is the company that now owns Tensilica and their Xtensa architecture. https://ip.cadence.com/. Use [cadence] for questions about the toolchain it provides. (Editor's note: I think that's accurate usage guidance, but not sure.)

Specific hardware / boards using Xtensa-ISA CPUs include many things outside the CPU, and have dev tools, SDKs, and so on which are totally specific to them, not the Xtensa ISA. Those are often C/C++ and toolchain questions specific to that one board and vendor-supplied files, not Xtensa chips in general.


Resources

https://en.wikipedia.org/wiki/Tensilica_Instruction_Extension can customize Xtensa cores. (At design time, not runtime). Extensibility is the literal namesake of Xtensa.


Slides from 2000 from Earl Killian, Tensilica's the lead architect for Xtensa: http://bwrcs.eecs.berkeley.edu/Classes/CS252/Notes/xtensa_022400.pdf including 1. How Tensilica and Xtensa came to be, 2. What Xtensa is, with motivation for the decisions we made

34 questions
14
votes
2 answers

What does a dangerous relocation error mean?

I am getting a linking error: dangerous relocation: l32r: Literal placed after use: I am still trying to debug. However, I want to better understand this error. I understand what relocation is, but I am not sure how it can be dangerous and was…
Fred Thomsen
  • 1,538
  • 2
  • 13
  • 15
8
votes
1 answer

for loop being ignored (optimized?) out

I am using for/while loops for implementing a delay in my code. The duration of the delay is unimportant here though it is sufficiently large to be noticeable. Here is the code snippet. uint32_t i; // Do something useful for (i = 0; i < 50000000U;…
LoneWolf
  • 83
  • 7
3
votes
2 answers

Xtensa --- dangerous relocation: windowed long call crosses 1GB boundary

I got the following error during compilation (.sram.text+0x1283): dangerous relocation: windowed longcall crosses 1GB boundary; return may fail: (UND+0xdeadcafe) in one of the functions. The architecture is Xtensa and the toolchain used is a GNU…
2
votes
0 answers

Xtensa xt-xcc license issue

I am trying to use Xtensa cross compiler to build a simple embedded application. And I got 2 mysterious issues. The first issue is probably a license issue: The Xtensa toolchain always reports below error: License checkout failed: No such feature…
smwikipedia
  • 61,609
  • 92
  • 309
  • 482
2
votes
0 answers

Structure bitfields compilation problem in C

Used architecture: Xtensa-LX6 I have a following definition: volatile typedef struct{ union{ struct{ uint32_t FIELD1:16; uint32_t FIELD2:12; uint32_t FIELD3:4; }; uint32_t _; …
Patrik Staron
  • 331
  • 1
  • 9
2
votes
0 answers

Adding new instructions to the processor lx106

In the xtensa documentation there is a paragraph saying that it is possible to 'burn' new instructions in the processor itself using a sort of C language. How to create new instruction in an assembly source program or how to link this new…
Recifarium
  • 21
  • 2
2
votes
2 answers

Xtensa instruction: L32R - which addres is loaded?

I am trying to read some xtensa assembly code and am stumped by the L32R instruction: E.g. given the following line: 0000 2f04 : 2f0c: ffef21 l32r a2, 2ec8 Which address does this load?
ARF
  • 7,420
  • 8
  • 45
  • 72
1
vote
4 answers

Branchless way to add two UINT while avoiding overflow?

I'm curious if there's a branchless way to do this, or perhaps just a generally better way: uint16_t add_with_no_overflow(uint16_t num, uint16_t delta) { if (UINT16_MAX - delta < num) { return UINT16_MAX; } return num + delta; } I…
Jonathan Levin
  • 594
  • 3
  • 13
1
vote
1 answer

Assigning `array[i]` to variable inside loop on `i` , what pros and cons it gives in C?

There is some abstract loop that loops through array, and processes every single element without dependency of it's place in array. Element value is checked against conditions many times. Adding int value = arr[i] will help reading the code, and…
filimonic
  • 3,988
  • 2
  • 19
  • 26
1
vote
0 answers

Printf output on godbolt using xtensa compiler?

Is there some way to produce output in godbolt for the Xtensa compiler? This #include int main() { printf("Hello World!"); } generates an asm call to printf, but nothing is displayed.
glades
  • 3,778
  • 1
  • 12
  • 34
1
vote
1 answer

Curly brackets in xtensa dissasembly

I'm dissassembling and inspecting (mostly for fun and learning) the Arduino code generated for an ESP8266 (Xtensa ISA). I've been following the code so far without issues until the curly brackets (location 4010f4c2) in the main function: 4010f494…
carlosV2
  • 1,167
  • 6
  • 15
1
vote
2 answers

"Error: attempt to move .org backwards" using Xtensa XCC, GCC works fine

Here is a minimal reproducible example: /* * Example for Xtensa xt-xcc compiler "error: attempt to move .org backwards". */ struct k_dict { char *m_name_dict; char *p_name_dict; union { float f_value; int i_value; …
Danijel
  • 8,198
  • 18
  • 69
  • 133
1
vote
0 answers

Payload from command line not overwriting the stack

I'm sorry that this is unusually long, I just want the contributors to see what I have tried before posting. My code: #include #include #include void nevercalled(){ …
dbayoxy
  • 33
  • 7
1
vote
1 answer

Assembler messages: Error: attempt to move .org backwards

I am using xtensa-esp32-elf-8.2.0 toolchain for compilation (which is based on gcc 8). I also tried with xtensa-esp32-elf-5.2.0 toolchain (which is based on gcc 5). Both generate the same error message. I have written a jumptable which has…
1
vote
1 answer

Writing callback function for Xtensa simcall function

I'm writing a code in C++ for Xtensa virtual platform. I want to use the functionality of the simcall_callback, to return data from the internal FW code. My C++ is a little bit rusty. How do I build the callback function for the following typedef…
AleXelA
  • 13
  • 3
1
2 3