support stm8
1. see: TencentOS-tiny\board\STM8L052R8T6\IAR\hello_world 2. compile/debug/run with IAR for STM8
This commit is contained in:
@@ -62,25 +62,25 @@ __API__ cpu_hrtimer_t tos_cpu_hrtimer_read(void);
|
||||
|
||||
#endif
|
||||
|
||||
__KERNEL__ void cpu_init(void);
|
||||
__KNL__ void cpu_init(void);
|
||||
|
||||
__KERNEL__ void cpu_reset(void);
|
||||
__KNL__ void cpu_reset(void);
|
||||
|
||||
__KERNEL__ void cpu_systick_init(k_cycle_t cycle_per_tick);
|
||||
__KNL__ void cpu_systick_init(k_cycle_t cycle_per_tick);
|
||||
|
||||
__KERNEL__ void cpu_sched_start(void);
|
||||
__KNL__ void cpu_sched_start(void);
|
||||
|
||||
__KERNEL__ void cpu_context_switch(void);
|
||||
__KNL__ void cpu_context_switch(void);
|
||||
|
||||
__KERNEL__ void cpu_irq_context_switch(void);
|
||||
__KNL__ void cpu_irq_context_switch(void);
|
||||
|
||||
#if TOS_CFG_TASK_STACK_DRAUGHT_DEPTH_DETACT_EN > 0u
|
||||
|
||||
__KERNEL__ k_err_t cpu_task_stack_draught_depth(k_stack_t *stk_base, size_t stk_size, int *depth);
|
||||
__KNL__ k_err_t cpu_task_stack_draught_depth(k_stack_t *stk_base, size_t stk_size, int *depth);
|
||||
|
||||
#endif
|
||||
|
||||
__KERNEL__ k_stack_t *cpu_task_stk_init(void *entry,
|
||||
__KNL__ k_stack_t *cpu_task_stk_init(void *entry,
|
||||
void *arg,
|
||||
void *exit,
|
||||
k_stack_t *stk_base,
|
||||
@@ -88,29 +88,29 @@ __KERNEL__ k_stack_t *cpu_task_stk_init(void *entry,
|
||||
|
||||
#if TOS_CFG_TICKLESS_EN > 0u
|
||||
|
||||
__KERNEL__ void cpu_systick_resume(void);
|
||||
__KNL__ void cpu_systick_resume(void);
|
||||
|
||||
__KERNEL__ void cpu_systick_suspend(void);
|
||||
__KNL__ void cpu_systick_suspend(void);
|
||||
|
||||
__KERNEL__ void cpu_systick_reload_reset(void);
|
||||
__KNL__ void cpu_systick_reload_reset(void);
|
||||
|
||||
__KERNEL__ void cpu_systick_pending_reset(void);
|
||||
__KNL__ void cpu_systick_pending_reset(void);
|
||||
|
||||
__KERNEL__ k_time_t cpu_systick_max_delay_millisecond(void);
|
||||
__KNL__ k_time_t cpu_systick_max_delay_millisecond(void);
|
||||
|
||||
__KERNEL__ void cpu_systick_expires_set(k_time_t millisecond);
|
||||
__KNL__ void cpu_systick_expires_set(k_time_t millisecond);
|
||||
|
||||
__KERNEL__ void cpu_systick_reset(void);
|
||||
__KNL__ void cpu_systick_reset(void);
|
||||
|
||||
#endif
|
||||
|
||||
#if TOS_CFG_PWR_MGR_EN > 0u
|
||||
|
||||
__KERNEL__ void cpu_sleep_mode_enter(void);
|
||||
__KNL__ void cpu_sleep_mode_enter(void);
|
||||
|
||||
__KERNEL__ void cpu_stop_mode_enter(void);
|
||||
__KNL__ void cpu_stop_mode_enter(void);
|
||||
|
||||
__KERNEL__ void cpu_standby_mode_enter(void);
|
||||
__KNL__ void cpu_standby_mode_enter(void);
|
||||
|
||||
#endif
|
||||
|
||||
@@ -118,11 +118,11 @@ __KERNEL__ void cpu_standby_mode_enter(void);
|
||||
|
||||
#if defined (TOS_CFG_CPU_ARM_FPU_EN) && (TOS_CFG_CPU_ARM_FPU_EN == 1U)
|
||||
|
||||
__KERNEL__ void cpu_flush_fpu(void);
|
||||
__KNL__ void cpu_flush_fpu(void);
|
||||
|
||||
#endif /* TOS_CFG_CPU_ARM_FPU_EN */
|
||||
|
||||
__KERNEL__ void cpu_fault_diagnosis(void);
|
||||
__KNL__ void cpu_fault_diagnosis(void);
|
||||
|
||||
#endif
|
||||
|
||||
|
@@ -18,17 +18,13 @@
|
||||
#ifndef _TOS_CPU_DEF_H_
|
||||
#define _TOS_CPU_DEF_H_
|
||||
|
||||
enum CPU_WORD_SIZE {
|
||||
CPU_WORD_SIZE_08,
|
||||
CPU_WORD_SIZE_16,
|
||||
CPU_WORD_SIZE_32,
|
||||
CPU_WORD_SIZE_64,
|
||||
};
|
||||
#define CPU_WORD_SIZE_08 1
|
||||
#define CPU_WORD_SIZE_16 2
|
||||
#define CPU_WORD_SIZE_32 3
|
||||
#define CPU_WORD_SIZE_64 4
|
||||
|
||||
enum CPU_STK_GROWTH {
|
||||
CPU_STK_GROWTH_ASCENDING,
|
||||
CPU_STK_GROWTH_DESCENDING,
|
||||
};
|
||||
#define CPU_STK_GROWTH_ASCENDING 1
|
||||
#define CPU_STK_GROWTH_DESCENDING 2
|
||||
|
||||
#endif /* _TOS_CPU_DEF_H_ */
|
||||
|
||||
|
@@ -226,9 +226,9 @@ __STATIC_INLINE__ cpu_addr_t fault_msp_limit(void)
|
||||
|
||||
__API__ void tos_fault_log_writer_set(k_fault_log_writer_t log_writer);
|
||||
|
||||
__KERNEL__ int fault_default_log_writer(const char *format, ...);
|
||||
__KNL__ int fault_default_log_writer(const char *format, ...);
|
||||
|
||||
__KERNEL__ void fault_backtrace(cpu_addr_t lr, fault_exc_frame_t *frame);
|
||||
__KNL__ void fault_backtrace(cpu_addr_t lr, fault_exc_frame_t *frame);
|
||||
|
||||
#endif
|
||||
|
||||
|
@@ -92,15 +92,15 @@ typedef struct gic_data_st {
|
||||
gic_cpu_t *cpu;
|
||||
} gic_data_t;
|
||||
|
||||
__KERNEL__ uint32_t gic_interrupt_id_get(uint32_t gic_nr);
|
||||
__KNL__ uint32_t gic_interrupt_id_get(uint32_t gic_nr);
|
||||
|
||||
__KERNEL__ void gic_interrupt_end(uint32_t gic_nr, uint32_t vector);
|
||||
__KNL__ void gic_interrupt_end(uint32_t gic_nr, uint32_t vector);
|
||||
|
||||
__KERNEL__ int gic_init(uint32_t gic_nr);
|
||||
__KNL__ int gic_init(uint32_t gic_nr);
|
||||
|
||||
__KERNEL__ void gic_interrupt_enable(uint32_t gic_nr, uint32_t vector);
|
||||
__KNL__ void gic_interrupt_enable(uint32_t gic_nr, uint32_t vector);
|
||||
|
||||
__KERNEL__ void gic_interrupt_disable(uint32_t gic_nr, uint32_t vector);
|
||||
__KNL__ void gic_interrupt_disable(uint32_t gic_nr, uint32_t vector);
|
||||
|
||||
#endif /* _TOS_GIC_H_ */
|
||||
|
||||
|
@@ -51,15 +51,15 @@ typedef struct int_frame_st {
|
||||
cpu_data_t spsr;
|
||||
} int_frame_t;
|
||||
|
||||
__KERNEL__ void interrupt_irq(int_frame_t *int_frame);
|
||||
__KNL__ void interrupt_irq(int_frame_t *int_frame);
|
||||
|
||||
__KERNEL__ int interrupt_init(void);
|
||||
__KNL__ int interrupt_init(void);
|
||||
|
||||
__API__ int tos_interrupt_handler_register(uint32_t vector, int_handler_t handler, void *arg);
|
||||
__API__ int tos_interrupt_handler_register(uint32_t vector, int_handler_t handler, void *arg);
|
||||
|
||||
__API__ void tos_interrupt_enable(uint32_t vector);
|
||||
__API__ void tos_interrupt_enable(uint32_t vector);
|
||||
|
||||
__API__ void tos_interrupt_disable(uint32_t vector);
|
||||
__API__ void tos_interrupt_disable(uint32_t vector);
|
||||
|
||||
#endif /* _TOS_INTERRUPT_H_ */
|
||||
|
||||
|
@@ -76,7 +76,7 @@ __API__ void tos_cpu_cpsr_restore(cpu_cpsr_t cpsr)
|
||||
port_cpsr_restore(cpsr);
|
||||
}
|
||||
|
||||
__KERNEL__ void cpu_init(void)
|
||||
__KNL__ void cpu_init(void)
|
||||
{
|
||||
k_cpu_cycle_per_tick = TOS_CFG_CPU_CLOCK / k_cpu_tick_per_second;
|
||||
|
||||
@@ -84,27 +84,27 @@ __KERNEL__ void cpu_init(void)
|
||||
chip_init();
|
||||
}
|
||||
|
||||
__KERNEL__ void cpu_reset(void)
|
||||
__KNL__ void cpu_reset(void)
|
||||
{
|
||||
port_cpu_reset();
|
||||
}
|
||||
|
||||
__KERNEL__ void cpu_sched_start(void)
|
||||
__KNL__ void cpu_sched_start(void)
|
||||
{
|
||||
port_sched_start();
|
||||
}
|
||||
|
||||
__KERNEL__ void cpu_context_switch(void)
|
||||
__KNL__ void cpu_context_switch(void)
|
||||
{
|
||||
port_context_switch();
|
||||
}
|
||||
|
||||
__KERNEL__ void cpu_irq_context_switch(void)
|
||||
__KNL__ void cpu_irq_context_switch(void)
|
||||
{
|
||||
port_irq_context_switch();
|
||||
}
|
||||
|
||||
__KERNEL__ void cpu_systick_init(k_cycle_t cycle_per_tick)
|
||||
__KNL__ void cpu_systick_init(k_cycle_t cycle_per_tick)
|
||||
{
|
||||
port_systick_priority_set(TOS_CFG_CPU_SYSTICK_PRIO);
|
||||
port_systick_config(cycle_per_tick);
|
||||
@@ -129,7 +129,7 @@ __STATIC_INLINE__ void cpu_systick_reload(k_cycle_t cycle_per_tick)
|
||||
*
|
||||
* @return None
|
||||
*/
|
||||
__KERNEL__ void cpu_systick_resume(void)
|
||||
__KNL__ void cpu_systick_resume(void)
|
||||
{
|
||||
port_systick_resume();
|
||||
}
|
||||
@@ -139,17 +139,17 @@ __KERNEL__ void cpu_systick_resume(void)
|
||||
*
|
||||
* @return None
|
||||
*/
|
||||
__KERNEL__ void cpu_systick_suspend(void)
|
||||
__KNL__ void cpu_systick_suspend(void)
|
||||
{
|
||||
port_systick_suspend();
|
||||
}
|
||||
|
||||
__KERNEL__ k_time_t cpu_systick_max_delay_millisecond(void)
|
||||
__KNL__ k_time_t cpu_systick_max_delay_millisecond(void)
|
||||
{
|
||||
return port_systick_max_delay_millisecond();
|
||||
}
|
||||
|
||||
__KERNEL__ void cpu_systick_expires_set(k_time_t millisecond)
|
||||
__KNL__ void cpu_systick_expires_set(k_time_t millisecond)
|
||||
{
|
||||
k_cycle_t cycles;
|
||||
|
||||
@@ -158,12 +158,12 @@ __KERNEL__ void cpu_systick_expires_set(k_time_t millisecond)
|
||||
cpu_systick_reload(cycles - 12); /* interrupt delay */
|
||||
}
|
||||
|
||||
__KERNEL__ void cpu_systick_pending_reset(void)
|
||||
__KNL__ void cpu_systick_pending_reset(void)
|
||||
{
|
||||
port_systick_pending_reset();
|
||||
}
|
||||
|
||||
__KERNEL__ void cpu_systick_reset(void)
|
||||
__KNL__ void cpu_systick_reset(void)
|
||||
{
|
||||
cpu_systick_reload(k_cpu_cycle_per_tick);
|
||||
}
|
||||
@@ -172,24 +172,24 @@ __KERNEL__ void cpu_systick_reset(void)
|
||||
|
||||
#if TOS_CFG_PWR_MGR_EN > 0u
|
||||
|
||||
__KERNEL__ void cpu_sleep_mode_enter(void)
|
||||
__KNL__ void cpu_sleep_mode_enter(void)
|
||||
{
|
||||
port_sleep_mode_enter();
|
||||
}
|
||||
|
||||
__KERNEL__ void cpu_stop_mode_enter(void)
|
||||
__KNL__ void cpu_stop_mode_enter(void)
|
||||
{
|
||||
port_stop_mode_enter();
|
||||
}
|
||||
|
||||
__KERNEL__ void cpu_standby_mode_enter(void)
|
||||
__KNL__ void cpu_standby_mode_enter(void)
|
||||
{
|
||||
port_standby_mode_enter();
|
||||
}
|
||||
|
||||
#endif /* TOS_CFG_PWR_MGR_EN */
|
||||
|
||||
__KERNEL__ k_stack_t *cpu_task_stk_init(void *entry,
|
||||
__KNL__ k_stack_t *cpu_task_stk_init(void *entry,
|
||||
void *arg,
|
||||
void *exit,
|
||||
k_stack_t *stk_base,
|
||||
@@ -241,7 +241,7 @@ __KERNEL__ k_stack_t *cpu_task_stk_init(void *entry,
|
||||
|
||||
#if TOS_CFG_TASK_STACK_DRAUGHT_DEPTH_DETACT_EN > 0u
|
||||
|
||||
__KERNEL__ k_err_t cpu_task_stack_draught_depth(k_stack_t *stk_base, size_t stk_size, int *depth)
|
||||
__KNL__ k_err_t cpu_task_stack_draught_depth(k_stack_t *stk_base, size_t stk_size, int *depth)
|
||||
{
|
||||
uint8_t *slot;
|
||||
uint8_t *sp, *bp;
|
||||
@@ -271,13 +271,13 @@ __KERNEL__ k_err_t cpu_task_stack_draught_depth(k_stack_t *stk_base, size_t stk_
|
||||
#if TOS_CFG_FAULT_BACKTRACE_EN > 0u
|
||||
|
||||
#if defined (TOS_CFG_CPU_ARM_FPU_EN) && (TOS_CFG_CPU_ARM_FPU_EN == 1U)
|
||||
__KERNEL__ void cpu_flush_fpu(void)
|
||||
__KNL__ void cpu_flush_fpu(void)
|
||||
{
|
||||
(void)__get_FPSCR();
|
||||
}
|
||||
#endif
|
||||
|
||||
__KERNEL__ void cpu_fault_diagnosis(void)
|
||||
__KNL__ void cpu_fault_diagnosis(void)
|
||||
{
|
||||
port_fault_diagnosis();
|
||||
}
|
||||
|
@@ -222,7 +222,7 @@ __STATIC__ void fault_gather_information(cpu_data_t lr, fault_exc_frame_t *frame
|
||||
info->is_stk_ovrf = (info->sp_before_fault < info->stack_start || info->sp_before_fault > info->stack_limit);
|
||||
}
|
||||
|
||||
__KERNEL__ int fault_default_log_writer(const char *format, ...)
|
||||
__KNL__ int fault_default_log_writer(const char *format, ...)
|
||||
{
|
||||
int len;
|
||||
va_list ap;
|
||||
@@ -239,7 +239,7 @@ __API__ void tos_fault_log_writer_set(k_fault_log_writer_t log_writer)
|
||||
k_fault_log_writer = log_writer;
|
||||
}
|
||||
|
||||
__KERNEL__ void fault_backtrace(cpu_addr_t lr, fault_exc_frame_t *frame)
|
||||
__KNL__ void fault_backtrace(cpu_addr_t lr, fault_exc_frame_t *frame)
|
||||
{
|
||||
fault_info_t info;
|
||||
|
||||
|
@@ -81,7 +81,7 @@ __STATIC_INLINE__ gic_data_t *gic_get(uint32_t gic_nr)
|
||||
return K_NULL;
|
||||
}
|
||||
|
||||
__KERNEL__ uint32_t gic_interrupt_id_get(uint32_t gic_nr)
|
||||
__KNL__ uint32_t gic_interrupt_id_get(uint32_t gic_nr)
|
||||
{
|
||||
gic_data_t *gic = gic_get(gic_nr);
|
||||
|
||||
@@ -93,7 +93,7 @@ __KERNEL__ uint32_t gic_interrupt_id_get(uint32_t gic_nr)
|
||||
return (uint32_t)-1;
|
||||
}
|
||||
|
||||
__KERNEL__ void gic_interrupt_end(uint32_t gic_nr, uint32_t vector)
|
||||
__KNL__ void gic_interrupt_end(uint32_t gic_nr, uint32_t vector)
|
||||
{
|
||||
gic_data_t *gic = gic_get(gic_nr);
|
||||
|
||||
@@ -102,7 +102,7 @@ __KERNEL__ void gic_interrupt_end(uint32_t gic_nr, uint32_t vector)
|
||||
}
|
||||
}
|
||||
|
||||
__KERNEL__ int gic_init(uint32_t gic_nr)
|
||||
__KNL__ int gic_init(uint32_t gic_nr)
|
||||
{
|
||||
gic_data_t *gic;
|
||||
|
||||
@@ -119,7 +119,7 @@ __KERNEL__ int gic_init(uint32_t gic_nr)
|
||||
return 0;
|
||||
}
|
||||
|
||||
__KERNEL__ void gic_interrupt_enable(uint32_t gic_nr, uint32_t vector)
|
||||
__KNL__ void gic_interrupt_enable(uint32_t gic_nr, uint32_t vector)
|
||||
{
|
||||
int reg;
|
||||
uint32_t mask;
|
||||
@@ -134,7 +134,7 @@ __KERNEL__ void gic_interrupt_enable(uint32_t gic_nr, uint32_t vector)
|
||||
}
|
||||
}
|
||||
|
||||
__KERNEL__ void gic_interrupt_disable(uint32_t gic_nr, uint32_t vector)
|
||||
__KNL__ void gic_interrupt_disable(uint32_t gic_nr, uint32_t vector)
|
||||
{
|
||||
int reg;
|
||||
uint32_t mask;
|
||||
|
@@ -19,7 +19,7 @@
|
||||
|
||||
__STATIC__ int_handle_t int_handle_table[INTERRUPT_MAX];
|
||||
|
||||
__KERNEL__ void interrupt_irq(int_frame_t *int_frame)
|
||||
__KNL__ void interrupt_irq(int_frame_t *int_frame)
|
||||
{
|
||||
uint32_t vector;
|
||||
int_handle_t *handle;
|
||||
@@ -38,7 +38,7 @@ __KERNEL__ void interrupt_irq(int_frame_t *int_frame)
|
||||
gic_interrupt_end(0u, vector);
|
||||
}
|
||||
|
||||
__KERNEL__ int interrupt_init(void)
|
||||
__KNL__ int interrupt_init(void)
|
||||
{
|
||||
gic_init(0u);
|
||||
return 0;
|
||||
|
@@ -18,7 +18,7 @@
|
||||
#include "tos_k.h"
|
||||
#include "imx6ul.h"
|
||||
|
||||
__KERNEL__ void chip_init(void)
|
||||
__KNL__ void chip_init(void)
|
||||
{
|
||||
clock_init();
|
||||
clock_enable();
|
||||
|
Reference in New Issue
Block a user