Skip to content

Commit

Permalink
Merge pull request #51 from xmos/release/0.2.0
Browse files Browse the repository at this point in the history
Release/0.2.0 to main
  • Loading branch information
xalbertoisorna authored Sep 8, 2023
2 parents 2c28479 + 619d45c commit 5e50ce3
Show file tree
Hide file tree
Showing 186 changed files with 9,653 additions and 5,345 deletions.
24 changes: 21 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
**/*.eggs/*
**/.ipynb_checkpoints/*
.venv
.python-version

# Build & debug cruft
**/.build*/*
Expand All @@ -17,7 +18,6 @@
*.dylib
*.xe
*.vcd
*.s
*.xi
*.i
*.xmt
Expand All @@ -41,6 +41,9 @@
*.swmem
*.bin
*.fs
*.exe
.editorconfig
*.csv

# Test cruft
**/.pytest_cache/*
Expand Down Expand Up @@ -77,9 +80,24 @@ tools/ai/ai_tools

# temp folder
temp

!CMakeLists.txt

# images
*.png

# dotenv
.env
.png

# ninja
.ninja_deps
.ninja_log
/build.ninja
*.exe

# Images
*.bmp
*.raw
*.png

#documentation
!**/images/*.png
18 changes: 7 additions & 11 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,16 +1,12 @@
[submodule "xmos_cmake_toolchain"]
path = xmos_cmake_toolchain
url = [email protected]:xalbertoisorna/xmos_cmake_toolchain # grouping some CMAKE utilities
url = [email protected]:xmos/xmos_cmake_toolchain # grouping some CMAKE utilities
branch = main
[submodule "modules/i2c"]
path = modules/i2c
url = [email protected]:xalbertoisorna/lib_i2c # adding lib assert and cmake to the repo
[submodule "tests/Unity"]
path = tests/Unity
url = [email protected]:xmos/Unity # unit testing
branch = develop
[submodule "modules/mipi"]
path = modules/mipi
url = [email protected]:xalbertoisorna/lib_mipi # same adding cmake to the repo
branch = master
[submodule "modules/core"]
path = modules/core
url = [email protected]:xmos/fwk_core # xcore math inside the repo
[submodule "utils/xscope_fileio"]
path = utils/xscope_fileio
url = https://github.com/xmos/xscope_fileio
branch = develop
36 changes: 36 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
fwk_camera change log
=====================

0.2.0
-----

* ADDED: Dynamic configuration for the resolution, pixel format, binning mode
and frame offsets
* CHANGED: Mipi has been reimplemented to C
* CHANGED: I2c library version (from xc version to c version from fwk_io)
* CHANGED: Sensor control has been reimplemented
* CHANGED: "assert" function replaced with "xassert" from <xcore/assert.h>
* CHANGED: streaming channels of camera_api.c have been replaced with channels
* ADDED: new supported mode, MODE_1280x960
* CHANGED: value of PLL_VT_MPY from 0x0047 to 0x0027 due to timing in
MODE_1280x960
* CHANGED: default AWB static values in order to match sony sensor

0.1.0
-----

* ADDED: Sony IMX219 support (Raspberry Pi Camera V2).
* ADDED: RAW8 and Raw10 capture support using only internal RAM.
* ADDED: Raw8 capture example (640X480).
* ADDED: Raw8 + Downsample exmaple (160x120x3) RGB.
* ADDED: Xscope_fileio suport.
* ADDED: AE control: auto exposure based on histogram skewness.
* ADDED: AWB control: auto white balance. Combination of grey world assumption
and percentile white balance.
* ADDED: AWB control: auto white balance based on a combination of grey world
assumption and percentile.
* ADDED: Image rotation: image rotation capabilities (sensor and ISP)
* ADDED: cropping / scaling : image scalling, cropping.
* ADDED: Image statistics: histogram, mean, variance, skewness.
* ADDED: sensor control, start, stop functons.

46 changes: 23 additions & 23 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,48 +1,48 @@
# edit here --------------------------------
set(PROJECT_NAME first_project)

# do not edit ----------------------------------------------------------------
cmake_minimum_required(VERSION 3.21)

## Set the target
set(XCORE_TARGET "XCORE-AI-EXPLORER")

## Disable in-source build.
if("${CMAKE_SOURCE_DIR}" STREQUAL "${CMAKE_BINARY_DIR}")
message(FATAL_ERROR "In-source build is not allowed! Please specify a build folder.\n\tex:cmake -B build")
message(FATAL_ERROR "In-source build is not allowed! Please specify a build folder.\n\tex:cmake -B build")
endif()

## Project declaration
project(PROJECT_NAME)
project(fwk_camera)

## Enable languages for project
enable_language(CXX C ASM)

## Project options
option(XCORE_VOICE_TESTS "Enable XCORE-VOICE tests" OFF)
## Fixes unnecessary recompilation of .xc files in Windows builds.
string(REPLACE "-MD" "-MMD" CMAKE_DEPFILE_FLAGS_C ${CMAKE_DEPFILE_FLAGS_C})

## Import some helpful macros
include(xmos_cmake_toolchain/xmos_macros.cmake)

## Setup a root path
set(first_project_PATH ${PROJECT_SOURCE_DIR} CACHE STRING "Root folder of sln_voice in this cmake project tree")
if(${CMAKE_SYSTEM_PROCESSOR} STREQUAL XCORE_XS3A)

set(CONFIG_RAW8 0x2A)
set(CONFIG_RAW10 0x2B)
set(CONFIG_MIPI_FORMAT ${CONFIG_RAW8})

## Add frameworks
if(IS_DIRECTORY modules)
add_subdirectory(modules)
message("Adding modules/")
endif()
add_subdirectory(modules)
add_subdirectory(external_deps)

## Add sensors
add_subdirectory(sensors)
message("Adding sensors/")

## Add cameras
add_subdirectory(camera)
message("Adding camera/")

if(PROJECT_IS_TOP_LEVEL)
## utils for examples and testing
add_subdirectory(utils)

## Add tests
add_subdirectory(tests)

## Add top level project targets
if(PROJECT_IS_TOP_LEVEL)
include(examples/examples.cmake)
endif()
## Add examples
add_subdirectory(examples)

endif() # top level

endif() # xs3a
122 changes: 122 additions & 0 deletions Jenkinsfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,122 @@
@Library('[email protected]')

def runningOn(machine) {
println "Stage running on:"
println machine
}

getApproval()
pipeline {
agent none

parameters {
string(
name: 'TOOLS_VERSION',
defaultValue: '15.2.1',
description: 'The XTC tools version'
)
} // parameters
options {
skipDefaultCheckout()
} // options

stages {
stage('Builds') {
parallel {
stage ('Build and Unit test') {
agent {
label 'linux&&x86_64'
}
stages {
stage ('Build') {
steps {
runningOn(env.NODE_NAME)
dir('fwk_camera') {
checkout scm
// fetch submodules
sh 'git submodule update --init --recursive --jobs 4'
// build examples and tests
withTools(params.TOOLS_VERSION) {
sh 'cmake -B build --toolchain=xmos_cmake_toolchain/xs3a.cmake'
sh 'make -C build -j4'
}
}
}
} // Build

stage('Create Python enviroment') {
steps {
// Clone infrastructure repos
sh "git clone [email protected]:xmos/infr_apps"
sh "git clone [email protected]:xmos/infr_scripts_py"
// can't use createVenv on the top level yet
dir('fwk_camera') {
createVenv()
withVenv {
sh "pip install -e ../infr_scripts_py"
sh "pip install -e ../infr_apps"
}
}
}
} // Create Python enviroment

stage('Source check') {
steps {
// bit weird for now but should changed after the next xjsl release
dir('fwk_camera') {
withVenv {
dir('tests/lib_checks') {
sh "pytest -s"
}
}
}
}
} // Source check

stage('Unit tests') {
steps {
dir('fwk_camera/build/tests/unit_tests') {
withTools(params.TOOLS_VERSION) {
sh 'xsim --xscope "-offline trace.xmt" test_camera.xe'
}
}
}
} // Unit tests

} // stages
post {
cleanup {
cleanWs()
}
}
} // Build and Unit test

stage ('Build Documentation') {
agent {
label 'docker'
}
stages {
stage ('Build Docs') {
steps {
runningOn(env.NODE_NAME)
checkout scm
sh """docker run --user "\$(id -u):\$(id -g)" \
--rm \
-v ${WORKSPACE}:/build \
-e EXCLUDE_PATTERNS="/build/doc/exclude_patterns.inc" \
-e PDF=1 \
ghcr.io/xmos/doc_builder:v3.0.0"""
archiveArtifacts artifacts: "doc/_build/**", allowEmptyArchive: true
}
} // Build Docs
} // stages
post {
cleanup {
cleanWs()
}
}
} // Build Documentation
} // parallel
} // Builds
} // stages
} // pipeline
84 changes: 84 additions & 0 deletions LICENSE.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
*******************************
XMOS PUBLIC LICENCE: Version 1
*******************************

Subject to the conditions and limitations below, permission is hereby granted by XMOS LIMITED (“XMOS”), free of charge, to any person or entity obtaining a copy of the XMOS Software.

**1. Definitions**

**“Applicable Patent Rights”** means: (a) where XMOS is the grantor of the rights, (i) claims of patents that are now or in future owned by or assigned to XMOS and (ii) that cover subject matter contained in the Software, but only to the extent it is necessary to use, reproduce or distribute the Software without infringement; and (b) where you are the grantor of the rights, (i) claims of patents that are now or in future owned by or assigned to you and (ii) that cover the subject matter contained in your Derivatives, taken alone or in combination with the Software.

**“Compiled Code”** means any compiled, binary, machine readable or executable version of the Source Code.

**“Contributor”** means any person or entity that creates or contributes to the creation of Derivatives.

**“Derivatives”** means any addition to, deletion from and/or change to the substance, structure of the Software, any previous Derivatives, the combination of the Derivatives and the Software and/or any respective portions thereof.

**“Source Code”** means the human readable code that is suitable for making modifications but excluding any Compiled Code.

**“Software”** means the software and associated documentation files which XMOS makes available and which contain a notice identifying the software as original XMOS software and referring to the software being subject to the terms of this XMOS Public Licence.

This Licence refers to XMOS Software and does not relate to any XMOS hardware or devices which are protected by intellectual property rights (including patent and trade marks) which may be sold to you under a separate agreement.


**2. Licence**

**Permitted Uses, Conditions and Restrictions.** Subject to the conditions below, XMOS grants you a worldwide, royalty free, non-exclusive licence, to the extent of any Patent Rights to do the following:

2.1 **Unmodified Software.** You may use, copy, display, publish, distribute and make available unmodified copies of the Software:

2.1.1 for personal or academic, non-commercial purposes; or

2.1.2 for commercial purposes provided the Software is at all times used on a device designed, licensed or developed by XMOS and, provided that in each instance (2.1.1 and 2.1.2):

(a) you must retain and reproduce in all copies of the Software the copyright and proprietary notices and disclaimers of XMOS as they appear in the Software, and keep intact all notices and disclaimers in the Software files that refer to this Licence; and

(b) you must include a copy of this Licence with every copy of the Software and documentation you publish, distribute and make available and you may not offer or impose any terms on such Software that alter or restrict this Licence or the intent of such Licence, except as permitted below (Additional Terms).

The licence above does not include any Compiled Code which XMOS may make available under a separate support and licence agreement.

2.2 **Derivatives.** You may create and modify Derivatives and use, copy, display, publish, distribute and make available Derivatives:

2.2.1 for personal or academic, non-commercial purposes; or

2.2.2 for commercial purposes, provided the Derivatives are at all times used on a device designed, licensed or developed by XMOS and, provided that in each instance (2.2.1 and 2.2.2):

(a) you must comply with the terms of clause 2.1 with respect to the Derivatives;

(b) you must copy (to the extent it doesn’t already exist) the notice below in each file of the Derivatives, and ensure all the modified files carry prominent notices stating that you have changed the files and the date of any change; and

(c) if you sublicence, distribute or otherwise make the Software and/or the Derivatives available for commercial purposes, you must provide that the Software and Derivatives are at all times used on a device designed, licensed or developed by XMOS.

Without limitation to these terms and clause 3 below, the Source Code and Compiled Code to your Derivatives may at your discretion (but without obligation) be released, copied, displayed, published, distributed and made available; and if you elect to do so, it must be under the terms of this Licence including the terms of the licence at clauses 2.2.1, 2.2.2 and clause 3 below.

2.3 **Distribution of Executable Versions.** If you distribute or make available Derivatives, you must include a prominent notice in the code itself as well as in all related documentation, stating that the Source Code of the Software from which the Derivatives are based is available under the terms of this Licence, with information on how and where to obtain such Source Code.

**3. Your Grant of Rights.** In consideration and as a condition to this Licence, you grant to any person or entity receiving or distributing any Derivatives, a non-exclusive, royalty free, perpetual, irrevocable license under your Applicable Patent Rights and all other intellectual property rights owned or controlled by you, to use, copy, display, publish, distribute and make available your Derivatives of the same scope and extent as XMOS’s licence under clause 2.2 above.

**4. Combined Products.** You may create a combined product by combining Software, Derivatives and other code not covered by this Licence as a single application or product. In such instance, you must comply with the requirements of this Licence for any portion of the Software and/or Derivatives.

**5. Additional Terms.** You may choose to offer, and to charge a fee for, warranty, support, indemnity or liability obligations and/or other rights consistent with the term of this Licence (“Additional Terms”) to any legitimate recipients of the Software and/or Derivatives. The terms on which you provide such Additional Terms are on your sole responsibility and you shall indemnify, defend and hold XMOS harmless against any claims asserted against XMOS.

**6. New Versions.** XMOS may publish revised and/or new versions of this Licence from time to time to accommodate changes to the Licence terms, new versions, updates and bug fixes of the Software. Each version will be given a distinguishing version number. Once Software has been published under a particular version of this Licence, you may continue to use it under the terms of that version. You may also choose to use the latest version of the Software under any subsequent version published by XMOS. Only XMOS shall have the right to modify these terms.

**7. IPR and Ownership**
Any rights, including all intellectual property rights and all trademarks not expressly granted herein are reserved in full by the authors or copyright holders. Any requests for additional permissions by XMOS including any rights to use XMOS trademarks, should be made (without obligation) to XMOS at **[email protected]**

Nothing herein shall limit any rights that XMOS is otherwise entitled to under the doctrines of patent exhaustion, implied license, or legal estoppel. Neither the name of the authors, the copyright holders or any contributors may be used to endorse or promote any Derivatives from this Software without specific written permission. Any attempt to deal with the Software which does not comply with this Licence shall be void and shall automatically terminate any rights granted under this licence (including any licence of any intellectual property rights granted herein).
Subject to the licences granted under this Licence any Contributor retains all rights, title and interest in and to any Derivatives made by Contributor subject to the underlying rights of XMOS in the Software. XMOS shall retain all rights, title and interest in the Software and any Derivatives made by XMOS (“XMOS Derivatives”). XMOS Derivatives will not automatically be subject to this Licence and XMOS shall be entitled to licence such rights on any terms (without obligation) as it sees fit.

**8. Termination**

8.1 This Licence will automatically terminate immediately, without notice to you, if:

(a) you fail to comply with the terms of this Licence; and/or

(b) you directly or indirectly commence any action for patent or intellectual property right infringement against XMOS, or any parent, group, affiliate or subsidiary of XMOS; provided XMOS did not first commence an action or patent infringement against you in that instance; and/or

(c) the terms of this Licence are held by any court of competent jurisdiction to be unenforceable in whole or in part.

**9. Critical Applications.** Unless XMOS has agreed in writing with you an agreement specifically governing use of the Goods in military, aerospace, automotive or medically related functions (collectively and individually hereinafter referred to as "Special Use"), any permitted use of the Software excludes Special Use. Notwithstanding any agreement between XMOS and you for Special Use, Special Use shall be at your own risk, and you shall fully indemnify XMOS against any damages, losses, costs and claims (direct and indirect) arising out of any Special Use.

**10. NO WARRANTY OR SUPPORT.** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL XMOS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, WARRANTY, CIVIL TORT (INCLUDING NEGLIGENCE), PRODUCTS LIABILITY OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE INCLUDING GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES EVEN IF SUCH PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES AND NOT WITHSTANDING THE FAILURE OF ESSENTIAL PURPOSE. IN SOME JURISDICTIONS PARTIES ARE UNABLE TO LIMIT LIABILTY IN THIS WAY, IF THIS APPLIES TO YOUR JURISDICTION THIS LIABILITY CLAUSE ABOVE MAY NOT APPLY. NOTWITHSTANDING THE ABOVE, IN NO EVENT SHALL XMOS’s TOTAL LIABILITY TO YOU FOR ALL DAMAGES, LOSS OR OTHERWISE EXCEED $50.

**11. Governing Law and Jurisdiction.** This Licence constitutes the entire agreement between the parties with respect to the subject matter hereof. The Licence shall be governed by the laws of England and the conflict of laws and UN Convention on Contracts for the International Sale of Goods, shall not apply.
Loading

0 comments on commit 5e50ce3

Please sign in to comment.