Discuss here different C compiler set ups, and compiling executables for the ESP8266

User avatar
By jcmvbkbc
#19118
cal wrote:Hmm but you are modifying the stack, too and doing a call to the exception handler.
Code: Select allmovi a1, stack + STACK_SIZE - 20


I have to take a closer look how that works together with gdb dummy_frame "call" handling.

'- 20' looks suspicious here, it should've been -16 or -32.
I must admit I never tried to call functions from gdb with this gdbstub.
Saving all windowed registers unconditionally and switching to separate stack makes access to all registers easy and straightforward.

cal wrote:Why do you clear EXCM?

EXCM makes things more complex if possible at all:
- it disables normal windowed registers behaviour, making it impossible to use C code in the handler (this does not affect call0 ABI code as long as the current register window is completely available);
- it disables zero overhead loops which now may be generated by the compiler (lx106 doesn't have this option);
- exceptions go to the double exception vector instead of normal kernel/user vectors.

cal wrote:Does your debug handler run with interrupts enabled?
Do you recommend that?

It runs with ps.intlevel set to debuglevel, so only NMI is possible.
I haven't tried running it with interrupts enabled and at least stack manipulations need to be reconsidered before allowing that.
User avatar
By cal
#19121
jcmvbkbc wrote:
In the gdbserver I made for another xtensa setup a while ago I did the following:
https://github.com/jcmvbkbc/gdbstub-xte ... ntry.S#L46


I can't believe I missed this.
I am working on an esp8266 version for nearly 2 months now without noticing.
But at least learning xtensa assembler, gdb rsp and XTOS was not a small part of it.

Cal
User avatar
By cal
#19179
cal wrote:
jcmvbkbc wrote:
In the gdbserver I made for another xtensa setup a while ago I did the following:
https://github.com/jcmvbkbc/gdbstub-xte ... ntry.S#L46


I can't believe I missed this.
I am working on an esp8266 version for nearly 2 months now without noticing.
But at least learning xtensa assembler, gdb rsp and XTOS was not a small part of it.

Cal



Your use of l32i and dealing with alignment is really cool.
Also cool hitchhiking the ex handlers to catch mem_err.
That should reduce my recursive S05 issues...

I learned about .literal_section. Great.

I wonder if some fall throughs in handle_exception should return error codes.

My code feels bloated... too many years of enterprise java I guess.

Thanks for sharing,
Cal
User avatar
By jcmvbkbc
#19196
cal wrote:I can't believe I missed this.

I've only published it a couple days ago. It's not very relevant for esp8266, and it's rather a working prototype. I haven't got any feedback from people that were to use it.
Its primary objective was minimal memory footprint, hence various hacks. IIRC its total memory footprint is less than 5KB.
There's also a gdbstub library from Tensilica developed around the same time, the xmon, but it's bigger, AFAIK tens of KB.

cal wrote:I wonder if some fall throughs in handle_exception should return error codes.

That very well may be. Existing error codes may be wrong too.