diff --git a/pkg/arch/cortex-m/arti.c b/pkg/arch/cortex-m/arti.c new file mode 100644 index 0000000..5bfe3f1 --- /dev/null +++ b/pkg/arch/cortex-m/arti.c @@ -0,0 +1,396 @@ +/* +***Disclaimer: + +* This work (specification and/or software implementation) and the material contained in +* it, as released by AUTOSAR, is for the purpose of information only. AUTOSAR and the +* companies that have contributed to it shall not be liable for any use of the work. +* The material contained in this work is protected by copyright and other types of intellectual +* property rights. The commercial exploitation of the material contained in this +* work requires a license to such intellectual property rights. + +* This work may be utilized or reproduced without any modification, in any form or by +* any means, for informational purposes only. For any other purpose, no part of the work +* may be utilized or reproduced, in any form or by any means, without permission in +* writing from the publisher. + +*The work has been developed for automotive applications only. It has neither been +*developed, nor tested for non-automotive applications. +*The word AUTOSAR and the AUTOSAR logo are registered trademarks. + + +* More details about the Arti Tracing Macro can be +* found at https://www.autosar.org/standards/classic-platform/classic-platform-440/ +* [SWArch] (Document Title: Specification of AUTOSAR Run-Time Interface) +* [AUTOSAR_SWS_ClassicPlatformARTI] + + + +*/ + +#include +#include "Arti.h" + + + +/* Stubs for intrinsics */ +#define __disable() ((void)(0)) +#define __enable() ((void)(0)) + + + +void TraceImpl_AR_CP_OS_TASKSCHEDULER_OsTask_Start_SPRVSR( + uint32_t instanceName, uint32_t instanceParameter, uint32_t event_value) +{ + __disable(); + + TraceImpl_AR_CP_OS_TASKSCHEDULER_OsTask_Start_NOSUSP(instanceName, + instanceParameter, event_value); + + __enable(); + +} + + +void TraceImpl_AR_CP_OS_TASKSCHEDULER_OsTask_Start_USER( + uint32_t instanceName, uint32_t instanceParameter, uint32_t event_value) + +{ + SuspendAllInterrupts(); + + TraceImpl_AR_CP_OS_TASKSCHEDULER_OsTask_Start_NOSUSP(instanceName, + instanceParameter, event_value); + + ResumeAllInterrupts(); + +} + +void TraceImpl_AR_CP_OS_TASKSCHEDULER_OsTask_Start_NOSUSP( + uint32_t instanceName, uint32_t instanceParameter, uint32_t event_value) + +{ + (void) instanceName; + (void) instanceParameter; + (void) event_value; + // actual tracing code goes here + + +} + +void TraceImpl_AR_CP_OS_TASKSCHEDULER_OsTask_Resuming_SPRVSR( + uint32_t instanceName, uint32_t instanceParameter, uint32_t event_value) + +{ + __disable(); + TraceImpl_AR_CP_OS_TASKSCHEDULER_OsTask_Waiting_NOSUSP(instanceName, + instanceParameter, event_value); + __enable(); +} + +void TraceImpl_AR_CP_OS_TASKSCHEDULER_OsTask_Resuming_USER( + uint32_t instanceName, uint32_t instanceParameter, uint32_t event_value) +{ + + SuspendAllInterrupts(); + + TraceImpl_AR_CP_OS_TASKSCHEDULER_OsTask_Waiting_NOSUSP(instanceName, + instanceParameter, event_value); + + ResumeAllInterrupts(); + +} + +void TraceImpl_AR_CP_OS_TASKSCHEDULER_OsTask_Resuming_NOSUSP( + uint32_t instanceName, uint32_t instanceParameter, uint32_t event_value) +{ + + (void) instanceName; + (void) instanceParameter; + (void) event_value; + // actual tracing code goes here +} + +void TraceImpl_AR_CP_OS_TASKSCHEDULER_OsTask_Stop_SPRVSR( + uint32_t instanceName, uint32_t instanceParameter, uint32_t event_value) +{ + __disable(); + TraceImpl_AR_CP_OS_TASKSCHEDULER_OsTask_Stop_NOSUSP(instanceName, + instanceParameter, event_value); + __enable(); +} + +void TraceImpl_AR_CP_OS_TASKSCHEDULER_OsTask_Stop_USER( + uint32_t instanceName, uint32_t instanceParameter, uint32_t event_value) + +{ + SuspendAllInterrupts(); + + TraceImpl_AR_CP_OS_TASKSCHEDULER_OsTask_Stop_NOSUSP(instanceName, + instanceParameter, event_value); + + ResumeAllInterrupts(); + +} + + +void TraceImpl_AR_CP_OS_TASKSCHEDULER_OsTask_Stop_NOSUSP( + uint32_t instanceName, uint32_t instanceParameter, uint32_t event_value) + +{ + (void) instanceName; + (void) instanceParameter; + (void) event_value; + // actual tracing code goes here + +} + + +void TraceImpl_AR_CP_OS_TASKSCHEDULER_OsTask_Activation_SPRVSR( + uint32_t instanceName, uint32_t instanceParameter, uint32_t event_value) +{ + __disable(); + TraceImpl_AR_CP_OS_TASKSCHEDULER_OsTask_Activation_NOSUSP(instanceName, + instanceParameter, event_value); + __enable(); +} + + +void TraceImpl_AR_CP_OS_TASKSCHEDULER_OsTask_Activation_USER( + uint32_t instanceName, uint32_t instanceParameter, uint32_t event_value) +{ + SuspendAllInterrupts(); + + TraceImpl_AR_CP_OS_TASKSCHEDULER_OsTask_Activation_NOSUSP(instanceName, + instanceParameter, event_value); + + ResumeAllInterrupts(); + +} + +void TraceImpl_AR_CP_OS_TASKSCHEDULER_OsTask_Activation_NOSUSP( + uint32_t instanceName, uint32_t instanceParameter, uint32_t event_value) +{ + (void) instanceName; + (void) instanceParameter; + (void) event_value; + // actual tracing code goes here + +} + +void TraceImpl_AR_CP_OS_TASKSCHEDULER_OsTask_Waiting_SPRVSR( + uint32_t instanceName, uint32_t instanceParameter, uint32_t event_value) + +{ + __disable(); + TraceImpl_AR_CP_OS_TASKSCHEDULER_OsTask_Waiting_NOSUSP(instanceName, + instanceParameter, event_value); + __enable(); +} + +void TraceImpl_AR_CP_OS_TASKSCHEDULER_OsTask_Waiting_USER( + uint32_t instanceName, uint32_t instanceParameter, uint32_t event_value) +{ + SuspendAllInterrupts(); + + TraceImpl_AR_CP_OS_TASKSCHEDULER_OsTask_Waiting_NOSUSP(instanceName, + instanceParameter, event_value); + + ResumeAllInterrupts(); + +} + +void TraceImpl_AR_CP_OS_TASKSCHEDULER_OsTask_Waiting_NOSUSP( + uint32_t instanceName, uint32_t instanceParameter, uint32_t event_value) +{ + (void) instanceName; + (void) instanceParameter; + (void) event_value; + // actual tracing code goes here +} + + + +void TraceImpl_AR_CP_OS_TASKSCHEDULER_OsTask_Release_SPRVSR( + uint32_t instanceName, uint32_t instanceParameter, uint32_t event_value) +{ + + __disable(); + TraceImpl_AR_CP_OS_TASKSCHEDULER_OsTask_Waiting_NOSUSP(instanceName, + instanceParameter, event_value); + __enable(); +} + +void TraceImpl_AR_CP_OS_TASKSCHEDULER_OsTask_Release_USER( + uint32_t instanceName, uint32_t instanceParameter, uint32_t event_value) +{ + + SuspendAllInterrupts(); + + TraceImpl_AR_CP_OS_TASKSCHEDULER_OsTask_Waiting_NOSUSP(instanceName, + instanceParameter, event_value); + + ResumeAllInterrupts(); + +} +void TraceImpl_AR_CP_OS_TASKSCHEDULER_OsTask_Release_NOSUSP( + uint32_t instanceName, uint32_t instanceParameter, uint32_t event_value) +{ + + (void) instanceName; + (void) instanceParameter; + (void) event_value; + // actual tracing code goes here + +} + +/**************** ISR 2 ************************/ + + +void TraceImpl_AR_CP_OS_CAT2DISPATCHER_OsIsr2_Start_SPRVSR( + uint32_t instanceName, uint32_t instanceParameter, uint32_t event_value) +{ + + __disable(); + + TraceImpl_AR_CP_OS_CAT2DISPATCHER_OsIsr2_Start_NOSUSP(instanceName, + instanceParameter, event_value); + + __enable(); + +} + +void TraceImpl_AR_CP_OS_CAT2DISPATCHER_OsIsr2_Start_USER( + uint32_t instanceName, uint32_t instanceParameter, uint32_t event_value) +{ + + SuspendAllInterrupts(); + + TraceImpl_AR_CP_OS_CAT2DISPATCHER_OsIsr2_Start_NOSUSP(instanceName, + instanceParameter, event_value); + + ResumeAllInterrupts(); + +} + +void TraceImpl_AR_CP_OS_CAT2DISPATCHER_OsIsr2_Start_NOSUSP( + uint32_t instanceName, uint32_t instanceParameter, uint32_t event_value) +{ + + (void) instanceName; + (void) instanceParameter; + (void) event_value; + // actual tracing code goes here + +} + +void TraceImpl_AR_CP_OS_CAT2DISPATCHER_OsIsr2_Stop_SPRVSR( + uint32_t instanceName, uint32_t instanceParameter, uint32_t event_value) +{ + + __disable(); + + TraceImpl_AR_CP_OS_CAT2DISPATCHER_OsIsr2_Stop_NOSUSP(instanceName, + instanceParameter, event_value); + + __enable(); + +} + +void TraceImpl_AR_CP_OS_CAT2DISPATCHER_OsIsr2_Stop_USER( + uint32_t instanceName, uint32_t instanceParameter, uint32_t event_value) +{ + + SuspendAllInterrupts(); + + TraceImpl_AR_CP_OS_CAT2DISPATCHER_OsIsr2_Stop_NOSUSP(instanceName, + instanceParameter, event_value); + + ResumeAllInterrupts(); + +} + +void TraceImpl_AR_CP_OS_CAT2DISPATCHER_OsIsr2_Stop_NOSUSP( + uint32_t instanceName, uint32_t instanceParameter, uint32_t event_value) +{ + + (void) instanceName; + (void) instanceParameter; + (void) event_value; + // actual tracing code goes here + +} + + +/**************** ISR 1 ************************/ + + +void TraceImpl_AR_CP_OS_CAT1DISPATCHER_OsIsr1_Start_SPRVSR( + uint32_t instanceName, uint32_t instanceParameter, uint32_t event_value) +{ + + __disable(); + + TraceImpl_AR_CP_OS_CAT2DISPATCHER_OsIsr2_Stop_NOSUSP(instanceName, + instanceParameter, event_value); + + __enable(); + +} + +void TraceImpl_AR_CP_OS_CAT1DISPATCHER_OsIsr1_Start_USER( + uint32_t instanceName, uint32_t instanceParameter, uint32_t event_value) +{ + + SuspendAllInterrupts(); + + TraceImpl_AR_CP_OS_CAT2DISPATCHER_OsIsr2_Stop_NOSUSP(instanceName, + instanceParameter, event_value); + + ResumeAllInterrupts(); + +} + +void TraceImpl_AR_CP_OS_CAT1DISPATCHER_OsIsr1_Start_NOSUSP( + uint32_t instanceName, uint32_t instanceParameter, uint32_t event_value) + +{ + + (void) instanceName; + (void) instanceParameter; + (void) event_value; + // actual tracing code goes here +} + +void TraceImpl_AR_CP_OS_CAT1DISPATCHER_OsIsr1_Stop_SPRVSR( + uint32_t instanceName, uint32_t instanceParameter, uint32_t event_value) +{ + + __disable(); + + TraceImpl_AR_CP_OS_CAT2DISPATCHER_OsIsr2_Stop_NOSUSP(instanceName, + instanceParameter, event_value); + + __enable(); + +} + +void TraceImpl_AR_CP_OS_CAT1DISPATCHER_OsIsr1_Stop_USER( + uint32_t instanceName, uint32_t instanceParameter, uint32_t event_value) +{ + + SuspendAllInterrupts(); + + TraceImpl_AR_CP_OS_CAT2DISPATCHER_OsIsr2_Stop_NOSUSP(instanceName, + instanceParameter, event_value); + + ResumeAllInterrupts(); + +} +void TraceImpl_AR_CP_OS_CAT1DISPATCHER_OsIsr1_Stop_NOSUSP( + uint32_t instanceName, uint32_t instanceParameter, uint32_t event_value) +{ + + (void) instanceName; + (void) instanceParameter; + (void) event_value; + // actual tracing code goes here +} diff --git a/pkg/arch/cortex-m/arti.h b/pkg/arch/cortex-m/arti.h new file mode 100644 index 0000000..c3ff8c0 --- /dev/null +++ b/pkg/arch/cortex-m/arti.h @@ -0,0 +1,181 @@ +/* +***Disclaimer: + +* This work (specification and/or software implementation) and the material contained in +* it, as released by AUTOSAR, is for the purpose of information only. AUTOSAR and the +* companies that have contributed to it shall not be liable for any use of the work. +* The material contained in this work is protected by copyright and other types of intellectual +* property rights. The commercial exploitation of the material contained in this +* work requires a license to such intellectual property rights. + +* This work may be utilized or reproduced without any modification, in any form or by +* any means, for informational purposes only. For any other purpose, no part of the work +* may be utilized or reproduced, in any form or by any means, without permission in +* writing from the publisher. + +*The work has been developed for automotive applications only. It has neither been +*developed, nor tested for non-automotive applications. +*The word AUTOSAR and the AUTOSAR logo are registered trademarks. + + +* More details about the Arti Tracing Macro can be +* found at https://www.autosar.org/standards/classic-platform/classic-platform-440/ +* [SWArch] (Document Title: Specification of AUTOSAR Run-Time Interface) +* [AUTOSAR_SWS_ClassicPlatformARTI] + + + +*/ + +#ifndef ARTI_H +#define ARTI_H + +#include + +#define ARTI_TRACE(_contextName, _className, _instanceName, instanceParameter, _eventName, event_value) \ + (void)TraceImpl ## _ ## _className ## _ ## _eventName ## _ ## _contextName( (_instanceName), (instanceParameter), (event_value) ) + +#define OS_SHORT_NAME (0) +#define OS_CORE_ID (0) + + + +/*uncomment the following line to trace all task with start event*/ +//#define AR_CP_OS_TASKSCHEDULER_OsTask_Start_NOSUSP + +/*uncomment the following line to trace all task with stop event*/ +//#define AR_CP_OS_TASKSCHEDULER_OsTask_Stop_NOSUSP + +/*uncomment the following line to trace all task with activation event*/ +//#define AR_CP_OS_TASKSCHEDULER_OsTask_Activation_NOSUSP + +/*uncomment the following line to trace all task with waiting event*/ +//#define AR_CP_OS_TASKSCHEDULER_OsTask_Waiting_NOSUSP + +/*uncomment the following line to trace all task with Release event*/ + +//#define AR_CP_OS_TASKSCHEDULER_OsTask_Release_NOSUSP + +/*uncomment the following line to trace all task with Resuming event*/ + +//#define AR_CP_OS_TASKSCHEDULER_OsTask_Resuming_NOSUSP + +/*uncomment the following line to trace all ISR2 with start event*/ + +//#define AR_CP_OS_CAT2DISPATCHER_OsIsr2_Start_NOSUSP + +/*uncomment the following line to trace all ISR2 with stop event*/ + +//#define AR_CP_OS_CAT2DISPATCHER_OsIsr2_Stop_NOSUSP + +/*uncomment the following line to trace all ISR1 with start event*/ + +//#define AR_CP_OS_CAT1DISPATCHER_OsIsr1_Start_NOSUSP + +/*uncomment the following line to trace all ISR1 with stop event*/ + +//#define AR_CP_OS_CAT1DISPATCHER_OsIsr1_Stop_NOSUSP + + +/********************************************************************/ +/* AR_CP_OS_TASKSCHEDULER */ + +void TraceImpl_AR_CP_OS_TASKSCHEDULER_OsTask_Start_NOSUSP( + uint32_t instanceName, uint32_t instanceParameter, uint32_t event_value); + +void TraceImpl_AR_CP_OS_TASKSCHEDULER_OsTask_Start_SPRVSR( + uint32_t instanceName, uint32_t instanceParameter, uint32_t event_value); + +void TraceImpl_AR_CP_OS_TASKSCHEDULER_OsTask_Start_USER( + uint32_t instanceName, uint32_t instanceParameter, uint32_t event_value); + +void TraceImpl_AR_CP_OS_TASKSCHEDULER_OsTask_Stop_SPRVSR( + uint32_t instanceName, uint32_t instanceParameter, uint32_t event_value); + +void TraceImpl_AR_CP_OS_TASKSCHEDULER_OsTask_Stop_NOSUSP( + uint32_t instanceName, uint32_t instanceParameter, uint32_t event_value); + +void TraceImpl_AR_CP_OS_TASKSCHEDULER_OsTask_Stop_USER( + uint32_t instanceName, uint32_t instanceParameter, uint32_t event_value); + +void TraceImpl_AR_CP_OS_TASKSCHEDULER_OsTask_Activation_NOSUSP( + uint32_t instanceName, uint32_t instanceParameter, uint32_t event_value); + +void TraceImpl_AR_CP_OS_TASKSCHEDULER_OsTask_Activation_SPRVSR( + uint32_t instanceName, uint32_t instanceParameter, uint32_t event_value); + +void TraceImpl_AR_CP_OS_TASKSCHEDULER_OsTask_Activation_USER( + uint32_t instanceName, uint32_t instanceParameter, uint32_t event_value); + +void TraceImpl_AR_CP_OS_TASKSCHEDULER_OsTask_Waiting_NOSUSP( + uint32_t instanceName, uint32_t instanceParameter, uint32_t event_value); + +void TraceImpl_AR_CP_OS_TASKSCHEDULER_OsTask_Waiting_SPRVSR( + uint32_t instanceName, uint32_t instanceParameter, uint32_t event_value); + +void TraceImpl_AR_CP_OS_TASKSCHEDULER_OsTask_Waiting_USER( + uint32_t instanceName, uint32_t instanceParameter, uint32_t event_value); + +void TraceImpl_AR_CP_OS_TASKSCHEDULER_OsTask_Resuming_NOSUSP( + uint32_t instanceName, uint32_t instanceParameter, uint32_t event_value); + +void TraceImpl_AR_CP_OS_TASKSCHEDULER_OsTask_Resuming_SPRVSR( + uint32_t instanceName, uint32_t instanceParameter, uint32_t event_value); + +void TraceImpl_AR_CP_OS_TASKSCHEDULER_OsTask_Resuming_USER( + uint32_t instanceName, uint32_t instanceParameter, uint32_t event_value); + +void TraceImpl_AR_CP_OS_TASKSCHEDULER_OsTask_Release_NOSUSP( + uint32_t instanceName, uint32_t instanceParameter, uint32_t event_value); + +void TraceImpl_AR_CP_OS_TASKSCHEDULER_OsTask_Release_SPRVSR( + uint32_t instanceName, uint32_t instanceParameter, uint32_t event_value); + +void TraceImpl_AR_CP_OS_TASKSCHEDULER_OsTask_Release_USER( + uint32_t instanceName, uint32_t instanceParameter, uint32_t event_value); + +/* AR_CP_OS_CAT2DISPATCHER */ + + +void TraceImpl_AR_CP_OS_CAT2DISPATCHER_OsIsr2_Start_NOSUSP( + uint32_t instanceName, uint32_t instanceParameter, uint32_t event_value); + +void TraceImpl_AR_CP_OS_CAT2DISPATCHER_OsIsr2_Start_SPRVSR( + uint32_t instanceName, uint32_t instanceParameter, uint32_t event_value); + +void TraceImpl_AR_CP_OS_CAT2DISPATCHER_OsIsr2_Start_USER( + uint32_t instanceName, uint32_t instanceParameter, uint32_t event_value); + +void TraceImpl_AR_CP_OS_CAT2DISPATCHER_OsIsr2_Stop_NOSUSP( + uint32_t instanceName, uint32_t instanceParameter, uint32_t event_value); + +void TraceImpl_AR_CP_OS_CAT2DISPATCHER_OsIsr2_Stop_SPRVSR( + uint32_t instanceName, uint32_t instanceParameter, uint32_t event_value); + +void TraceImpl_AR_CP_OS_CAT2DISPATCHER_OsIsr2_Stop_USER( + uint32_t instanceName, uint32_t instanceParameter, uint32_t event_value); + + +/* AR_CP_OS_CAT1DISPATCHER **not supported */ + +void TraceImpl_AR_CP_OS_CAT1DISPATCHER_OsIsr1_Start_NOSUSP( + uint32_t instanceName, uint32_t instanceParameter, uint32_t event_value); + +void TraceImpl_AR_CP_OS_CAT1DISPATCHER_OsIsr1_Start_SPRVSR( + uint32_t instanceName, uint32_t instanceParameter, uint32_t event_value); + +void TraceImpl_AR_CP_OS_CAT1DISPATCHER_OsIsr1_Start_USER( + uint32_t instanceName, uint32_t instanceParameter, uint32_t event_value); + +void TraceImpl_AR_CP_OS_CAT1DISPATCHER_OsIsr1_Stop_NOSUSP( + uint32_t instanceName, uint32_t instanceParameter, uint32_t event_value); + +void TraceImpl_AR_CP_OS_CAT1DISPATCHER_OsIsr1_Stop_SPRVSR( + uint32_t instanceName, uint32_t instanceParameter, uint32_t event_value); + +void TraceImpl_AR_CP_OS_CAT1DISPATCHER_OsIsr1_Stop_USER( + uint32_t instanceName, uint32_t instanceParameter, uint32_t event_value); + + + +#endif \ No newline at end of file diff --git a/pkg/arch/cortex-m/ee_arch_cfg.mk b/pkg/arch/cortex-m/ee_arch_cfg.mk index 49e8054..a81aca6 100644 --- a/pkg/arch/cortex-m/ee_arch_cfg.mk +++ b/pkg/arch/cortex-m/ee_arch_cfg.mk @@ -60,7 +60,10 @@ EE_SRCS += ee_cortex_m_irqstub.c EE_SRCS += ee_cortex_m_system.c #[GS]: Not used for now! #EE_SRCS += ee_cortex_m_utils.c - +######################################### +#include arti source +EE_SRCS += Arti.c +########################################## EE_SRCS += ee_cortex_m_change_context.c ifeq ($(call iseeopt, OSEE_HAS_SYSTEM_TIMER), yes) diff --git a/pkg/arch/cortex-m/ee_cortex_m_change_context.c b/pkg/arch/cortex-m/ee_cortex_m_change_context.c index 3bf15ed..192ca19 100644 --- a/pkg/arch/cortex-m/ee_cortex_m_change_context.c +++ b/pkg/arch/cortex-m/ee_cortex_m_change_context.c @@ -75,7 +75,30 @@ FUNC(void, OS_CODE) } p_to = osEE_scheduler_task_terminated(osEE_get_kernel(), &p_from); +/**************************************ARTI TASK STOP *******************************************/ + /* macro to record state transition from running to terminated */ +#if (defined(AR_CP_OS_TASKSCHEDULER_OsTask_Stop_NOSUSP)) + SuspendAllInterrupts() ; + if ((p_from)->task_type != OSEE_TASK_TYPE_ISR2){ + ARTI_TRACE(NOSUSP, AR_CP_OS_TASKSCHEDULER, OS_SHORT_NAME, + OS_CORE_ID, OsTask_Stop,(uint32_t) (p_from)->tid); + } + ResumeAllInterrupts(); +#endif +/************************************************************************************************/ + +/**************************************ARTI ISR2 STOP*******************************************/ +/* macro to record state transition from running to terminated */ +#if (defined(AR_CP_OS_CAT2DISPATCHER_OsIsr2_Stop_NOSUSP)) + SuspendAllInterrupts() ; + if (p_from->task_type == OSEE_TASK_TYPE_ISR2){ + ARTI_TRACE(NOSUSP, AR_CP_OS_CAT2DISPATCHER, OS_SHORT_NAME, + OS_CORE_ID, OsIsr2_Stop,(uint32_t)p_from->tid); + } + ResumeAllInterrupts(); +#endif +/************************************************************************************************/ if (p_from->task_type != OSEE_TASK_TYPE_ISR2) { osEE_change_context_from_task_end(p_from, p_to); } else { diff --git a/pkg/arch/cortex-m/ee_cortex_m_irqstub.c b/pkg/arch/cortex-m/ee_cortex_m_irqstub.c index 296ba8b..e895129 100644 --- a/pkg/arch/cortex-m/ee_cortex_m_irqstub.c +++ b/pkg/arch/cortex-m/ee_cortex_m_irqstub.c @@ -89,10 +89,27 @@ osEE_cortex_m_isr1_stub( VAR(OsEE_void_cb, AUTOMATIC) f ) { - +/**************************************ARTI ISR 1 START*******************************************/ + /* macro to record state transition to running */ +#if (defined(AR_CP_OS_CAT1DISPATCHER_OsIsr1_Start_NOSUSP)) + SuspendAllInterrupts() ; + ARTI_TRACE(NOSUSP, AR_CP_OS_CAT1DISPATCHER, OS_SHORT_NAME, + OS_CORE_ID, OsIsr1_Start, (uint32_t) f); + ResumeAllInterrupts(); +#endif +/*************************************************************************************************/ /* Call The ISR User Handler */ f(); +/**************************************ARTI ISR 1 STOP*******************************************/ + /* macro to record state transition from running to terminated */ +#if (defined(AR_CP_OS_CAT1DISPATCHER_OsIsr1_Stop_NOSUSP)) + SuspendAllInterrupts() ; + ARTI_TRACE(NOSUSP, AR_CP_OS_CAT1DISPATCHER, OS_SHORT_NAME, + OS_CORE_ID, OsIsr1_Stop,(uint32_t) f); + ResumeAllInterrupts(); +#endif +/*************************************************************************************************/ } /* osEE_cortex_m_isr1_stub() */ /* @@ -107,7 +124,15 @@ osEE_cortex_m_isr2_stub( p_orig_tdb = osEE_get_curr_core()->p_ccb->p_curr; OsEE_reg f = osEE_hal_begin_nested_primitive(); - +/**************************************ARTI ISR2 START*******************************************/ + /* macro to record state transition to running */ +#if (defined(AR_CP_OS_CAT2DISPATCHER_OsIsr2_Start_NOSUSP)) + SuspendAllInterrupts() ; + ARTI_TRACE(NOSUSP, AR_CP_OS_CAT2DISPATCHER, OS_SHORT_NAME, + OS_CORE_ID, OsIsr2_Start,t); + ResumeAllInterrupts(); +#endif +/*************************************************************************************************/ /* Activate ISR2 */ osEE_activate_isr2(t); diff --git a/pkg/arch/cortex-m/ee_internal.h b/pkg/arch/cortex-m/ee_internal.h index 5c523a8..51e962b 100644 --- a/pkg/arch/cortex-m/ee_internal.h +++ b/pkg/arch/cortex-m/ee_internal.h @@ -60,4 +60,11 @@ #include "ee_hal_internal.h" #include "ee_kernel.h" +#include "arti.h" +/****************************************** +Variable to strore the released task id to use it in +os_task_resuming hook macro +*******************************************/ +extern uint32_t p_resuming_id ; + #endif /* !OSEE_INTERNAL_H */ diff --git a/pkg/arch/cortex-m/ee_pull.mk b/pkg/arch/cortex-m/ee_pull.mk index 9f4a2d9..68a51ec 100644 --- a/pkg/arch/cortex-m/ee_pull.mk +++ b/pkg/arch/cortex-m/ee_pull.mk @@ -49,7 +49,13 @@ ## \date 2018 ifeq ($(call iseeopt, OS_EE_ARCH_CORTEX_M), yes) +######################################### +#include arti header +OS_EE_PULL_SRC_FILES += $(ERIKA_FILES)/pkg/arch/cortex-m/Arti.h +#include arti source +OS_EE_PULL_SRC_FILES += $(ERIKA_FILES)/pkg/arch/cortex-m/Arti.c +########################################## OS_EE_PULL_MK_FILES += $(ERIKA_FILES)/pkg/arch/cortex-m/ee_arch_rules.mk OS_EE_PULL_MK_FILES += $(ERIKA_FILES)/pkg/arch/cortex-m/ee_arch_cfg.mk OS_EE_PULL_MK_FILES += $(ERIKA_FILES)/pkg/arch/cortex-m/ee_arch_compiler_gcc.mk diff --git a/pkg/arch/cortex-m/examples/s32k148evb_q144_q176_full_3/code.c b/pkg/arch/cortex-m/examples/s32k148evb_q144_q176_full_3/code.c index 90fa9c0..a28cf58 100755 --- a/pkg/arch/cortex-m/examples/s32k148evb_q144_q176_full_3/code.c +++ b/pkg/arch/cortex-m/examples/s32k148evb_q144_q176_full_3/code.c @@ -54,6 +54,8 @@ /* HAL */ #include "hal.h" +/* arti*/ +#include "../erika/src/Arti.h" #include #include @@ -228,7 +230,14 @@ TASK(Task2) task2_ended++; } +/* Example of using Arti_Trace macro to record + the Start and END of TASK 3 ****/ TASK(Task3) { + TaskType id_3; + GetTaskID(&id_3); + + ARTI_TRACE(NOSUSP, AR_CP_OS_TASKSCHEDULER, OS_SHORT_NAME, + OS_CORE_ID, OsTask_Start,id_3); serial_print("TASK3\r\n"); ++task3_fired; @@ -236,6 +245,9 @@ TASK(Task3) { ActivateTask(Task4); ++task3_ended; + + ARTI_TRACE(NOSUSP, AR_CP_OS_TASKSCHEDULER, OS_SHORT_NAME, + OS_CORE_ID, OsTask_Stop, id_3); } TASK(Task4) { diff --git a/pkg/arch/cortex-m/examples/s32k148evb_q144_q176_full_3/conf.oil b/pkg/arch/cortex-m/examples/s32k148evb_q144_q176_full_3/conf.oil index 05cd5b5..875f0d1 100755 --- a/pkg/arch/cortex-m/examples/s32k148evb_q144_q176_full_3/conf.oil +++ b/pkg/arch/cortex-m/examples/s32k148evb_q144_q176_full_3/conf.oil @@ -54,7 +54,7 @@ CPU mySystem { EE_OPT = "OS_EE_APPL_BUILD_DEBUG"; EE_OPT = "OS_EE_BUILD_DEBUG"; // EE_OPT = "OS_EE_VERBOSE"; - + USEORTI =TRUE; USERESSCHEDULER = FALSE; CPU_DATA = CORTEX_M { diff --git a/pkg/kernel/oo/ee_oo_sched_entry_points.c b/pkg/kernel/oo/ee_oo_sched_entry_points.c index 2bd194b..96435b2 100644 --- a/pkg/kernel/oo/ee_oo_sched_entry_points.c +++ b/pkg/kernel/oo/ee_oo_sched_entry_points.c @@ -52,6 +52,13 @@ */ #include "ee_internal.h" +/*******************************************************************/ +/* this variable will be used to store the id of the released task + from the function osEE_scheduler_task_unblocked () +*/ +uint32_t p_resuming_id =0xFFFFFFFF; +/*******************************************************************/ + #if (defined(OSEE_HAS_RESOURCES)) || (defined(OSEE_HAS_SPINLOCKS)) static FUNC_P2VAR(OsEE_MDB, OS_APPL_CONST, OS_CODE) @@ -214,10 +221,46 @@ FUNC(void, OS_CODE) } #endif /* OSEE_HAS_ORTI */ - + /* this variable (State) is added to test if the running task was released or activated + if it was activated then we will use OsTask_Start macro + else we will use OsTask_Resuming macro */ + VAR(TaskStateType, TYPEDEF) State = p_tdb_to->p_tcb->status; /* Set the TASK status to RUNNING. Before calling PreTaskHook */ p_tdb_to->p_tcb->status = OSEE_TASK_RUNNING; +/**************************************ARTI TASK START *******************************************/ + /* macro to record task state transition from activated (Ready) to Running*/ +#if (defined(AR_CP_OS_TASKSCHEDULER_OsTask_Start_NOSUSP)) + SuspendAllInterrupts() ; + if (p_tdb_to->task_type < OSEE_TASK_TYPE_ISR2){ + if(State!=OSEE_TASK_READY_STACKED){ + ARTI_TRACE(NOSUSP, AR_CP_OS_TASKSCHEDULER, OS_SHORT_NAME, + OS_CORE_ID, OsTask_Start,(uint32_t) p_tdb_to->tid); + } + } + else if (p_tdb_to->task_type > OSEE_TASK_TYPE_ISR2){ + ARTI_TRACE(NOSUSP, AR_CP_OS_TASKSCHEDULER, OS_SHORT_NAME, + OS_CORE_ID, OsTask_Start,(uint32_t) p_tdb_to->tid); + } + + ResumeAllInterrupts(); +#endif +/*************************************************************************************************************/ +/**************************************ARTI TASK RESUMING *******************************************/ + /* macro to record task state transition from Released (Ready) to Running*/ + /* Released: Continuation of a terminating task which previously was in the waiting state */ +#if (defined(AR_CP_OS_TASKSCHEDULER_OsTask_Resuming_NOSUSP)) + SuspendAllInterrupts() ; + if (p_tdb_to->task_type < OSEE_TASK_TYPE_ISR2){ + if((State == OSEE_TASK_READY_STACKED)&&(p_resuming_id == p_tdb_to->tid)) + { + ARTI_TRACE(NOSUSP, AR_CP_OS_TASKSCHEDULER, OS_SHORT_NAME, + OS_CORE_ID, OsTask_Resuming,(uint32_t) p_tdb_to->tid); + } + } + ResumeAllInterrupts(); +#endif +/*************************************************************************************************************/ /* Call PreTaskHook only if I'm scheduling a real TASK not an ISR2 or the * Idle TASK */ #if (defined(OSEE_HAS_PRETASKHOOK)) || (defined(OSEE_HAS_CONTEXT)) diff --git a/pkg/kernel/oo/ee_oo_sched_partitioned.c b/pkg/kernel/oo/ee_oo_sched_partitioned.c index a2badbe..0988682 100644 --- a/pkg/kernel/oo/ee_oo_sched_partitioned.c +++ b/pkg/kernel/oo/ee_oo_sched_partitioned.c @@ -83,6 +83,17 @@ static FUNC(OsEE_bool, OS_CODE) if (p_tcb_act->status == OSEE_TASK_SUSPENDED) { p_tcb_act->status = OSEE_TASK_READY; osEE_task_event_reset_mask(p_tcb_act); +/**************************************ARTI TASK ACTIVATION *******************************************/ +/* Macro to record state transition from Suspended to activated (Ready) */ +#if (defined(AR_CP_OS_TASKSCHEDULER_OsTask_Activation_NOSUSP)) + SuspendAllInterrupts() ; + if (p_tdb_act->task_type != OSEE_TASK_TYPE_ISR2){ + ARTI_TRACE(NOSUSP, AR_CP_OS_TASKSCHEDULER, OS_SHORT_NAME, + OS_CORE_ID, OsTask_Activation,(uint32_t) (p_tdb_act->tid) ); + } + ResumeAllInterrupts(); +#endif +/******************************************************************************************************/ } rq_head_changed = osEE_scheduler_rq_insert(&p_ccb->rq, @@ -236,7 +247,17 @@ FUNC_P2VAR(OsEE_TDB, OS_APPL_DATA, OS_CODE) p_tdb_blocked->p_tcb->status = OSEE_TASK_WAITING; osEE_unlock_core(p_cdb); - +/**************************************ARTI TASK WAITING *******************************************/ +/* Macro to record state transition from Runing to Waiting */ +#if (defined(AR_CP_OS_TASKSCHEDULER_OsTask_Waiting_NOSUSP)) + SuspendAllInterrupts() ; + if (p_tdb_blocked->task_type != OSEE_TASK_TYPE_ISR2){ + ARTI_TRACE(NOSUSP, AR_CP_OS_TASKSCHEDULER, OS_SHORT_NAME, + OS_CORE_ID, OsTask_Waiting,(uint32_t) (p_tdb_blocked->tid) ); + } + ResumeAllInterrupts(); +#endif +/***************************************************************************************************/ return p_ccb->p_curr; } @@ -291,6 +312,20 @@ FUNC(OsEE_bool, OS_CODE) } #endif /* !OSEE_SINGLECORE */ +/****** Record th id of unblocked task to use it in OsTask_resuming macro */ + p_resuming_id = p_tdb_released->tid; +/*****************************************************************************/ + +/**************************************ARTI TASK RELEASE *******************************************/ +#if (defined(AR_CP_OS_TASKSCHEDULER_OsTask_Release_NOSUSP)) + SuspendAllInterrupts() ; + if (p_tdb_released->task_type != OSEE_TASK_TYPE_ISR2){ + ARTI_TRACE(NOSUSP, AR_CP_OS_TASKSCHEDULER, OS_SHORT_NAME, + OS_CORE_ID, OsTask_Release,(uint32_t) (p_tdb_released->tid) ); + } + ResumeAllInterrupts(); +#endif +/***************************************************************************************************/ return is_preemption; }