Git Product home page Git Product logo

platformio / zephyr Goto Github PK

View Code? Open in Web Editor NEW

This project forked from zephyrproject-rtos/zephyr

6.0 7.0 9.0 576.98 MB

Primary Git Repository for the Zephyr Project. Zephyr is a new generation, scalable, optimized, secure RTOS for multiple hardware architectures.

Home Page: https://docs.zephyrproject.org

License: Apache License 2.0

Makefile 0.01% Assembly 1.21% C 88.55% C++ 1.37% Shell 0.24% Perl 0.77% Python 5.46% Verilog 0.02% Objective-C 0.08% CMake 2.16% Batchfile 0.01% EmberScript 0.01% HTML 0.01% Haskell 0.01% Tcl 0.01% SmPL 0.08% VBA 0.01%

zephyr's Introduction

The Zephyr Project is a scalable real-time operating system (RTOS) supporting multiple hardware architectures, optimized for resource constrained devices, and built with security in mind.

The Zephyr OS is based on a small-footprint kernel designed for use on resource-constrained systems: from simple embedded environmental sensors and LED wearables to sophisticated smart watches and IoT wireless gateways.

The Zephyr kernel supports multiple architectures, including ARM Cortex-M, Intel x86, ARC, Nios II, Tensilica Xtensa, and RISC-V, and a large number of supported boards.

Getting Started

Welcome to Zephyr! See the Introduction to Zephyr for a high-level overview, and the documentation's Getting Started Guide to start developing.

Community Support

Community support is provided via mailing lists and Discord; see the Resources below for details.

Resources

Here's a quick summary of resources to help you find your way around:

zephyr's People

Contributors

ajstephens avatar benwrs avatar carlescufi avatar ceolin avatar cvinayak avatar dcpleung avatar erwango avatar finikorg avatar galak avatar gmarull avatar henrikbrixandersen avatar ioannisg avatar jfischer-no avatar jhedberg avatar joerchan avatar jukkar avatar maureenhelm avatar mbolivar-nordic avatar mshawcroft avatar nashif avatar nordic-krch avatar pabigot avatar pfalcon avatar rlubos avatar rveerama1 avatar stephanosio avatar tbursztyka avatar ulfalizer avatar vudentz avatar wrspetermitsis avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

zephyr's Issues

scripts/platformio/platformio-build.py:

elif board_config.get("build.march", "") in ("rv64imac", "rv32imac"):

Dear platformio devs,

Can we add rv32im to the supported architectures?

elif board_config.get("build.march", "") in ("rv64imac", "rv32imac", **"rv32im"**):
I am trying to support litex_vexriscv , judging from the litex compiler options the AC extensions are not supported for the vexriscv core.

See https://github.com/hvegh/platform-litex for preliminary litex-riscv support with zephyr....

Git submodules in modules are not fetched

Hello,

git submodules for zephyr modules are not fetched automatically during installation of the framework.

After installation of zephyr 2.6 framework the modules directory in filled with modules according their west.yml revision but submodules are not fetched. example .platformio/packages/framework-zephyr/_pio/modules/lib/loramac-node/src/radio/lr1110/lr1110_driver is empty

Thank you

Feature request: Support for an arbitraty path to Zephyr project files

when using zephyr OS based project on platform IO, platform IO expects cmakelist to be part of zephyr folder in the project folder. how can I instruct pio to use the cmakelist available in the project folder directly. I have observed that when if I delete this folder, pio automatically creates it before building. as far as I understand, this is mandatory as mentioned here -
https://community.platformio.org/t/how-to-get-rid-of-zephyr-folder-created-automatically-by-platform-io/25157
request you to allow the option to set the root cmake list path or anything additional that is pio searching in zephyr folder.

Zephyr SYSCALL_INCLUDE_DIRS doesn't take effect

What kind of issue is this?

  • Question.
    This issue tracker is not the place for questions. If you want to ask how to do something,
    or to understand why something isn't working the way you expect it to,
    use Community Forums or Premium Support

  • PlatformIO IDE.
    All issues related to PlatformIO IDE should be reported to appropriate repository:
    PlatformIO IDE for Atom or
    PlatformIO IDE for VSCode

  • Development Platform or Board.
    All issues (building, uploading, adding new boards, etc.) related to PlatformIO development platforms
    should be reported to appropriate repository related to your hardware
    https://github.com/topics/platformio-platform

  • Feature Request.
    Start by telling us what problem you’re trying to solve. Often a solution
    already exists! Don’t send pull requests to implement new features without first getting our
    support. Sometimes we leave features out on purpose to keep the project small.

  • PlatformIO Core.
    If you’ve found a bug, please provide an information below.

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>
  1. 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
  1. Refer the uwb.h in one of user source files in src
  2. 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

AttributeError: 'SConsEnvironment' object has no attribute 'AddPlatformTarget'

Hello @valeros,

Thanks for updating PlatformIO to Zephyr 2.3!

I get the following error:

AttributeError: 'SConsEnvironment' object has no attribute 'AddPlatformTarget':
  File "/home/martin/.platformio/penv/lib/python3.8/site-packages/platformio/builder/main.py", line 168:
    env.SConscript("$BUILD_SCRIPT")
  File "/home/martin/.platformio/packages/tool-scons/script/../engine/SCons/Script/SConscript.py", line 597:
    return _SConscript(self.fs, *files, **subst_kw)
  File "/home/martin/.platformio/packages/tool-scons/script/../engine/SCons/Script/SConscript.py", line 286:
    exec(compile(scriptdata, scriptname, 'exec'), call_stack[-1].globals)
  File "/home/martin/.platformio/platforms/ststm32/builder/main.py", line 98:
    target_elf = env.BuildProgram()
  File "/home/martin/.platformio/packages/tool-scons/script/../engine/SCons/Environment.py", line 219:
    return self.method(*nargs, **kwargs)
  File "/home/martin/.platformio/packages/framework-zephyr/scripts/platformio/platformio-build-pre.py", line 29:
    env.ProcessProgramDeps()
  File "/home/martin/.platformio/packages/tool-scons/script/../engine/SCons/Environment.py", line 219:
    return self.method(*nargs, **kwargs)
  File "/home/martin/.platformio/penv/lib/python3.8/site-packages/platformio/builder/tools/platformio.py", line 118:
    env.BuildFrameworks(env.get("PIOFRAMEWORK"))
  File "/home/martin/.platformio/packages/tool-scons/script/../engine/SCons/Environment.py", line 219:
    return self.method(*nargs, **kwargs)
  File "/home/martin/.platformio/penv/lib/python3.8/site-packages/platformio/builder/tools/platformio.py", line 330:
    SConscript(env.GetFrameworkScript(f), exports="env")
  File "/home/martin/.platformio/packages/tool-scons/script/../engine/SCons/Script/SConscript.py", line 660:
    return method(*args, **kw)
  File "/home/martin/.platformio/packages/tool-scons/script/../engine/SCons/Script/SConscript.py", line 597:
    return _SConscript(self.fs, *files, **subst_kw)
  File "/home/martin/.platformio/packages/tool-scons/script/../engine/SCons/Script/SConscript.py", line 286:
    exec(compile(scriptdata, scriptname, 'exec'), call_stack[-1].globals)
  File "/home/martin/.platformio/platforms/ststm32/builder/frameworks/zephyr.py", line 28:
    SConscript(
  File "/home/martin/.platformio/packages/tool-scons/script/../engine/SCons/Script/SConscript.py", line 660:
    return method(*args, **kw)
  File "/home/martin/.platformio/packages/tool-scons/script/../engine/SCons/Script/SConscript.py", line 597:
    return _SConscript(self.fs, *files, **subst_kw)
  File "/home/martin/.platformio/packages/tool-scons/script/../engine/SCons/Script/SConscript.py", line 286:
    exec(compile(scriptdata, scriptname, 'exec'), call_stack[-1].globals)
  File "/home/martin/.platformio/packages/framework-zephyr/scripts/platformio/platformio-build.py", line 1077:
    env.AddPlatformTarget("menuconfig", None, [env.VerboseAction(

If I comment out the menuconfig line here it builds fine.

Further information:

  • PlatformIO, version 4.3.4
  • Linux 5.4.44-1-MANJARO #1 SMP PREEMPT
  • Already ran pio update and pio upgrade
  • Using this platformio.ini, but without the version number after ststm32.

Zephyr external modules cannot be placed inside zephyr directory

What kind of issue is this?

  • Question.
    This issue tracker is not the place for questions. If you want to ask how to do something,
    or to understand why something isn't working the way you expect it to,
    use Community Forums or Premium Support

  • PlatformIO IDE.
    All issues related to PlatformIO IDE should be reported to appropriate repository:
    PlatformIO IDE for Atom or
    PlatformIO IDE for VSCode

  • Development Platform or Board.
    All issues (building, uploading, adding new boards, etc.) related to PlatformIO development platforms
    should be reported to appropriate repository related to your hardware
    https://github.com/topics/platformio-platform

  • Feature Request.
    Start by telling us what problem you’re trying to solve. Often a solution
    already exists! Don’t send pull requests to implement new features without first getting our
    support. Sometimes we leave features out on purpose to keep the project small.

  • PlatformIO Core.
    If you’ve found a bug, please provide an information below.

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

This is a problem with the zephyr framework integration. I am developing a custom device driver and I don't want to put it inside zephyr tree. I go with external modules as described here and here. I put the module source inside zephyr directory, but the compilation error unable to find the source files.

Steps to Reproduce

  1. Create a module directory inside zephyr dir (alongside with the CMakeLists.txt and prj.conf)
  2. Structure the module directory as described here
zephyr
_drivers
__m24m02
___ zephyr
____CMakeLists.txt
____Kconfig
____m24m02.c
  1. Register the module dir in zephyr/CMakeLists.txt
list(APPEND ZEPHYR_EXTRA_MODULES
    ${CMAKE_CURRENT_SOURCE_DIR}/drivers/m24m02
)
  1. Enable the module as the registered Kconfig entry in step 2 by modifying zephyr/prj.conf
CONFIG_M24M02=y

Actual Results

*** [.pio/build/solemetrix_dwm1001/………solemetrix-repo__gms-firmware__zephyr__drivers__m24m02__zephyr/modules/m24m02/m24m02.c.o] Source src/drivers/m24m02/zephyr/m24m02.c' not found, needed by target .pio/build/solemetrix_dwm1001/……__…__solemetrix-repo__gms-firmware__zephyr__drivers__m24m02__zephyr/modules/m24m02/m24m02.c.o’.

Expected Results

Build successfully

If problems with PlatformIO Build System:

The content of platformio.ini:

[env:solemetrix_dwm1001]
platform = nordicnrf52
board = solemetrix_dwm1001
framework = zephyr
monitor_speed = 11520

Additional info

I replicated the the project structure and managed to compile it using west build. Please kindly advise to get it working in platformio.

Solution

It turned out that the source cannot be placed inside the zephyr directory. I created an additional directory in the root platformio project and moved the module source there.

zephyr
zephyr_ext
_drivers
__m24m02
___ zephyr
____CMakeLists.txt
____Kconfig
____m24m02.c

Suggestion

If this is a limitation, please update the documentation. Otherwise, please fix the bug. Thank you.

Zephyr v2.7 BuildSkripts - Shell Commands not linked

Describe the bug
I just did a bug report in zephyr project. see

Short:

  • i did an Update from Zephyr v2.6 to v2.7
  • I have some submodules in my PlatformIO project with code of shell commands
  • after the update my shell commands are not available.

Workarround:
I just had a look at the platformio zephyr build skripts because i think that the issue may caused by linker options.
After adding -Wl,--whole-archive to my build_flags my shell commands are back on screen. What is the intention for not including this option?

To Reproduce
see

Expected behavior
My commands should appear in shell.

Impact
Key features are not available in my application. showstopper

Logs and console output
No logs. Shell commands not appear.

Environment (please complete the following information):

  • OS: (e.g. Linux, MacOS, Windows)
  • Toolchain (e.g Zephyr SDK, ...)
  • Commit SHA or Version used

Additional context
OS: Ubuntu 20.04.4 LTS x86_64
Toolchain: Platformio Core 5.2.5·Home 3.4.1
Zephyr 2.7.2

Cmake errors in framework-zephyr for stm32, which is fixed after clearing the cache

What kind of issue is this?

  • PlatformIO Core.

Configuration

Operating system:
Windows 10

PlatformIO Version (platformio --version):
PlatformIO, version 4.3.4

Description of problem

CMake errors while using different ststm32 platforms and framework-zephyr. PIO gives errors whereas west build works fine.

Steps to Reproduce

  1. I have an STM32 based project running on Zephyr that compiles fine with the latest PIO (having Zephyr 2.3.0). I have selected the below in the platformio.ini file.
    platform = ststm32@~7.1.1

  2. Now if I try to compile an older project in PIO that uses the below settings in the platformio.ini file,
    platform = ststm32@~6.1.0 ( I think )

  3. PIO throws the below errors
    -- The C compiler identification is GNU 8.2.1
    -- The CXX compiler identification is GNU 8.2.1
    -- The ASM compiler identification is GNU
    -- Found assembler: C:/Users/xxx/.platformio/packages/toolchain-gccarmnoneeabi/bin/arm-none-eabi-gcc.exe
    -- Cache files will be written to: C:/Users/xxx/.platformio/packages/framework-zephyr/.cache
    -- Could NOT find Git (missing: GIT_EXECUTABLE)
    -- Configuring incomplete, errors occurred!
    See also "C:/Users/xxx/yyy/node-firmware-stm32/.pio/build/sb-0v3/CMakeFiles/CMakeOutput.log".
    See also "C:/Users/xxx/yyy/node-firmware-stm32/.pio/build/sb-0v3/CMakeFiles/CMakeError.log".

    Including boilerplate (Zephyr base): C:/Users/xxx/.platformio/packages/framework-zephyr/cmake/app/boilerplate.cmake
    Python path: C:/Users/xxx/.platformio/penv/Scripts/python.exe
    CMake Error at C:/Users/xxx/.platformio/packages/framework-zephyr/cmake/extensions.cmake:372 (add_library):
    The target name
    "[email protected]+sha.d1bc80d021__stm32cube" is
    reserved or not valid for certain CMake features, such as generator
    expressions, and may result in undefined behavior.
    Call Stack (most recent call first):
    C:/Users/xxx/.platformio/packages/framework-zephyr/cmake/extensions.cmake:349 (zephyr_library_named)
    C:/Users/xxx/.platformio/packages/[email protected]+sha.d1bc80d021/stm32cube/CMakeLists.txt:9 (zephyr_library)

    CMake Error at C:/Users/xxx/.platformio/packages/framework-zephyr/cmake/extensions.cmake:416 (target_sources):
    Cannot specify sources for target
    "[email protected]+sha.d1bc80d021__stm32cube"
    which is not built by this project.
    Call Stack (most recent call first):
    C:/Users/xxx/.platformio/packages/[email protected]+sha.d1bc80d021/stm32cube/stm32l0xx/CMakeLists.txt:5 (zephyr_library_sources)

  4. Now if I go back and if try to compile the previously compiling code, it gets the same error too.

  5. In order to make this work this, you have to manually delete some folders such as

If problems with PlatformIO Build System:

The content of platformio.ini:

# ststm32 platform release 7.1.1 includes Zephyr 2.3.0
#platform = https://github.com/platformio/platform-ststm32.git
platform = ststm32@~7.1.1

framework = zephyr

upload_protocol = stlink

# Custom Serial Monitor baud rate
monitor_speed = 115200

Cannot find Zephyr v2.6 branch

Dear @valeros,

I already asked the question in #8 but since this one is Closed, I guess it is preferable to raise a new one.

Can you please clarify where I can find Zephyr v2.6 branch in platformio zephyr project?

I need to port some patches on top of it for my own purposes and I'm confused now about how to proceed as the last commit seems to be from March 9th 2021 on branch v2.5.

Thanks a lot.

Target mcuboot-image does not upload the signed executable

Describe the bug
On STSTM32 platform, we use the mcuboot-image target to sign the image after building. We had trouble making this target to work flawlessly, as while the firmware is correctly built, it is the pre-mcuboot firmware that gets uploaded to the board. We finally found some workarounds, but they all have drawbacks. Here are the different steps we took:

First try

We started by using the following parameters in platformio.ini:

[env]
board_build.zephyr.bootloader.header_len = 0x200
board_build.zephyr.bootloader.flash_alignment = 8
board_build.zephyr.bootloader.slot_size = 0x37800
board_build.zephyr.bootloader.secondary_slot = 1
board_upload.offset_address = 0x8047800

targets = mcuboot-image

In this case, the firmware is correctly built, but the upload phase will not upload the signed firmware (firmware.mcuboot.bin), only the pre-mcuboot file firmware.bin. At this stage, the workaround was to use an external tool to upload the firmware to the board.

Second try

We identified the following code snippet in STSTM32's main.py:

    if "zephyr" in frameworks and "mcuboot-image" in COMMAND_LINE_TARGETS:
        target_firm = env.MCUbootImage(
            join("$BUILD_DIR", "${PROGNAME}.mcuboot.bin"), target_firm)

[...]

upload_source = target_firm

This lead us to a second try by ensuring the upload phase is done in a single step with the build/sign process. Here, we modified the targets in platformio.ini as follows:

targets = mcuboot-image,upload

There, it works but this is an akward configuration because the "build" button in the bottom bar of VS Code will also upload the file (thus would result in an error when not connected to the board), while the "upload" button still uploads the wrong file.

Third try

Finally, we resorted in a trick consisting in forcing pio scripts use the mcuboot-image even with the single "upload" step, by altering the COMMAND_LINE_TARGETS variable. This uses a "pre" hook as follows:

extra_scripts = pre:upload_signed_firmware.py
targets = mcuboot-image

With the following content in upload_signed_firmware.py:

Import("env")

# Make sure mcuboot-image is in the target list when uploading,
# because pio scripts will behave incorrectly if it isn't
# (wrong file gets uploaded)
if "mcuboot-image" not in COMMAND_LINE_TARGETS:
	COMMAND_LINE_TARGETS.insert(0, "mcuboot-image")

To Reproduce
Steps to reproduce the behavior:

  1. Add targets = mcuboot-image to platformio.ini
  2. Click on the "build" button in VS Code and observe that it produces a file firmware.mcuboot.bin
  3. Click on the "upload" button in VS Code
  4. Watch the uploader upload the wrong file firmware.bin

Expected behavior
When using the mcuboot-image target in platformio.ini, the "upload" phase should upload the final, signed, firmware, not the one produced at an earlier phase of the build process.

Impact
The impact was a time-consuming process of going through the pio scripts and understanding Scons in order to find a workaround. Now that it works, the impact is minimal (only an additional script to ship in our repo).

Environment

  • OS: Linux
  • Toolchain: Platformio toolchain within the STSTM32 platform, using VS Code
  • Commit SHA or Version used: framework-zephyr version 2.30400.230914

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.