-
Notifications
You must be signed in to change notification settings - Fork 13.3k
PoC cache configuration control #7060
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
Changes from 1 commit
fc63320
57043bd
17ceceb
7424aed
56306d3
0645923
a6bb5a1
5bb3e19
b443e43
0c661db
c6eabc5
70842de
f35290b
71e36cb
edf008a
161e7bc
5ac46f7
91fc391
eb9882e
1422b8d
b921e11
cfb3826
a1cd3a2
352a2ed
062f8dc
69fdd5b
d5dac93
9d3a7de
ecd826c
a9b92e2
5a99afc
f51dd82
71ef229
1a9d909
7b4a8d4
d9ab27e
6d18190
50fe8a3
f62ff0a
1847a72
d3ace64
a43a2a8
2f47516
fd8f942
74df810
b767a5d
e7402d8
51ea542
3ff489c
232dce4
a3c9e02
fc5f611
bbdf166
b88d197
b058f17
5e31ed5
a4d28e2
d45ceb0
4831410
f64a7d0
2238535
c070657
be71429
50ea394
4d7e1e9
61afce0
d828d76
7d4a600
20d39ee
f33ed95
53894c7
5ee2136
3f415f8
addb149
d7fb4ab
c8412a8
5786ec1
86c4e5a
0c9ae16
2f88e7b
6c324c1
929e79b
1875c73
d3f9a0a
e48d95e
3ab791b
a3bf35c
1ff2aef
9f9e206
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
Adapted changes to umm_malloc, Esp.cpp, StackThunk.cpp, WiFiClientSecureBearSSL.cpp, and virtualmem.ino to irammem.ino from @earlephilhower PR #6994. Reworked umm_malloc to use context pointers instead of copy context. umm_malloc now supports allocations from IRAM. Added class HeapSelectIram, ... to aid in selecting alternate heaps, modeled after class InterruptLock. Restrict alloc request from ISRs to DRAM. Never ending improvements to debug printing. Sec Heap option now pulls in free IRAM left over in the 1st 32K block. Managed through umm_malloc with HeapSelectIram. Updated examples.
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,6 +17,7 @@ | |
|
||
#include "Arduino.h" | ||
#include "mmu_iram.h" | ||
#include <user_interface.h> | ||
|
||
extern "C" { | ||
|
||
|
@@ -110,12 +111,12 @@ void IRAM_ATTR Cache_Read_Enable(uint8_t map, uint8_t p, uint8_t v) { | |
if (0 == mmu_status.enable_count) { | ||
mmu_status.enable_count--; // keep saturated value | ||
} | ||
DBG_MMU_PRINT_IRAM_BANK_REG("before"); | ||
DBG_MMU_PRINT_IRAM_BANK_REG("before", "Enable"); | ||
|
||
real_Cache_Read_Enable(map, p, SOC_CACHE_SIZE); | ||
|
||
DBG_MMU_PRINT_IRAM_BANK_REG("after"); | ||
DBG_MM_PRINT_STATUS(); | ||
DBG_MMU_PRINT_IRAM_BANK_REG("after", "Enable"); | ||
DBG_MMU_PRINT_STATUS(); | ||
} | ||
|
||
#ifndef ROM_Cache_Read_Disable | ||
|
@@ -129,20 +130,86 @@ constexpr fp_Cache_Read_Disable_t real_Cache_Read_Disable = | |
* | ||
*/ | ||
void IRAM_ATTR Cache_Read_Disable(void) { | ||
|
||
mmu_status.disable_count++; | ||
mmu_status.state = 0; | ||
if (0 == mmu_status.disable_count) { | ||
mmu_status.disable_count--; // keep saturated value | ||
} | ||
DBG_MMU_PRINT_IRAM_BANK_REG("before"); | ||
DBG_MMU_PRINT_IRAM_BANK_REG("before", "Disable"); | ||
|
||
real_Cache_Read_Disable(); | ||
|
||
DBG_MMU_PRINT_IRAM_BANK_REG("after"); | ||
DBG_MM_PRINT_STATUS(); | ||
DBG_MMU_PRINT_IRAM_BANK_REG("after", "Disable"); | ||
DBG_MMU_PRINT_STATUS(); | ||
} | ||
|
||
#ifdef DEV_DEBUG_PRINT | ||
/* | ||
* Early adjustment for CPU crystal frequency, so debug printing will work. | ||
* This should not be left enabled all the time in Crash_Read..., I am concerned | ||
* that there may be unknown interference with the NONOS SDK startup. | ||
* | ||
* Inspired by: | ||
* https://github.com/pvvx/esp8266web/blob/2e25559bc489487747205db2ef171d48326b32d4/app/sdklib/system/app_main.c#L581-L591 | ||
*/ | ||
extern "C" uint8_t rom_i2c_readReg(uint8_t block, uint8_t host_id, uint8_t reg_add); | ||
extern "C" void rom_i2c_writeReg(uint8_t block, uint8_t host_id, uint8_t reg_add, uint8_t data); | ||
|
||
extern "C" void IRAM_ATTR set_pll(void) | ||
{ | ||
#if !defined(F_CRYSTAL) | ||
#define F_CRYSTAL 26000000 | ||
#endif | ||
if (F_CRYSTAL != 40000000) { | ||
// At Boot ROM(-BIOS) start, it assumes a 40MHz crystal. | ||
// If it is not, we assume a 26MHz crystal. | ||
// There is no support for 24MHz crustal at this time. | ||
if(rom_i2c_readReg(103,4,1) != 136) { // 8: 40MHz, 136: 26MHz | ||
// Assume 26MHz crystal | ||
// soc_param0: 0: 40MHz, 1: 26MHz, 2: 24MHz | ||
// set 80MHz PLL CPU | ||
rom_i2c_writeReg(103,4,1,136); | ||
rom_i2c_writeReg(103,4,2,145); | ||
} | ||
} | ||
} | ||
|
||
extern "C" void IRAM_ATTR dbg_set_pll(void) | ||
{ | ||
char r103_4_1 = rom_i2c_readReg(103,4,1); | ||
char r103_4_2 = rom_i2c_readReg(103,4,2); | ||
set_pll(); | ||
ets_uart_printf("\nrom_i2c_readReg(103,4,1) == %u\n", r103_4_1); | ||
ets_uart_printf( "rom_i2c_readReg(103,4,2) == %u\n", r103_4_2); | ||
} | ||
|
||
/* | ||
This helps keep the UART enabled at user_init() so we can get a few more | ||
messages printed. | ||
*/ | ||
extern struct rst_info resetInfo; | ||
extern "C" void __pinMode( uint8_t pin, uint8_t mode ); | ||
|
||
inline bool is_gpio_persistent(void) { | ||
return REASON_EXCEPTION_RST <= resetInfo.reason && | ||
REASON_SOFT_RESTART >= resetInfo.reason; | ||
} | ||
|
||
extern "C" void pinMode( uint8_t pin, uint8_t mode ) { | ||
static bool in_initPins = true; | ||
if (in_initPins && (1 == pin)) { | ||
if (!is_gpio_persistent()) { | ||
/* Restore pin to TX after Power-on and EXT_RST */ | ||
__pinMode(pin, FUNCTION_0); | ||
} | ||
in_initPins = false; | ||
return; | ||
} | ||
|
||
__pinMode( pin, mode ); | ||
} | ||
Comment on lines
+167
to
+187
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is this persistent pin thing needed for this PR? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This along with This was more for development debugging. In my mind using this feature (Cache_Read_Enable) had a lot of uncertainty about it. Since it is scarcely documented. I have held back from deleting a lot of the development code used to monitor what is going on. I think there is more of this scattered around that needs to be looked at. I suppose now may be the time to purge. This is currently contained in a Edited - added clarifications |
||
#endif | ||
|
||
#endif | ||
|
||
}; |
Uh oh!
There was an error while loading. Please reload this page.