RT-Thread Getting Started Study Notes-Use of menuconfig Kconfig
RT-Thread Getting Started Study Notes - Familiarizado com a aplicação e versão de memória dinâmica
RT-Thread Getting Started Study Notes-View the address of the thread stack
RT-Thread Getting Started Study Notes-Resolve o problema de falha RT_ASSERT
Prefácio
- No processo de uso da memória dinâmica, repeti um ponteiro rt_free e descobri que não havia erro!
- De repente, descobrir que meu código é anormalmente robusto, a declaração RT_ASSERT trava?
- Após a depuração do software, descobri que desliguei a função RT_ASSERT! !
Ligue a função RT_ASSERT
Analise as razões
- Para ligar:
#define RT_DEBUG
- Por que não abrir :,
#define RT_DEBUG
RT_ASSERT não funciona mais? - A execução do código RT_ASSERT original, rt_assert_handler, depende de: RT_DEBUG
/* rt-thread\src\kservice.c */
#ifdef RT_DEBUG
/* RT_ASSERT(EX)'s hook */
void (*rt_assert_hook)(const char *ex, const char *func, rt_size_t line);
/**
* This function will set a hook function to RT_ASSERT(EX). It will run when the expression is false.
*
* @param hook the hook function
*/
void rt_assert_set_hook(void (*hook)(const char *ex, const char *func, rt_size_t line))
{
rt_assert_hook = hook;
}
/**
* The RT_ASSERT function.
*
* @param ex the assertion condition string
* @param func the function name when assertion.
* @param line the file line number when assertion.
*/
void rt_assert_handler(const char *ex_string, const char *func, rt_size_t line)
{
volatile char dummy = 0;
if (rt_assert_hook == RT_NULL)
{
#ifdef RT_USING_MODULE
if (dlmodule_self())
{
/* close assertion module */
dlmodule_exit(-1);
}
else
#endif
{
rt_kprintf("(%s) assertion failed at function:%s, line number:%d \n", ex_string, func, line);
while (dummy == 0);
}
}
else
{
rt_assert_hook(ex_string, func, line);
}
}
RTM_EXPORT(rt_assert_handler);
#endif /* RT_DEBUG */
problema resolvido
.config - RT-Thread Configuration
RT-Thread Kernel
[*] Enable debugging features --->
- Habilitar: Após #define RT_DEBUG, RT_ASSERT é normal
- Quanto a quando a opção do kernel foi fechada, não tenho certeza. Se você encontrar problemas, você deve perguntar mais, depurar mais e resumir mais.