kernel: init: Add nop instruction in main
The main function is just a weak function that should be override by the applications if they need. Just adding a nop instructions to explicitly says that this function does nothing. MISRA-C rule 2.2 Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
This commit is contained in:
parent
a0a63ac344
commit
b82a339813
8 changed files with 61 additions and 0 deletions
|
@ -220,6 +220,15 @@ extern "C" {
|
||||||
#ifndef _ASMLANGUAGE
|
#ifndef _ASMLANGUAGE
|
||||||
/* Typedef for the k_mem_partition attribute*/
|
/* Typedef for the k_mem_partition attribute*/
|
||||||
typedef u32_t k_mem_partition_attr_t;
|
typedef u32_t k_mem_partition_attr_t;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Explicitly nop operation.
|
||||||
|
*/
|
||||||
|
static ALWAYS_INLINE void arch_nop(void)
|
||||||
|
{
|
||||||
|
__asm__ volatile("nop");
|
||||||
|
}
|
||||||
|
|
||||||
#endif /* _ASMLANGUAGE */
|
#endif /* _ASMLANGUAGE */
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
|
|
@ -23,6 +23,15 @@ extern void k_cpu_idle(void);
|
||||||
|
|
||||||
extern u32_t _timer_cycle_get_32(void);
|
extern u32_t _timer_cycle_get_32(void);
|
||||||
#define _arch_k_cycle_get_32() _timer_cycle_get_32()
|
#define _arch_k_cycle_get_32() _timer_cycle_get_32()
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Explicitly nop operation.
|
||||||
|
*/
|
||||||
|
static ALWAYS_INLINE void arch_nop(void)
|
||||||
|
{
|
||||||
|
__asm__ volatile("nop");
|
||||||
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
|
|
@ -201,6 +201,14 @@ enum nios2_exception_cause {
|
||||||
extern u32_t _timer_cycle_get_32(void);
|
extern u32_t _timer_cycle_get_32(void);
|
||||||
#define _arch_k_cycle_get_32() _timer_cycle_get_32()
|
#define _arch_k_cycle_get_32() _timer_cycle_get_32()
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Explicitly nop operation.
|
||||||
|
*/
|
||||||
|
static ALWAYS_INLINE void arch_nop(void)
|
||||||
|
{
|
||||||
|
__asm__ volatile("nop");
|
||||||
|
}
|
||||||
|
|
||||||
#endif /* _ASMLANGUAGE */
|
#endif /* _ASMLANGUAGE */
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
|
|
@ -54,6 +54,14 @@ FUNC_NORETURN void _SysFatalErrorHandler(unsigned int reason,
|
||||||
FUNC_NORETURN void _NanoFatalErrorHandler(unsigned int reason,
|
FUNC_NORETURN void _NanoFatalErrorHandler(unsigned int reason,
|
||||||
const NANO_ESF *esf);
|
const NANO_ESF *esf);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Explicitly nop operation.
|
||||||
|
*/
|
||||||
|
static ALWAYS_INLINE void arch_nop(void)
|
||||||
|
{
|
||||||
|
__asm__ volatile("nop");
|
||||||
|
}
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -115,6 +115,15 @@ static ALWAYS_INLINE void _arch_irq_unlock(unsigned int key)
|
||||||
: "memory");
|
: "memory");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Explicitly nop operation.
|
||||||
|
*/
|
||||||
|
static ALWAYS_INLINE void arch_nop(void)
|
||||||
|
{
|
||||||
|
__asm__ volatile("nop");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
extern u32_t _timer_cycle_get_32(void);
|
extern u32_t _timer_cycle_get_32(void);
|
||||||
#define _arch_k_cycle_get_32() _timer_cycle_get_32()
|
#define _arch_k_cycle_get_32() _timer_cycle_get_32()
|
||||||
|
|
||||||
|
|
|
@ -453,6 +453,15 @@ static ALWAYS_INLINE void _arch_irq_unlock(unsigned int key)
|
||||||
_do_irq_unlock();
|
_do_irq_unlock();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Explicitly nop operation.
|
||||||
|
*/
|
||||||
|
static ALWAYS_INLINE void arch_nop(void)
|
||||||
|
{
|
||||||
|
__asm__ volatile("nop");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The NANO_SOFT_IRQ macro must be used as the value for the @a irq parameter
|
* The NANO_SOFT_IRQ macro must be used as the value for the @a irq parameter
|
||||||
* to NANO_CPU_INT_REGISTER when connecting to an interrupt that does not
|
* to NANO_CPU_INT_REGISTER when connecting to an interrupt that does not
|
||||||
|
|
|
@ -134,6 +134,14 @@ XTENSA_ERR_NORET void _NanoFatalErrorHandler(unsigned int reason,
|
||||||
extern u32_t _timer_cycle_get_32(void);
|
extern u32_t _timer_cycle_get_32(void);
|
||||||
#define _arch_k_cycle_get_32() _timer_cycle_get_32()
|
#define _arch_k_cycle_get_32() _timer_cycle_get_32()
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Explicitly nop operation.
|
||||||
|
*/
|
||||||
|
static ALWAYS_INLINE void arch_nop(void)
|
||||||
|
{
|
||||||
|
__asm__ volatile("nop");
|
||||||
|
}
|
||||||
|
|
||||||
#endif /* !defined(_ASMLANGUAGE) && !defined(__ASSEMBLER__) */
|
#endif /* !defined(_ASMLANGUAGE) && !defined(__ASSEMBLER__) */
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
|
|
|
@ -259,6 +259,7 @@ static void bg_thread_main(void *unused1, void *unused2, void *unused3)
|
||||||
void __weak main(void)
|
void __weak main(void)
|
||||||
{
|
{
|
||||||
/* NOP default main() if the application does not provide one. */
|
/* NOP default main() if the application does not provide one. */
|
||||||
|
arch_nop();
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(CONFIG_MULTITHREADING)
|
#if defined(CONFIG_MULTITHREADING)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue