-->
Page 2 of 2

Re: execute run-time generated asm code

PostPosted: Tue Nov 01, 2022 8:24 am
by QuickFix
@xi@g@me wrote:Took me a long time, but I got it! :mrgreen:

Glad you figured it out. 8-)
This all goes over my head, but kudos! :idea:

Re: execute run-time generated asm code

PostPosted: Wed Nov 02, 2022 5:36 am
by @xi@g@me
Looks like I'm more familiar with tensilica ASM than with x86 now '^^
Anyways, thanks for the kudos :-)

This way, I managed to generate a clock signal @ 6.66Mhz, could not do faster. It seems like the ESP8266 is not able to switch pins faster, it needs 6 clock cycles. If you add 6 nops between 2 pin switches, I have the exact same frequency. I may post here when I'll have more research info to share.

Re: execute run-time generated asm code

PostPosted: Fri Jan 06, 2023 4:04 am
by eriksl
Yes you already found out. You can't execute code from DRAM. There is no "general purpose" RAM like on x86. There are only two places that can contain code to be executed and that's FLASH and IRAM. As code from flash is always read into IRAM first ("cached") it's actually one.

The IRAM is divided into two parts: half of it is "cache" for SPI FLASH code, the other half is "IRAM" ram where you can have code of yourself and keep it there. I guess you can instruct the assembler to reserve an x amount of bytes there (instead of real code), then you could put some code there runtime. I think it's obvious not to use the "flash cache" area.

Re: execute run-time generated asm code

PostPosted: Fri Jan 06, 2023 4:10 am
by eriksl
About the pin change frequency, yes that is correct. The I/O's are connected over an internal bus (the APB, advanced peripheral bus) which is only that fast. If you need a steady and fast frequency, I would not recommend using an ESP8266 anyway, it's not designed for that purpose. I'd think of a VCO (voltage controlled oscillator) or (I2C/SPI) programmable oscillator. You also might want to consider the UART which can output data at 80 Mhz (divider = 1) or the I2S module which can also be very fast. Advantages: less work in software, higher speeds and completely PLL controlled so deviations in cycles by non-maskable-interrupts.

Or use an ESP32 which has some interesting hardware modules which will very probably do what you want anyway (the bit pattern generator).