Commit 8a597090 authored by Maxime Perrotin's avatar Maxime Perrotin

Parse USER_CFLAGS/LDFLAGS per target

These are new flags optionally set in ocarina_components.aadl for each
processor
parent b09cf8f8
......@@ -1094,7 +1094,9 @@ procedure BuildSupport is
if Get_Category_Of_Component (Tmp_CI) = CC_Process then
declare
Node_Coverage : Boolean := False;
Env_Vars : Name_Id := No_Name;
Env_Vars : Name_Id := No_Name;
User_CFlags : Name_Id := No_Name;
User_LdFlags : Name_Id := No_Name;
begin
if Is_Defined_Property (Tmp_CI,
"taste_dv_properties::coverageenabled")
......@@ -1110,7 +1112,9 @@ procedure BuildSupport is
end if;
CPU := Get_Bound_Processor (Tmp_CI);
Env_Vars := Get_Env_Vars (CPU);
Env_Vars := Get_Env_Vars (CPU);
User_CFlags := Get_User_CFlags (CPU);
User_LdFlags := Get_User_LdFlags (CPU);
Set_Str_To_Name_Buffer ("");
CPU_Name := Name (Identifier (Parent_Subcomponent (CPU)));
......@@ -1145,10 +1149,22 @@ procedure BuildSupport is
Supported_Execution_Platform'Image (CPU_Platform),
Supported_Execution_Platform'Image (CPU_Platform)'Length,
(if Env_Vars /= No_Name then
Get_Name_String (Env_Vars)
Get_Name_String (Env_Vars)
else ""),
(if Env_Vars /= No_Name then
Get_Name_String (Env_Vars)'Length
Get_Name_String (Env_Vars)'Length
else 0),
(if User_CFlags /= No_Name then
Get_Name_String (User_CFlags)
else ""),
(if User_CFlags /= No_Name then
Get_Name_String (User_CFlags)'Length
else 0),
(if User_LdFlags /= No_Name then
Get_Name_String (User_LdFlags)
else ""),
(if User_LdFlags /= No_Name then
Get_Name_String (User_LdFlags)'Length
else 0));
C_New_Process
......
......@@ -229,10 +229,10 @@ package body Buildsupport_Utils is
------------------
function Get_Env_Vars (D : Node_Id) return Name_Id is
Interface_Name : constant Name_id :=
Env_Vars : constant Name_id :=
Get_String_Name ("envvars");
begin
return Get_String_Property (D, Interface_Name);
return Get_String_Property (D, Env_Vars);
end Get_Env_Vars;
---------------------------
......
......@@ -83,7 +83,7 @@ package Buildsupport_Utils is
function Get_Interface_Name (D : Node_Id) return Name_Id;
function Get_Env_Vars (D : Node_Id) return Name_Id;
function Get_Env_Vars (D : Node_Id) return Name_Id;
function Get_ASN1_Module_Name (D : Node_Id) return String;
......
......@@ -46,7 +46,11 @@ package Imported_Routines is
Platform : String;
Platform_Len : Integer;
EnvVars : String;
EnvVars_Len : Integer);
EnvVars_Len : Integer;
CFflags : String;
CFlags_Len : Integer;
LdFlags : String;
LdFlags_Len : Integer);
procedure C_New_Bus (Name : String;
Name_Len : Integer;
......
......@@ -551,30 +551,37 @@ void New_Process(char *procname,
}
}
void New_Processor (char *name, size_t name_length,
void New_Processor (char *name, size_t name_length,
char *classifier, size_t classifier_length,
char* platform, size_t platform_length,
char *envvars, size_t envvars_length)
char* platform, size_t platform_length,
char *envvars, size_t envvars_length,
char *cflags, size_t cflags_length,
char *ldflags, size_t ldflags_length)
{
processor = malloc(sizeof(Processor));
assert(NULL != processor);
processor->name = NULL;
processor->classifier = NULL;
processor->name = NULL;
processor->classifier = NULL;
processor->platform_name = NULL;
processor->envvars = NULL;
processor->envvars = NULL;
processor->user_cflags = NULL;
processor->user_ldflags = NULL;
build_string(&(processor->name), name, name_length);
build_string(&(processor->classifier), classifier,
classifier_length);
if (platform_length > 0)
{
build_string(&(processor->platform_name), platform,
platform_length);
if (platform_length > 0) {
build_string(&(processor->platform_name), platform, platform_length);
}
if (envvars_length > 0) {
build_string(&(processor->envvars), envvars, envvars_length);
}
if (cflags_length > 0) {
build_string(&(processor->user_cflags), cflags, cflags_length);
}
if (envvars_length > 0)
{
build_string(&(processor->envvars), envvars,
envvars_length);
if (ldflags_length > 0) {
build_string(&(processor->user_ldflags), ldflags, ldflags_length);
}
}
......
......@@ -818,8 +818,19 @@ void GenerateProcessImplementation(Process *p)
fprintf (nodes, "\n");
/* Env vars per target */
if ( (p->cpu != NULL) && (p->cpu->envvars != NULL) )
if ( (p->cpu != NULL) && (p->cpu->envvars != NULL) ) {
fprintf (nodes, "envvars %s\n", p->cpu->envvars);
}
/* USER CFLAGS per target */
if ( (p->cpu != NULL) && (p->cpu->user_cflags != NULL) ) {
fprintf (nodes, "USER_CFLAGS %s\n", p->cpu->user_cflags);
}
/* USER LDFLAGS per target */
if ( (p->cpu != NULL) && (p->cpu->user_ldflags != NULL) ) {
fprintf (nodes, "USER_LDFLAGS %s\n", p->cpu->user_ldflags);
}
FOREACH(b, Aplc_binding, p->bindings, {
fprintf(nodes, "%s\n", b->fv->name);
......
......@@ -30,10 +30,12 @@ void Set_Current_Process(Process *p);
void End_Process();
void New_Drivers_Section();
void End_Drivers_Section();
void New_Processor (char *name, size_t name_length,
char *classifier, size_t classifier_length,
char* platform, size_t platform_length,
char *envvars, size_t envvars_length);
void New_Processor (char *name, size_t name_length,
char *classifier, size_t classifier_length,
char* platform, size_t platform_length,
char *envvars, size_t envvars_length,
char *cflags, size_t cflags_length,
char *ldflags, size_t ldflags_length);
void New_Process(char *, size_t, char *,size_t, char *, size_t, bool);
void Set_OutDir(char *o,size_t len);
void Set_Interfaceview (char *name, size_t len);
......
......@@ -266,6 +266,8 @@ typedef struct t_processor {
char *classifier;
char *platform_name;
char *envvars;
char *user_cflags;
char *user_ldflags;
} Processor;
/*
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment