Skip to contentSkip to conversation

dtoc: make generated platdata structs const

PATCH In review Simon Goldschmidt 4 participants 6 messages Jan 7, 2019 – Jan 21, 2019

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 dtoc: make generated platdata structs const

The platdata initialization structs are currently generated into .rwdata. Make sure the are put into .rodata by generating them as const.

---

 tools/dtoc/dtb_platdata.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tools/dtoc/dtb_platdata.py +1 -1
index 6cb1259446..ca580b45d4 100644
@@ -461,7 +461,7 @@ class DtbPlatdata(object):
         """
         struct_name, _ = get_compat_name(node)
         var_name = conv_name_to_c(node.name)
-        self.buf('static struct %s%s %s%s = {\n' %
+        self.buf('static const struct %s%s %s%s = {\n' %
                  (STRUCT_PREFIX, struct_name, VAL_PREFIX, var_name))
         for pname, prop in node.props.items():
             if pname in PROP_IGNORE_LIST or pname[0] == '#':
Signature · 1 line
2.17.1
#1 lore raw

PATCH 1/1 dtoc: make generated platdata structs const

Quoted 9 lines · Simon Goldschmidt

The platdata initialization structs are currently generated into .rwdata. Make sure the are put into .rodata by generating them as const.

---

 tools/dtoc/dtb_platdata.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
#2 lore raw
In reply to Simon Goldschmidt
Quoted 5 lines · Simon Goldschmidt

The platdata initialization structs are currently generated into .rwdata. Make sure the are put into .rodata by generating them as const.

Applied to u-boot/master, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20190115/5171d3d6/attachment.sig>
#4 lore raw

PATCH 1/1 dtoc: make generated platdata structs const

In reply to Simon Goldschmidt

Hi Simon,

Quoted 5 lines · Simon Goldschmidt

The platdata initialization structs are currently generated into .rwdata. Make sure the are put into .rodata by generating them as const.

Unfortunately this breaks the dtoc and binman tests (make qcheck). Can you please take a look?

Regards,
Simon

Quoted 21 lines

---

 tools/dtoc/dtb_platdata.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tools/dtoc/dtb_platdata.py +1 -2
index 6cb1259446..ca580b45d4 100644
@@ -461,7 +461,7 @@ class DtbPlatdata(object):
         """
         struct_name, _ = get_compat_name(node)
         var_name = conv_name_to_c(node.name)
-        self.buf('static struct %s%s %s%s = {\n' %
+        self.buf('static const struct %s%s %s%s = {\n' %
                  (STRUCT_PREFIX, struct_name, VAL_PREFIX, var_name))
         for pname, prop in node.props.items():
             if pname in PROP_IGNORE_LIST or pname[0] == '#':
--

2.17.1

#5 lore raw

PATCH 1/1 dtoc: make generated platdata structs const

Hi Simon,

Am 20.01.2019 um 21:23 schrieb Simon Glass:

Quoted 5 lines

Hi Simon,

Quoted 1 line · Simon Goldschmidt
Quoted 7 lines
Quoted 4 lines

The platdata initialization structs are currently generated into .rwdata. Make sure the are put into .rodata by generating them as const.

Unfortunately this breaks the dtoc and binman tests (make qcheck). Can you please take a look?

Yes, sorry, I wasn't aware of that.

I'll fix the dtoc tests, but I don't get binman test failures, so I don't know what I should fix there...

Regards,
Simon

Quoted 25 lines

Regards,
Simon

Quoted 21 lines

---

  tools/dtoc/dtb_platdata.py | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
tools/dtoc/dtb_platdata.py +1 -2
index 6cb1259446..ca580b45d4 100644
@@ -461,7 +461,7 @@ class DtbPlatdata(object):
          """
          struct_name, _ = get_compat_name(node)
          var_name = conv_name_to_c(node.name)
-        self.buf('static struct %s%s %s%s = {\n' %
+        self.buf('static const struct %s%s %s%s = {\n' %
                   (STRUCT_PREFIX, struct_name, VAL_PREFIX, var_name))
          for pname, prop in node.props.items():
              if pname in PROP_IGNORE_LIST or pname[0] == '#':
--

2.17.1