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

Parse USER_CFLAGS/LDFLAGS per target

These are new flags optionally set in ocarina_components.aadl for each
processor
parent b09cf8f8
...@@ -1095,6 +1095,8 @@ procedure BuildSupport is ...@@ -1095,6 +1095,8 @@ procedure BuildSupport is
declare declare
Node_Coverage : Boolean := False; 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 begin
if Is_Defined_Property (Tmp_CI, if Is_Defined_Property (Tmp_CI,
"taste_dv_properties::coverageenabled") "taste_dv_properties::coverageenabled")
...@@ -1111,6 +1113,8 @@ procedure BuildSupport is ...@@ -1111,6 +1113,8 @@ procedure BuildSupport is
CPU := Get_Bound_Processor (Tmp_CI); 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 (""); Set_Str_To_Name_Buffer ("");
CPU_Name := Name (Identifier (Parent_Subcomponent (CPU))); CPU_Name := Name (Identifier (Parent_Subcomponent (CPU)));
...@@ -1149,6 +1153,18 @@ procedure BuildSupport is ...@@ -1149,6 +1153,18 @@ procedure BuildSupport is
else ""), else ""),
(if Env_Vars /= No_Name then (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)); else 0));
C_New_Process C_New_Process
......
...@@ -229,10 +229,10 @@ package body Buildsupport_Utils is ...@@ -229,10 +229,10 @@ package body Buildsupport_Utils is
------------------ ------------------
function Get_Env_Vars (D : Node_Id) return Name_Id 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"); Get_String_Name ("envvars");
begin begin
return Get_String_Property (D, Interface_Name); return Get_String_Property (D, Env_Vars);
end Get_Env_Vars; end Get_Env_Vars;
--------------------------- ---------------------------
......
...@@ -46,7 +46,11 @@ package Imported_Routines is ...@@ -46,7 +46,11 @@ package Imported_Routines is
Platform : String; Platform : String;
Platform_Len : Integer; Platform_Len : Integer;
EnvVars : String; EnvVars : String;
EnvVars_Len : Integer); EnvVars_Len : Integer;
CFflags : String;
CFlags_Len : Integer;
LdFlags : String;
LdFlags_Len : Integer);
procedure C_New_Bus (Name : String; procedure C_New_Bus (Name : String;
Name_Len : Integer; Name_Len : Integer;
......
...@@ -554,7 +554,9 @@ void New_Process(char *procname, ...@@ -554,7 +554,9 @@ 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 *classifier, size_t classifier_length,
char* platform, size_t platform_length, char* platform, size_t platform_length,
char *envvars, size_t envvars_length) char *envvars, size_t envvars_length,
char *cflags, size_t cflags_length,
char *ldflags, size_t ldflags_length)
{ {
processor = malloc(sizeof(Processor)); processor = malloc(sizeof(Processor));
assert(NULL != processor); assert(NULL != processor);
...@@ -563,18 +565,23 @@ void New_Processor (char *name, size_t name_length, ...@@ -563,18 +565,23 @@ void New_Processor (char *name, size_t name_length,
processor->classifier = NULL; processor->classifier = NULL;
processor->platform_name = 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->name), name, name_length);
build_string(&(processor->classifier), classifier, build_string(&(processor->classifier), classifier,
classifier_length); classifier_length);
if (platform_length > 0) if (platform_length > 0) {
{ build_string(&(processor->platform_name), platform, platform_length);
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) if (ldflags_length > 0) {
{ build_string(&(processor->user_ldflags), ldflags, ldflags_length);
build_string(&(processor->envvars), envvars,
envvars_length);
} }
} }
......
...@@ -818,8 +818,19 @@ void GenerateProcessImplementation(Process *p) ...@@ -818,8 +818,19 @@ void GenerateProcessImplementation(Process *p)
fprintf (nodes, "\n"); fprintf (nodes, "\n");
/* Env vars per target */ /* 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); 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, { FOREACH(b, Aplc_binding, p->bindings, {
fprintf(nodes, "%s\n", b->fv->name); fprintf(nodes, "%s\n", b->fv->name);
......
...@@ -33,7 +33,9 @@ void End_Drivers_Section(); ...@@ -33,7 +33,9 @@ void End_Drivers_Section();
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 *classifier, size_t classifier_length,
char* platform, size_t platform_length, char* platform, size_t platform_length,
char *envvars, size_t envvars_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 New_Process(char *, size_t, char *,size_t, char *, size_t, bool);
void Set_OutDir(char *o,size_t len); void Set_OutDir(char *o,size_t len);
void Set_Interfaceview (char *name, size_t len); void Set_Interfaceview (char *name, size_t len);
......
...@@ -266,6 +266,8 @@ typedef struct t_processor { ...@@ -266,6 +266,8 @@ typedef struct t_processor {
char *classifier; char *classifier;
char *platform_name; char *platform_name;
char *envvars; char *envvars;
char *user_cflags;
char *user_ldflags;
} Processor; } 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