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 following instructions 10 times , which are basically used to jump at the particular address and execute particular instruction. But I am getting an error while compilation which is
Assembler Messages: Error: attempt to move .org backwards
.org .LSAC_jumptable_base + (16 * 6)
mov a6, a4
l32i a2, sp, 0x08
l32i a4, sp, 0x10
mov a1, a0
rsr a0, excsave1
rfe
I have surfed the web for the same but, either most of the pages do not provide viable answer or they say its a compiler version problem ( which I dont think is the right solution as I use latest toolchain )
Can somebody please help
example use of my jumptable:
movi a3, .LSAC_jumptable_base
l32i a0, sp, 0
addx8 a2, a2, a3 // a2 is now the address to jump to
l32i a3, sp, 0x0c
jx a2
.org .LSAC_jumptable_base + (16 * 5)
mov a5, a4 //Here, a4 is the correctly read value
l32i a2, sp, 0x08
l32i a4, sp, 0x10
mov a1, a0
rsr a0, excsave1
rfe
.org .LSAC_jumptable_base + (16 * 6)
mov a6, a4
l32i a2, sp, 0x08
l32i a4, sp, 0x10
mov a1, a0
rsr a0, excsave1
rfe