strange board DTS parsing error
Li, Jun R
Hi all,
I’m trying to add a sensor board to a STM32F4 discovery board for a prototype, i.e., adding a BMI160 sensor to the SPI1 bus. To do that, I’ve modified the file “boards/arm/stm32f4_disco/stm32f4_disco.dts” and added the following section:
+ +&spi1 { + cs-gpios = <&gpiob 5 0>; + status = "ok"; + + bmi160@1 { + compatible = "bosch,bmi160"; + reg = <0x1>; + label = "bmi160"; + spi-max-frequency = <640000>; + int-gpios = <&gpioa 4 0>; + status = "ok"; + }; +};
I used samples/hello_world to validate my changes. However, when I built “hello_world” by specifying the board to “stm32f4_disco”, I got the following errors:
cmake -DBOARD=stm32f4_disco .. Zephyr version: 1.14.0 -- Found PythonInterp: /usr/bin/python3 (found suitable version "3.5.2", minimum required is "3.4") -- Selected BOARD stm32f4_disco -- Loading /home/my/zephyr/boards/arm/stm32f4_disco/stm32f4_disco.dts as base -- Overlaying /home/my/zephyr/dts/common/common.dts Traceback (most recent call last): File "/home/my/zephyr/scripts/dts/extract_dts_includes.py", line 542, in <module> main() File "/home/my/zephyr/scripts/dts/extract_dts_includes.py", line 524, in main generate_node_definitions() File "/home/my/zephyr/scripts/dts/extract_dts_includes.py", line 471, in generate_node_definitions extract_node_include_info(reduced, k, k, None) File "/home/my/zephyr/scripts/dts/extract_dts_includes.py", line 300, in extract_node_include_info node_compat, sub_node_address, c, v, names) File "/home/my/zephyr/scripts/dts/extract_dts_includes.py", line 219, in extract_property reg.extract(node_address, names, def_label, 1) File "/home/my/zephyr/scripts/dts/extract/reg.py", line 49, in extract extract_controller(node_address, "cs-gpios", cs_gpios, reg[0], def_label, "cs-gpio", True) File "/home/my/zephyr/scripts/dts/extract/globals.py", line 373, in extract_controller prop_array = [prop_array[index]] IndexError: list index out of range CMake Error at /home/my/zephyr/cmake/dts.cmake:145 (message): command failed with return code: 1 Call Stack (most recent call first): /home/my/zephyr/cmake/app/boilerplate.cmake:401 (include) CMakeLists.txt:3 (include)
-- Configuring incomplete, errors occurred!
If I comment either the line “cs-gpios = <&gpiob 5 0>;” or the section “bmi160@1 { ...}” above, the cmake configuration will succeed. But keeping both will get the above errors. I have no idea why it generated the parsing error. I saw the board dts definition file “boards/arc/arduino_101_sss/arduino_101_sss.dts” also did the same thing but it doesn’t get this kind of error.
Thank you! Jun Li
|
|
Kumar Gala
I’m guessing this is because the reg should be set to 0 and not 1.
toggle quoted messageShow quoted text
So it should be: bmi160@0 { … reg = <0>; ... }; - k
On Feb 12, 2019, at 6:11 PM, Li, Jun R <jun.r.li@intel.com> wrote:
|
|
Li, Jun R
Hah, it works after reg is changed to <0>. Thank you, Kumar!
toggle quoted messageShow quoted text
By the way, what does "reg=<0>" mean for the sensor bmi160 here? Regards, Jun On 2/12/19, 19:36, "Kumar Gala" <kumar.gala@linaro.org> wrote: I’m guessing this is because the reg should be set to 0 and not 1. So it should be: bmi160@0 { … reg = <0>; ... }; - k
On Feb 12, 2019, at 6:11 PM, Li, Jun R <jun.r.li@intel.com> wrote:> > Hi all, > > I’m trying to add a sensor board to a STM32F4 discovery board for a prototype, i.e., adding a BMI160 sensor to the SPI1 bus. To do that, I’ve modified the file > “boards/arm/stm32f4_disco/stm32f4_disco.dts” and added the following section: > > + > +&spi1 { > + cs-gpios = <&gpiob 5 0>; > + status = "ok"; > + > + bmi160@1 { > + compatible = "bosch,bmi160"; > + reg = <0x1>; > + label = "bmi160"; > + spi-max-frequency = <640000>; > + int-gpios = <&gpioa 4 0>; > + status = "ok"; > + }; > +}; > > I used samples/hello_world to validate my changes. However, when I built “hello_world” by specifying the board to “stm32f4_disco”, I got the following errors: > > cmake -DBOARD=stm32f4_disco .. > Zephyr version: 1.14.0 > -- Found PythonInterp: /usr/bin/python3 (found suitable version "3.5.2", minimum required is "3.4") > -- Selected BOARD stm32f4_disco > -- Loading /home/my/zephyr/boards/arm/stm32f4_disco/stm32f4_disco.dts as base > -- Overlaying /home/my/zephyr/dts/common/common.dts > Traceback (most recent call last): > File "/home/my/zephyr/scripts/dts/extract_dts_includes.py", line 542, in <module> > main() > File "/home/my/zephyr/scripts/dts/extract_dts_includes.py", line 524, in main > generate_node_definitions() > File "/home/my/zephyr/scripts/dts/extract_dts_includes.py", line 471, in generate_node_definitions > extract_node_include_info(reduced, k, k, None) > File "/home/my/zephyr/scripts/dts/extract_dts_includes.py", line 300, in extract_node_include_info > node_compat, sub_node_address, c, v, names) > File "/home/my/zephyr/scripts/dts/extract_dts_includes.py", line 219, in extract_property > reg.extract(node_address, names, def_label, 1) > File "/home/my/zephyr/scripts/dts/extract/reg.py", line 49, in extract > extract_controller(node_address, "cs-gpios", cs_gpios, reg[0], def_label, "cs-gpio", True) > File "/home/my/zephyr/scripts/dts/extract/globals.py", line 373, in extract_controller > prop_array = [prop_array[index]] > IndexError: list index out of range > CMake Error at /home/my/zephyr/cmake/dts.cmake:145 (message): > command failed with return code: 1 > Call Stack (most recent call first): > /home/my/zephyr/cmake/app/boilerplate.cmake:401 (include) > CMakeLists.txt:3 (include) > > -- Configuring incomplete, errors occurred! > > If I comment either the line “cs-gpios = <&gpiob 5 0>;” or the section “bmi160@1 { ...}” above, the cmake configuration will succeed. But keeping both will get the above errors. I have no idea why it generated the parsing error. I saw the board dts definition file “boards/arc/arduino_101_sss/arduino_101_sss.dts” also did the same thing but it doesn’t get this kind of error. > > Thank you! > > Jun Li > >
|
|
Kumar Gala
Reg is specifying which chip select to use. In your dts snippet since you have a cs-gpio I assumed that there is a single CS and so reg should be 0 instead of 1.
toggle quoted messageShow quoted text
- k
On Feb 12, 2019, at 10:05 PM, Li, Jun R <jun.r.li@intel.com> wrote:
|
|