[PATCH V7] kbuild: create a rule to run the pre-processor on *.dts files

Srinivas KANDAGATLA srinivas.kandagatla at st.com
Sat Feb 2 06:22:59 EST 2013


On 01/02/13 16:51, Rob Herring wrote:
> On 02/01/2013 03:01 AM, Srinivas KANDAGATLA wrote:
>> Hi Stephen,
>> Not sure if you have already noticed this but,
>> I did try this patch on my 3.8, and it looks like the intermediate dts
>> file replaces all instances of linux with 1 because of predefined macros
>> in gcc.
>> As a result
>>     linux,stdout-path = "/soc/stm-asc2";
>> is changed to.
>>     1,stdout-path = "/soc/stm-asc2";
>>
>> On my version of compiler(gcc version 4.6.3) I have
>>
>> armv7-linux-gcc -E -dM - < /dev/null | grep -v _
>> #define unix 1
>> #define linux 1
>>
>> Which might be true with most compiler versions aswell.
>> As we are using linux as prefix for some device tree properties it makes
>> sense to undef the linux gcc define.
>> Adding -Ulinux to cmd_dtc_cpp should fix it.
>>
>> -cmd_dtc_cpp = $(CPP) $(cpp_flags) -D__DTS__ -x assembler-with-cpp -o
>> $(dtc-tmp) $< ; \
>> +cmd_dtc_cpp = $(CPP) $(cpp_flags) -D__DTS__  -Ulinux -x
>> assembler-with-cpp -o $(dtc-tmp) $< ; \
>>     $(objtree)/scripts/dtc/dtc -O dtb -o $@ -b 0 $(DTC_FLAGS) $(dtc-tmp)
> That's a hackish solution that seems fragile as well. Is there no way to
> turn off all built-in defines?
Yes, there is another option to turn of system-specific options and keep
macros like __ASSEMBLER__

|-undef||(|Do not predefine any system-specific or GCC-specific macros.
The standard predefined macros remain defined. See Standard Predefined
Macros
<http://gcc.gnu.org/onlinedocs/cpp/Standard-Predefined-Macros.html#Standard-Predefined-Macros>.)
This option also worked for me.

--srini



>
> Rob
> _______________________________________________
> devicetree-discuss mailing list
> devicetree-discuss at lists.ozlabs.org
> https://lists.ozlabs.org/listinfo/devicetree-discuss
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ozlabs.org/pipermail/devicetree-discuss/attachments/20130201/b5b9bbc4/attachment.html>


More information about the devicetree-discuss mailing list