platformio / zephyr

Primary Git Repository for the Zephyr Project. Zephyr is a new generation, scalable, optimized, secure RTOS for multiple hardware architectures.
https://docs.zephyrproject.org
Apache License 2.0
9 stars 11 forks source link

Zephyr SYSCALL_INCLUDE_DIRS doesn't take effect #2

Open andung07 opened 4 years ago

andung07 commented 4 years ago

What kind of issue is this?

You can erase any parts of this template not applicable to your Issue.


Configuration

Operating system: Mac OS 10.15.5

PlatformIO Version (platformio --version): 4.3.4

Description of problem

I am developing a custom out-of-tree driver with __syscall definition. As described here, I need to append the path containing my header definition to SYSCALL_INCLUDE_DIRS list CMake variables. But the scripts/gen_syscalls.py doesn't aware this additional path.

Steps to Reproduce

  1. Create the header file containing some __syscall functions. Let's say uwb.h
    
    __syscall void uwb_configure(struct device *dev, uwb_config_t *config);

static inline void z_impl_uwb_configure(struct device dev, uwb_config_t config) { const struct uwb_driver_api api = (const struct uwb_driver_api )dev->driver_api; return api->configure(dev, config); }

include <syscalls/uwb.h>

2. Add the path in step 1, to `zephyr/CMakeLists.txt`

list(APPEND SYSCALL_INCLUDE_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/include/drivers )

include($ENV{ZEPHYR_BASE}/cmake/app/boilerplate.cmake NO_POLICY_SCOPE)

zephyr_include_directories(${CMAKE_CURRENT_SOURCE_DIR}/include/drivers

3. Refer the uwb.h in one of user source files in `src`
4. Run the build

### Actual Results

In file included from src/main.c:31: zephyr/include/drivers/uwb.h:89:10: fatal error: syscalls/uwb.h: No such file or directory

include <syscalls/uwb.h>



### Expected Results
Build successfully

### Additional info
The additional SYSCALL_INCLUDE_DIRS doesn't take effect. It misses the appointed directory. There is no `uwb.h` generated in `.pio\build\zephyr\include\generated\syscalls`
th-fischer2020 commented 2 years ago

I run in a similar Problem. Have a look at your boards directory inside your platform-repo. There you can see many .json-Files. There you have to add "syscall_include_dirs": "zephyr" like this:

{
  "build": {
    "core": "stm32",
    "cpu": "cortex-m4",
    "extra_flags": "-DSTM32F412Vx -DSTM32F4xx",
    "f_cpu": "100000000L",
    "mcu": "stm32f412vet6",
    "product_line": "STM32F412Vx",
    "variant": "my_board_xyz",
    "zepyhr": {
      "variant": "my_board_xyz",
      "syscall_include_dirs": "zephyr"         <<===
    }
  },
  "debug": {
    "default_tools": [
      "stlink"
    ],
    "jlink_device": "STM32F412VE",
    "onboard_tools": [
      "stlink"
    ],

...