Skip to content

implement EspClass::getFreeSysStack method #5153

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

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions cores/esp8266/Esp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,11 @@ uint32_t EspClass::getFreeContStack()
return cont_get_free_stack(g_pcont);
}

uint32_t EspClass::getFreeSysStack()
{
register volatile uint32_t stackAddress asm("a1");
return stackAddress-SYSTEM_STACK_END_ADDRESS;
}
uint32_t EspClass::getChipId(void)
{
return system_get_chip_id();
Expand Down
4 changes: 4 additions & 0 deletions cores/esp8266/Esp.h
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,9 @@ enum RFMode {
#define WAKE_NO_RFCAL RF_NO_CAL
#define WAKE_RF_DISABLED RF_DISABLED

// for getFreeSysStack
#define SYSTEM_STACK_END_ADDRESS 0x3FFFC000

enum ADCMode {
ADC_TOUT = 33,
ADC_TOUT_3V3 = 33,
Expand Down Expand Up @@ -111,6 +114,7 @@ class EspClass {
void getHeapStats(uint32_t* free = nullptr, uint16_t* max = nullptr, uint8_t* frag = nullptr);

uint32_t getFreeContStack();
uint32_t getFreeSysStack();

const char * getSdkVersion();
String getCoreVersion();
Expand Down