How to build external drivers


Joris Offouga
 

Hi all,

How to build external drivers with zephyr, like board with example : west build -b board_name . -- -DBOARD=board_name -DBOARD_ROOT=<path_to_board>.

is there a similar command for drivers?

Best regards,

Joris Offouga



--
Best Regards,

Joris Offouga


Sebastian Boe
 

Yes,

you can add out-of-tree directories that contain CMakeLists.txt files that define zephyr libraries (like drivers), by doing

west build -b board_name . -- -DZEPHYR_EXTRA_MODULES<path_to_driver>

________________________________________
From: devel@lists.zephyrproject.org <devel@lists.zephyrproject.org> on behalf of Joris Offouga via Lists.Zephyrproject.Org <offougajoris=gmail.com@lists.zephyrproject.org>
Sent: Thursday, September 5, 2019 5:39:37 PM
To: devel@lists.zephyrproject.org
Cc: devel@lists.zephyrproject.org
Subject: [Zephyr-devel] How to build external drivers

Hi all,

How to build external drivers with zephyr, like board with example :
west build -b board_name . -- -DBOARD=board_name
-DBOARD_ROOT=<path_to_board>.

is there a similar command for drivers?

Best regards,

Joris Offouga



--
Best Regards,

Joris Offouga


Joris Offouga
 

Hi Sebastian,

Thanks for your quick reply, does it have to have a specific folder structure like for boards too? If yes which one ?

Le 05/09/2019 à 17:44, Bøe, Sebastian a écrit :
Yes,

you can add out-of-tree directories that contain CMakeLists.txt files that define zephyr libraries (like drivers), by doing

west build -b board_name . -- -DZEPHYR_EXTRA_MODULES<path_to_driver>

________________________________________
From: devel@lists.zephyrproject.org <devel@lists.zephyrproject.org> on behalf of Joris Offouga via Lists.Zephyrproject.Org <offougajoris=gmail.com@lists.zephyrproject.org>
Sent: Thursday, September 5, 2019 5:39:37 PM
To: devel@lists.zephyrproject.org
Cc: devel@lists.zephyrproject.org
Subject: [Zephyr-devel] How to build external drivers

Hi all,

How to build external drivers with zephyr, like board with example :
west build -b board_name . -- -DBOARD=board_name
-DBOARD_ROOT=<path_to_board>.

is there a similar command for drivers?

Best regards,

Joris Offouga



--
Best Regards,

Joris Offouga

--
Best Regards,

Joris Offouga


Bolivar, Marti
 

"Joris Offouga via Lists.Zephyrproject.Org"
<offougajoris=gmail.com@lists.zephyrproject.org> writes:

Hi all,

How to build external drivers with zephyr, like board with example :
west build -b board_name . -- -DBOARD=board_name
-DBOARD_ROOT=<path_to_board>.
Just a couple of notes:

- the board doesn't have to be specified twice
- the default source directory is the current working directory

So this could be written a bit more simply as:

$ west build -b board_name -- -DBOARD_ROOT=<path_to_board>


is there a similar command for drivers?
This is supported:

https://github.com/zephyrproject-rtos/zephyr/issues/8379

As far as I can tell, there's nothing to do. For example, the
downstream nrf repository has out of tree drivers in its drivers/
directory:

https://github.com/NordicPlayground/fw-nrfconnect-nrf

This supports building applications with west build out of the box.

E.g. you can build nrf/applications/nrf_desktop with an out of tree
board, using the out of tree pmw3360 driver, with:

west build -b nrf52840_pca20041 -- -DBOARD_ROOT=$HOME/ncs/nrf

(The BOARD_ROOT is not strictly necessary here because of some magic
in the nrf build system, but it doesn't hurt so I've put it in for
your reference.)

Please note that if you're going to try to replicate this exact
example yourself, you need to create a separate west installation
using the downstream getting started guide:

https://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/nrf/getting_started.html

Otherwise, hopefully it's a starting point for you.

Best,
Marti


Best regards,

Joris Offouga



--
Best Regards,

Joris Offouga


Joris Offouga
 

Le 05/09/2019 à 19:24, Bolivar, Marti a écrit :
"Joris Offouga via Lists.Zephyrproject.Org"
<offougajoris=gmail.com@lists.zephyrproject.org> writes:

Hi all,

How to build external drivers with zephyr, like board with example :
west build -b board_name . -- -DBOARD=board_name
-DBOARD_ROOT=<path_to_board>.
Just a couple of notes:

- the board doesn't have to be specified twice
- the default source directory is the current working directory

So this could be written a bit more simply as:

$ west build -b board_name -- -DBOARD_ROOT=<path_to_board>

is there a similar command for drivers?
This is supported:

https://github.com/zephyrproject-rtos/zephyr/issues/8379

As far as I can tell, there's nothing to do. For example, the
downstream nrf repository has out of tree drivers in its drivers/
directory:

https://github.com/NordicPlayground/fw-nrfconnect-nrf

This supports building applications with west build out of the box.

E.g. you can build nrf/applications/nrf_desktop with an out of tree
board, using the out of tree pmw3360 driver, with:

west build -b nrf52840_pca20041 -- -DBOARD_ROOT=$HOME/ncs/nrf

(The BOARD_ROOT is not strictly necessary here because of some magic
in the nrf build system, but it doesn't hurt so I've put it in for
your reference.)

Please note that if you're going to try to replicate this exact
example yourself, you need to create a separate west installation
using the downstream getting started guide:

https://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/nrf/getting_started.html

Otherwise, hopefully it's a starting point for you.

Best,
Marti
Hi Marti,

Thanks for your help, I was inspired by the nrf repo and I could build my driver.

Best Regards,

Joris Offouga


Best regards,

Joris Offouga



--
Best Regards,

Joris Offouga


--
Best Regards,

Joris Offouga


Bolivar, Marti
 

Joris Offouga <offougajoris@gmail.com> writes:

Le 05/09/2019 à 19:24, Bolivar, Marti a écrit :
"Joris Offouga via Lists.Zephyrproject.Org"
<offougajoris=gmail.com@lists.zephyrproject.org> writes:
Hi Marti,

Thanks for your help, I was inspired by the nrf repo and I could build
my driver.

Best Regards,

Joris Offouga
Great! Glad it helped.