public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [PATCH v1 1/1] BaseTools: Build ASL files before C files
@ 2019-10-30 13:50 PierreGondois
  2019-10-30 13:52 ` [edk2-devel] " PierreGondois
                   ` (2 more replies)
  0 siblings, 3 replies; 22+ messages in thread
From: PierreGondois @ 2019-10-30 13:50 UTC (permalink / raw)
  To: devel; +Cc: Pierre Gondois, bob.c.feng, liming.gao, Sami.Mujawar, nd

From: Pierre Gondois <pierre.gondois@arm.com>

The '-tc' option of the Intel iASL compiler facilitates
generation of AML code in a C array. This AML code is
output to a .hex file. The .hex file can be included
from a C source file, thereby allowing one to run a
fix-up code in C.

For example, this technique can be used to patch the
resource data elements that describe the base address
or interrupt number for a device, before installing
the ACPI table.

To implement this feature two conditions need to be
satisfied:
 - The ASL and C files must be included in the sources
   section of the same .inf file for the module.
 - The ASL files are pre-processed and compiled before
   the C files (so that the .hex file include dependency
   is satisfied).

This patch resolves the dependency by sorting the
CODA_TARGET list for the module being built and
placing the .aml files at the very beginning of
the list.

Signed-off-by: Pierre Gondois <pierre.gondois@arm.com>
---

The changes can be seen at https://github.com/PierreARM/edk2/commits/676_build_asl_first_v1

Notes:
    v1:
    - Sort .aml files first in the CODA_TARGET to build      [Pierre]
      them before other files.

 BaseTools/Source/Python/AutoGen/ModuleAutoGen.py | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/BaseTools/Source/Python/AutoGen/ModuleAutoGen.py b/BaseTools/Source/Python/AutoGen/ModuleAutoGen.py
index f0812b6887be6f9fbdb14003f2efff229633fb34..a59ed1d1952c23d0d3de83353a0566fb8a7dab77 100755
--- a/BaseTools/Source/Python/AutoGen/ModuleAutoGen.py
+++ b/BaseTools/Source/Python/AutoGen/ModuleAutoGen.py
@@ -2,6 +2,7 @@
 # Create makefile for MS nmake and GNU make
 #
 # Copyright (c) 2019, Intel Corporation. All rights reserved.<BR>
+# Copyright (c) 2019, ARM Limited. All rights reserved.<BR>
 # SPDX-License-Identifier: BSD-2-Clause-Patent
 #
 from __future__ import absolute_import
@@ -931,7 +932,14 @@ class ModuleAutoGen(AutoGen):
     @cached_property
     def CodaTargetList(self):
         self.Targets
-        return self._FinalBuildTargetList
+
+        # To resolve dependencies on compiled ASL files (.aml files) in modules,
+        # build them first by putting them as the first targets in the
+        # CodaTargetList.
+        OrderedList = list(self._FinalBuildTargetList)
+        OrderedList.sort(key=lambda T: (T.Target.Ext.lower() != '.aml'))
+
+        return OrderedList
 
     @cached_property
     def FileTypes(self):
-- 
'Guid(CE165669-3EF3-493F-B85D-6190EE5B9759)'



^ permalink raw reply related	[flat|nested] 22+ messages in thread

end of thread, other threads:[~2019-12-24 16:47 UTC | newest]

Thread overview: 22+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-10-30 13:50 [PATCH v1 1/1] BaseTools: Build ASL files before C files PierreGondois
2019-10-30 13:52 ` [edk2-devel] " PierreGondois
2019-10-31  0:41 ` Liming Gao
2019-10-31 11:12   ` PierreGondois
2019-11-04  7:49     ` Bob Feng
2019-11-04 10:32       ` PierreGondois
2019-11-12 13:33       ` PierreGondois
2019-11-13  1:15         ` Liming Gao
2019-11-13  1:40         ` Bob Feng
2019-11-15 16:27           ` PierreGondois
2019-12-04 17:32             ` PierreGondois
2019-12-11 11:23               ` PierreGondois
2019-12-12  9:14                 ` Bob Feng
2019-12-16  0:33                   ` PierreGondois
2019-12-17 11:41                     ` Bob Feng
2019-12-18 10:43                       ` PierreGondois
2019-12-18 17:50 ` Ard Biesheuvel
2019-12-19 11:18   ` PierreGondois
2019-12-19 16:58     ` Ard Biesheuvel
2019-12-19 18:15       ` Sami Mujawar
2019-12-23 16:09         ` Ard Biesheuvel
2019-12-24 16:47           ` PierreGondois

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox