Permalink
Browse files

[templates] Updates WithOrti.

  • Loading branch information...
KamelHacene committed Oct 24, 2016
1 parent 1f50d46 commit 335fca66cdd7b6deb3e6350f4fe07cbac7f89350
View
@@ -174,10 +174,27 @@ extern tpl_com_service_call_descriptor tpl_com_service;
* code at all if the flag is off.
*/
#if WITH_COM_ERROR_HOOK == YES
#define PROCESS_COM_ERROR_ERRHOOK(error) tpl_call_com_error_hook(error);
#else
#define PROCESS_COM_ERROR_ERRHOOK(error)
#endif
#if WITH_ORTI == YES
#define PROCESS_COM_ERROR_ORTI(error) \
{ \
GET_CURRENT_CORE_ID(core_id) \
TPL_LAST_ERROR(core_id) = error; \
}
#else
#define PROCESS_COM_ERROR_ORTI(error)
#endif
#if (WITH_COM_ERROR_HOOK == YES) || (WITH_ORTI == YES)
#define PROCESS_COM_ERROR(error) \
if (error != E_OK) { \
tpl_call_com_error_hook(error); \
}
if (error != E_OK) { \
PROCESS_COM_ERROR_ERRHOOK(error) \
PROCESS_COM_ERROR_ORTI(error) \
}
#else
#define PROCESS_COM_ERROR(error)
#endif
@@ -69,11 +69,14 @@ if ioc_unqueued_count > 0 then
let APIUSED += APIMAP["ioc_unqueued"]
end if
foreach orti in OS::WITHORTI do
if not exists orti::FILE then
error orti::NAME : "File required."
end if
write to PROJECT + "/" + orti::FILE :
let listOfApiFunc := @( )
foreach api_sec in APIUSED do
foreach api_func in api_sec::SYSCALL do
let listOfApiFunc += api_func
end foreach
end foreach
sort listOfApiFunc by CALLABLE_BY_ISR1 >
%
/**
* @file % !FILENAME %
@@ -100,41 +103,6 @@ foreach orti in OS::WITHORTI do
* $Author$
* $URL$
*/
%
# =============================================================================
# Core dependant variables
#
let orti_tpl_kern
let orti_last_error
let orti_current_appmode
let orti_service_trace
if OS::NUMBER_OF_CORES > 1 then
let orti_core := exists orti::CORE default (0)
let orti_core_a := "[" + [orti_core string] + "]"
let orti_tpl_kern := "tpl_kern" + orti_core_a
let orti_last_error := "tpl_last_error" + orti_core_a
let orti_current_appmode := "application_mode" + orti_core_a
let orti_service_trace := "tpl_servicetrace" + orti_core_a
else
let orti_tpl_kern := "tpl_kern"
let orti_last_error := "tpl_last_error"
let orti_current_appmode := "application_mode"
let orti_service_trace := "tpl_servicetrace"
end if
# =============================================================================
# Other variables
#
let orti_running_task_id := orti_tpl_kern + ".running_id"
let listOfApiFunc := @( )
foreach api_sec in APIUSED do
foreach api_func in api_sec::SYSCALL do
let listOfApiFunc += api_func
end foreach
end foreach
sort listOfApiFunc by CALLABLE_BY_ISR1 >
%
VERSION
{
@@ -216,6 +184,12 @@ end foreach
"E_OS_RESOURCE" = 6,
"E_OS_STATE" = 7,
"E_OS_VALUE" = 8,
"E_NOT_OK" = 9,
"E_COM_ID" = 10,
"E_COM_LENGTH" = 11,
"E_COM_LIMIT" = 12,
"E_COM_NOMSG" = 13,
"E_COM_FILTERDOUR" = 14,
"E_OS_SERVICEID" = 16,
"E_OS_ILLEGAL_ADDRESS" = 17,
"E_OS_MISSINGEND" = 18,
@@ -231,7 +205,7 @@ end foreach
"E_OS_SPINLOCK" = 28,
"E_OS_LOST_DATA" = 29,
"E_OS_NO_DATA" = 30
] LASTERROR; // FIXME : Not generated
] LASTERROR; /* FIXME : Not generated */
ENUM [
"NOAPPMODE" = "-1",%
foreach appmode in APPMODE do
@@ -369,7 +343,21 @@ template if exists custom_orti_implementation
/* ----------------------------------------------------------------------------
* Definitions
*/
OS Trampoline_arch
%
loop core_id from 0 to OS::NUMBER_OF_CORES - 1 do
let orti_core_a := ""
if OS::NUMBER_OF_CORES > 1 then
let orti_core_a := "[" + [core_id string] + "]"
end if
let orti_tpl_kern := "tpl_kern" + orti_core_a
let orti_last_error := "tpl_last_error" + orti_core_a
let orti_current_appmode := "application_mode" + orti_core_a
let orti_service_trace := "tpl_servicetrace" + orti_core_a
let orti_running_task_id := orti_tpl_kern + ".running_id"
let orti_osname := "Trampoline_arch" + orti_core_a
%
OS Trampoline_arch% ![core_id string] %
{
RUNNINGTASK = "% !orti_running_task_id %";
RUNNINGISR2 = "% !orti_running_task_id %";
@@ -379,8 +367,8 @@ OS Trampoline_arch
VALID = "% !orti_running_task_id % != -1";
SERVICETRACE = "% !orti_service_trace %";
};
%
end loop
foreach proc in PROCESSES do
if proc::KIND == "Task" then
@@ -475,18 +463,21 @@ foreach message in MESSAGE do
let queuecount := "1"
let messagetype := "UNQUEUED"
let firstelement := message::NAME + "_buffer"
elsif message::MESSAGEPROPERTY == "RECEIVE_QUEUED_INTERNAL" then
let show := true
let queuesize := [message::MESSAGEPROPERTY_S::QUEUESIZE string]
let messagetype := "QUEUED"
let queuecount := message::NAME + "_dyn_queue.size/"
+ message::NAME + "_message.queue.element_size"
let queueindex := message::NAME + "_dyn_queue.index/"
+ message::NAME + "_message.queue.element_size"
let firstelement := message::NAME + "_buffer[" + queueindex + "]"
elsif message::MESSAGEPROPERTY == "RECEIVE_ZERO_INTERNAL" then
let show := true
let queuesize := "1"
let queuecount := "1"
let messagetype := "UNQUEUED"
let firstelement := ""
elsif message::MESSAGEPROPERTY == "RECEIVE_QUEUED_INTERNAL" then
let show := true
let queuesize := [message::MESSAGEPROPERTY_S::QUEUESIZE string]
let queuecount := message::NAME + "_dyn_queue.size/" + message::NAME + "_message.queue.element_size"
let messagetype := "QUEUED"
let firstelement := message::NAME + "_buffer[" + message::NAME + "_dyn_queue.index]"
end if
if show then
@@ -515,6 +506,4 @@ template if exists custom_orti_definition
* End of file % !FILENAME %
*/
%
end write
end foreach
%
@@ -56,9 +56,41 @@ STACK % !proc::NAME %_stack
SIZE = "% !proc::STACKSIZE %";
BASEADDRESS = "&(% !proc::NAME %_stack_zone[0])";
STACKDIRECTION = "DOWN";
FILLPATTERN = "0xAAAAAAAAU";
FILLPATTERN = "0xAAAAAAAAU"; /* File tpl_machine.h */
};
%
end foreach
loop core_id from 0 to OS::NUMBER_OF_CORES - 1 do
%
STACK kernel_stack_core% !core_id %
{
SIZE = "2000"; /* File tpl_os_kernel_stack.h */
BASEADDRESS = "tpl_kernel_stack[% !core_id %]";
STACKDIRECTION = "DOWN";
FILLPATTERN = "0xAAAAAAAAU"; /* File tpl_machine.h */
}
%
end loop
%
STACK startup_stack_core0
{
SIZE = "0x1000"; /* ld script */
BASEADDRESS = "0x4000E000"; /* ld script */
STACKDIRECTION = "DOWN";
FILLPATTERN = "0x00000000U";
}
%
if OS::NUMBER_OF_CORES > 1 then
%
STACK startup_stack_core1
{
SIZE = "0x1000"; /* ld script */
BASEADDRESS = "0x4000F000"; /* ld script */
STACKDIRECTION = "DOWN";
FILLPATTERN = "0x00000000U";
}
%
end if
@@ -41,7 +41,7 @@
#define TARGET_BOARD "% !BOARD %"
#define NUMBER_OF_CORES % !exists OS::NUMBER_OF_CORES default (1) %
#define WITH_OS_EXTENDED % !yesNo(OS::STATUS == "EXTENDED") %
#define WITH_ORTI % !yesNo([OS::WITHORTI length] > 0) %
#define WITH_ORTI % !yesNo(OS::WITHORTI) %
#define WITH_STARTUP_HOOK % !yesNo(OS::STARTUPHOOK) %
#define WITH_SHUTDOWN_HOOK % !yesNo(OS::SHUTDOWNHOOK) %
#define WITH_ERROR_HOOK % !yesNo(OS::ERRORHOOK) %
@@ -78,7 +78,7 @@ end if%
#define OS_STOP_SEC_CONST_UNSPECIFIED
#include "tpl_memmap.h"
%
if [OS::WITHORTI length] > 0 then%
if OS::WITHORTI then%
#define OS_START_SEC_VAR_UNSPECIFIED
#include "tpl_memmap.h"%
if OS::NUMBER_OF_CORES > 1 then%
@@ -157,10 +157,12 @@ IMPLEMENTATION trampoline_common {
OS {
/* Standard OIL attributes */
ENUM [STANDARD, EXTENDED] STATUS;
STRUCT {
STRING FILE = "orti.orti";
UINT32 CORE = 0;
} WITHORTI [];
BOOLEAN [
TRUE {
STRING FILE = "";
},
FALSE
] WITHORTI = FALSE;
BOOLEAN STARTUPHOOK = FALSE;
BOOLEAN ERRORHOOK = FALSE;
BOOLEAN SHUTDOWNHOOK = FALSE;
@@ -80,7 +80,6 @@ let IOC := exists IOC default (@())
let TRANSACTION := exists TRANSACTION default (@())
let OBJECT := exists OBJECT default (@())
let SPINLOCK := exists SPINLOCK default (@())
let OS::WITHORTI := exists OS::WITHORTI default (@())
template if exists configCheck
@@ -1520,7 +1519,14 @@ write to PROJECT+"/stm_structure.c":
template stm_structure_c in code
end write
if [OS::WITHORTI length] > 0 then
template orti in code
if OS::WITHORTI then
if OS::WITHORTI_S::FILE == "" then
let OS::WITHORTI_S::FILE := PROJECT + ".orti"
warning OS::WITHORTI : "Invalid or missing ORTI file name."
+ "Using default value : " + OS::WITHORTI_S::FILE
end if
write to PROJECT + "/" + OS::WITHORTI_S::FILE :
template orti in code
end write
end if

0 comments on commit 335fca6

Please sign in to comment.