Skip to content

Commit 70842de

Browse files
committed
Post push CI cleanup.
1 parent c6eabc5 commit 70842de

File tree

7 files changed

+33
-14
lines changed

7 files changed

+33
-14
lines changed

cores/esp8266/umm_malloc/umm_local.c

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -162,14 +162,27 @@ size_t umm_block_size( void ) {
162162
#endif
163163

164164
#if defined(UMM_STATS) || defined(UMM_STATS_FULL)
165-
// UMM_STATISTICS ummStats;
165+
166+
#if defined(UMM_POISON_CHECK) || defined(UMM_POISON_CHECK_LITE)
167+
168+
// Adjustment needed for free_blocks to express the number of bytes that can
169+
// actually be allocated.
170+
#define UMM_OVERHEAD_ADJUST \
171+
(umm_block_size() + \
172+
umm_block_size()/2 + \
173+
UMM_POISON_SIZE_BEFORE + \
174+
UMM_POISON_SIZE_AFTER + \
175+
sizeof(UMM_POISONED_BLOCK_LEN_TYPE))
176+
#else
177+
#define UMM_OVERHEAD_ADJUST (umm_block_size() + umm_block_size()/2)
178+
#endif
166179

167180
// Keep complete call path in IRAM
168181
size_t umm_free_heap_size_lw( void ) {
169182
UMM_INIT_HEAP;
170183

171184
umm_heap_context_t *_context = umm_get_current_heap();
172-
return (size_t)_context->stats.free_blocks * sizeof(umm_block) - umm_block_size() - umm_block_size()/2;
185+
return (size_t)_context->stats.free_blocks * sizeof(umm_block) - UMM_OVERHEAD_ADJUST;
173186
}
174187
#endif
175188

@@ -231,7 +244,7 @@ size_t ICACHE_FLASH_ATTR umm_get_oom_count( void ) {
231244

232245
size_t ICACHE_FLASH_ATTR umm_free_heap_size_lw_min( void ) {
233246
umm_heap_context_t *_context = umm_get_current_heap();
234-
return (size_t)_context->stats.free_blocks_min * umm_block_size() - umm_block_size() - umm_block_size()/2;
247+
return (size_t)_context->stats.free_blocks_min * umm_block_size() - UMM_OVERHEAD_ADJUST;
235248
}
236249

237250
size_t ICACHE_FLASH_ATTR umm_free_heap_size_min_reset( void ) {
@@ -242,12 +255,12 @@ size_t ICACHE_FLASH_ATTR umm_free_heap_size_min_reset( void ) {
242255

243256
size_t ICACHE_FLASH_ATTR umm_free_heap_size_min( void ) {
244257
umm_heap_context_t *_context = umm_get_current_heap();
245-
return _context->stats.free_blocks_min * umm_block_size() - umm_block_size() - umm_block_size()/2;
258+
return _context->stats.free_blocks_min * umm_block_size() - UMM_OVERHEAD_ADJUST;
246259
}
247260

248261
size_t ICACHE_FLASH_ATTR umm_free_heap_size_isr_min( void ) {
249262
umm_heap_context_t *_context = umm_get_current_heap();
250-
return _context->stats.free_blocks_isr_min * umm_block_size() - umm_block_size() - umm_block_size()/2;
263+
return _context->stats.free_blocks_isr_min * umm_block_size() - UMM_OVERHEAD_ADJUST;
251264
}
252265

253266
size_t ICACHE_FLASH_ATTR umm_get_max_alloc_size( void ) {

cores/esp8266/umm_malloc/umm_local.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737

3838

3939
#if defined(UMM_POISON_CHECK_LITE)
40-
static int check_poison_neighbors( unsigned short cur );
40+
static int check_poison_neighbors( umm_heap_context_t *_context, unsigned short cur );
4141
#endif
4242

4343

cores/esp8266/umm_malloc/umm_malloc_cfg.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -558,7 +558,7 @@ static inline void _critical_exit(UMM_TIME_STAT *p, uint32_t *saved_ps) {
558558
# define POISON_CHECK() 1
559559
# define POISON_CHECK_NEIGHBORS(c) \
560560
do {\
561-
if(!check_poison_neighbors(c)) \
561+
if(!check_poison_neighbors(_context, c)) \
562562
panic();\
563563
} while(false)
564564
#else

cores/esp8266/umm_malloc/umm_poison.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ static void *get_unpoisoned( void *v_ptr ) {
135135
umm_heap_context_t *_context = umm_get_ptr_context( v_ptr );
136136
if (NULL == _context) {
137137
panic();
138-
return NULL:
138+
return NULL;
139139
}
140140
/* Figure out which block we're in. Note the use of truncated division... */
141141
c = (((char *)ptr)-(char *)(&(_context->heap[0])))/sizeof(umm_block);

libraries/esp8266/examples/MMU48K/MMU48K.ino

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,17 +21,18 @@ static inline char get ## name(void *o) { \
2121
#if (MMU_IRAM_SIZE > 32*1024)
2222
uint32_t gobble[4 * 1024] IRAM_ATTR;
2323
constexpr size_t gobble_sz = sizeof(gobble);
24-
#endif
25-
26-
#ifdef MMU_SEC_HEAP
24+
#elif defined(MMU_SEC_HEAP)
2725
uint32_t *gobble;
2826
size_t gobble_sz;
27+
#else
28+
uint32_t gobble[256] IRAM_ATTR;
29+
constexpr size_t gobble_sz = sizeof(gobble);
2930
#endif
3031

3132
bool isValid(uint32_t *probe) {
3233
bool rc = true;
3334
if (NULL == probe) {
34-
ets_uart_printf("\nNULL memory pointer %p ...\n", probe);
35+
ets_uart_printf("\nNULL memory pointer %p ...\n", probe);
3536
return false;
3637
}
3738

@@ -156,6 +157,7 @@ void setup() {
156157
}
157158

158159
int* nullPointer = NULL;
160+
159161
char *probe_b = (char *)gobble;
160162
short *probe_s = (short *)((uintptr_t)gobble);
161163
char *probe_c = (char *)0x40110000;

libraries/esp8266/examples/irammem/irammem.ino

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/*
22
This sketch assumes you have selected IRAM as a Second Heap from
33
the Arduino IDE tools menu.
4-
*/
4+
*/
55

66
#include <ESP8266WiFi.h>
77
#include <umm_malloc/umm_malloc.h>

tests/host/common/MockEsp.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,11 @@ uint32_t EspClass::getCycleCount()
227227
return (((uint64_t)t.tv_sec) * 1000000 + t.tv_usec) * (F_CPU / 1000000);
228228
}
229229

230-
void EspClass::setInternalHeap()
230+
void EspClass::setDramHeap()
231+
{
232+
}
233+
234+
void EspClass::setIramHeap()
231235
{
232236
}
233237

0 commit comments

Comments
 (0)