Skip to content

Commit

Permalink
Add support for Hailo Card
Browse files Browse the repository at this point in the history
This includes the following main components:

- hailo-pci (OSS kernel module)
- hailo-firmware (proprietary firmware for hailo8 chip)
- hailort (Userspace Libraries)
  - hailortcli (tool)
  - hailort (service)
  - libhailort (c library)
  - libhailort-dev (dev package)
  - python3-hailort (python library)
  - libgsthailo (gstreamer element)

Signed-off-by: Li Hua Qian <huaqian.li@siemens.com>
  • Loading branch information
huaqianli committed Nov 15, 2024
1 parent 088f2a9 commit c3c0930
Show file tree
Hide file tree
Showing 41 changed files with 1,545 additions and 0 deletions.
3 changes: 3 additions & 0 deletions kas/iot2050.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@ repos:
url: https://gitlab.com/cip-project/cip-core/isar-cip-core.git
commit: bafd102601ae21c2b2643d536d62fb7cc5f98767

meta-hailo:
path: ${TOPDIR}/../meta-hailo

local_conf_header:
standard: |
CONF_VERSION = "1"
Expand Down
16 changes: 16 additions & 0 deletions kas/opt/meta-hailo.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#
# Copyright (c) Siemens AG, 2024
#
# Authors:
# Li Hua Qian <huaqian.li@siemens.com>
#
# This file is subject to the terms and conditions of the MIT License. See
# COPYING.MIT file in the top-level directory.
#

header:
version: 14

repos:
meta-hailo:
path: ${TOPDIR}/../meta-hailo
1 change: 1 addition & 0 deletions meta-hailo/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
build/
42 changes: 42 additions & 0 deletions meta-hailo/.gitlab-ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# SPDX-FileCopyrightText: Copyright 2023 Siemens AG
# SPDX-License-Identifier: LicenseRef-Siemens-Inner-Source-License
include:
- project: "ebsy/components/kas-patterns"
ref: main
file: "gitlab-ci/common.yml"

stages:
- build

variables:
KAS_CONFIG: kas/opt/hailo.inc.yml
KAS_VERSION: "4.2"

.kas-build:
stage: build
image: ghcr.io/siemens/kas/kas-isar:${KAS_VERSION}
tags: [privileged, region-eu]
extends:
- .kaspat-kas-build
after_script:
- !reference [.kaspat-sstate-analyze, script]
- !reference [.kaspat-sstate-upload, script]

######## Build jobs ########
bookworm-packages-amd64:
extends:
- .kas-build
script:
- kas build kas/hailo-packages-bookworm-amd64.yml

bookworm-packages-arm64:
extends:
- .kas-build
script:
- kas build kas/hailo-packages-bookworm-arm64.yml

bookworm-image-amd64:
extends:
- .kas-build
script:
- kas build kas/hailo-img-ci-amd64.yml
99 changes: 99 additions & 0 deletions meta-hailo/CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
# Developer Notes for Contributing Code

We welcome and appreciate any kind of use case evaluations, feature requests,
bug reports and code contributions. To simplify cooperation, we follow the
guidelines described in the following.

## Developer Notes

### Versioning

The whole layer is versioned according to the hailo drivers version (e.g. 4).
For each major version, a corresponding branch `v<major>` is created.
When using this layer in downstream projects, we highly recommend to point your builder
to a versioned branch and in addition pin the version (e.g. with kas lockfiles).

In addition to that, the individual components are versioned according to the
corresponding package / artifact versions.

### Issues

Before opening an issue, check if the following conditions are met:

- The issue is related to the integration (and not to a bug in a component itself)
- There is no similar issue

### Code Contributions

We follow the [Conventional Changelog](https://www.conventionalcommits.org/en/) strategy.
Please write your commit message(s) according to this standard.

To contribute code, please use the merge-request workflow. If you are a member of the project,
please directly create a MR in this project. If you are not a member, please fork the project
and create a cross-repo merge request. As we cannot run the CI on foreign repositories, we will
not merge the MR directly, but use an integration branch and cherry-pick the changes.

For a code change to be integrated, the following conditions must be met:

- The series (MR) passes the CI
- The series (MR) is approved by at least one maintainer (see `MAINTAINERS.md`)

In case of major version updates of the drivers, please get in contact with the maintainers.

## Siemens Developer Notes

Every planned contribution to Siemens Inner Source projects has to satisfy the following:

* **Do not "release"** any code or other material without having received
permission from the person with the proper authority within Siemens.

* **Do not "release"** any code or other material without review from an
experienced developer. _"release" means that the code will be integrated in a
product or delivered to a customer._

* **Do not contribute** any code from 3rd parties to Siemens Inner Source
projects, i.e. do not copy code from code sharing sites (stackoverflow,
codeguru,...), open source projects, commercial code available in source code
form, books, journals, etc.).

* **Do not remove** copyrights and/or license references and/or license texts.

* If an entire package will be contributed, ensure that the text of the
Inner Source License is provided in the file `LICENSE.md` in the root directory of the project.

* Additionally, create a file `COPYING.md` with an appropriate copyright notice. E.g.:

```txt
Copyright YEAR Siemens AG
Licensed under the Siemens Inner Source License 1.4 or at your option any later version
```

* Include a link to the files `LICENSE.md` and `COPYING.md` in the `README.md` of your project

* Please adhere to the following comment header format for code files which designates
author, year and copyright information:

```c++
/*
* SPDX-FileCopyrightText: Copyright YEAR Siemens AG
*
* SPDX-License-Identifier: LicenseRef-Siemens-Inner-Source-License
*/
```

* Ensure that the comments and file headers **do not contain**:
* product and/or project names, release numbers and their release dates
* inappropriate language
* any words and/or phrases like "stolen from" or "copied from". A
contribution is a serious matter and not the place for jokes. If you have
the need to provide information like "derived from" ensure that you also
provide the "license information" of the code you derived from.

* Ensure that files **do not contain**:
* configuration information
* credentials for real IT-environments, like server names, IP-addresses,
login information, or passwords.

* **Do notify** the authors/maintainers of projects under the Siemens Inner
Source License if you find code or other parts failing to fulfill the
requirements of the license or this checklist.
2 changes: 2 additions & 0 deletions meta-hailo/COPYING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Copyright 2023 Siemens AG
Licensed under the [Siemens Inner Source License 1.4](LICENSES/LicenseRef-Siemens-Inner-Source-License.txt) or at your option any later version
10 changes: 10 additions & 0 deletions meta-hailo/EXPORT.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
AL: 'N'
ECCN: 'N'
NECC: 'N'
OTR: not relevant
CCATS: not relevant
COO: not relevant
# Documentation: https://code.siemens.io/docs/export/
# Generated by: https://code.siemens.com/code-ops/ecc-wizard/tree/86e3fe95
# Decision Path: Q1,Q2,Q3,Q4,Q5,Q6,Q6exit2
# Creation Date: 2023-12-18T05:53:53.414Z
67 changes: 67 additions & 0 deletions meta-hailo/LICENSES/LicenseRef-Siemens-Inner-Source-License.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
Siemens Inner Source License v1.4

Preamble
This License serves the purpose to facilitate exchange of source code among Siemens’ AFFILIATES on an internal code sharing platform. It applies to Siemens Aktiengesellschaft and all of its AFFILIATES that either have concluded the “Agreement on the use of the Inner Source Platform in collaborative software development projects” with Siemens Aktiengesellschaft (“AGREEMENT”) or participate in the inner source code sharing by means of any other valid agreement.

1. Definitions
Terms with capital letters are defined in Exhibit 1 to this Annex 4.

2. Grants
To the extent and as long as it has the right to do so, the PARTICIPATING SIEMENS ENTITY, which has uploaded the SOFTWARE, as well as the Siemens Aktiengesellschaft grant all other PARTICIPATING SIEMENS ENTITIES with respect to the SOFTWARE and the associated documentation file(s) under its copyrights and intellectual property rights a non-exclusive, worldwide, and irrevocable right and license to:
i. use, have used, copy, have copied, modify, have modified the SOFTWARE,
ii. incorporate and have incorporated the SOFTWARE and/or modified versions thereof in binary form into PRODUCTS; and
iii. to market, have market, distribute, have distributed, make available, have made available (including online distribution and hosting as a service) to third parties for use in virtual and/or non-virtual environments, the SOFTWARE solely in binary form and as part of PRODUCTS. If the SOFTWARE can only be used and distributed in source code form (e.g. scripting languages), the rights granted under this section ii.-iii.) shall also apply to the source code of the SOFTWARE.
iv. deposit the source code of the SOFTWARE with third parties acting as escrow agents and grant customers of PRODUCTS, into which the SOFTWARE or modified versions thereof have been incorporated, non-exclusive rights to use and modify the SOFTWARE under the conditions specified in the escrow agreement for the purpose of manufacturing and using such PRODUCTS, which incorporate the SOFTWARE and modified versions thereof.

If SOFTWARE is software which has been developed and/or enhanced by or for a SIEMENS GAS AND POWER OPERATING COMPANY and for which the SIEMENS GAS AND POWER OPERATING COMPANY had granted to INNER SOURCE CONTRIBUTOR corresponding sublicensing rights, the license of this Section 2 shall be limited to the SIEMENS CURRENT FIELD.

3. Restrictions
For avoidance of doubt, a PARTICIPATING SIEMENS ENTITY shall not be entitled to grant third parties exclusive rights to the SOFTWARE and to make available to third parties its PRODUCTS containing SOFTWARE and/or modified versions thereof under license terms that violate or conflict with the terms of this license or any applicable agreement referring to this license.
Furthermore all PARTICIPATING SIEMENS ENTITIES shall
i. comply with all current restrictions, obligations and guidelines posted on or referenced by the SIEMENS CODE REPOSITORY and additional restrictions and/or obligations – if any available – in an optional file named “RESTRICTIONS.md file” associated with the respective SOFTWARE on the SIEMENS CODE REPOSITORY; and
ii. use reasonable efforts to make all enhancements and/or modifications made to the SOFTWARE available to all other PARTICIPATING SIEMENS ENTITY on the SIEMENS CODE REPOSITORY under the terms of this license, as amended from time to time.

4. Liability
All PARTICIPATING SIEMENS ENTITIES shall be solely responsible for their use of SOFTWARE and/or modified versions thereof and shall be liable to third parties for their PRODUCTS containing SOFTWARE and/or modified versions thereof and shall not be entitled to assert warranty or compensation claims against other PARTICIPATING SIEMENS ENTITIES for defects or third party intellectual property rights infringement in the SOFTWARE, notwithstanding any contrary provisions in the Terms and Conditions for Deliveries and Services for Siemens-internal Transactions (Siemens Conditions).

5. Newer Versions
The license administrator of this license is Siemens Aktiengesellschaft, SOP IT. This license may be changed from time to time. Any change and its effective date have to be agreed by the Divisional Support Group / Steering Committee or any successor organization thereof. No one other than the license administrator has the right to publish the changes to this license agreed by the Divisional Support Group / Steering Committee or any successor organization thereof. The released version of this license has a unique version number. The license administrator shall publish revised and/or new versions of this license at least 30 days before the change effective date. Such revised/new versions will be similar in spirit to the current version, but may differ in detail to address new problems or concerns. Revised and/or new versions of this license released on the SIEMENS CODE REPOSITORY become binding at the given change effective date.
The SIEMENS CODE REPOSITORY shall show which version of the license applies to which SOFTWARE.

6. Termination
If the AGREEMENT or any other agreement from which PARTICIPATING SIEMENS ENTITY derives its right to participate in the inner source code sharing terminates, the former PARTICIPATING SIEMENS ENTITY retains the right to use the SOFTWARE downloaded during the term of the respective terminated agreement under the terms of this License. In contrast, the former PARTICIPATING SIEMENS ENTITY is no longer entitled to access the SIEMENS CODE REPOSITORY or use SOFTWARE made available on the SIEMENS CODE REPOSITORY after termination of the respective agreement.

Exhibit 1 to Annex 4
Definitions

"AFFILIATE" shall mean a corporation or other entity directly or indirectly, owned or controlled by, or owning or controlling, or under common control with Siemens Aktiengesellschaft where “control” shall mean to have, directly or indirectly, the power to direct or cause the direction of the management and policies of a corporation or other entity.

“BUSINESS MANDATE” shall mean BUSINESS MANDATES published in the Business Mandate Directory of Siemens on 1 October 2019, provided that, if omissions or errors that may be contained in the Business Mandate Directory on 1 October 2019 are corrected by the Parties until the Loss of Control Date in accordance with the procedure of approval and release of the BUSINESS MANDATES of Siemens, such corrected version of the Business Mandate Directory shall apply.

“GP CURRENT FIELD” shall mean the portfolio of products and services, including legacy products and services, of the BUSINESS as conducted on PORTFOLIO REFERENCE DATE, whereas such portfolio shall consist of:
(i) products and services set out in the BUSINESS MANDATES of the SIEMENS GAS AND POWER OPERATING COMPANY,
(ii) products and services which are actually part of the portfolio of the BUSINESS on the PORTFOLIO REFERENCE DATE and are neither set out in the BUSINESS MANDATES of the SIEMENS GAS AND POWER OPERATING COMPANY nor in the BUSINESS MANDATES of SIEMENS GROUP, excluding SIEMENS GAS AND POWER OPERATING COMPANY, and
(iii) products or services which are not set out in the BUSINESS MANDATES of either Party but are on the PORTFOLIO REFERENCE DATE part of the research and development conducted by, or on behalf of, the BUSINESS, provided that, such research and development (a) has been funded by the BUSINESS prior to the PORTFOLIO REFERENCE DATE and (b) is documented in a written BUSINESS or research and development plan.

For the avoidance of doubt,
(1) in case the products and services are set out in the BUSINESS MANDATES of both SIEMENS GROUP, excluding SIEMENS GAS AND POWER OPERATING COMPANY, and the BUSINESS, such products and services shall be deemed to be both within SIEMENS CURRENT FIELD and GP CURRENT FIELD;
(2) in case products and services are actually part of both, the portfolio of SIEMENS GROUP, excluding SIEMENS GAS AND POWER OPERATING COMPANY, and of the BUSINESS, and are not set out in either of the respective BUSINESS MANDATES, such products and services shall be deemed to be both within SIEMENS CURRENT FIELD and GP CURRENT FIELD; and
(3) in case the products and services are part of the research and development conducted on the PORTFOLIO REFERENCE DATE by both the BUSINESS and SIEMENS GROUP, excluding SIEMENS GAS AND POWER OPERATING COMPANY, but excluding any research and development by Siemens or its AFFILIATES (excluding SIEMENS GAS AND POWER OPERATING COMPANY) for the BUSINESS based on orders placed by the BUSINESS and where such research and development is fully funded by the BUSINESS and as set out in a list agreed between Siemens Aktiengesellschaft and SIEMENS GAS AND POWER OPERATING COMPANY, then such products and services shall be deemed to be both within SIEMENS CURRENT FIELD and GP CURRENT FIELD.

“LOSS OF CONTROL DATE” shall mean the date upon which SIEMENS GAS AND POWER OPERATING COMPANY ceases to be an AFFILIATE of Siemens Aktiengesellschaft.
“PARTICIPATING SIEMENS ENTITIES” shall mean Siemens Aktiengesellschaft and all AFFILIATES that i) either have concluded or will conclude the “Agreement on the use of the Inner Source Platform in collaborative software development projects” (hereinafter referred to as “AGREEMENT”) with Siemens Aktiengesellschaft, for as long as the respective entity is a party to the AGREEMENT or that ii) participate in the inner source code sharing by means of any other valid agreement.
“PORTFOLIO REFERENCE DATE” shall mean October 1, 2019.
“PRODUCTS” are products, supplies, services, projects, solutions and systems for internal use and/or for third parties.
“SIEMENS CODE REPOSITORY” shall mean the source code management platform ‘code.siemens.com’.
“SIEMENS GROUP” shall mean Siemens Aktiengesellschaft and its AFFILIATES:
“SOFTWARE” shall mean proprietary code uploaded by a PARTICIPATING SIEMENS ENTITY to the SIEMENS CODE REPOSITORY marked as “internal project” for further use by all other PARTICIPATING SIEMENS ENTITIES.
“SIEMENS CURRENT FIELD” shall mean the portfolio of products and services, including legacy products and services, of SIEMENS GROUP, excluding SIEMENS GAS AND POWER OPERATING COMPANY, as conducted on PORTFOLIO REFERENCE DATE, whereas such portfolio shall consist of:
(i) products and services set out in the BUSINESS MANDATE of the SIEMENS GROUP, excluding SIEMENS GAS AND POWER OPERATING COMPANY,
(ii) products and services which are actually part of the portfolio of the SIEMENS GROUP, excluding SIEMENS GAS AND POWER OPERATING COMPANY, on the PORTFOLIO REFERENCE DATE and are neither set out in the BUSINESS MANDATEs of the SIEMENS GROUP, excluding SIEMENS GAS AND POWER OPERATING COMPANY, nor in the BUSINESS MANDATES of the BUSINESS, and
(iii) products and services which are not set out in the BUSINESS MANDATES of either Party but are on the PORTFOLIO REFERENCE DATE part of the research and development conducted by, or on behalf of, the SIEMENS GROUP, excluding SIEMENS GAS AND POWER OPERATING COMPANY, provided that, such research and development (a) has been funded by SIEMENS GROUP, excluding SIEMENS GAS AND POWER OPERATING COMPANY, and (b) is documented in a written business or research and development plan.
For the avoidance of doubt:
(1) in case the products and services are set out in the BUSINESS MANDATES of both SIEMENS GROUP, excluding SIEMENS GAS AND POWER OPERATING COMPANY, and the BUSINESS, such products and services shall be deemed to be both within SIEMENS CURRENT FIELD and GP CURRENT FIELD;
(2) in case products and services are actually part of both, the portfolio of SIEMENS GROUP, excluding SIEMENS GAS AND POWER OPERATING COMPANY, and of the BUSINESS, and are not set out in either of the BUSINESS MANDATES, such products and services shall be deemed to be both within SIEMENS CURRENT FIELD and GP CURRENT FIELD; and
(3) in case the products and services are part of the research and development conducted on the PORTFOLIO REFERENCE DATE by both the BUSINESS and SIEMENS GROUP, excluding SIEMENS GAS AND POWER OPERATING COMPANY, but excluding any research and development by the BUSINESS for the Transferor or its AFFILIATES (excluding SIEMENS GAS AND POWER OPERATING COMPANY) based on orders placed by the TRANSFEROR or its AFFILIATES (excluding SIEMENS GAS AND POWER OPERATING COMPANY) and where such research and development is fully funded by the TRANSFEROR or its AFFILIATE (excluding Gas and Power Operating Company) and as set out in a list agreed between Siemens AG and SIEMENS GAS AND POWER OPERATING COMPANY, then such products and services shall be deemed to be both within SIEMENS CURRENT FIELD and GP CURRENT FIELD.

“TRANSFEROR” shall mean Siemens Aktiengesellschaft or its AFFILIATE ((excluding SIEMENS GAS AND POWER OPERATING COMPANY).
4 changes: 4 additions & 0 deletions meta-hailo/MAINTAINERS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Maintainers

- Diogo Ivo <diogo.ivo@siemens.com>
- Felix Moessbauer <felix.moessbauer@siemens.com>
21 changes: 21 additions & 0 deletions meta-hailo/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# meta-hailo - Support for HAILO NPU chips

This repo provides recipes to build the kernel and userspace drivers and utilities
for the Hailo-8 NPU chip.
This includes the following main components:

- hailo-pci (OSS kernel module)
- hailo-firmware (proprietary firmware for hailo8 chip)
- hailort (Userspace API)
- hailortcli (tool)
- hailort (service)
- libhailort (c library)
- libhailort-dev (dev package)
- python3-hailort (python library)

## Versioning

This layer is versioned according to the major hailo driver version.
Note, that the kernel ABI is not stable and by that the version of the
userspace components need to perfectly match the version of the firmware
and the kernel module.
Loading

0 comments on commit c3c0930

Please sign in to comment.