Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
7 changes: 7 additions & 0 deletions cores/esp8266/Esp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
#include "interrupts.h"
#include "MD5Builder.h"
#include "umm_malloc/umm_malloc.h"
#include "cont.h"

extern "C" {
#include "user_interface.h"
Expand Down Expand Up @@ -177,6 +178,12 @@ uint16_t EspClass::getMaxFreeBlockSize(void)
return umm_max_block_size();
}

uint32_t EspClass::getFreeContStack()
{
extern cont_t* g_pcont;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This declaration is already done in cont.h

As a general question, why don't we write these trivial functions directly inside the class ?
This would have the effect of reducing the final image size if they are not used.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since -ffunction-sections is used, all unused functions should be stripped anyway, right?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Damn right !
I was totally unaware of that and I thought that was the LTO feature that we don't have.
So I uselessly separated some code from Esp.cpp namely Esp-frag.cpp and Esp-version.cpp.
Thanks for opening my eyes, I will seek details on the differences between these two gcc/ld features.

return cont_get_free_stack(g_pcont);
}

uint32_t EspClass::getChipId(void)
{
return system_get_chip_id();
Expand Down
2 changes: 2 additions & 0 deletions cores/esp8266/Esp.h
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,8 @@ class EspClass {
uint8_t getHeapFragmentation(); // in %
void getHeapStats(uint32_t* free = nullptr, uint16_t* max = nullptr, uint8_t* frag = nullptr);

uint32_t getFreeContStack();

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