@@ -356,25 +356,25 @@ void system_show_malloc(void)
356356void * IRAM_ATTR pvPortMalloc (size_t size, const char * file, int line)
357357{
358358 HeapSelectDram ephemeral;
359- return heap_pvPortMalloc (size, file, line);;
359+ return heap_pvPortMalloc (size, file, line);;
360360}
361361
362362void * IRAM_ATTR pvPortCalloc (size_t count, size_t size, const char * file, int line)
363363{
364364 HeapSelectDram ephemeral;
365- return heap_pvPortCalloc (count, size, file, line);
365+ return heap_pvPortCalloc (count, size, file, line);
366366}
367367
368368void * IRAM_ATTR pvPortRealloc (void *ptr, size_t size, const char * file, int line)
369369{
370370 HeapSelectDram ephemeral;
371- return heap_pvPortRealloc (ptr, size, file, line);
371+ return heap_pvPortRealloc (ptr, size, file, line);
372372}
373373
374374void * IRAM_ATTR pvPortZalloc (size_t size, const char * file, int line)
375375{
376376 HeapSelectDram ephemeral;
377- return heap_pvPortZalloc (size, file, line);
377+ return heap_pvPortZalloc (size, file, line);
378378}
379379
380380void IRAM_ATTR vPortFree (void *ptr, const char * file, int line)
@@ -384,7 +384,44 @@ void IRAM_ATTR vPortFree(void *ptr, const char* file, int line)
384384 // correct context. umm_malloc free internally determines the correct heap.
385385 HeapSelectDram ephemeral;
386386#endif
387- return heap_vPortFree (ptr, file, line);
387+ return heap_vPortFree (ptr, file, line);
388+ }
389+
390+ // //////////////////////////////////////////////////////////////////////////////
391+ /*
392+ New for NON-OS SDK 3.0.0 and up
393+ Needed for WPA2 Enterprise support. This was not present in SDK pre 3.0
394+
395+ The NON-OS SDK 3.0.x has breaking changes to pvPortMalloc. They added one more
396+ argument for selecting a heap. To avoid breaking the build, I renamed their
397+ broken version pvEsprMalloc. To be used, the LIBS need to be edited.
398+
399+ They also added pvPortZallocIram and pvPortCallocIram, which are not a
400+ problem.
401+
402+ WPA2 Enterprise connect crashing is fixed at v3.0.2 and up.
403+ */
404+ void * IRAM_ATTR pvEsprMalloc (size_t size, const char * file, int line, bool iram)
405+ {
406+ if (iram) {
407+ HeapSelectIram ephemeral;
408+ return heap_pvPortMalloc (size, file, line);;
409+ } else {
410+ HeapSelectDram ephemeral;
411+ return heap_pvPortMalloc (size, file, line);;
412+ }
413+ }
414+
415+ void * IRAM_ATTR pvPortCallocIram (size_t count, size_t size, const char * file, int line)
416+ {
417+ HeapSelectIram ephemeral;
418+ return heap_pvPortCalloc (count, size, file, line);
419+ }
420+
421+ void * IRAM_ATTR pvPortZallocIram (size_t size, const char * file, int line)
422+ {
423+ HeapSelectIram ephemeral;
424+ return heap_pvPortZalloc (size, file, line);
388425}
389426
390427};
0 commit comments