Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build error for lwm2m_client w/ modem overlay #11447

Closed
mike-scott opened this issue Nov 16, 2018 · 5 comments
Closed

Build error for lwm2m_client w/ modem overlay #11447

mike-scott opened this issue Nov 16, 2018 · 5 comments
Assignees
Labels
area: Devicetree bug The issue is a bug, or the PR is fixing a bug priority: low Low impact/importance bug
Milestone

Comments

@mike-scott
Copy link
Contributor

** Issue reproduction **
Using SDK 0.9.5 on Ubuntu 18.04:

$ cd <zephyr dir>
$ export ZEPHYR_SDK_INSTALL_DIR=~/zephyr-sdk
$ export ZEPHYR_TOOLCHAIN_VARIANT=zephyr
$ . zephyr-env.sh
$ cd samples/net/lwm2m_client/
$ mkdir build && cd build
$ cmake -DBOARD=frdm_k64f -DOVERLAY_CONFIG=overlay-dns.conf ..
$ make

Generates the following build errors:

[ 47%] Building C object zephyr/CMakeFiles/zephyr.dir/drivers/modem/wncm14a2a.c.obj
/zephyr/samples/net/lwm2m_client/build/zephyr/include/generated/generated_dts_board.h:823:53: error: ‘DT_NXP_KINETIS_UART_4006C000_WNCM14A2A_MDM_BOOT_MODE_SEL_GPIOS_CONTROLLER’ undeclared here (not in a function)
 #define DT_WNCM14A2A_GPIO_MDM_BOOT_MODE_SEL_NAME    DT_NXP_KINETIS_UART_4006C000_WNCM14A2A_MDM_BOOT_MODE_SEL_GPIOS_CONTROLLER
                                                     ^
/zephyr/drivers/modem/wncm14a2a.c:46:14: note: in definition of macro ‘PINCONFIG’
  .dev_name = name_, \
              ^~~~~
/zephyr/drivers/modem/wncm14a2a.c:65:12: note: in expansion of macro ‘DT_WNCM14A2A_GPIO_MDM_BOOT_MODE_SEL_NAME’
  PINCONFIG(DT_WNCM14A2A_GPIO_MDM_BOOT_MODE_SEL_NAME,
            ^
/zephyr/samples/net/lwm2m_client/build/zephyr/include/generated/generated_dts_board.h:824:53: error: ‘DT_NXP_KINETIS_UART_4006C000_WNCM14A2A_MDM_BOOT_MODE_SEL_GPIOS_PIN’ undeclared here (not in a function)
 #define DT_WNCM14A2A_GPIO_MDM_BOOT_MODE_SEL_PIN     DT_NXP_KINETIS_UART_4006C000_WNCM14A2A_MDM_BOOT_MODE_SEL_GPIOS_PIN
                                                     ^
/zephyr/drivers/modem/wncm14a2a.c:47:9: note: in definition of macro ‘PINCONFIG’
  .pin = pin_ \
         ^~~~
/zephyr/drivers/modem/wncm14a2a.c:66:5: note: in expansion of macro ‘DT_WNCM14A2A_GPIO_MDM_BOOT_MODE_SEL_PIN’
     DT_WNCM14A2A_GPIO_MDM_BOOT_MODE_SEL_PIN),
     ^
/zephyr/samples/net/lwm2m_client/build/zephyr/include/generated/generated_dts_board.h:825:53: error: ‘DT_NXP_KINETIS_UART_4006C000_WNCM14A2A_MDM_POWER_GPIOS_CONTROLLER’ undeclared here (not in a function)
 #define DT_WNCM14A2A_GPIO_MDM_POWER_NAME            DT_NXP_KINETIS_UART_4006C000_WNCM14A2A_MDM_POWER_GPIOS_CONTROLLER
                                                     ^
/zephyr/drivers/modem/wncm14a2a.c:46:14: note: in definition of macro ‘PINCONFIG’
  .dev_name = name_, \
              ^~~~~
/zephyr/drivers/modem/wncm14a2a.c:69:12: note: in expansion of macro ‘DT_WNCM14A2A_GPIO_MDM_POWER_NAME’
  PINCONFIG(DT_WNCM14A2A_GPIO_MDM_POWER_NAME,
            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/zephyr/samples/net/lwm2m_client/build/zephyr/include/generated/generated_dts_board.h:826:53: error: ‘DT_NXP_KINETIS_UART_4006C000_WNCM14A2A_MDM_POWER_GPIOS_PIN’ undeclared here (not in a function)
 #define DT_WNCM14A2A_GPIO_MDM_POWER_PIN             DT_NXP_KINETIS_UART_4006C000_WNCM14A2A_MDM_POWER_GPIOS_PIN
                                                     ^
/zephyr/drivers/modem/wncm14a2a.c:47:9: note: in definition of macro ‘PINCONFIG’
  .pin = pin_ \
         ^~~~
/zephyr/drivers/modem/wncm14a2a.c:70:5: note: in expansion of macro ‘DT_WNCM14A2A_GPIO_MDM_POWER_PIN’
     DT_WNCM14A2A_GPIO_MDM_POWER_PIN),
     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/zephyr/samples/net/lwm2m_client/build/zephyr/include/generated/generated_dts_board.h:827:53: error: ‘DT_NXP_KINETIS_UART_4006C000_WNCM14A2A_MDM_KEEP_AWAKE_GPIOS_CONTROLLER’ undeclared here (not in a function)
 #define DT_WNCM14A2A_GPIO_MDM_KEEP_AWAKE_NAME       DT_NXP_KINETIS_UART_4006C000_WNCM14A2A_MDM_KEEP_AWAKE_GPIOS_CONTROLLER
                                                     ^
/zephyr/drivers/modem/wncm14a2a.c:46:14: note: in definition of macro ‘PINCONFIG’
  .dev_name = name_, \
              ^~~~~
/zephyr/drivers/modem/wncm14a2a.c:73:12: note: in expansion of macro ‘DT_WNCM14A2A_GPIO_MDM_KEEP_AWAKE_NAME’
  PINCONFIG(DT_WNCM14A2A_GPIO_MDM_KEEP_AWAKE_NAME,
            ^
/zephyr/samples/net/lwm2m_client/build/zephyr/include/generated/generated_dts_board.h:828:53: error: ‘DT_NXP_KINETIS_UART_4006C000_WNCM14A2A_MDM_KEEP_AWAKE_GPIOS_PIN’ undeclared here (not in a function)
 #define DT_WNCM14A2A_GPIO_MDM_KEEP_AWAKE_PIN        DT_NXP_KINETIS_UART_4006C000_WNCM14A2A_MDM_KEEP_AWAKE_GPIOS_PIN
                                                     ^
/zephyr/drivers/modem/wncm14a2a.c:47:9: note: in definition of macro ‘PINCONFIG’
  .pin = pin_ \
         ^~~~
/zephyr/drivers/modem/wncm14a2a.c:74:5: note: in expansion of macro ‘DT_WNCM14A2A_GPIO_MDM_KEEP_AWAKE_PIN’
     DT_WNCM14A2A_GPIO_MDM_KEEP_AWAKE_PIN),
     ^
/zephyr/samples/net/lwm2m_client/build/zephyr/include/generated/generated_dts_board.h:829:53: error: ‘DT_NXP_KINETIS_UART_4006C000_WNCM14A2A_MDM_RESET_GPIOS_CONTROLLER’ undeclared here (not in a function)
 #define DT_WNCM14A2A_GPIO_MDM_RESET_NAME            DT_NXP_KINETIS_UART_4006C000_WNCM14A2A_MDM_RESET_GPIOS_CONTROLLER
                                                     ^
/zephyr/drivers/modem/wncm14a2a.c:46:14: note: in definition of macro ‘PINCONFIG’
  .dev_name = name_, \
              ^~~~~
/zephyr/drivers/modem/wncm14a2a.c:77:12: note: in expansion of macro ‘DT_WNCM14A2A_GPIO_MDM_RESET_NAME’
  PINCONFIG(DT_WNCM14A2A_GPIO_MDM_RESET_NAME,
            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/zephyr/samples/net/lwm2m_client/build/zephyr/include/generated/generated_dts_board.h:830:53: error: ‘DT_NXP_KINETIS_UART_4006C000_WNCM14A2A_MDM_RESET_GPIOS_PIN’ undeclared here (not in a function)
 #define DT_WNCM14A2A_GPIO_MDM_RESET_PIN             DT_NXP_KINETIS_UART_4006C000_WNCM14A2A_MDM_RESET_GPIOS_PIN
                                                     ^
/zephyr/drivers/modem/wncm14a2a.c:47:9: note: in definition of macro ‘PINCONFIG’
  .pin = pin_ \
         ^~~~
/zephyr/drivers/modem/wncm14a2a.c:78:5: note: in expansion of macro ‘DT_WNCM14A2A_GPIO_MDM_RESET_PIN’
     DT_WNCM14A2A_GPIO_MDM_RESET_PIN),
     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/zephyr/samples/net/lwm2m_client/build/zephyr/include/generated/generated_dts_board.h:831:53: error: ‘DT_NXP_KINETIS_UART_4006C000_WNCM14A2A_MDM_SHLD_TRANS_ENA_GPIOS_CONTROLLER’ undeclared here (not in a function)
 #define DT_WNCM14A2A_GPIO_MDM_SHLD_TRANS_ENA_NAME   DT_NXP_KINETIS_UART_4006C000_WNCM14A2A_MDM_SHLD_TRANS_ENA_GPIOS_CONTROLLER
                                                     ^
/zephyr/drivers/modem/wncm14a2a.c:46:14: note: in definition of macro ‘PINCONFIG’
  .dev_name = name_, \
              ^~~~~
/zephyr/drivers/modem/wncm14a2a.c:81:12: note: in expansion of macro ‘DT_WNCM14A2A_GPIO_MDM_SHLD_TRANS_ENA_NAME’
  PINCONFIG(DT_WNCM14A2A_GPIO_MDM_SHLD_TRANS_ENA_NAME,
            ^
/zephyr/samples/net/lwm2m_client/build/zephyr/include/generated/generated_dts_board.h:832:53: error: ‘DT_NXP_KINETIS_UART_4006C000_WNCM14A2A_MDM_SHLD_TRANS_ENA_GPIOS_PIN’ undeclared here (not in a function)
 #define DT_WNCM14A2A_GPIO_MDM_SHLD_TRANS_ENA_PIN    DT_NXP_KINETIS_UART_4006C000_WNCM14A2A_MDM_SHLD_TRANS_ENA_GPIOS_PIN
                                                     ^
/zephyr/drivers/modem/wncm14a2a.c:47:9: note: in definition of macro ‘PINCONFIG’
  .pin = pin_ \
         ^~~~
/zephyr/drivers/modem/wncm14a2a.c:82:5: note: in expansion of macro ‘DT_WNCM14A2A_GPIO_MDM_SHLD_TRANS_ENA_PIN’
     DT_WNCM14A2A_GPIO_MDM_SHLD_TRANS_ENA_PIN),
     ^
In file included from /zephyr/include/arch/arm/arch.h:20:0,
                 from /zephyr/include/arch/cpu.h:15,
                 from /zephyr/include/kernel_includes.h:34,
                 from /zephyr/include/kernel.h:17,
                 from /zephyr/include/logging/log_msg.h:9,
                 from /zephyr/include/logging/log_core.h:9,
                 from /zephyr/include/logging/log.h:11,
                 from /zephyr/drivers/modem/wncm14a2a.c:9:
/zephyr/drivers/modem/wncm14a2a.c: In function ‘wncm14a2a_init’:
/zephyr/samples/net/lwm2m_client/build/zephyr/include/generated/generated_dts_board.h:822:53: error: ‘DT_NXP_KINETIS_UART_4006C000_WNCM14A2A_BUS_NAME’ undeclared (first use in this function)
 #define DT_WNCM14A2A_UART_DRV_NAME                  DT_NXP_KINETIS_UART_4006C000_WNCM14A2A_BUS_NAME
                                                     ^
/zephyr/samples/net/lwm2m_client/build/zephyr/include/generated/generated_dts_board.h:822:53: note: in definition of macro ‘DT_WNCM14A2A_UART_DRV_NAME’
 #define DT_WNCM14A2A_UART_DRV_NAME                  DT_NXP_KINETIS_UART_4006C000_WNCM14A2A_BUS_NAME
                                                     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/zephyr/drivers/modem/wncm14a2a.c:1483:45: note: in expansion of macro ‘MDM_UART_DEV_NAME’
  ret = mdm_receiver_register(&ictx.mdm_ctx, MDM_UART_DEV_NAME,
                                             ^~~~~~~~~~~~~~~~~
/zephyr/samples/net/lwm2m_client/build/zephyr/include/generated/generated_dts_board.h:822:53: note: each undeclared identifier is reported only once for each function it appears in
 #define DT_WNCM14A2A_UART_DRV_NAME                  DT_NXP_KINETIS_UART_4006C000_WNCM14A2A_BUS_NAME
                                                     ^
/zephyr/samples/net/lwm2m_client/build/zephyr/include/generated/generated_dts_board.h:822:53: note: in definition of macro ‘DT_WNCM14A2A_UART_DRV_NAME’
 #define DT_WNCM14A2A_UART_DRV_NAME                  DT_NXP_KINETIS_UART_4006C000_WNCM14A2A_BUS_NAME
                                                     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/zephyr/drivers/modem/wncm14a2a.c:1483:45: note: in expansion of macro ‘MDM_UART_DEV_NAME’
  ret = mdm_receiver_register(&ictx.mdm_ctx, MDM_UART_DEV_NAME,
                                             ^~~~~~~~~~~~~~~~~
/zephyr/samples/net/lwm2m_client/build/zephyr/include/generated/generated_dts_board.h:822:53: warning: passing argument 2 of ‘mdm_receiver_register’ from incompatible pointer type [-Wincompatible-pointer-types]
 #define DT_WNCM14A2A_UART_DRV_NAME                  DT_NXP_KINETIS_UART_4006C000_WNCM14A2A_BUS_NAME
                                                     ^
/zephyr/samples/net/lwm2m_client/build/zephyr/include/generated/generated_dts_board.h:822:53: note: in definition of macro ‘DT_WNCM14A2A_UART_DRV_NAME’
 #define DT_WNCM14A2A_UART_DRV_NAME                  DT_NXP_KINETIS_UART_4006C000_WNCM14A2A_BUS_NAME
                                                     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/zephyr/drivers/modem/wncm14a2a.c:1483:45: note: in expansion of macro ‘MDM_UART_DEV_NAME’
  ret = mdm_receiver_register(&ictx.mdm_ctx, MDM_UART_DEV_NAME,
                                             ^~~~~~~~~~~~~~~~~
In file included from /zephyr/drivers/modem/wncm14a2a.c:33:0:
/zephyr/include/drivers/modem/modem_receiver.h:47:5: note: expected ‘const char *’ but argument is of type ‘const struct mdm_control_pinconfig *’
 int mdm_receiver_register(struct mdm_receiver_context *ctx,
     ^~~~~~~~~~~~~~~~~~~~~
zephyr/CMakeFiles/zephyr.dir/build.make:1062: recipe for target 'zephyr/CMakeFiles/zephyr.dir/drivers/modem/wncm14a2a.c.obj' failed
make[2]: *** [zephyr/CMakeFiles/zephyr.dir/drivers/modem/wncm14a2a.c.obj] Error 1
CMakeFiles/Makefile2:547: recipe for target 'zephyr/CMakeFiles/zephyr.dir/all' failed
make[1]: *** [zephyr/CMakeFiles/zephyr.dir/all] Error 2
Makefile:83: recipe for target 'all' failed
make: *** [all] Error 2

Expected behavior
No errors. When building sample using modem overlay.

Diagnosis
#1 When I checked build/zephyr/include/generated/generated_dts_board.h I noticed I'm missing the uart entries for UART2 used for the modem. Looks like we need to add status = "ok" to the DTS overlay.

I fixed this locally with the following patch:

diff --git a/samples/net/lwm2m_client/frdm_k64f.overlay b/samples/net/lwm2m_client/frdm_k64f.overlay
index c902dc7440..23f5081654 100644
--- a/samples/net/lwm2m_client/frdm_k64f.overlay
+++ b/samples/net/lwm2m_client/frdm_k64f.overlay
@@ -4,6 +4,9 @@
  * SPDX-License-Identifier: Apache-2.0
  */
 &uart2 {
+       current-speed = <115200>;
+       status = "ok";
+
        wncm14a2a {
                compatible = "wnc,m14a2a";
                label = "wncm14a2a";

However, this doesn't fix the build. I still see a slew of errors like:

zephyr/samples/net/lwm2m_client/build/zephyr/include/generated/generated_dts_board.h:867:53: error: ‘DT_NXP_KINETIS_UART_4006C000_WNCM14A2A_MDM_BOOT_MODE_SEL_GPIOS_CONTROLLER’ undeclared here (not in a function)
 #define DT_WNCM14A2A_GPIO_MDM_BOOT_MODE_SEL_NAME    DT_NXP_KINETIS_UART_4006C000_WNCM14A2A_MDM_BOOT_MODE_SEL_GPIOS_CONTROLLER

I check the generated_dts_board.h again. I do have the UART2 entries, however, the WNCM14A2A entries are not prefixed with DT_*:

/* wncm14a2a */
#define DT_NXP_KINETIS_UART_4006C000_WNCM14A2A_BUS_NAME					"UART_2"
#define NXP_KINETIS_UART_4006C000_WNCM14A2A_LABEL					"wncm14a2a"
#define NXP_KINETIS_UART_4006C000_WNCM14A2A_MDM_BOOT_MODE_SEL_GPIOS_CONTROLLER		"GPIO_2"
#define NXP_KINETIS_UART_4006C000_WNCM14A2A_MDM_BOOT_MODE_SEL_GPIOS_FLAGS		0
#define NXP_KINETIS_UART_4006C000_WNCM14A2A_MDM_BOOT_MODE_SEL_GPIOS_PIN			17
#define NXP_KINETIS_UART_4006C000_WNCM14A2A_MDM_KEEP_AWAKE_GPIOS_CONTROLLER		"GPIO_2"
#define NXP_KINETIS_UART_4006C000_WNCM14A2A_MDM_KEEP_AWAKE_GPIOS_FLAGS			0
#define NXP_KINETIS_UART_4006C000_WNCM14A2A_MDM_KEEP_AWAKE_GPIOS_PIN			2
#define NXP_KINETIS_UART_4006C000_WNCM14A2A_MDM_POWER_GPIOS_CONTROLLER			"GPIO_1"
#define NXP_KINETIS_UART_4006C000_WNCM14A2A_MDM_POWER_GPIOS_FLAGS			0
#define NXP_KINETIS_UART_4006C000_WNCM14A2A_MDM_POWER_GPIOS_PIN				9
#define NXP_KINETIS_UART_4006C000_WNCM14A2A_MDM_RESET_GPIOS_CONTROLLER			"GPIO_2"
#define NXP_KINETIS_UART_4006C000_WNCM14A2A_MDM_RESET_GPIOS_FLAGS			0
#define NXP_KINETIS_UART_4006C000_WNCM14A2A_MDM_RESET_GPIOS_PIN				12
#define NXP_KINETIS_UART_4006C000_WNCM14A2A_MDM_SEND_OK_GPIOS_CONTROLLER		"GPIO_3"
#define NXP_KINETIS_UART_4006C000_WNCM14A2A_MDM_SEND_OK_GPIOS_FLAGS			0
#define NXP_KINETIS_UART_4006C000_WNCM14A2A_MDM_SEND_OK_GPIOS_PIN			0
#define NXP_KINETIS_UART_4006C000_WNCM14A2A_MDM_SHLD_TRANS_ENA_GPIOS_CONTROLLER		"GPIO_2"
#define NXP_KINETIS_UART_4006C000_WNCM14A2A_MDM_SHLD_TRANS_ENA_GPIOS_FLAGS		0
#define NXP_KINETIS_UART_4006C000_WNCM14A2A_MDM_SHLD_TRANS_ENA_GPIOS_PIN		4

This is seems to be an error in the DTS processing?

@mike-scott mike-scott added this to the v1.14.0 milestone Nov 16, 2018
@mike-scott mike-scott added the bug The issue is a bug, or the PR is fixing a bug label Nov 16, 2018
@mike-scott
Copy link
Contributor Author

Fix for #1 issue mentioned above: #11448

@mike-scott
Copy link
Contributor Author

So it looks like the use of "base_label" in the dt-binding stops the addition of DT_* to the property:

$ fgrep -nr "base_label" dts/bindings/
dts/bindings/mtd/partition.yaml:40:base_label: FLASH_AREA
dts/bindings/arm/st,stm32-ccm.yaml:22:base_label: CCM
dts/bindings/modem/wnc,m14a2a.yaml:54:base_label: WNCM14A2A
dts/bindings/interrupt-controller/riscv,plic0.yaml:33:base_label: PLIC
dts/bindings/interrupt-controller/pulpino,event-unit.yaml:27:base_label: PULPINO_EVENT_UNIT
dts/bindings/device_node.yaml.template:73:base_label: LABEL

I have to wonder why these are being skipped?

@mike-scott
Copy link
Contributor Author

I removed the base_label from the modem binding and adjusted the dts_fixup files in new patches here:
#11448

@galak
Copy link
Collaborator

galak commented Nov 20, 2018

Is this now resolved with #11448 being merged?

@galak galak added the priority: low Low impact/importance bug label Nov 20, 2018
@mike-scott
Copy link
Contributor Author

Yep, can close.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: Devicetree bug The issue is a bug, or the PR is fixing a bug priority: low Low impact/importance bug
Projects
None yet
Development

No branches or pull requests

4 participants