Skip to content

Commit

Permalink
[generators] always put configure options at beginning
Browse files Browse the repository at this point in the history
put all makefile vars (specified via configure) before including the board makefile.

e.g. RADIO_CONTROL_PPM_PIN has moved to the board makefile, and this
```
<subsystem name="radio_control" type="ppm">
   <configure name="RADIO_CONTROL_PPM_PIN" value="UART1_RX"/>
</subsystem>
```
was not working anymore and instead it was necessary to move the configure line outside of the subsystem lines:
```
<subsystem name="radio_control" type="ppm"/>
<configure name="RADIO_CONTROL_PPM_PIN" value="UART1_RX"/>
```

This should fix that regression again.
  • Loading branch information
flixr committed Jan 13, 2016
1 parent c000dd9 commit 6679c1e
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions sw/tools/generators/gen_aircraft.ml
Expand Up @@ -107,7 +107,7 @@ let module_xml2mk = fun f target m ->
let section =
let targets = Gen_common.targets_of_field section Env.default_module_targets in
if Gen_common.test_targets target targets then section else Xml.Element ("makefile", [], [])
in
in
Xml.iter
(fun field ->
match String.lowercase (Xml.tag field) with
Expand Down Expand Up @@ -163,7 +163,7 @@ let subsystem_xml2mk = fun f firmware s ->
fprintf f "\n# -subsystem: '%s'\n" name;
let s_config, rest = ExtXml.partition_tag "configure" (Xml.children s) in
let s_defines, _ = ExtXml.partition_tag "define" rest in
List.iter (configure_xml2mk f) s_config;
(*List.iter (configure_xml2mk f) s_config;*)
List.iter (fun def -> define_xml2mk f def) s_defines;
(* include subsystem *) (* TODO test if file exists with the generator ? *)
let s_name = name ^ s_type ^ ".makefile" in
Expand All @@ -174,6 +174,10 @@ let subsystem_xml2mk = fun f firmware s ->
fprintf f "\tinclude $(CFG_SHARED)/%s\n" s_name;
fprintf f "endif\n"

let subsystem_configure_xml2mk = fun f s ->
let s_config, _ = ExtXml.partition_tag "configure" (Xml.children s) in
List.iter (configure_xml2mk f) s_config

let mod_or_subsys_xml2mk = fun f global_targets firmware target xml ->
try
let m = Gen_common.get_module xml global_targets in
Expand Down Expand Up @@ -208,7 +212,11 @@ let parse_firmware = fun makefile_ac ac_xml firmware ->
end;
List.iter (configure_xml2mk makefile_ac) config;
List.iter (configure_xml2mk makefile_ac) t_config;
fprintf makefile_ac "include $(PAPARAZZI_SRC)/conf/boards/%s.makefile\n" (Xml.attrib target "board");
List.iter (subsystem_configure_xml2mk makefile_ac) subsystems;
List.iter (subsystem_configure_xml2mk makefile_ac) t_subsystems;
List.iter (subsystem_configure_xml2mk makefile_ac) mods;
List.iter (subsystem_configure_xml2mk makefile_ac) t_mods;
fprintf makefile_ac "\ninclude $(PAPARAZZI_SRC)/conf/boards/%s.makefile\n" (Xml.attrib target "board");
fprintf makefile_ac "include $(PAPARAZZI_SRC)/conf/firmwares/%s.makefile\n" (Xml.attrib firmware "name");
List.iter (fun def -> define_xml2mk makefile_ac def) defines;
List.iter (fun def -> define_xml2mk makefile_ac def) t_defines;
Expand Down

0 comments on commit 6679c1e

Please sign in to comment.