mirror of
https://github.com/RT-Thread/rt-thread.git
synced 2026-09-25 06:13:56 +08:00
Add memtrace command for memheap.c
This commit is contained in:
+50
-22
@@ -32,6 +32,8 @@
|
||||
* 2019-01-27 Bernard change version number to v4.0.1
|
||||
* 2019-05-17 Bernard change version number to v4.0.2
|
||||
* 2019-12-20 Bernard change version number to v4.0.3
|
||||
* 2020-08-10 Meco Man add macro for struct rt_device_ops
|
||||
* 2020-10-23 Meco Man define maximum value of ipc type
|
||||
*/
|
||||
|
||||
#ifndef __RT_DEF_H__
|
||||
@@ -101,6 +103,13 @@ typedef rt_base_t rt_off_t; /**< Type for offset */
|
||||
#define RT_UINT32_MAX 0xffffffff /**< Maxium number of UINT32 */
|
||||
#define RT_TICK_MAX RT_UINT32_MAX /**< Maxium number of tick */
|
||||
|
||||
/* maximum value of ipc type */
|
||||
#define RT_SEM_VALUE_MAX RT_UINT16_MAX /**< Maxium number of semaphore .value */
|
||||
#define RT_MUTEX_VALUE_MAX RT_UINT16_MAX /**< Maxium number of mutex .value */
|
||||
#define RT_MUTEX_HOLD_MAX RT_UINT8_MAX /**< Maxium number of mutex .hold */
|
||||
#define RT_MB_ENTRY_MAX RT_UINT16_MAX /**< Maxium number of mailbox .entry */
|
||||
#define RT_MQ_ENTRY_MAX RT_UINT16_MAX /**< Maxium number of message queue .entry */
|
||||
|
||||
#if defined (__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050)
|
||||
#define __CLANG_ARM
|
||||
#endif
|
||||
@@ -108,7 +117,7 @@ typedef rt_base_t rt_off_t; /**< Type for offset */
|
||||
/* Compiler Related Definitions */
|
||||
#if defined(__CC_ARM) || defined(__CLANG_ARM) /* ARM Compiler */
|
||||
#include <stdarg.h>
|
||||
#define SECTION(x) __attribute__((section(x)))
|
||||
#define RT_SECTION(x) __attribute__((section(x)))
|
||||
#define RT_UNUSED __attribute__((unused))
|
||||
#define RT_USED __attribute__((used))
|
||||
#define ALIGN(n) __attribute__((aligned(n)))
|
||||
@@ -124,7 +133,7 @@ typedef rt_base_t rt_off_t; /**< Type for offset */
|
||||
|
||||
#elif defined (__IAR_SYSTEMS_ICC__) /* for IAR Compiler */
|
||||
#include <stdarg.h>
|
||||
#define SECTION(x) @ x
|
||||
#define RT_SECTION(x) @ x
|
||||
#define RT_UNUSED
|
||||
#define RT_USED __root
|
||||
#define PRAGMA(x) _Pragma(#x)
|
||||
@@ -145,7 +154,7 @@ typedef rt_base_t rt_off_t; /**< Type for offset */
|
||||
#define va_arg(v,l) __builtin_va_arg(v,l)
|
||||
#endif
|
||||
|
||||
#define SECTION(x) __attribute__((section(x)))
|
||||
#define RT_SECTION(x) __attribute__((section(x)))
|
||||
#define RT_UNUSED __attribute__((unused))
|
||||
#define RT_USED __attribute__((used))
|
||||
#define ALIGN(n) __attribute__((aligned(n)))
|
||||
@@ -154,7 +163,7 @@ typedef rt_base_t rt_off_t; /**< Type for offset */
|
||||
#define RTT_API
|
||||
#elif defined (__ADSPBLACKFIN__) /* for VisualDSP++ Compiler */
|
||||
#include <stdarg.h>
|
||||
#define SECTION(x) __attribute__((section(x)))
|
||||
#define RT_SECTION(x) __attribute__((section(x)))
|
||||
#define RT_UNUSED __attribute__((unused))
|
||||
#define RT_USED __attribute__((used))
|
||||
#define ALIGN(n) __attribute__((aligned(n)))
|
||||
@@ -163,7 +172,7 @@ typedef rt_base_t rt_off_t; /**< Type for offset */
|
||||
#define RTT_API
|
||||
#elif defined (_MSC_VER)
|
||||
#include <stdarg.h>
|
||||
#define SECTION(x)
|
||||
#define RT_SECTION(x)
|
||||
#define RT_UNUSED
|
||||
#define RT_USED
|
||||
#define ALIGN(n) __declspec(align(n))
|
||||
@@ -175,7 +184,7 @@ typedef rt_base_t rt_off_t; /**< Type for offset */
|
||||
/* The way that TI compiler set section is different from other(at least
|
||||
* GCC and MDK) compilers. See ARM Optimizing C/C++ Compiler 5.9.3 for more
|
||||
* details. */
|
||||
#define SECTION(x)
|
||||
#define RT_SECTION(x)
|
||||
#define RT_UNUSED
|
||||
#define RT_USED
|
||||
#define PRAGMA(x) _Pragma(#x)
|
||||
@@ -183,6 +192,18 @@ typedef rt_base_t rt_off_t; /**< Type for offset */
|
||||
#define RT_WEAK
|
||||
#define rt_inline static inline
|
||||
#define RTT_API
|
||||
#elif defined (__TASKING__)
|
||||
|
||||
#include <stdarg.h>
|
||||
#define RT_SECTION(x)
|
||||
#define RT_UNUSED
|
||||
#define RT_USED
|
||||
#define PRAGMA(x) _Pragma(#x)
|
||||
#define ALIGN(n)
|
||||
#define RT_WEAK
|
||||
#define rt_inline static inline
|
||||
#define RTT_API
|
||||
|
||||
#else
|
||||
#error not supported tool chain
|
||||
#endif
|
||||
@@ -201,11 +222,11 @@ typedef int (*init_fn_t)(void);
|
||||
};
|
||||
#define INIT_EXPORT(fn, level) \
|
||||
const char __rti_##fn##_name[] = #fn; \
|
||||
RT_USED const struct rt_init_desc __rt_init_desc_##fn SECTION(".rti_fn." level) = \
|
||||
RT_USED const struct rt_init_desc __rt_init_desc_##fn RT_SECTION(".rti_fn." level) = \
|
||||
{ __rti_##fn##_name, fn};
|
||||
#else
|
||||
#define INIT_EXPORT(fn, level) \
|
||||
RT_USED const init_fn_t __rt_init_##fn SECTION(".rti_fn." level) = fn
|
||||
RT_USED const init_fn_t __rt_init_##fn RT_SECTION(".rti_fn." level) = fn
|
||||
#endif
|
||||
#endif
|
||||
#else
|
||||
@@ -372,20 +393,20 @@ typedef struct rt_object *rt_object_t; /**< Type for kernel obj
|
||||
*/
|
||||
enum rt_object_class_type
|
||||
{
|
||||
RT_Object_Class_Null = 0, /**< The object is not used. */
|
||||
RT_Object_Class_Thread, /**< The object is a thread. */
|
||||
RT_Object_Class_Semaphore, /**< The object is a semaphore. */
|
||||
RT_Object_Class_Mutex, /**< The object is a mutex. */
|
||||
RT_Object_Class_Event, /**< The object is a event. */
|
||||
RT_Object_Class_MailBox, /**< The object is a mail box. */
|
||||
RT_Object_Class_MessageQueue, /**< The object is a message queue. */
|
||||
RT_Object_Class_MemHeap, /**< The object is a memory heap */
|
||||
RT_Object_Class_MemPool, /**< The object is a memory pool. */
|
||||
RT_Object_Class_Device, /**< The object is a device */
|
||||
RT_Object_Class_Timer, /**< The object is a timer. */
|
||||
RT_Object_Class_Module, /**< The object is a module. */
|
||||
RT_Object_Class_Unknown, /**< The object is unknown. */
|
||||
RT_Object_Class_Static = 0x80 /**< The object is a static object. */
|
||||
RT_Object_Class_Null = 0x00, /**< The object is not used. */
|
||||
RT_Object_Class_Thread = 0x01, /**< The object is a thread. */
|
||||
RT_Object_Class_Semaphore = 0x02, /**< The object is a semaphore. */
|
||||
RT_Object_Class_Mutex = 0x03, /**< The object is a mutex. */
|
||||
RT_Object_Class_Event = 0x04, /**< The object is a event. */
|
||||
RT_Object_Class_MailBox = 0x05, /**< The object is a mail box. */
|
||||
RT_Object_Class_MessageQueue = 0x06, /**< The object is a message queue. */
|
||||
RT_Object_Class_MemHeap = 0x07, /**< The object is a memory heap. */
|
||||
RT_Object_Class_MemPool = 0x08, /**< The object is a memory pool. */
|
||||
RT_Object_Class_Device = 0x09, /**< The object is a device. */
|
||||
RT_Object_Class_Timer = 0x0a, /**< The object is a timer. */
|
||||
RT_Object_Class_Module = 0x0b, /**< The object is a module. */
|
||||
RT_Object_Class_Unknown = 0x0c, /**< The object is unknown. */
|
||||
RT_Object_Class_Static = 0x80 /**< The object is a static object. */
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -781,6 +802,9 @@ struct rt_memheap_item
|
||||
|
||||
struct rt_memheap_item *next_free; /**< next free memheap item */
|
||||
struct rt_memheap_item *prev_free; /**< prev free memheap item */
|
||||
#ifdef RT_USING_MEMTRACE
|
||||
rt_uint8_t owner_thread_name[4]; /**< owner thread name */
|
||||
#endif
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -862,6 +886,7 @@ enum rt_device_class_type
|
||||
RT_Device_Class_Miscellaneous, /**< Miscellaneous device */
|
||||
RT_Device_Class_Sensor, /**< Sensor device */
|
||||
RT_Device_Class_Touch, /**< Touch device */
|
||||
RT_Device_Class_PHY, /**< PHY device */
|
||||
RT_Device_Class_Unknown /**< unknown device */
|
||||
};
|
||||
|
||||
@@ -920,6 +945,8 @@ enum rt_device_class_type
|
||||
#define RT_DEVICE_CTRL_RTC_SET_ALARM 0x13 /**< set alarm */
|
||||
|
||||
typedef struct rt_device *rt_device_t;
|
||||
|
||||
#ifdef RT_USING_DEVICE_OPS
|
||||
/**
|
||||
* operations set for device object
|
||||
*/
|
||||
@@ -933,6 +960,7 @@ struct rt_device_ops
|
||||
rt_size_t (*write) (rt_device_t dev, rt_off_t pos, const void *buffer, rt_size_t size);
|
||||
rt_err_t (*control)(rt_device_t dev, int cmd, void *args);
|
||||
};
|
||||
#endif
|
||||
|
||||
/**
|
||||
* WaitQueue structure
|
||||
|
||||
Reference in New Issue
Block a user