-
Notifications
You must be signed in to change notification settings - Fork 13.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Resolve HWDT Reset with core_esp8266_vm #9025
Conversation
With the newer GCC compiler (after tag 3.0.2), example virtualmem was crashing with a HWDT reset. Reordered some SPI register set lines in spi_init(). New ordering was based on ::begin in SPI.cpp This change may resolve issues describe in esp8266#9010
Memory barrier is needed? asm comparison would be more apparent what reordered where |
spi_ctrl appears to need setting before other SPI registers
Extracted and trimmed old source code void spi_init(spi_regs *spi1)
{
spi1->spi_cmd = 0;
GPMUX &= ~(1 << 9);
spi1->spi_clock = spi_clkval;
spi1->spi_ctrl = 0 ; // MSB first + plain SPI mode
spi1->spi_ctrl1 = 0; // undocumented, clear for safety?
spi1->spi_ctrl2 = 0; // No add'l delays on signals
spi1->spi_user2 = 0; // No insn or insn_bits to set
} Failing build - with compiler from the current master
Working build - with compiler from Release 3.0.2
The old compiler reordered instructions such that |
* Resolve HWDT Reset with core_esp8266_vm With the newer GCC compiler (after tag 3.0.2), example virtualmem was crashing with a HWDT reset. Reordered some SPI register set lines in spi_init(). New ordering was based on ::begin in SPI.cpp This change may resolve issues describe in esp8266#9010 * Added memory barrier to changes spi_ctrl appears to need setting before other SPI registers
With the newer GCC compiler (after tag 3.0.2), example virtualmem was crashing with an HWDT reset. Reordered some SPI register set lines in
spi_init()
. New ordering was based onSPIClass::begin
inSPI.cpp
.Someone with a deeper understanding of these SPI registers should review my changes.
This change may resolve issues described in
Addendum:
I have only tested with the
8M w/256K Heap External 64 MBit PSRAM
build option.