Improved testing procedures for RT. Improved simulator port for RT.
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@7879 35acf78f-673a-0410-8e92-d51de3d6d3f4
This commit is contained in:
parent
1f0dc76613
commit
234d88f6d0
|
@ -1,7 +1,5 @@
|
||||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||||
<?fileVersion 4.0.0?>
|
<?fileVersion 4.0.0?><cproject storage_type_id="org.eclipse.cdt.core.XmlProjectDescriptionStorage">
|
||||||
|
|
||||||
<cproject storage_type_id="org.eclipse.cdt.core.XmlProjectDescriptionStorage">
|
|
||||||
<storageModule moduleId="org.eclipse.cdt.core.settings">
|
<storageModule moduleId="org.eclipse.cdt.core.settings">
|
||||||
<cconfiguration id="0.759990224">
|
<cconfiguration id="0.759990224">
|
||||||
<storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="0.759990224" moduleId="org.eclipse.cdt.core.settings" name="Default">
|
<storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="0.759990224" moduleId="org.eclipse.cdt.core.settings" name="Default">
|
||||||
|
@ -48,4 +46,5 @@
|
||||||
</scannerConfigBuildInfo>
|
</scannerConfigBuildInfo>
|
||||||
</storageModule>
|
</storageModule>
|
||||||
<storageModule moduleId="org.eclipse.cdt.core.LanguageSettingsProviders"/>
|
<storageModule moduleId="org.eclipse.cdt.core.LanguageSettingsProviders"/>
|
||||||
|
<storageModule moduleId="refreshScope"/>
|
||||||
</cproject>
|
</cproject>
|
||||||
|
|
|
@ -25,6 +25,8 @@
|
||||||
* @{
|
* @{
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include <windows.h>
|
||||||
|
|
||||||
#include "ch.h"
|
#include "ch.h"
|
||||||
|
|
||||||
/*===========================================================================*/
|
/*===========================================================================*/
|
||||||
|
@ -35,6 +37,9 @@
|
||||||
/* Module exported variables. */
|
/* Module exported variables. */
|
||||||
/*===========================================================================*/
|
/*===========================================================================*/
|
||||||
|
|
||||||
|
bool port_isr_context_flag;
|
||||||
|
syssts_t port_irq_sts;
|
||||||
|
|
||||||
/*===========================================================================*/
|
/*===========================================================================*/
|
||||||
/* Module local types. */
|
/* Module local types. */
|
||||||
/*===========================================================================*/
|
/*===========================================================================*/
|
||||||
|
@ -98,4 +103,18 @@ void _port_thread_start(msg_t (*pf)(void *), void *p) {
|
||||||
while(1);
|
while(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Returns the current value of the realtime counter.
|
||||||
|
*
|
||||||
|
* @return The realtime counter value.
|
||||||
|
*/
|
||||||
|
rtcnt_t port_rt_get_counter_value(void) {
|
||||||
|
LARGE_INTEGER n;
|
||||||
|
|
||||||
|
QueryPerformanceCounter(&n);
|
||||||
|
|
||||||
|
return (rtcnt_t)(n.QuadPart / 1000LL);
|
||||||
|
}
|
||||||
|
|
||||||
/** @} */
|
/** @} */
|
||||||
|
|
|
@ -60,7 +60,7 @@
|
||||||
/**
|
/**
|
||||||
* @brief This port supports a realtime counter.
|
* @brief This port supports a realtime counter.
|
||||||
*/
|
*/
|
||||||
#define PORT_SUPPORTS_RT FALSE
|
#define PORT_SUPPORTS_RT TRUE
|
||||||
|
|
||||||
/*===========================================================================*/
|
/*===========================================================================*/
|
||||||
/* Module pre-compile time settings. */
|
/* Module pre-compile time settings. */
|
||||||
|
@ -204,14 +204,19 @@ struct context {
|
||||||
* @details This macro must be inserted at the start of all IRQ handlers
|
* @details This macro must be inserted at the start of all IRQ handlers
|
||||||
* enabled to invoke system APIs.
|
* enabled to invoke system APIs.
|
||||||
*/
|
*/
|
||||||
#define PORT_IRQ_PROLOGUE()
|
#define PORT_IRQ_PROLOGUE() { \
|
||||||
|
port_isr_context_flag = true; \
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief IRQ epilogue code.
|
* @brief IRQ epilogue code.
|
||||||
* @details This macro must be inserted at the end of all IRQ handlers
|
* @details This macro must be inserted at the end of all IRQ handlers
|
||||||
* enabled to invoke system APIs.
|
* enabled to invoke system APIs.
|
||||||
*/
|
*/
|
||||||
#define PORT_IRQ_EPILOGUE()
|
#define PORT_IRQ_EPILOGUE() { \
|
||||||
|
port_isr_context_flag = false; \
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief IRQ handler function declaration.
|
* @brief IRQ handler function declaration.
|
||||||
|
@ -231,6 +236,9 @@ struct context {
|
||||||
/* External declarations. */
|
/* External declarations. */
|
||||||
/*===========================================================================*/
|
/*===========================================================================*/
|
||||||
|
|
||||||
|
extern bool port_isr_context_flag;
|
||||||
|
extern syssts_t port_irq_sts;
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
@ -239,6 +247,7 @@ extern "C" {
|
||||||
__attribute__((cdecl, noreturn)) void _port_thread_start(msg_t (*pf)(void *p),
|
__attribute__((cdecl, noreturn)) void _port_thread_start(msg_t (*pf)(void *p),
|
||||||
void *p);
|
void *p);
|
||||||
/*lint -restore*/
|
/*lint -restore*/
|
||||||
|
rtcnt_t port_rt_get_counter_value(void);
|
||||||
void _sim_check_for_interrupts(void);
|
void _sim_check_for_interrupts(void);
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
|
@ -253,6 +262,8 @@ extern "C" {
|
||||||
*/
|
*/
|
||||||
static inline void port_init(void) {
|
static inline void port_init(void) {
|
||||||
|
|
||||||
|
port_irq_sts = (syssts_t)0;
|
||||||
|
port_isr_context_flag = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -262,7 +273,7 @@ static inline void port_init(void) {
|
||||||
*/
|
*/
|
||||||
static inline syssts_t port_get_irq_status(void) {
|
static inline syssts_t port_get_irq_status(void) {
|
||||||
|
|
||||||
return (syssts_t)0;
|
return port_irq_sts;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -276,7 +287,7 @@ static inline syssts_t port_get_irq_status(void) {
|
||||||
*/
|
*/
|
||||||
static inline bool port_irq_enabled(syssts_t sts) {
|
static inline bool port_irq_enabled(syssts_t sts) {
|
||||||
|
|
||||||
return (sts & (syssts_t)1) == (syssts_t)0;
|
return sts == (syssts_t)0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -288,7 +299,7 @@ static inline bool port_irq_enabled(syssts_t sts) {
|
||||||
*/
|
*/
|
||||||
static inline bool port_is_isr_context(void) {
|
static inline bool port_is_isr_context(void) {
|
||||||
|
|
||||||
return false;
|
return port_isr_context_flag;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -297,7 +308,7 @@ static inline bool port_is_isr_context(void) {
|
||||||
*/
|
*/
|
||||||
static inline void port_lock(void) {
|
static inline void port_lock(void) {
|
||||||
|
|
||||||
__asm volatile ("nop");
|
port_irq_sts = (syssts_t)1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -306,7 +317,7 @@ static inline void port_lock(void) {
|
||||||
*/
|
*/
|
||||||
static inline void port_unlock(void) {
|
static inline void port_unlock(void) {
|
||||||
|
|
||||||
__asm volatile ("nop");
|
port_irq_sts = (syssts_t)0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -316,7 +327,7 @@ static inline void port_unlock(void) {
|
||||||
*/
|
*/
|
||||||
static inline void port_lock_from_isr(void) {
|
static inline void port_lock_from_isr(void) {
|
||||||
|
|
||||||
__asm volatile ("nop");
|
port_irq_sts = (syssts_t)1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -326,7 +337,7 @@ static inline void port_lock_from_isr(void) {
|
||||||
*/
|
*/
|
||||||
static inline void port_unlock_from_isr(void) {
|
static inline void port_unlock_from_isr(void) {
|
||||||
|
|
||||||
__asm volatile ("nop");
|
port_irq_sts = (syssts_t)0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -334,7 +345,7 @@ static inline void port_unlock_from_isr(void) {
|
||||||
*/
|
*/
|
||||||
static inline void port_disable(void) {
|
static inline void port_disable(void) {
|
||||||
|
|
||||||
__asm volatile ("nop");
|
port_irq_sts = (syssts_t)1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -342,7 +353,7 @@ static inline void port_disable(void) {
|
||||||
*/
|
*/
|
||||||
static inline void port_suspend(void) {
|
static inline void port_suspend(void) {
|
||||||
|
|
||||||
__asm volatile ("nop");
|
port_irq_sts = (syssts_t)1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -350,7 +361,7 @@ static inline void port_suspend(void) {
|
||||||
*/
|
*/
|
||||||
static inline void port_enable(void) {
|
static inline void port_enable(void) {
|
||||||
|
|
||||||
__asm volatile ("nop");
|
port_irq_sts = (syssts_t)0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -61,8 +61,8 @@
|
||||||
*/
|
*/
|
||||||
void _stats_init(void) {
|
void _stats_init(void) {
|
||||||
|
|
||||||
ch.kernel_stats.n_irq = 0;
|
ch.kernel_stats.n_irq = (ucnt_t)0;
|
||||||
ch.kernel_stats.n_ctxswc = 0;
|
ch.kernel_stats.n_ctxswc = (ucnt_t)0;
|
||||||
chTMObjectInit(&ch.kernel_stats.m_crit_thd);
|
chTMObjectInit(&ch.kernel_stats.m_crit_thd);
|
||||||
chTMObjectInit(&ch.kernel_stats.m_crit_isr);
|
chTMObjectInit(&ch.kernel_stats.m_crit_isr);
|
||||||
}
|
}
|
||||||
|
|
|
@ -136,7 +136,7 @@ clean:
|
||||||
-rm -fR .dep
|
-rm -fR .dep
|
||||||
|
|
||||||
misra:
|
misra:
|
||||||
@lint-nt -v -w3 $(DEFS) pclint/co-gcc.lnt pclint/au-misra3.lnt pclint/waivers.lnt $(INCDIR) $(KERNSRC) &> misra.txt
|
@lint-nt -v -w3 $(DEFS) pclint/co-gcc.lnt pclint/au-misra3.lnt pclint/waivers.lnt $(INCDIR) $(KERNSRC)
|
||||||
|
|
||||||
#
|
#
|
||||||
# Include the dependency files, should be the last of the makefile
|
# Include the dependency files, should be the last of the makefile
|
||||||
|
|
|
@ -153,7 +153,7 @@
|
||||||
* @note The default is @p TRUE.
|
* @note The default is @p TRUE.
|
||||||
*/
|
*/
|
||||||
#if !defined(CH_CFG_USE_TM) || defined(__DOXIGEN__)
|
#if !defined(CH_CFG_USE_TM) || defined(__DOXIGEN__)
|
||||||
#define CH_CFG_USE_TM FALSE
|
#define CH_CFG_USE_TM TRUE
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -18,6 +18,7 @@ function compile() {
|
||||||
clean
|
clean
|
||||||
exit
|
exit
|
||||||
fi
|
fi
|
||||||
|
mv -f buildlog.txt ./reports/${1}_build.txt
|
||||||
echo "OK"
|
echo "OK"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -29,28 +30,29 @@ function execute_test() {
|
||||||
clean
|
clean
|
||||||
exit
|
exit
|
||||||
fi
|
fi
|
||||||
|
mv -f testlog.txt ./reports/${1}_test.txt
|
||||||
echo "OK"
|
echo "OK"
|
||||||
}
|
}
|
||||||
|
|
||||||
function coverage() {
|
function coverage() {
|
||||||
echo -n " * Coverage..."
|
echo -n " * Coverage..."
|
||||||
mkdir coverage 2> /dev/null
|
mkdir reports/${1}_gcov 2> /dev/null
|
||||||
mkdir coverage/$1 2> /dev/null
|
echo "Configuration $2" > gcovlog.txt
|
||||||
echo "Configuration $2" > coverage/$1.txt
|
echo "----------------------------------------------------------------" >> reports/gcovlog.txt
|
||||||
echo "----------------------------------------------------------------" >> coverage/$1.txt
|
if ! make gcov >> gcovlog.txt 2> /dev/null
|
||||||
if ! make gcov >> coverage/$1.txt 2> /dev/null
|
|
||||||
then
|
then
|
||||||
echo "failed"
|
echo "failed"
|
||||||
clean
|
clean
|
||||||
exit
|
exit
|
||||||
fi
|
fi
|
||||||
mv -f *.gcov ./coverage/$1
|
mv -f gcovlog.txt ./reports/${1}_gcov.txt
|
||||||
|
mv -f *.gcov ./reports/${1}_gcov
|
||||||
echo "OK"
|
echo "OK"
|
||||||
}
|
}
|
||||||
|
|
||||||
function misra() {
|
function misra() {
|
||||||
echo -n " * Analysing..."
|
echo -n " * Analysing..."
|
||||||
if ! make misra > misralog.txt
|
if ! make misra > misralog.txt 2> misraerrlog.txt
|
||||||
then
|
then
|
||||||
echo "failed"
|
echo "failed"
|
||||||
clean
|
clean
|
||||||
|
@ -69,8 +71,8 @@ function test() {
|
||||||
XDEFS=$2
|
XDEFS=$2
|
||||||
fi
|
fi
|
||||||
echo $msg
|
echo $msg
|
||||||
compile
|
compile $1
|
||||||
execute_test
|
execute_test $1
|
||||||
coverage $1 "$msg"
|
coverage $1 "$msg"
|
||||||
misra
|
misra
|
||||||
clean
|
clean
|
||||||
|
@ -83,34 +85,39 @@ function partial() {
|
||||||
clean
|
clean
|
||||||
}
|
}
|
||||||
|
|
||||||
|
mkdir reports 2> /dev/null
|
||||||
|
|
||||||
test cfg1 ""
|
test cfg1 ""
|
||||||
test cfg2 "-DCH_CFG_OPTIMIZE_SPEED=FALSE"
|
test cfg2 "-DCH_CFG_OPTIMIZE_SPEED=FALSE"
|
||||||
test cfg3 "-DCH_CFG_TIME_QUANTUM=0"
|
test cfg3 "-DCH_CFG_TIME_QUANTUM=0"
|
||||||
test cfg4 "-DCH_CFG_USE_REGISTRY=FALSE"
|
test cfg4 "-DCH_CFG_USE_REGISTRY=FALSE"
|
||||||
test cfg5 "-DCH_CFG_USE_SEMAPHORES=FALSE -DCH_CFG_USE_MAILBOXES=FALSE"
|
test cfg5 "-DCH_CFG_USE_TM=FALSE"
|
||||||
test cfg6 "-DCH_CFG_USE_SEMAPHORES_PRIORITY=TRUE"
|
test cfg6 "-DCH_CFG_USE_SEMAPHORES=FALSE -DCH_CFG_USE_MAILBOXES=FALSE"
|
||||||
test cfg7 "-DCH_CFG_USE_MUTEXES=FALSE -DCH_CFG_USE_CONDVARS=FALSE"
|
test cfg7 "-DCH_CFG_USE_SEMAPHORES_PRIORITY=TRUE"
|
||||||
test cfg8 "-DCH_CFG_USE_MUTEXES_RECURSIVE=TRUE"
|
test cfg8 "-DCH_CFG_USE_MUTEXES=FALSE -DCH_CFG_USE_CONDVARS=FALSE"
|
||||||
test cfg9 "-DCH_CFG_USE_CONDVARS=FALSE"
|
test cfg9 "-DCH_CFG_USE_MUTEXES_RECURSIVE=TRUE"
|
||||||
test cfg10 "-DCH_CFG_USE_CONDVARS_TIMEOUT=FALSE"
|
test cfg10 "-DCH_CFG_USE_CONDVARS=FALSE"
|
||||||
test cfg11 "-DCH_CFG_USE_EVENTS=FALSE"
|
test cfg11 "-DCH_CFG_USE_CONDVARS_TIMEOUT=FALSE"
|
||||||
test cfg12 "-DCH_CFG_USE_EVENTS_TIMEOUT=FALSE"
|
test cfg12 "-DCH_CFG_USE_EVENTS=FALSE"
|
||||||
test cfg13 "-DCH_CFG_USE_MESSAGES=FALSE"
|
test cfg13 "-DCH_CFG_USE_EVENTS_TIMEOUT=FALSE"
|
||||||
test cfg14 "-DCH_CFG_USE_MESSAGES_PRIORITY=TRUE"
|
test cfg14 "-DCH_CFG_USE_MESSAGES=FALSE"
|
||||||
test cfg15 "-DCH_CFG_USE_MAILBOXES=FALSE"
|
test cfg15 "-DCH_CFG_USE_MESSAGES_PRIORITY=TRUE"
|
||||||
test cfg16 "-DCH_CFG_USE_MEMCORE=FALSE -DCH_CFG_USE_MEMPOOLS=FALSE -DCH_CFG_USE_HEAP=FALSE -DCH_CFG_USE_DYNAMIC=FALSE"
|
test cfg16 "-DCH_CFG_USE_MAILBOXES=FALSE"
|
||||||
test cfg17 "-DCH_CFG_USE_MEMPOOLS=FALSE -DCH_CFG_USE_HEAP=FALSE -DCH_CFG_USE_DYNAMIC=FALSE"
|
test cfg17 "-DCH_CFG_USE_MEMCORE=FALSE -DCH_CFG_USE_MEMPOOLS=FALSE -DCH_CFG_USE_HEAP=FALSE -DCH_CFG_USE_DYNAMIC=FALSE"
|
||||||
test cfg18 "-DCH_CFG_USE_MEMPOOLS=FALSE"
|
test cfg18 "-DCH_CFG_USE_MEMPOOLS=FALSE -DCH_CFG_USE_HEAP=FALSE -DCH_CFG_USE_DYNAMIC=FALSE"
|
||||||
test cfg19 "-DCH_CFG_USE_HEAP=FALSE"
|
test cfg19 "-DCH_CFG_USE_MEMPOOLS=FALSE"
|
||||||
test cfg20 "-DCH_CFG_USE_DYNAMIC=FALSE"
|
test cfg20 "-DCH_CFG_USE_HEAP=FALSE"
|
||||||
#test cfg21 "-DCH_DBG_STATISTICS=TRUE"
|
test cfg21 "-DCH_CFG_USE_DYNAMIC=FALSE"
|
||||||
test cfg22 "-DCH_DBG_SYSTEM_STATE_CHECK=TRUE"
|
test cfg22 "-DCH_DBG_STATISTICS=TRUE"
|
||||||
test cfg23 "-DCH_DBG_ENABLE_CHECKS=TRUE"
|
test cfg23 "-DCH_DBG_SYSTEM_STATE_CHECK=TRUE"
|
||||||
test cfg24 "-DCH_DBG_ENABLE_ASSERTS=TRUE"
|
test cfg24 "-DCH_DBG_ENABLE_CHECKS=TRUE"
|
||||||
test cfg25 "-DCH_DBG_ENABLE_TRACE=TRUE"
|
test cfg25 "-DCH_DBG_ENABLE_ASSERTS=TRUE"
|
||||||
#test cfg26 "-DCH_DBG_ENABLE_STACK_CHECK=TRUE"
|
test cfg26 "-DCH_DBG_ENABLE_TRACE=TRUE"
|
||||||
test cfg27 "-DCH_DBG_FILL_THREADS=TRUE"
|
#test cfg27 "-DCH_DBG_ENABLE_STACK_CHECK=TRUE"
|
||||||
test cfg28 "-DCH_DBG_THREADS_PROFILING=FALSE"
|
test cfg28 "-DCH_DBG_FILL_THREADS=TRUE"
|
||||||
test cfg29 "-DCH_DBG_SYSTEM_STATE_CHECK=TRUE -DCH_DBG_ENABLE_CHECKS=TRUE -DCH_DBG_ENABLE_ASSERTS=TRUE -DCH_DBG_ENABLE_TRACE=TRUE -DCH_DBG_FILL_THREADS=TRUE"
|
test cfg29 "-DCH_DBG_THREADS_PROFILING=FALSE"
|
||||||
|
test cfg30 "-DCH_DBG_SYSTEM_STATE_CHECK=TRUE -DCH_DBG_ENABLE_CHECKS=TRUE -DCH_DBG_ENABLE_ASSERTS=TRUE -DCH_DBG_ENABLE_TRACE=TRUE -DCH_DBG_FILL_THREADS=TRUE"
|
||||||
|
|
||||||
rm *log.txt 2> /dev/null
|
rm *log.txt 2> /dev/null
|
||||||
|
echo
|
||||||
|
echo "Done"
|
||||||
|
|
|
@ -15,7 +15,7 @@ Coverage data is collected during the execution for use by step 3.
|
||||||
Step 3: Coverage
|
Step 3: Coverage
|
||||||
|
|
||||||
The utility gcov is ran on the generate data and the coverage information is
|
The utility gcov is ran on the generate data and the coverage information is
|
||||||
stored in reports under ./coverage.
|
stored in reports under ./reports.
|
||||||
|
|
||||||
Step 4: Analysis
|
Step 4: Analysis
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue