How to use hal external module with Zephyr?

I'm trying to create a HAL library to use it with zephyr application

From what I have read I need to create another module .

I can't figure out how to set up the module and how to compile it.

for the moment I have only 1 module to add with the following files hal_flash.c and hal_flash.h 

How can I add cmake files kconfig files to make it work with zephyr application

note: app on nRF9160

Parents
  • I used this project as reference https://github.com/zephyrproject-rtos/hal_nrfx

    I made those changes:

    and added flash.h file to "nrfx/drivers/include" and flash.c to "nrfx/drivers/src/"

    and changed the CMakeLists and added this line

    zephyr_sources_ifdef(CONFIG_NRFX_FLASH   nrfx/drivers/src/hal_flash.c)

    and for the test I created an app folder with this structure

    hal_nrfx/app
    ├── CMakeLists.txt
    ├── prj.conf
    └── src
        └── main.c
    

    in main i include 

    #include <hal_flash.h>

    In the prj.conf I added 

    CONFIG_NRFX_FLASH=y
    but I keep getting this error when I try to build with "west build -p auto -b nrf9160dk_nrf9160_ns ."
Reply
  • I used this project as reference https://github.com/zephyrproject-rtos/hal_nrfx

    I made those changes:

    and added flash.h file to "nrfx/drivers/include" and flash.c to "nrfx/drivers/src/"

    and changed the CMakeLists and added this line

    zephyr_sources_ifdef(CONFIG_NRFX_FLASH   nrfx/drivers/src/hal_flash.c)

    and for the test I created an app folder with this structure

    hal_nrfx/app
    ├── CMakeLists.txt
    ├── prj.conf
    └── src
        └── main.c
    

    in main i include 

    #include <hal_flash.h>

    In the prj.conf I added 

    CONFIG_NRFX_FLASH=y
    but I keep getting this error when I try to build with "west build -p auto -b nrf9160dk_nrf9160_ns ."
Children
Related