Skip to content

Commit

Permalink
[OS][AUTOSAR][GOIL] Fix #30, Add AUTOSAR 4.2 configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
jlbirccyn committed Nov 24, 2023
1 parent a752a66 commit dd29f60
Show file tree
Hide file tree
Showing 10 changed files with 280 additions and 202 deletions.
2 changes: 1 addition & 1 deletion goil/templates/code/resource_descriptor.goilTemplate
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ VAR(tpl_resource, OS_VAR) % !resource::NAME %_rez_desc = {
/* ceiling priority of the resource */ % !resource::PRIORITY %,
/* owner previous priority */ 0,
/* owner of the resource */ INVALID_PROC_ID,
#if WITH_OSAPPLICATION == YES
#if RESOURCE_BELONGS_TO_OS_APP == YES
/* OS Application id */ %
if AUTOSAR then
if OS::SCALABILITYCLASS >= 3 then
Expand Down
10 changes: 10 additions & 0 deletions goil/templates/code/tpl_app_define_h.goilTemplate
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,22 @@

#include "tpl_config_def.h"

%
let rezBelongToApp := OS::SCALABILITYCLASS > 2 &
OILDECIMAL >= 31 &
OILDECIMAL <= 40
%

/*=============================================================================
* Configuration flags
*/
#define TARGET_ARCH "% !ARCH %"
#define TARGET_CHIP "% !CHIP %"
#define TARGET_BOARD "% !BOARD %"
#define MAJOR_OIL_VERSION % !OILMAJOR %
#define MINOR_OIL_VERSION % !OILMINOR %
#define DECIMAL_OIL_VERSION % !OILDECIMAL %
#define RESOURCE_BELONGS_TO_OS_APP % !yesNo(rezBelongToApp) %
#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) %
Expand Down
97 changes: 97 additions & 0 deletions goil/templates/config/autosar_common.oil
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
IMPLEMENTATION trampoline_autosar_common {

OS {
/* Autosar OIL */
BOOLEAN PROTECTIONHOOK = FALSE;
ENUM WITH_AUTO [SC1,SC2,SC3,SC4] SCALABILITYCLASS = AUTO;
BOOLEAN STACKMONITORING = FALSE;
};

ALARM [] {
ENUM [
ACTIVATETASK { TASK_TYPE TASK; },
SETEVENT { TASK_TYPE TASK; EVENT_TYPE EVENT; },
INCREMENTCOUNTER { COUNTER_TYPE COUNTER; }
] ACTION;
APPLICATION_TYPE ACCESSING_APPLICATION[];
};

TASK [] {
BOOLEAN [
TRUE {
UINT32 EXECUTIONBUDGET;
UINT32 TIMEFRAME;
},
FALSE
] TIMING_PROTECTION = FALSE;
APPLICATION_TYPE ACCESSING_APPLICATION[];
};

ISR [] {
BOOLEAN [
TRUE,
FALSE
] TIMING_PROTECTION = FALSE;
APPLICATION_TYPE ACCESSING_APPLICATION[];
};

COUNTER [] {
ENUM [ HARDWARE, SOFTWARE ] TYPE = HARDWARE;
APPLICATION_TYPE ACCESSING_APPLICATION[];
};

RESOURCE [] {
APPLICATION_TYPE ACCESSING_APPLICATION[];
};

SCHEDULETABLE [] {
COUNTER_TYPE COUNTER;
ENUM [
NONE,
ABSOLUTE { UINT64 START; APPMODE_TYPE APPMODE[]; },
RELATIVE { UINT64 OFFSET; APPMODE_TYPE APPMODE[]; },
SYNCHRON { APPMODE_TYPE APPMODE[]; }
] AUTOSTART = NONE;
BOOLEAN [
TRUE {
ENUM [ IMPLICIT, EXPLICIT ] SYNC_STRATEGY;
UINT64 PRECISION;
},
FALSE
] LOCAL_TO_GLOBAL_TIME_SYNCHRONIZATION;
BOOLEAN PERIODIC;
UINT64 LENGTH;
STRUCT {
UINT64 OFFSET;
ENUM [
ACTIVATETASK { TASK_TYPE TASK; },
SETEVENT { TASK_TYPE TASK; EVENT_TYPE EVENT; }
] ACTION [];
BOOLEAN [
TRUE { UINT64 MAX_ADVANCE; UINT64 MAX_RETARD; },
FALSE
] ADJUSTABLE = FALSE;
} EXPIRY_POINT [];
APPLICATION_TYPE ACCESSING_APPLICATION[];
};

APPLICATION [] {
BOOLEAN [
TRUE { IDENTIFIER TRUSTED_FUNCTION []; },
FALSE
] TRUSTED = FALSE;
BOOLEAN STARTUPHOOK = FALSE;
BOOLEAN SHUTDOWNHOOK = FALSE;
BOOLEAN ERRORHOOK = FALSE;
BOOLEAN [
TRUE { TASK_TYPE RESTARTTASK; },
FALSE
] HAS_RESTARTTASK = FALSE;
TASK_TYPE TASK [];
ISR_TYPE ISR [];
ALARM_TYPE ALARM [];
SCHEDULETABLE_TYPE SCHEDULETABLE [];
COUNTER_TYPE COUNTER [];
MESSAGE_TYPE MESSAGE [];
};
};
69 changes: 69 additions & 0 deletions goil/templates/config/autosar_multicore.oil
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
/*
* AUTOSAR multicore objects. Objects defined here are:
* - IOC
* - SPINLOCK
*
* Objects reciving additional attributes are:
* - OS: NUMBER_OF_CORES.
* - ALARM: ACTION as an INCREMENTCOUNTER value for software counters and
* ACCESSING_APPLICATION.
* - TASK: TIMINGPROTECTION and ACCESSING_APPLICATION.
* - ISR: TIMINGPROTECTION and ACCESSING_APPLICATION.
* - COUNTER: TYPE and ACCESSING_APPLICATION.
* - RESOURCE: ACCESSING_APPLICATION.
*/
IMPLEMENTATION autosar_multicore {
OS {
UINT32 [1..65535] NUMBER_OF_CORES = 1;
};

IOC [] {
STRUCT {
ENUM [
DATA,
REFERENCE
] DATATYPEPROPERTY;
} DATATYPENAME [];

ENUM [
QUEUED {
UINT32 BUFFER_LENGTH;
},
LAST_IS_BEST {
STRING WITH_AUTO INIT_VALUE_SYMBOL = AUTO;
}
] SEMANTICS = QUEUED;

STRUCT {
APPLICATION_TYPE RCV_OSAPPLICATION;
STRING WITH_AUTO RECEIVER_PULL_CB = AUTO;
ENUM [
NONE,
ACTIVATETASK { TASK_TYPE TASK; },
SETEVENT {TASK_TYPE TASK; EVENT_TYPE EVENT; }
] ACTION = NONE;
} RECEIVER [];

STRUCT {
UINT32 WITH_AUTO SENDER_ID = AUTO;
APPLICATION_TYPE SND_OSAPPLICATION;
} SENDER [] ;

};

SPINLOCK [] {
APPLICATION_TYPE ACCESSING_APPLICATION [];
SPINLOCK_TYPE SUCCESSOR[];
ENUM [
LOCK_ALL_INTERRUPTS,
LOCK_CAT2_INTERRUPTS,
LOCK_WITH_RES_SCHEDULER,
LOCK_NOTHING
] LOCKMETHOD = LOCK_NOTHING;
};

APPLICATION [] {
IOC_TYPE IOC [];
UINT32 CORE = 0;
};
};
102 changes: 7 additions & 95 deletions goil/templates/config/config3.1.oil
Original file line number Diff line number Diff line change
@@ -1,100 +1,12 @@
IMPLEMENTATION trampoline_autosar {

OS {
/* Autosar OIL */
BOOLEAN PROTECTIONHOOK = FALSE;
ENUM WITH_AUTO [SC1,SC2,SC3,SC4] SCALABILITYCLASS = AUTO;
BOOLEAN STACKMONITORING = FALSE;
};

ALARM [] {
ENUM [
ACTIVATETASK { TASK_TYPE TASK; },
SETEVENT { TASK_TYPE TASK; EVENT_TYPE EVENT; },
INCREMENTCOUNTER { COUNTER_TYPE COUNTER; }
] ACTION;
APPLICATION_TYPE ACCESSING_APPLICATION[];
};

TASK [] {
BOOLEAN [
TRUE {
UINT32 EXECUTIONBUDGET;
UINT32 TIMEFRAME;
},
FALSE
] TIMING_PROTECTION = FALSE;
APPLICATION_TYPE ACCESSING_APPLICATION[];
};
/*
* AUTOSAR 3.1
*
* This version of AUTOSAR add the RESOURCE attribute in the APPLICATION object.
*/
#include "autosar_common.oil"

ISR [] {
BOOLEAN [
TRUE,
FALSE
] TIMING_PROTECTION = FALSE;
APPLICATION_TYPE ACCESSING_APPLICATION[];
};

COUNTER [] {
ENUM [ HARDWARE, SOFTWARE ] TYPE = HARDWARE;
APPLICATION_TYPE ACCESSING_APPLICATION[];
};

RESOURCE [] {
APPLICATION_TYPE ACCESSING_APPLICATION[];
};

SCHEDULETABLE [] {
COUNTER_TYPE COUNTER;
ENUM [
NONE,
ABSOLUTE { UINT64 START; APPMODE_TYPE APPMODE[]; },
RELATIVE { UINT64 OFFSET; APPMODE_TYPE APPMODE[]; },
SYNCHRON { APPMODE_TYPE APPMODE[]; }
] AUTOSTART = NONE;
BOOLEAN [
TRUE {
ENUM [ IMPLICIT, EXPLICIT ] SYNC_STRATEGY;
UINT64 PRECISION;
},
FALSE
] LOCAL_TO_GLOBAL_TIME_SYNCHRONIZATION;
BOOLEAN PERIODIC;
UINT64 LENGTH;
STRUCT {
UINT64 OFFSET;
ENUM [
ACTIVATETASK { TASK_TYPE TASK; },
SETEVENT { TASK_TYPE TASK; EVENT_TYPE EVENT; }
] ACTION [];
BOOLEAN [
TRUE { UINT64 MAX_ADVANCE; UINT64 MAX_RETARD; },
FALSE
] ADJUSTABLE = FALSE;
} EXPIRY_POINT [];
APPLICATION_TYPE ACCESSING_APPLICATION[];
};

IMPLEMENTATION trampoline_autosar {
APPLICATION [] {
BOOLEAN [
TRUE { IDENTIFIER TRUSTED_FUNCTION []; },
FALSE
] TRUSTED = FALSE;
BOOLEAN STARTUPHOOK = FALSE;
BOOLEAN SHUTDOWNHOOK = FALSE;
BOOLEAN ERRORHOOK = FALSE;
BOOLEAN [
TRUE { TASK_TYPE RESTARTTASK; },
FALSE
] HAS_RESTARTTASK = FALSE;
TASK_TYPE TASK [];
ISR_TYPE ISR [];
ALARM_TYPE ALARM [];
SCHEDULETABLE_TYPE SCHEDULETABLE [];
COUNTER_TYPE COUNTER [];
RESOURCE_TYPE RESOURCE [];
MESSAGE_TYPE MESSAGE [];
};
};

/*#include "api_autosar.oil"*/
63 changes: 6 additions & 57 deletions goil/templates/config/config4.0.oil
Original file line number Diff line number Diff line change
@@ -1,60 +1,9 @@
/*
* AUTOSAR 4.0
*
* This version of AUTOSAR is basically the 3.1 plus the multicore one.
*/
#include "config3.1.oil"

IMPLEMENTATION autosar4 {
OS {
UINT32 [1..65535] NUMBER_OF_CORES = 1;
};

IOC [] {
STRUCT {
ENUM [
DATA,
REFERENCE
] DATATYPEPROPERTY;
} DATATYPENAME [];

ENUM [
QUEUED {
UINT32 BUFFER_LENGTH;
},
LAST_IS_BEST {
STRING WITH_AUTO INIT_VALUE_SYMBOL = AUTO;
}
] SEMANTICS = QUEUED;

STRUCT {
APPLICATION_TYPE RCV_OSAPPLICATION;
STRING WITH_AUTO RECEIVER_PULL_CB = AUTO;
ENUM [
NONE,
ACTIVATETASK { TASK_TYPE TASK; },
SETEVENT {TASK_TYPE TASK; EVENT_TYPE EVENT; }
] ACTION = NONE;
} RECEIVER [];

STRUCT {
UINT32 WITH_AUTO SENDER_ID = AUTO;
APPLICATION_TYPE SND_OSAPPLICATION;
} SENDER [] ;

};

SPINLOCK [] {
APPLICATION_TYPE ACCESSING_APPLICATION [];
SPINLOCK_TYPE SUCCESSOR[];
ENUM [
LOCK_ALL_INTERRUPTS,
LOCK_CAT2_INTERRUPTS,
LOCK_WITH_RES_SCHEDULER,
LOCK_NOTHING
] LOCKMETHOD = LOCK_NOTHING;
};

APPLICATION [] {
IOC_TYPE IOC [];
UINT32 CORE = 0;
};

};
#include "autosar_multicore.oil"

/*#include "api_ioc.oil"*/
9 changes: 9 additions & 0 deletions goil/templates/config/config4.2.oil
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
/*
* AUTOSAR 4.2
*
* This version of AUTOSAR is the common plus the multicore one.
* Compared to 4.0, RESOURCE attribute is no longer included in
* APPLICATION object
*/
#include "autosar_common.oil"
#include "autosar_multicore.oil"
10 changes: 10 additions & 0 deletions goil/templates/lib/check.gtm
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
%
#
# Various checking getter and functions
#
getter @string isUnsigned() result
let result := true
loop i from 0 to [self length] - 1 do
let result := result & [[self charAtIndex : i] isDigit]
end loop
end getter
Loading

0 comments on commit dd29f60

Please sign in to comment.