clean up malloc/free
This commit is contained in:
parent
660ca0724d
commit
781f3ddb81
4 changed files with 15 additions and 39 deletions
|
|
@ -184,15 +184,15 @@ standard names - or at least those used in the unmodified vector table. */
|
|||
|
||||
/** Implementation note: Use this with caution and set this to 1 ONLY for debugging
|
||||
* ----------------------------------------------------------
|
||||
* Set the value of configUSE_DISABLE_TICK_AUTO_CORRECTION_DEBUG to below for enabling or disabling RTOS tick auto correction:
|
||||
* 0. This is default. If the RTC tick interrupt is masked for more than 1 tick by higher priority interrupts, then most likely
|
||||
* one or more RTC ticks are lost. The tick interrupt inside RTOS will detect this and make a correction needed. This is needed
|
||||
* for the RTOS internal timers to be more accurate.
|
||||
* 1. The auto correction for RTOS tick is disabled even though few RTC tick interrupts were lost. This feature is desirable when debugging
|
||||
* the RTOS application and stepping though the code. After stepping when the application is continued in debug mode, the auto-corrections of
|
||||
* RTOS tick might cause asserts. Setting configUSE_DISABLE_TICK_AUTO_CORRECTION_DEBUG to 1 will make RTC and RTOS go out of sync but could be
|
||||
* convenient for debugging.
|
||||
*/
|
||||
* Set the value of configUSE_DISABLE_TICK_AUTO_CORRECTION_DEBUG to below for enabling or disabling RTOS tick auto correction:
|
||||
* 0. This is default. If the RTC tick interrupt is masked for more than 1 tick by higher priority interrupts, then most likely
|
||||
* one or more RTC ticks are lost. The tick interrupt inside RTOS will detect this and make a correction needed. This is needed
|
||||
* for the RTOS internal timers to be more accurate.
|
||||
* 1. The auto correction for RTOS tick is disabled even though few RTC tick interrupts were lost. This feature is desirable when debugging
|
||||
* the RTOS application and stepping though the code. After stepping when the application is continued in debug mode, the auto-corrections of
|
||||
* RTOS tick might cause asserts. Setting configUSE_DISABLE_TICK_AUTO_CORRECTION_DEBUG to 1 will make RTC and RTOS go out of sync but could be
|
||||
* convenient for debugging.
|
||||
*/
|
||||
#define configUSE_DISABLE_TICK_AUTO_CORRECTION_DEBUG 0
|
||||
|
||||
// Sysview is enabled by default at debug level 3
|
||||
|
|
|
|||
|
|
@ -76,16 +76,4 @@ caddr_t _sbrk( int incr )
|
|||
return (caddr_t) prev_heap;
|
||||
}
|
||||
|
||||
void __malloc_lock(struct _reent *ptr)
|
||||
{
|
||||
(void) ptr;
|
||||
vTaskSuspendAll();
|
||||
}
|
||||
|
||||
void __malloc_unlock(struct _reent *ptr)
|
||||
{
|
||||
(void) ptr;
|
||||
xTaskResumeAll();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -50,8 +50,6 @@
|
|||
#include "queue.h"
|
||||
#include "semphr.h"
|
||||
|
||||
#define DEBUG_MALLOC 1
|
||||
|
||||
#define DELAY_FOREVER portMAX_DELAY
|
||||
|
||||
enum
|
||||
|
|
@ -63,19 +61,13 @@ enum
|
|||
TASK_PRIO_HIGHEST = 4,
|
||||
};
|
||||
|
||||
#define ms2tick pdMS_TO_TICKS
|
||||
#define ms2tick pdMS_TO_TICKS
|
||||
#define tick2ms(tck) ( ( ((uint64_t)(tck)) * 1000) / configTICK_RATE_HZ )
|
||||
#define tick2us(tck) ( ( ((uint64_t)(tck)) * 1000000) / configTICK_RATE_HZ )
|
||||
|
||||
#define tick2ms(tck) ( ( ((uint64_t)(tck)) * 1000) / configTICK_RATE_HZ )
|
||||
#define tick2us(tck) ( ( ((uint64_t)(tck)) * 1000000) / configTICK_RATE_HZ )
|
||||
|
||||
#if DEBUG_MALLOC
|
||||
#define rtos_malloc_type(_type) ({ LOG_LV2("MALLOC", #_type " = %d bytes", sizeof(_type)); ((_type*) rtos_malloc(sizeof(_type))); })
|
||||
#else
|
||||
#define rtos_malloc_type(_type) ((_type*) rtos_malloc(sizeof(_type)))
|
||||
#endif
|
||||
|
||||
#define rtos_malloc malloc
|
||||
#define rtos_free free
|
||||
// legacy thread-safe malloc/free
|
||||
#define rtos_malloc malloc
|
||||
#define rtos_free free
|
||||
|
||||
// Visible only with C++
|
||||
#ifdef __cplusplus
|
||||
|
|
|
|||
|
|
@ -36,10 +36,6 @@ delay_ns KEYWORD2
|
|||
analogOversampling KEYWORD2
|
||||
analogReadVDD KEYWORD2
|
||||
|
||||
# RTOS
|
||||
rtos_malloc KEYWORD2
|
||||
rtos_free KEYWORD2
|
||||
|
||||
nrf52_flash_init KEYWORD2
|
||||
nrf52_flash_erase_sector KEYWORD2
|
||||
nrf52_flash_write KEYWORD2
|
||||
|
|
|
|||
Loading…
Reference in a new issue