浏览代码

dtoc: Replace dot with underscore to avoid compiler errors

If there is a '.' in a compatible string, then dtoc will produce a struct
with a name containing a '.'. This won't work, so replace it with '_'.

Also add a suitable test to the sandbox device tree to catch this.

Signed-off-by: Simon Glass <sjg@chromium.org>
Simon Glass 8 年之前
父节点
当前提交
6b6024a3a2
共有 2 个文件被更改,包括 6 次插入0 次删除
  1. 5 0
      arch/sandbox/dts/sandbox.dts
  2. 1 0
      tools/dtoc/dtoc.py

+ 5 - 0
arch/sandbox/dts/sandbox.dts

@@ -203,6 +203,11 @@
 		stringarray = "one";
 		stringarray = "one";
 	};
 	};
 
 
+	spl-test4 {
+		u-boot,dm-pre-reloc;
+		compatible = "sandbox,spl-test.2";
+	};
+
 	square {
 	square {
 		compatible = "demo-shape";
 		compatible = "demo-shape";
 		colour = "blue";
 		colour = "blue";

+ 1 - 0
tools/dtoc/dtoc.py

@@ -54,6 +54,7 @@ def Conv_name_to_c(name):
     str = name.replace('@', '_at_')
     str = name.replace('@', '_at_')
     str = str.replace('-', '_')
     str = str.replace('-', '_')
     str = str.replace(',', '_')
     str = str.replace(',', '_')
+    str = str.replace('.', '_')
     str = str.replace('/', '__')
     str = str.replace('/', '__')
     return str
     return str