8000 Update core with upstream umm_malloc by mhightower83 · Pull Request #6438 · esp8266/Arduino · GitHub
[go: up one dir, main page]

Skip to content

Update core with upstream umm_malloc #6438

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

Merged
merged 40 commits into from
Oct 29, 2019
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
88a32c8
WIP: Initial overlay of upstream version of umm_malloc over
mhightower83 Aug 20, 2019
b508642
WIP: upstream version of umm_malloc customized for Arduino ESP8266 Core
mhightower83 Aug 20, 2019
d7363e0
Resoved Travis CI - issue
mhightower83 Aug 23, 2019
57b65ab
Corrected #ifdef's for UMM_STATS/UMM_STATS_FULL
mhightower83 Aug 27, 2019
da47a79
Merge branch 'master' into WIP-upstream-umm_malloc
d-a-v Aug 29, 2019
71b10fd
Corrected UMM_REALLOC_DEFRAG option to be more like the original umm_…
mhightower83 Sep 3, 2019
4612235
Merge branch 'WIP-upstream-umm_malloc' of github.com:mhightower83/Ard…
mhightower83 Sep 3, 2019
79fe67f
Updated UMM_POISON_CHECK_LITE - Expanded the poison check on the current
mhightower83 Sep 5, 2019
5ded134
Updated printing in heap.cpp to behave the way os_printf did.
mhightower83 Sep 8, 2019
2a1923e
Merged latest, 2019-09-07, from upstream umm_malloc
mhightower83 Sep 8, 2019
f68a64f
Resolved issue where OOM selected w/ Debug port: "Disabled" caused hang.
mhightower83 Sep 8, 2019
9fcf27b
Fixed realloc OOM bug introduced due to confusing code, added comment…
mhightower83 Sep 9, 2019
ad03e16
Merge branch 'master' into WIP-upstream-umm_malloc
mhightower83 Sep 11, 2019
f438e02
Updated to track PRs for various print definitions. Cleaned up comments
mhightower83 Sep 27, 2019
919b122
Merge branch 'master' into WIP-upstream-umm_malloc
mhightower83 Sep 28, 2019
35c6868
Added missing "#ifdef __cplusplus"
mhightower83 Sep 28, 2019
47563cd
Reorganize local enhancements
mhightower83 Sep 29, 2019
2a1b722
Merge branch 'master' into WIP-upstream-umm_malloc
mhightower83 Sep 30, 2019
5560f6b
Print notice message for the need of -DUMM_INFO_PRINT
mhightower83 Sep 30, 2019
c4a46bc
Merge branch 'master' into WIP-upstream-umm_malloc
mhightower83 Sep 30, 2019
0b89ce7
This updates the heap management library, umm_malloc, to the current …
mhightower83 Sep 30, 2019
7e859c5
This updates the heap management library, umm_malloc, to the current …
mhightower83 Sep 30, 2019
2d26ccb
Updated upstream TODO
mhightower83 Oct 1, 2019
eed4b99
Merge branch 'WIP-upstream-umm_malloc' of github.com:mhightower83/Ard…
mhightower83 Oct 1, 2019
966812a
Changes on printing to comply with new understanding of SPI bus avail…
mhightower83 Oct 1, 2019
3669bf5
Removed no longer needed files.
mhightower83 Oct 1, 2019
be66ae7
OOM build option now saves file and line number for post mortem repor…
mhightower83 Oct 2, 2019
917e723
Merge branch 'master' into WIP-upstream-umm_malloc
mhightower83 Oct 2, 2019
503def2
Merge branch 'WIP-upstream-umm_malloc' of github.com:mhightower83/Ard…
mhightower83 Oct 2, 2019
3b80577
Missed change.
mhightower83 Oct 5, 2019
2507ced
Merge branch 'master' into WIP-upstream-umm_malloc
mhightower83 Oct 10, 2019
46b61fb
Consolated upstream integration comments into Notes.h. This helps
mhightower83 Oct 10, 2019
e9401c7
Comment updates.
mhightower83 Oct 10, 2019
648c028
Notes update.
mhightower83 Oct 10, 2019
3475ba2
Merge branch 'master' into WIP-upstream-umm_malloc
mhightower83 Oct 17, 2019
435b8a6
Merge branch 'master' into WIP-upstream-umm_malloc
mhightower83 Oct 23, 2019
eb5a7ca
Changes to heap.cpp -
mhightower83 Oct 24, 2019
3c77efe
Corrected Full Poison Check's placement and documented the
mhightower83 Oct 24, 2019
9da7eb8
Merge branch 'master' into WIP-upstream-umm_malloc
mhightower83 Oct 28, 2019
0eaa613
Fixed typos
mhightower83 Oct 29, 2019
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
Prev Previous commit
Next Next commit
Fixed realloc OOM bug introduced due to confusing code, added comment…
… for future.

umm_info(NULL, true) is now treated as a debug option that is enabled by
Arduino IDE->tools `Debug port: "Serial"`, etc. It now prints when
DEBUG_ESP_PORT or UMM_INFO_PRINT are defined.

Cleanup comments and some conditionals.
  • Loading branch information
mhightower83 committed Sep 10, 2019
commit 9fcf27b084b59002ee9b1036307cd2f987c2071c
4 changes: 2 additions & 2 deletions cores/esp8266/heap.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -142,8 +142,8 @@ void ICACHE_RAM_ATTR print_loc(size_t size, const char* file, int line)
#else // ! DEBUG_ESP_OOM

#if 1
//C Skip OOM check of pvPort... . It cost 64 more bytes of IRAM to turn on.
//C Was not previously enabled.
//C Skip OOM logging of last fail for malloc/... and pvPort... .
//C It cost 64 more bytes of IRAM to turn on. And was not previously enabled.
#undef PTR_CHECK__LOG_LAST_FAIL
#define PTR_CHECK__LOG_LAST_FAIL(p, s, a)
#endif
Expand Down
2 changes: 1 addition & 1 deletion cores/esp8266/umm_malloc/isr_safe_printf.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@
#include "umm_malloc_cfg.h"
extern "C" {

#if defined(DEBUG_ESP_PORT) || defined(DEBUG_ESP_OOM) || defined(UMM_POISON_CHECK) || defined(UMM_POISON_CHECK_LITE)
#if defined(DEBUG_ESP_ISR)

int _isr_safe_printf_P(const char *fmt, ...) __attribute__((format(printf, 1, 2)));
// Note, _isr_safe_printf_P will not handle additional string arguments in
Expand Down
8 changes: 8 additions & 0 deletions cores/esp8266/umm_malloc/umm_local.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,14 @@
#define memmove ets_memmove
#define memset ets_memset

#if !defined(UMM_INFO_PRINT)
/* This will stop umm_info from printing.
* At this time DBGLOG_FORCE is only used by umm_info.
*/
#undef DBGLOG_FORCE
#define DBGLOG_FORCE(force, format, ...) {(void)force; (void)format;}
#endif

#if defined(DEBUG_ESP_OOM) || defined(UMM_POISON_CHECK) || defined(UMM_POISON_CHECK_LITE) || defined(UMM_INTEGRITY_CHECK)
#else

Expand Down
16 changes: 12 additions & 4 deletions cores/esp8266/umm_malloc/umm_malloc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -771,12 +771,15 @@ void *umm_realloc( void *ptr, size_t size ) {
memcpy( ptr, oldptr, curSize );
UMM_CRITICAL_RESUME(id_realloc);
umm_free_core( oldptr );
blockSize = blocks;
} else {
DBGLOG_DEBUG( "realloc %i to a bigger block %i failed - return NULL and leave the old block!\n", blockSize, blocks );
/* This space intentionally left blnk */
STATS__OOM_UPDATE();
}
/* This is not accurate for OOM case; however, it will work for
* stopping a call to free before return.
*/
blockSize = blocks;
}
#elif defined(UMM_REALLOC_DEFRAG)
/*
Expand Down Expand Up @@ -847,12 +850,15 @@ void *umm_realloc( void *ptr, size_t size ) {
memcpy( ptr, oldptr, curSize );
UMM_CRITICAL_RESUME(id_realloc);
umm_free_core( oldptr);
blockSize = blocks;
} else {
DBGLOG_DEBUG( "realloc %d to a bigger block %d failed - return NULL and leave the old block!\n", blockSize, blocks );
/* This space intentionally left blnk */
STATS__OOM_UPDATE();
}
/* This is not accurate for OOM case; however, it will work for
* stopping a call to free before return.
*/
blockSize = blocks;
}
#else
#warning "Neither UMM_REALLOC_DEFRAG nor UMM_REALLOC_MINIMIZE_COPY is defined - check umm_malloc_cfg.h"
Expand All @@ -869,13 +875,15 @@ void *umm_realloc( void *ptr, size_t size ) {
memcpy( ptr, oldptr, curSize );
UMM_CRITICAL_RESUME(id_realloc);
umm_free_core( oldptr );
blockSize = blocks;
} else {
DBGLOG_DEBUG( "realloc %d to a bigger block %d failed - return NULL and leave the old block!\n", blockSize, blocks );
/* This space intentionally left blnk */
UMM_CRITICAL_RESUME(id_realloc);
STATS__OOM_UPDATE();
}
/* This is not accurate for OOM case; however, it will work for
* stopping a call to free before return.
*/
blockSize = blocks;
}
#endif
/* Now all we need to do is figure out if the block fit exactly or if we
Expand Down
31 changes: 27 additions & 4 deletions cores/esp8266/umm_malloc/umm_malloc_cfg.h
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,23 @@ extern char _heap_start[];
#else
#endif

/*
* -D UMM_INFO_PRINT
*
* umm_info(NULL, true) is used to print a debug view of heap information to the
* debug port. It has to walk the heap and print out information while in a
* critical section. This requires that the print function be able to print w/o
* doing malloc calls and from an IRQ disabled context. This requires extra IRAM
* based code for printing. Without this define `umm_info(NULL, true)` will
* not print.
*
* UMM_INFO_PRINT is enabled as part of selecting `Debug port: "Serial" or
* "Serial1"`. To make available all the time use '-D UMM_INFO_PRINT`.
*/
#if defined(DEBUG_ESP_PORT) && !defined(UMM_INFO_PRINT)
#define UMM_INFO_PRINT
#endif

/*
* -D UMM_STATS :
*
Expand Down Expand Up @@ -541,17 +558,23 @@ static inline void _critical_exit(UMM_TIME_STAT *p, uint32_t *saved_ps) {
#undef DBGLOG_FUNCTION
#undef DBGLOG_FUNCTION_P

#if defined(DEBUG_ESP_PORT) || defined(DEBUG_ESP_OOM) || defined(UMM_POISON_CHECK) || defined(UMM_POISON_CHECK_LITE)
#if defined(DEBUG_ESP_PORT) || defined(DEBUG_ESP_OOM) || \
defined(UMM_POISON_CHECK) || defined(UMM_POISON_CHECK_LITE) || \
defined(UMM_INFO_PRINT) || defined(UMM_INTEGRITY_CHECK)

#ifndef DEBUG_ESP_ISR
#define DEBUG_ESP_ISR
#endif

int _isr_safe_printf_P(const char *fmt, ...) __attribute__((format(printf, 1, 2)));
// Note, _isr_safe_printf_P will not handle additional string arguments in
// PROGMEM. Only the 1st parameter, fmt, is supported in PROGMEM.
#define DBGLOG_FUNCTION(fmt, ...) _isr_safe_printf_P(PSTR(fmt), ##__VA_ARGS__)
#define DBGLOG_FUNCTION_P(fmt, ...) _isr_safe_printf_P(fmt, ##__VA_ARGS__)
#else
#define DBGLOG_FUNCTION(fmt, ...) printf(PSTR(fmt), ##__VA_ARGS__)
#define DBGLOG_FUNCTION_P(fmt, ...) printf_P(fmt, ##__VA_ARGS__)
#define DBGLOG_FUNCTION(fmt, ...) do { (void)fmt; } while(false)
#define DBGLOG_FUNCTION_P(fmt, ...) do { (void)fmt; } while(false)
#endif
//C What about printing from umm_info - does it need to be ISR safe

/////////////////////////////////////////////////

Expand Down
0