git://scm.lunaixsky.com
/
lunaix-os.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
feat: serial device interfacing
[lunaix-os.git]
/
lunaix-os
/
scripts
/
expand.py
diff --git
a/lunaix-os/scripts/expand.py
b/lunaix-os/scripts/expand.py
index 041bb78421b93e6c0c5c11d7f836e43285ae2e50..9fe3d94969b3fdb9e6b3d6683c3fa036a23dd09e 100644
(file)
--- a/
lunaix-os/scripts/expand.py
+++ b/
lunaix-os/scripts/expand.py
@@
-284,33
+284,35
@@
class MemoryMapObject(DataObject):
if "width" in record:
self.__width = DataObject.create("width", record["width"])
if "width" in record:
self.__width = DataObject.create("width", record["width"])
- def __process(self, start_addr, idx, regions
, size_lookahead = False
):
+ def __process(self, start_addr, idx, regions):
if idx >= len(regions):
raise Exception("Unbounded region definition")
e = regions[idx]
if idx >= len(regions):
raise Exception("Unbounded region definition")
e = regions[idx]
+ if "start" not in e:
+ ne = regions[idx + 1]
+ if "start" not in ne or "size" not in e:
+ e["start"] = start_addr
+ else:
+ self.__process(start_addr + e["size"], idx + 1, regions)
+ e["start"] = ne['start'] - e["size"]
+
if "block" in e:
b = e["block"] - 1
if "block" in e:
b = e["block"] - 1
-
start_addr = (start_addr
+ b) & ~b
+
e["start"] = (e["start"]
+ b) & ~b
- if "start" not in e:
- e["start"] = start_addr
- elif e["start"] < start_addr:
+ if e["start"] < start_addr:
raise Exception(f"starting addr {hex(e['start'])} overrlapping with {hex(start_addr)}")
raise Exception(f"starting addr {hex(e['start'])} overrlapping with {hex(start_addr)}")
- else:
- start_addr = e["start"]
- if "size" not in e:
- if size_lookahead:
- raise Exception("could not infer size from unbounded region")
- tmp_addr = self.__process(start_addr, idx + 1, regions, size_lookahead=True)
- e["size"] = tmp_addr - start_addr
+ start_addr = e["start"]
- if not size_lookahead:
- start_addr += e["size"]
+ if "size" not in e:
+ self.__process(start_addr, idx + 1, regions)
+ ne = regions[idx + 1]
+ e["size"] = ne['start'] - start_addr
- return start_addr
+ return start_addr
+ e["size"]
def expand(self, param={}):
super().expand(param)
def expand(self, param={}):
super().expand(param)