@@ -175,10 +175,15 @@ void init_done() {
175
175
176
176
WPS beeing flawed by its poor security, or not beeing used by lots of
177
177
users, it has been decided that we are still going to use that memory for
178
- user's stack and disable the use of WPS, with an option to revert that
179
- back at the user's discretion. This selection can be done with the
180
- global define NO_EXTRA_4K_HEAP. An option has been added to the board
181
- generator script.
178
+ user's stack and disable the use of WPS.
179
+
180
+ app_entry() jumps to app_entry_custom() defined as "weakref" calling
181
+ itself a weak customizable function, allowing to use another one when
182
+ this is required (see core_esp8266_app_entry_noextra4k.cpp, used by WPS).
183
+
184
+ (note: setting app_entry() itself as "weak" is not sufficient and always
185
+ ends up with the other "noextra4k" one linked, maybe because it has a
186
+ default value in linker scripts).
182
187
183
188
References:
184
189
https://github.com/esp8266/Arduino/pull/4553
@@ -188,31 +193,25 @@ void init_done() {
188
193
189
194
*/
190
195
191
- #ifdef NO_EXTRA_4K_HEAP
192
- /* this is the default NONOS-SDK user's heap location */
193
- cont_t g_cont __attribute__ ((aligned (16 )));
194
- #endif
195
-
196
- extern " C" void ICACHE_RAM_ATTR app_entry (void )
196
+ extern " C" void ICACHE_RAM_ATTR app_entry_redefinable (void ) __attribute__((weak));
197
+ extern " C" void ICACHE_RAM_ATTR app_entry_redefinable (void )
197
198
{
198
- #ifdef NO_EXTRA_4K_HEAP
199
-
200
- /* this is the default NONOS-SDK user's heap location */
201
- g_pcont = &g_cont;
202
-
203
- #else
204
-
205
199
/* Allocate continuation context on this SYS stack,
206
200
and save pointer to it. */
207
201
cont_t s_cont __attribute__ ((aligned (16 )));
208
202
g_pcont = &s_cont;
209
203
210
- #endif
211
-
212
204
/* Call the entry point of the SDK code. */
213
205
call_user_start ();
214
206
}
215
207
208
+ static void ICACHE_RAM_ATTR app_entry_custom (void ) __attribute__((weakref(" app_entry_redefinable" )));
209
+
210
+ extern " C" void ICACHE_RAM_ATTR app_entry (void )
211
+ {
212
+ return app_entry_custom ();
213
+ }
214
+
216
215
extern " C" void user_init (void ) {
217
216
struct rst_info *rtc_info_ptr = system_get_rst_info ();
218
217
memcpy ((void *) &resetInfo, (void *) rtc_info_ptr, sizeof (resetInfo));
0 commit comments