Backported kernel debuggers info record from 2.5.1.

git-svn-id: svn://svn.code.sf.net/p/chibios/svn/branches/stable_2.4.x@4954 35acf78f-673a-0410-8e92-d51de3d6d3f4
This commit is contained in:
gdisirio 2012-12-23 10:07:22 +00:00
parent ab838f9021
commit 2ab425acf9
4 changed files with 81 additions and 2 deletions

View File

@ -37,6 +37,33 @@
#define _CHREGISTRY_H_ #define _CHREGISTRY_H_
#if CH_USE_REGISTRY || defined(__DOXYGEN__) #if CH_USE_REGISTRY || defined(__DOXYGEN__)
/**
* @brief ChibiOS/RT memory signature record.
*/
typedef struct {
char ch_identifier[4]; /**< @brief Always set to "main". */
uint8_t ch_zero; /**< @brief Must be zero. */
uint8_t ch_size; /**< @brief Size of this structure. */
uint16_t ch_version; /**< @brief Encoded ChibiOS/RT version. */
uint8_t ch_ptrsize; /**< @brief Size of a pointer. */
uint8_t ch_timesize; /**< @brief Size of a @p systime_t. */
uint8_t ch_threadsize; /**< @brief Size of a @p Thread struct. */
uint8_t cf_off_prio; /**< @brief Offset of @p p_prio field. */
uint8_t cf_off_ctx; /**< @brief Offset of @p p_ctx field. */
uint8_t cf_off_newer; /**< @brief Offset of @p p_newer field. */
uint8_t cf_off_older; /**< @brief Offset of @p p_older field. */
uint8_t cf_off_name; /**< @brief Offset of @p p_name field. */
uint8_t cf_off_stklimit; /**< @brief Offset of @p p_stklimit
field. */
uint8_t cf_off_state; /**< @brief Offset of @p p_state field. */
uint8_t cf_off_flags; /**< @brief Offset of @p p_flags field. */
uint8_t cf_off_refs; /**< @brief Offset of @p p_refs field. */
uint8_t cf_off_preempt; /**< @brief Offset of @p p_preempt
field. */
uint8_t cf_off_time; /**< @brief Offset of @p p_time field. */
} chdebug_t;
/** /**
* @name Macro Functions * @name Macro Functions
* @{ * @{
@ -96,6 +123,7 @@
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
#endif #endif
extern ROMCONST chdebug_t ch_debug;
Thread *chRegFirstThread(void); Thread *chRegFirstThread(void);
Thread *chRegNextThread(Thread *tp); Thread *chRegNextThread(Thread *tp);
#ifdef __cplusplus #ifdef __cplusplus

View File

@ -57,6 +57,51 @@
#if CH_USE_REGISTRY || defined(__DOXYGEN__) #if CH_USE_REGISTRY || defined(__DOXYGEN__)
#define _offsetof(st, m) \
((size_t)((char *)&((st *)0)->m - (char *)0))
/*
* OS signature in ROM plus debug-related information.
*/
ROMCONST chdebug_t ch_debug = {
"main",
(uint8_t)0,
(uint8_t)sizeof (chdebug_t),
(uint16_t)((CH_KERNEL_MAJOR << 11) |
(CH_KERNEL_MINOR << 6) |
(CH_KERNEL_PATCH) << 0),
(uint8_t)sizeof (void *),
(uint8_t)sizeof (systime_t),
(uint8_t)sizeof (Thread),
(uint8_t)_offsetof(Thread, p_prio),
(uint8_t)_offsetof(Thread, p_ctx),
(uint8_t)_offsetof(Thread, p_newer),
(uint8_t)_offsetof(Thread, p_older),
(uint8_t)_offsetof(Thread, p_name),
#if CH_DBG_ENABLE_STACK_CHECK
(uint8_t)_offsetof(Thread, p_stklimit),
#else
(uint8_t)0,
#endif
(uint8_t)_offsetof(Thread, p_state),
(uint8_t)_offsetof(Thread, p_flags),
#if CH_USE_DYNAMIC
(uint8_t)_offsetof(Thread, p_refs),
#else
(uint8_t)0,
#endif
#if CH_TIME_QUANTUM > 0
(uint8_t)_offsetof(Thread, p_preempt),
#else
(uint8_t)0,
#endif
#if CH_DBG_THREADS_PROFILING
(uint8_t)_offsetof(Thread, p_time)
#else
(uint8_t)0
#endif
};
/** /**
* @brief Returns the first thread in the system. * @brief Returns the first thread in the system.
* @details Returns the most ancient thread in the system, usually this is * @details Returns the most ancient thread in the system, usually this is

View File

@ -43,7 +43,9 @@
#include "ch.h" #include "ch.h"
#if !CH_NO_IDLE_THREAD || defined(__DOXYGEN__) #if !CH_NO_IDLE_THREAD || defined(__DOXYGEN__)
/* Idle thread working area.*/ /**
* @brief Idle thread working area.
*/
WORKING_AREA(_idle_thread_wa, PORT_IDLE_THREAD_STACK_SIZE); WORKING_AREA(_idle_thread_wa, PORT_IDLE_THREAD_STACK_SIZE);
/** /**
@ -108,7 +110,9 @@ void chSysInit(void) {
#endif #endif
chSysEnable(); chSysEnable();
chRegSetThreadName("main"); /* Note, &ch_debug points to the string "main" if the registry is
active, else the parameter is ignored.*/
chRegSetThreadName((const char *)&ch_debug);
#if !CH_NO_IDLE_THREAD #if !CH_NO_IDLE_THREAD
/* This thread has the lowest priority in the system, its role is just to /* This thread has the lowest priority in the system, its role is just to

View File

@ -79,6 +79,8 @@
***************************************************************************** *****************************************************************************
*** 2.4.3 *** *** 2.4.3 ***
- NEW: Added memory signature record to the registry in order to simplify
the implementation of ad-hoc debuggers.
- FIX: Fixed warning in STM32 ICU driver using IAR compiler (bug 3598177). - FIX: Fixed warning in STM32 ICU driver using IAR compiler (bug 3598177).
- FIX: Fixed typo in chOQGetEmptyI() macro (bug 3595910). - FIX: Fixed typo in chOQGetEmptyI() macro (bug 3595910).
- FIX: Fixed possible false detect of loaded prescaler in RTCv1 driver (bug - FIX: Fixed possible false detect of loaded prescaler in RTCv1 driver (bug