Skip to content
Prev Previous commit
Next Next commit
Revised comments and instructions
  • Loading branch information
mhightower83 committed Dec 9, 2022
commit dd7440e20d5b22044d57e5b420b18014856aeb6c
16 changes: 16 additions & 0 deletions cores/esp8266/heap.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -387,6 +387,7 @@ void IRAM_ATTR vPortFree(void *ptr, const char* file, int line)
return heap_vPortFree(ptr, file, line);
}

#if (NONOSDK >= (0x30000))
////////////////////////////////////////////////////////////////////////////////
/*
New for NON-OS SDK 3.0.0 and up
Expand Down Expand Up @@ -424,4 +425,19 @@ void* IRAM_ATTR pvPortZallocIram(size_t size, const char* file, int line)
return heap_pvPortZalloc(size, file, line);
}

/*
uint32_t IRAM_ATTR user_iram_memory_is_enabled(void)
{
return CONFIG_ENABLE_IRAM_MEMORY;
}

We do not need the function user_iram_memory_is_enabled().
1. It was used by mem_manager.o which was replaced with this custom heap
implementation. IRAM memory selection is handled differently.
2. In libmain.a, Cache_Read_Enable_New uses it for cache size. However, When
using IRAM for memory or running with 48K IRAM for code, we use a
replacement Cache_Read_Enable to correct the cache size ignoring
Cache_Read_Enable_New's selected value.
*/
#endif
};
15 changes: 8 additions & 7 deletions cores/esp8266/wpa2_eap_patch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,18 +24,20 @@
defined(NONOSDK304) || \
defined(NONOSDK305)

// eap_peer_config_deinit() - For this list of SDKs there is no significant
// eap_peer_config_deinit() - For this list of SDKs there are no significant
// changes in the function. Just the line number reference for when vPortFree
// is called. When vPortFree is called, register a12 continues to hold a pointer
// to the struct StateMachine. Our cleanup routine should continue to work.
// to the struct StateMachine. Our cleanup routine should continue to work.
#if defined(NONOSDK300) || defined(NONOSDK301)
// Minor changes only line number changed
#define SDK_LEAK_LINE 809
#elif defined(NONOSDK302) || defined(NONOSDK303) || defined(NONOSDK304)
// Minor changes only line number changed
#define SDK_LEAK_LINE 831
#elif defined(NONOSDK305)
// Changed from `.text.eap_peer_config_deinit` to `eap_peer_config_deinit`
// At v3.0.5 Espressif moved `.text.eap_peer_config_deinit` to
// `eap_peer_config_deinit` then later in latest git they moved it
// back. For our linker script both are placed in flash.
#define SDK_LEAK_LINE 831
#else
#define SDK_LEAK_LINE 799
Expand Down Expand Up @@ -165,10 +167,9 @@ void patch_wpa2_eap_vPortFree_a12(void *ptr, const char* file, int line, void* a
return;
}
#elif defined(NONOSDK302) || defined(NONOSDK303) || defined(NONOSDK304) || defined(NONOSDK305)
// WPA2 Enterpise connections appear to work without crashing
// wpa2_sm_rx_eapol() has a few changes between NONOSDK301 and NONOSDK302.
// Double free appears fixed; however, still has memory leak.
// TODO: evaluate the unasm functions
// It looks like double free is fixed. WPA2 Enterpise connections work
// without crashing. wpa2_sm_rx_eapol() has a few changes between NONOSDK301
// and NONOSDK302. However, this set of releases still have memory leaks.
#else
// This is not needed because the call was NO-OPed in the library.
// Keep code snippit for reference.
Expand Down
13 changes: 8 additions & 5 deletions tools/sdk/lib/README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
## Adding new SDKs
## Adding a new SDK library

- Create a new directory for the new SDK
- Create a directory for the new SDK.
- Copy .a files from SDK `lib` directory to the new directory
- Run `./eval_fix_sdks.sh --analyze`.
- Use above results to update `fix_sdk_libs.sh` to handle new SDK
- Once `fix_sdk_libs.sh` has been updated. You can run `./eval_fix_sdks.sh --patch` to do a batch run of `fix_sdk_libs.sh` against each SDK.
- Add the new SDK directory to those supported in `eval_fix_sdks.sh` and `fix_sdk_libs.sh`.
- To support WPA2 Enterprise connections, some patches are reguired review `wpa2_eap_patch.cpp` and `eval_fix_sdks.sh` for details.
- Use `./eval_fix_sdks.sh --analyze` to aid in finding relevant differences.
- Also, you can compare two SDKs with something like `./eval_fix_sdks.sh --analyze "NONOSDK305\nNONOSDK306"`
- Apply updates to `fix_sdk_libs.sh` and `wpa2_eap_patch.cpp`. You can run `./eval_fix_sdks.sh --patch` to do a batch run of `fix_sdk_libs.sh` against each SDK.
- If you used this section, you can skip _Updating SDK libraries_.

## Updating SDK libraries

Expand Down