Compare commits
28 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ab35052b89 | ||
|
|
b19f73de1d | ||
|
|
be823dcffb | ||
|
|
d7070b77eb | ||
|
|
d3831de32d | ||
|
|
92ce3bc2d6 | ||
|
|
b407d02637 | ||
|
|
416945ae75 | ||
|
|
89689e0286 | ||
|
|
91f4c387ae | ||
|
|
d2c4dbe6d7 | ||
|
|
ec53508b06 | ||
|
|
7f65aa8f78 | ||
|
|
705fb8ec26 | ||
|
|
d42bd89957 | ||
|
|
eebdb3b693 | ||
|
|
4d01527866 | ||
|
|
60b37e46ca | ||
|
|
7ee9fb5ced | ||
|
|
2d08b180b5 | ||
|
|
8136c0913f | ||
|
|
59d10ea93a | ||
|
|
c86b716481 | ||
|
|
ef7a6c485f | ||
|
|
66817cbac9 | ||
|
|
543acefc43 | ||
|
|
f913f9b9f0 | ||
|
|
3a4fb6e24e |
@@ -1,12 +0,0 @@
|
||||
#!/bin/bash
|
||||
# Copyright (c) 2020 Linaro Limited
|
||||
#
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
# report disk usage:
|
||||
echo "--- $0 disk usage"
|
||||
df -h
|
||||
docker image prune --all --force
|
||||
df -h
|
||||
ls
|
||||
cat docker-images
|
||||
@@ -1,42 +0,0 @@
|
||||
#!/bin/bash
|
||||
# Copyright (c) 2020 Linaro Limited
|
||||
#
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
# Save off where we started so we can go back there
|
||||
WORKDIR=${PWD}
|
||||
|
||||
if [ -n "${BUILDKITE_PULL_REQUEST_BASE_BRANCH}" ]; then
|
||||
git fetch -v origin ${BUILDKITE_PULL_REQUEST_BASE_BRANCH}
|
||||
git checkout FETCH_HEAD
|
||||
git config --local user.email "builds@zephyrproject.org"
|
||||
git config --local user.name "Zephyr CI"
|
||||
git merge --no-edit "${BUILDKITE_COMMIT}" || {
|
||||
local merge_result=$?
|
||||
echo "Merge failed: ${merge_result}"
|
||||
git merge --abort
|
||||
exit $merge_result
|
||||
}
|
||||
fi
|
||||
|
||||
mkdir -p /var/lib/buildkite-agent/zephyr-ccache/
|
||||
|
||||
# create cache dirs, no-op if they already exist
|
||||
mkdir -p /var/lib/buildkite-agent/zephyr-module-cache/modules
|
||||
mkdir -p /var/lib/buildkite-agent/zephyr-module-cache/tools
|
||||
mkdir -p /var/lib/buildkite-agent/zephyr-module-cache/bootloader
|
||||
|
||||
# Clean cache - if it already exists
|
||||
cd /var/lib/buildkite-agent/zephyr-module-cache
|
||||
find -type f -not -path "*/.git/*" -not -name ".git" -delete
|
||||
|
||||
# Remove any stale locks
|
||||
find -name index.lock -delete
|
||||
|
||||
# return from where we started so we can find pipeline files from
|
||||
# git repo
|
||||
cd ${WORKDIR}
|
||||
|
||||
# Save off what images was there before and clean things out
|
||||
docker images --filter=reference='zephyrprojectrtos/ci' --format "{{.Repository}}:{{.Tag}}" > docker-images
|
||||
docker image prune --all --force
|
||||
@@ -1,28 +0,0 @@
|
||||
steps:
|
||||
- command:
|
||||
- .buildkite/run.sh
|
||||
env:
|
||||
ZEPHYR_TOOLCHAIN_VARIANT: "zephyr"
|
||||
ZEPHYR_SDK_INSTALL_DIR: "/opt/sdk/zephyr-sdk-0.10.3"
|
||||
parallelism: 20
|
||||
timeout_in_minutes: 120
|
||||
retry:
|
||||
manual: true
|
||||
plugins:
|
||||
- docker#v3.5.0:
|
||||
image: "zephyrprojectrtos/ci:v0.8.2"
|
||||
propagate-environment: true
|
||||
volumes:
|
||||
- "/var/lib/buildkite-agent/git-mirrors:/var/lib/buildkite-agent/git-mirrors"
|
||||
- "/var/lib/buildkite-agent/zephyr-module-cache:/var/lib/buildkite-agent/zephyr-module-cache"
|
||||
- "/var/lib/buildkite-agent/zephyr-ccache:/root/.ccache"
|
||||
workdir: "/workdir/zephyr"
|
||||
agents:
|
||||
- "queue=default"
|
||||
|
||||
- wait: ~
|
||||
continue_on_failure: true
|
||||
|
||||
- plugins:
|
||||
- junit-annotate#v1.7.0:
|
||||
artifacts: sanitycheck-*.xml
|
||||
@@ -1,46 +0,0 @@
|
||||
#!/bin/bash
|
||||
# Copyright (c) 2020 Linaro Limited
|
||||
#
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
echo "--- run $0"
|
||||
|
||||
git log -n 5 --oneline --decorate --abbrev=12
|
||||
|
||||
# Setup module cache
|
||||
cd /workdir
|
||||
ln -s /var/lib/buildkite-agent/zephyr-module-cache/modules
|
||||
ln -s /var/lib/buildkite-agent/zephyr-module-cache/tools
|
||||
ln -s /var/lib/buildkite-agent/zephyr-module-cache/bootloader
|
||||
cd /workdir/zephyr
|
||||
|
||||
export JOB_NUM=$((${BUILDKITE_PARALLEL_JOB}+1))
|
||||
|
||||
# ccache stats
|
||||
echo ""
|
||||
echo "--- ccache stats at start"
|
||||
ccache -s
|
||||
|
||||
if [ -n "${BUILDKITE_PULL_REQUEST_BASE_BRANCH}" ]; then
|
||||
./scripts/ci/run_ci.sh -c -b ${BUILDKITE_PULL_REQUEST_BASE_BRANCH} -r origin \
|
||||
-m ${JOB_NUM} -M ${BUILDKITE_PARALLEL_JOB_COUNT} -p ${BUILDKITE_PULL_REQUEST}
|
||||
else
|
||||
./scripts/ci/run_ci.sh -c -b ${BUILDKITE_BRANCH} -r origin \
|
||||
-m ${JOB_NUM} -M ${BUILDKITE_PARALLEL_JOB_COUNT};
|
||||
fi;
|
||||
|
||||
SANITY_EXIT_STATUS=$?
|
||||
|
||||
# Rename sanitycheck junit xml for use with junit-annotate-buildkite-plugin
|
||||
mv ./scripts/sanity_chk/last_sanity.xml sanitycheck-${BUILDKITE_JOB_ID}.xml
|
||||
buildkite-agent artifact upload sanitycheck-${BUILDKITE_JOB_ID}.xml
|
||||
|
||||
# ccache stats
|
||||
echo "--- ccache stats at finish"
|
||||
ccache -s
|
||||
|
||||
# disk usage
|
||||
echo "--- disk usage at finish"
|
||||
df -h
|
||||
|
||||
exit ${SANITY_EXIT_STATUS}
|
||||
@@ -5,7 +5,6 @@
|
||||
--show-types
|
||||
--max-line-length=80
|
||||
--min-conf-desc-length=1
|
||||
--typedefsfile=scripts/checkpatch/typedefsfile
|
||||
|
||||
--ignore BRACES
|
||||
--ignore PRINTK_WITHOUT_KERN_LEVEL
|
||||
|
||||
151
.clang-format
151
.clang-format
@@ -1,151 +0,0 @@
|
||||
# SPDX-License-Identifier: GPL-2.0
|
||||
#
|
||||
# clang-format configuration file. Intended for clang-format >= 4.
|
||||
#
|
||||
# For more information, see:
|
||||
#
|
||||
# Documentation/process/clang-format.rst
|
||||
# https://clang.llvm.org/docs/ClangFormat.html
|
||||
# https://clang.llvm.org/docs/ClangFormatStyleOptions.html
|
||||
#
|
||||
---
|
||||
AccessModifierOffset: -4
|
||||
AlignAfterOpenBracket: Align
|
||||
AlignConsecutiveAssignments: false
|
||||
AlignConsecutiveDeclarations: false
|
||||
#AlignEscapedNewlines: Left # Unknown to clang-format-4.0
|
||||
AlignOperands: true
|
||||
AlignTrailingComments: false
|
||||
AllowAllParametersOfDeclarationOnNextLine: false
|
||||
AllowShortBlocksOnASingleLine: false
|
||||
AllowShortCaseLabelsOnASingleLine: false
|
||||
AllowShortFunctionsOnASingleLine: None
|
||||
AllowShortIfStatementsOnASingleLine: false
|
||||
AllowShortLoopsOnASingleLine: false
|
||||
AlwaysBreakAfterDefinitionReturnType: None
|
||||
AlwaysBreakAfterReturnType: None
|
||||
AlwaysBreakBeforeMultilineStrings: false
|
||||
AlwaysBreakTemplateDeclarations: false
|
||||
BinPackArguments: true
|
||||
BinPackParameters: true
|
||||
BraceWrapping:
|
||||
AfterClass: false
|
||||
AfterControlStatement: false
|
||||
AfterEnum: false
|
||||
AfterFunction: true
|
||||
AfterNamespace: true
|
||||
AfterObjCDeclaration: false
|
||||
AfterStruct: false
|
||||
AfterUnion: false
|
||||
#AfterExternBlock: false # Unknown to clang-format-5.0
|
||||
BeforeCatch: false
|
||||
BeforeElse: false
|
||||
IndentBraces: false
|
||||
#SplitEmptyFunction: true # Unknown to clang-format-4.0
|
||||
#SplitEmptyRecord: true # Unknown to clang-format-4.0
|
||||
#SplitEmptyNamespace: true # Unknown to clang-format-4.0
|
||||
BreakBeforeBinaryOperators: None
|
||||
BreakBeforeBraces: Custom
|
||||
#BreakBeforeInheritanceComma: false # Unknown to clang-format-4.0
|
||||
BreakBeforeTernaryOperators: false
|
||||
BreakConstructorInitializersBeforeComma: false
|
||||
#BreakConstructorInitializers: BeforeComma # Unknown to clang-format-4.0
|
||||
BreakAfterJavaFieldAnnotations: false
|
||||
BreakStringLiterals: false
|
||||
ColumnLimit: 80
|
||||
CommentPragmas: '^ IWYU pragma:'
|
||||
#CompactNamespaces: false # Unknown to clang-format-4.0
|
||||
ConstructorInitializerAllOnOneLineOrOnePerLine: false
|
||||
ConstructorInitializerIndentWidth: 8
|
||||
ContinuationIndentWidth: 8
|
||||
Cpp11BracedListStyle: false
|
||||
DerivePointerAlignment: false
|
||||
DisableFormat: false
|
||||
ExperimentalAutoDetectBinPacking: false
|
||||
#FixNamespaceComments: false # Unknown to clang-format-4.0
|
||||
|
||||
# Taken from:
|
||||
# git grep -h '^#define [^[:space:]]*for_each[^[:space:]]*(' include/ \
|
||||
# | sed "s,^#define \([^[:space:]]*for_each[^[:space:]]*\)(.*$, - '\1'," \
|
||||
# | sort | uniq
|
||||
ForEachMacros:
|
||||
- 'FOR_EACH'
|
||||
- 'for_each_linux_bus'
|
||||
- 'for_each_linux_driver'
|
||||
- 'metal_bitmap_for_each_clear_bit'
|
||||
- 'metal_bitmap_for_each_set_bit'
|
||||
- 'metal_for_each_page_size_down'
|
||||
- 'metal_for_each_page_size_up'
|
||||
- 'metal_list_for_each'
|
||||
- 'RB_FOR_EACH'
|
||||
- 'RB_FOR_EACH_CONTAINER'
|
||||
- 'SYS_DLIST_FOR_EACH_CONTAINER'
|
||||
- 'SYS_DLIST_FOR_EACH_CONTAINER_SAFE'
|
||||
- 'SYS_DLIST_FOR_EACH_NODE'
|
||||
- 'SYS_DLIST_FOR_EACH_NODE_SAFE'
|
||||
- 'SYS_SFLIST_FOR_EACH_CONTAINER'
|
||||
- 'SYS_SFLIST_FOR_EACH_CONTAINER_SAFE'
|
||||
- 'SYS_SFLIST_FOR_EACH_NODE'
|
||||
- 'SYS_SFLIST_FOR_EACH_NODE_SAFE'
|
||||
- 'SYS_SLIST_FOR_EACH_CONTAINER'
|
||||
- 'SYS_SLIST_FOR_EACH_CONTAINER_SAFE'
|
||||
- 'SYS_SLIST_FOR_EACH_NODE'
|
||||
- 'SYS_SLIST_FOR_EACH_NODE_SAFE'
|
||||
- '_WAIT_Q_FOR_EACH'
|
||||
- 'Z_GENLIST_FOR_EACH_CONTAINER'
|
||||
- 'Z_GENLIST_FOR_EACH_CONTAINER_SAFE'
|
||||
- 'Z_GENLIST_FOR_EACH_NODE'
|
||||
- 'Z_GENLIST_FOR_EACH_NODE_SAFE'
|
||||
|
||||
#IncludeBlocks: Preserve # Unknown to clang-format-5.0
|
||||
IncludeCategories:
|
||||
- Regex: '.*'
|
||||
Priority: 1
|
||||
IncludeIsMainRegex: '(Test)?$'
|
||||
IndentCaseLabels: false
|
||||
#IndentPPDirectives: None # Unknown to clang-format-5.0
|
||||
IndentWidth: 8
|
||||
IndentWrappedFunctionNames: false
|
||||
JavaScriptQuotes: Leave
|
||||
JavaScriptWrapImports: true
|
||||
KeepEmptyLinesAtTheStartOfBlocks: false
|
||||
MacroBlockBegin: ''
|
||||
MacroBlockEnd: ''
|
||||
MaxEmptyLinesToKeep: 1
|
||||
NamespaceIndentation: Inner
|
||||
#ObjCBinPackProtocolList: Auto # Unknown to clang-format-5.0
|
||||
ObjCBlockIndentWidth: 8
|
||||
ObjCSpaceAfterProperty: true
|
||||
ObjCSpaceBeforeProtocolList: true
|
||||
|
||||
# Taken from git's rules
|
||||
#PenaltyBreakAssignment: 10 # Unknown to clang-format-4.0
|
||||
PenaltyBreakBeforeFirstCallParameter: 30
|
||||
PenaltyBreakComment: 10
|
||||
PenaltyBreakFirstLessLess: 0
|
||||
PenaltyBreakString: 10
|
||||
PenaltyExcessCharacter: 100
|
||||
PenaltyReturnTypeOnItsOwnLine: 60
|
||||
|
||||
PointerAlignment: Right
|
||||
ReflowComments: false
|
||||
SortIncludes: false
|
||||
#SortUsingDeclarations: false # Unknown to clang-format-4.0
|
||||
SpaceAfterCStyleCast: false
|
||||
SpaceAfterTemplateKeyword: true
|
||||
SpaceBeforeAssignmentOperators: true
|
||||
#SpaceBeforeCtorInitializerColon: true # Unknown to clang-format-5.0
|
||||
#SpaceBeforeInheritanceColon: true # Unknown to clang-format-5.0
|
||||
SpaceBeforeParens: ControlStatements
|
||||
#SpaceBeforeRangeBasedForLoopColon: true # Unknown to clang-format-5.0
|
||||
SpaceInEmptyParentheses: false
|
||||
SpacesBeforeTrailingComments: 1
|
||||
SpacesInAngles: false
|
||||
SpacesInContainerLiterals: false
|
||||
SpacesInCStyleCastParentheses: false
|
||||
SpacesInParentheses: false
|
||||
SpacesInSquareBrackets: false
|
||||
Standard: Cpp03
|
||||
TabWidth: 8
|
||||
UseTab: Always
|
||||
...
|
||||
31
.codecov.yml
31
.codecov.yml
@@ -1,31 +0,0 @@
|
||||
codecov:
|
||||
notify:
|
||||
require_ci_to_pass: yes
|
||||
|
||||
coverage:
|
||||
precision: 2
|
||||
round: down
|
||||
range: "70...100"
|
||||
|
||||
status:
|
||||
project: yes
|
||||
patch: yes
|
||||
changes: no
|
||||
|
||||
#ignore:
|
||||
# - "tests/**/*"
|
||||
# - "samples/**/*"
|
||||
# - "ext/hal/**/*"
|
||||
|
||||
parsers:
|
||||
gcov:
|
||||
branch_detection:
|
||||
conditional: yes
|
||||
loop: yes
|
||||
method: no
|
||||
macro: no
|
||||
|
||||
comment:
|
||||
layout: "reach, diff, flags, files, footer"
|
||||
behavior: default
|
||||
require_changes: no
|
||||
@@ -1,56 +0,0 @@
|
||||
# EditorConfig: https://editorconfig.org/
|
||||
|
||||
# top-most EditorConfig file
|
||||
root = true
|
||||
|
||||
# All (Defaults)
|
||||
[*]
|
||||
charset = utf-8
|
||||
end_of_line = lf
|
||||
insert_final_newline = true
|
||||
trim_trailing_whitespace = true
|
||||
|
||||
# C
|
||||
[*.{c,h}]
|
||||
indent_style = tab
|
||||
indent_size = 8
|
||||
|
||||
# Python
|
||||
[*.py]
|
||||
indent_style = space
|
||||
indent_size = 4
|
||||
|
||||
# Perl
|
||||
[*.pl]
|
||||
indent_style = tab
|
||||
indent_size = 8
|
||||
|
||||
# YAML
|
||||
[*.yml]
|
||||
indent_style = space
|
||||
indent_size = 2
|
||||
|
||||
# Shell Script
|
||||
[*.sh]
|
||||
indent_style = space
|
||||
indent_size = 4
|
||||
|
||||
# Windows Command Script
|
||||
[*.cmd]
|
||||
end_of_line = crlf
|
||||
indent_style = tab
|
||||
indent_size = 8
|
||||
|
||||
# Valgrind Suppression File
|
||||
[*.supp]
|
||||
indent_style = space
|
||||
indent_size = 3
|
||||
|
||||
# CMake
|
||||
[{CMakeLists.txt,*.cmake}]
|
||||
indent_style = space
|
||||
indent_size = 2
|
||||
|
||||
# Makefile
|
||||
[Makefile]
|
||||
indent_style = tab
|
||||
39
.github/ISSUE_TEMPLATE/bug_report.md
vendored
39
.github/ISSUE_TEMPLATE/bug_report.md
vendored
@@ -1,39 +0,0 @@
|
||||
---
|
||||
name: Bug report
|
||||
about: Create a report to help us improve Zephyr
|
||||
title: ''
|
||||
labels: bug
|
||||
assignees: ''
|
||||
|
||||
---
|
||||
|
||||
**Describe the bug**
|
||||
A clear and concise description of what the bug is.
|
||||
What have you tried to diagnose or workaround this issue?
|
||||
|
||||
**To Reproduce**
|
||||
Steps to reproduce the behavior:
|
||||
1. mkdir build; cd build
|
||||
2. cmake -DBOARD=board\_xyz
|
||||
3. make
|
||||
4. See error
|
||||
|
||||
**Expected behavior**
|
||||
A clear and concise description of what you expected to happen.
|
||||
|
||||
**Impact**
|
||||
What impact does this issue have on your progress (e.g., annoyance, showstopper)
|
||||
|
||||
**Screenshots or console output**
|
||||
If applicable, add a screenshot (drag-and-drop an image), or console logs
|
||||
(cut-and-paste text and put a code fence (\`\`\`) before and after, to help
|
||||
explain the issue.
|
||||
|
||||
**Environment (please complete the following information):**
|
||||
- OS: (e.g. Linux, MacOS, Windows)
|
||||
- Toolchain (e.g Zephyr SDK, ...)
|
||||
- Commit SHA or Version used
|
||||
|
||||
|
||||
**Additional context**
|
||||
Add any other context about the problem here.
|
||||
20
.github/ISSUE_TEMPLATE/enhancement.md
vendored
20
.github/ISSUE_TEMPLATE/enhancement.md
vendored
@@ -1,20 +0,0 @@
|
||||
---
|
||||
name: Enhancement
|
||||
about: Suggest enhancements to existing features
|
||||
title: ''
|
||||
labels: enhancement
|
||||
assignees: ''
|
||||
|
||||
---
|
||||
|
||||
**Is your enhancement proposal related to a problem? Please describe.**
|
||||
A clear and concise description of what the problem is.
|
||||
|
||||
**Describe the solution you'd like**
|
||||
A clear and concise description of what you want to happen.
|
||||
|
||||
**Describe alternatives you've considered**
|
||||
A clear and concise description of any alternative solutions or features you've considered.
|
||||
|
||||
**Additional context**
|
||||
Add any other context or graphics (drag-and-drop an image) about the feature request here.
|
||||
20
.github/ISSUE_TEMPLATE/feature_request.md
vendored
20
.github/ISSUE_TEMPLATE/feature_request.md
vendored
@@ -1,20 +0,0 @@
|
||||
---
|
||||
name: Feature request
|
||||
about: Suggest an idea for this project
|
||||
title: ''
|
||||
labels: feature request
|
||||
assignees: ''
|
||||
|
||||
---
|
||||
|
||||
**Is your feature request related to a problem? Please describe.**
|
||||
A clear and concise description of what the problem is.
|
||||
|
||||
**Describe the solution you'd like**
|
||||
A clear and concise description of what you want to happen.
|
||||
|
||||
**Describe alternatives you've considered**
|
||||
A clear and concise description of any alternative solutions or features you've considered.
|
||||
|
||||
**Additional context**
|
||||
Add any other context or graphics (drag-and-drop an image) about the feature request here.
|
||||
51
.github/ISSUE_TEMPLATE/rfc---proposal.md
vendored
51
.github/ISSUE_TEMPLATE/rfc---proposal.md
vendored
@@ -1,51 +0,0 @@
|
||||
---
|
||||
name: RFC / Proposal
|
||||
about: Submit an RFC / Proposal
|
||||
title: ''
|
||||
labels: RFC
|
||||
assignees: ''
|
||||
|
||||
---
|
||||
|
||||
## Introduction
|
||||
|
||||
This section targets end users, TSC members, maintainers and anyone else that might
|
||||
need a quick explanation of your proposed change.
|
||||
|
||||
### Problem description
|
||||
|
||||
Why do we want this change and what problem are we trying to address?
|
||||
|
||||
### Proposed change
|
||||
|
||||
A brief summary of the proposed change - the 10,000 ft view on what it will
|
||||
change once this change is implemented.
|
||||
|
||||
## Detailed RFC
|
||||
|
||||
In this section of the document the target audience is the dev team. Upon
|
||||
reading this section each engineer should have a rather clear picture of what
|
||||
needs to be done in order to implement the described feature.
|
||||
|
||||
### Proposed change (Detailed)
|
||||
|
||||
This section is freeform - you should describe your change in as much detail
|
||||
as possible. Please also ensure to include any context or background info here.
|
||||
For example, do we have existing components which can be reused or altered.
|
||||
|
||||
By reading this section, each team member should be able to know what exactly
|
||||
you're planning to change and how.
|
||||
|
||||
### Dependencies
|
||||
|
||||
Highlight how the change may affect the rest of the project (new components,
|
||||
modifications in other areas), or other teams/projects.
|
||||
|
||||
### Concerns and Unresolved Questions
|
||||
|
||||
List any concerns, unknowns, and generally unresolved questions etc.
|
||||
|
||||
## Alternatives
|
||||
|
||||
List any alternatives considered, and the reasons for choosing this option
|
||||
over them.
|
||||
16
.github/license_config.yml
vendored
16
.github/license_config.yml
vendored
@@ -1,16 +0,0 @@
|
||||
license:
|
||||
main: apache-2.0
|
||||
report_missing: true
|
||||
category: Permissive
|
||||
copyright:
|
||||
check: true
|
||||
exclude:
|
||||
extensions:
|
||||
- yml
|
||||
- yaml
|
||||
- html
|
||||
- rst
|
||||
- conf
|
||||
- cfg
|
||||
langs:
|
||||
- HTML
|
||||
114
.github/workflows/compliance.yml
vendored
114
.github/workflows/compliance.yml
vendored
@@ -1,114 +0,0 @@
|
||||
name: Compliance
|
||||
|
||||
on: pull_request
|
||||
|
||||
jobs:
|
||||
compliance_job:
|
||||
runs-on: ubuntu-latest
|
||||
name: Run compliance checks on patch series (PR)
|
||||
steps:
|
||||
- name: Checkout the code
|
||||
uses: actions/checkout@v1
|
||||
|
||||
- name: cache-pip
|
||||
uses: actions/cache@v1
|
||||
with:
|
||||
path: ~/.cache/pip
|
||||
key: ${{ runner.os }}-doc-pip
|
||||
|
||||
- name: Install python dependencies
|
||||
run: |
|
||||
pip3 install setuptools
|
||||
pip3 install wheel
|
||||
pip3 install python-magic junitparser gitlint pylint pykwalify
|
||||
pip3 install west
|
||||
|
||||
- name: Run Compliance Tests
|
||||
id: compliance
|
||||
env:
|
||||
BASE_REF: ${{ github.base_ref }}
|
||||
run: |
|
||||
export PATH=$PATH:~/.local/bin
|
||||
export ZEPHYR_BASE=$PWD
|
||||
git config --global user.email "you@example.com"
|
||||
git config --global user.name "Your Name"
|
||||
git rebase origin/${BASE_REF}
|
||||
./scripts/ci/check_compliance.py -m Codeowners -m Devicetree -m Gitlint -m Identity -m Nits -m pylint -m checkpatch -m Kconfig -c origin/${BASE_REF}.. || true
|
||||
|
||||
- name: upload-results
|
||||
uses: actions/upload-artifact@master
|
||||
continue-on-error: True
|
||||
with:
|
||||
name: compliance.xml
|
||||
path: compliance.xml
|
||||
|
||||
- name: check-warns
|
||||
run: |
|
||||
if [ -s Nits.txt ]; then
|
||||
errors=$(cat Nits.txt)
|
||||
errors="${errors//'%'/'%25'}"
|
||||
errors="${errors//$'\n'/'%0A'}"
|
||||
errors="${errors//$'\r'/'%0D'}"
|
||||
echo "::error file=Nits.txt::$errors"
|
||||
exit=1
|
||||
fi
|
||||
if [ -s checkpatch.txt ]; then
|
||||
errors=$(cat checkpatch.txt)
|
||||
errors="${errors//'%'/'%25'}"
|
||||
errors="${errors//$'\n'/'%0A'}"
|
||||
errors="${errors//$'\r'/'%0D'}"
|
||||
echo "::error file=Checkpatch.txt::$errors"
|
||||
exit=1
|
||||
fi
|
||||
if [ -s Identity.txt ]; then
|
||||
errors=$(cat Identity.txt)
|
||||
errors="${errors//'%'/'%25'}"
|
||||
errors="${errors//$'\n'/'%0A'}"
|
||||
errors="${errors//$'\r'/'%0D'}"
|
||||
echo "::error file=Identity.txt::$errors"
|
||||
exit=1
|
||||
fi
|
||||
if [ -s Gitlint.txt ]; then
|
||||
errors=$(cat Gitlint.txt)
|
||||
errors="${errors//'%'/'%25'}"
|
||||
errors="${errors//$'\n'/'%0A'}"
|
||||
errors="${errors//$'\r'/'%0D'}"
|
||||
echo "::error file=Gitlint.txt::$errors"
|
||||
exit=1
|
||||
fi
|
||||
if [ -s pylint.txt ]; then
|
||||
errors=$(cat pylint.txt)
|
||||
errors="${errors//'%'/'%25'}"
|
||||
errors="${errors//$'\n'/'%0A'}"
|
||||
errors="${errors//$'\r'/'%0D'}"
|
||||
echo "::error file=pylint.txt::$errors"
|
||||
exit=1
|
||||
fi
|
||||
if [ -s Devicetree.txt ]; then
|
||||
errors=$(cat Devicetree.txt)
|
||||
errors="${errors//'%'/'%25'}"
|
||||
errors="${errors//$'\n'/'%0A'}"
|
||||
errors="${errors//$'\r'/'%0D'}"
|
||||
echo "::error file=Devicetree.txt::$errors"
|
||||
exit=1
|
||||
fi
|
||||
if [ -s Kconfig.txt ]; then
|
||||
errors=$(cat Kconfig.txt)
|
||||
errors="${errors//'%'/'%25'}"
|
||||
errors="${errors//$'\n'/'%0A'}"
|
||||
errors="${errors//$'\r'/'%0D'}"
|
||||
echo "::error file=Kconfig.txt::$errors"
|
||||
exit=1
|
||||
fi
|
||||
if [ -s Codeowners.txt ]; then
|
||||
errors=$(cat Codeowners.txt)
|
||||
errors="${errors//'%'/'%25'}"
|
||||
errors="${errors//$'\n'/'%0A'}"
|
||||
errors="${errors//$'\r'/'%0D'}"
|
||||
echo "::error file=Codeowners.txt::$errors"
|
||||
exit=1
|
||||
fi
|
||||
|
||||
if [ ${exit} == 1 ]; then
|
||||
exit 1;
|
||||
fi
|
||||
65
.github/workflows/doc-build.yml
vendored
65
.github/workflows/doc-build.yml
vendored
@@ -1,65 +0,0 @@
|
||||
# Copyright (c) 2020 Linaro Limited.
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
name: Documentation GitHub Workflow
|
||||
|
||||
on: [pull_request]
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Update PATH for west
|
||||
run: |
|
||||
echo "$HOME/.local/bin" >> $GITHUB_PATH
|
||||
|
||||
- name: checkout
|
||||
uses: actions/checkout@v2
|
||||
|
||||
- name: install-pkgs
|
||||
run: |
|
||||
sudo apt-get install -y ninja-build doxygen
|
||||
|
||||
- name: cache-pip
|
||||
uses: actions/cache@v1
|
||||
with:
|
||||
path: ~/.cache/pip
|
||||
key: ${{ runner.os }}-doc-pip
|
||||
|
||||
- name: install-pip
|
||||
run: |
|
||||
pip3 install setuptools
|
||||
pip3 install 'breathe>=4.9.1,<4.15.0' 'docutils>=0.14' \
|
||||
'sphinx>=1.7.5,<3.0' sphinx_rtd_theme sphinx-tabs \
|
||||
sphinxcontrib-svg2pdfconverter 'west>=0.6.2'
|
||||
pip3 install pyelftools
|
||||
|
||||
- name: west setup
|
||||
run: |
|
||||
west init -l . || true
|
||||
|
||||
- name: build-docs
|
||||
run: |
|
||||
source zephyr-env.sh
|
||||
make htmldocs
|
||||
tar cvf htmldocs.tar --directory=./doc/_build html
|
||||
|
||||
- name: upload-build
|
||||
uses: actions/upload-artifact@master
|
||||
continue-on-error: True
|
||||
with:
|
||||
name: htmldocs.tar
|
||||
path: htmldocs.tar
|
||||
|
||||
- name: check-warns
|
||||
run: |
|
||||
if [ -s doc/_build/doc.warnings ]; then
|
||||
docwarn=$(cat doc/_build/doc.warnings)
|
||||
docwarn="${docwarn//'%'/'%25'}"
|
||||
docwarn="${docwarn//$'\n'/'%0A'}"
|
||||
docwarn="${docwarn//$'\r'/'%0D'}"
|
||||
# We treat doc warnings as errors
|
||||
echo "::error file=doc.warnings::$docwarn"
|
||||
exit 1
|
||||
fi
|
||||
32
.github/workflows/license_check.yml
vendored
32
.github/workflows/license_check.yml
vendored
@@ -1,32 +0,0 @@
|
||||
name: Scancode
|
||||
|
||||
on: [pull_request]
|
||||
|
||||
jobs:
|
||||
scancode_job:
|
||||
runs-on: ubuntu-latest
|
||||
name: Scan code for licenses
|
||||
steps:
|
||||
- name: Checkout the code
|
||||
uses: actions/checkout@v1
|
||||
- name: Scan the code
|
||||
id: scancode
|
||||
uses: zephyrproject-rtos/action_scancode@v3
|
||||
with:
|
||||
directory-to-scan: 'scan/'
|
||||
- name: Artifact Upload
|
||||
uses: actions/upload-artifact@v1
|
||||
with:
|
||||
name: scancode
|
||||
path: ./artifacts
|
||||
|
||||
- name: Verify
|
||||
run: |
|
||||
if [ -s ./artifacts/report.txt ]; then
|
||||
report=$(cat ./artifacts/report.txt)
|
||||
report="${report//'%'/'%25'}"
|
||||
report="${report//$'\n'/'%0A'}"
|
||||
report="${report//$'\r'/'%0D'}"
|
||||
echo "::error file=./artifacts/report.txt::$report"
|
||||
exit 1
|
||||
fi
|
||||
34
.gitignore
vendored
34
.gitignore
vendored
@@ -7,20 +7,17 @@
|
||||
*.swp
|
||||
*.swo
|
||||
*~
|
||||
build*/
|
||||
cscope.*
|
||||
.dir
|
||||
|
||||
/*.patch
|
||||
|
||||
# The .cache directory will be used to cache toolchain capabilities if
|
||||
# no suitable out-of-tree directory is found.
|
||||
.cache
|
||||
|
||||
outdir
|
||||
outdir-*
|
||||
scripts/basic/fixdep
|
||||
scripts/gen_idt/gen_idt
|
||||
scripts/kconfig/conf
|
||||
scripts/kconfig/mconf
|
||||
scripts/kconfig/zconf.hash.c
|
||||
scripts/kconfig/zconf.lex.c
|
||||
scripts/kconfig/zconf.tab.c
|
||||
doc/_build
|
||||
doc/doxygen
|
||||
doc/xml
|
||||
@@ -29,21 +26,12 @@ doc/boards
|
||||
doc/samples
|
||||
doc/latex
|
||||
doc/themes/zephyr-docs-theme
|
||||
sanity-out*
|
||||
bsim_bt_out
|
||||
sanity-out/
|
||||
scripts/grub
|
||||
doc/reference/kconfig/*.rst
|
||||
doc/doc.warnings
|
||||
doc/reference/kconfig/CONFIG_*
|
||||
doc/reference/kconfig/index.rst
|
||||
tags
|
||||
.*project
|
||||
.settings
|
||||
.project
|
||||
.cproject
|
||||
.xxproject
|
||||
.envrc
|
||||
.vscode
|
||||
hide-defaults-note
|
||||
|
||||
# Tag files
|
||||
GPATH
|
||||
GRTAGS
|
||||
GTAGS
|
||||
|
||||
.idea
|
||||
|
||||
9
.gitlint
9
.gitlint
@@ -1,6 +1,6 @@
|
||||
# All these sections are optional, edit this file as you like.
|
||||
[general]
|
||||
ignore=title-trailing-punctuation, T3, title-max-length, T1, body-hard-tab, B3, B1
|
||||
ignore=title-trailing-punctuation, T3, title-max-length, T1
|
||||
# verbosity should be a value between 1 and 3, the commandline -v flags take precedence over this
|
||||
verbosity = 3
|
||||
# By default gitlint will ignore merge commits. Set to 'false' to disable.
|
||||
@@ -15,20 +15,17 @@ extra-path=scripts/gitlint
|
||||
[title-max-length-no-revert]
|
||||
line-length=72
|
||||
|
||||
[body-min-line-count]
|
||||
min-line-count=1
|
||||
|
||||
[body-max-line-count]
|
||||
max-line-count=200
|
||||
|
||||
[title-starts-with-subsystem]
|
||||
regex = ^(?!subsys:)(([^:]+):)(\s([^:]+):)*\s(.+)$
|
||||
regex = ^(([^:]+):)(\s([^:]+):)*\s(.+)$
|
||||
|
||||
[title-must-not-contain-word]
|
||||
# Comma-separated list of words that should not occur in the title. Matching is case
|
||||
# insensitive. It's fine if the keyword occurs as part of a larger word (so "WIPING"
|
||||
# will not cause a violation, but "WIP: my title" will.
|
||||
words=wip
|
||||
words=wip,title
|
||||
|
||||
[title-match-regex]
|
||||
# python like regex (https://docs.python.org/2/library/re.html) that the
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
#
|
||||
# FIXME: all these should match the relative filename
|
||||
#
|
||||
^(?P<filename>([\-:\\/\w\.])+[/\\]doc[/\\]reference[/\\]bluetooth.rst):(?P<lineno>[0-9]+): WARNING: Invalid definition: Expected identifier in nested name. \[error at [0-9]+]$
|
||||
^(?P<filename>[-._/\w]+/doc/api/bluetooth.rst):(?P<lineno>[0-9]+): WARNING: Invalid definition: Expected identifier in nested name. \[error at [0-9]+]$
|
||||
^[ \t]*$
|
||||
^[ \t]*\^$
|
||||
^(?P=filename):(?P=lineno): WARNING: Invalid definition: Expected identifier in nested name. \[error at [0-9]+]$
|
||||
@@ -15,7 +15,7 @@
|
||||
#
|
||||
# bt_gatt_discover_params unnamed struct definition
|
||||
#
|
||||
^(?P<filename>([\-:\\/\w\.])+[/\\]doc[/\\]reference[/\\]bluetooth.rst):(?P<lineno>[0-9]+): WARNING: Invalid definition: Expected identifier in nested name. \[error at [0-9]+]
|
||||
^(?P<filename>[-._/\w]+/doc/api/bluetooth.rst):(?P<lineno>[0-9]+): WARNING: Invalid definition: Expected identifier in nested name. \[error at [0-9]+]
|
||||
^[ \t]*
|
||||
^[ \t]*\^
|
||||
^(?P=filename):(?P=lineno): WARNING: Invalid definition: Expected identifier in nested name. \[error at [0-9]+]
|
||||
@@ -27,7 +27,7 @@
|
||||
#
|
||||
# Bluetooth GATT unnamed struct definition
|
||||
#
|
||||
^(?P<filename>([\-:\\/\w\.])+[/\\]doc[/\\]reference[/\\]bluetooth.rst):(?P<lineno>[0-9]+): WARNING: Invalid definition: Expected identifier in nested name. \[error at [0-9]+]
|
||||
^(?P<filename>[-._/\w]+/doc/api/bluetooth.rst):(?P<lineno>[0-9]+): WARNING: Invalid definition: Expected identifier in nested name. \[error at [0-9]+]
|
||||
^[ \t]*
|
||||
^[ \t]*\^
|
||||
^(?P=filename):(?P=lineno): WARNING: Invalid definition: Expected identifier in nested name. \[error at [0-9]+]
|
||||
@@ -37,32 +37,6 @@
|
||||
^.*bt_gatt_read_params.__unnamed__.*
|
||||
^[- \t]*\^
|
||||
#
|
||||
# Bluetooth mesh unnamed struct definition
|
||||
# Bluetooth packed
|
||||
#
|
||||
^(?P<filename>([\-:\\/\w\.])+[/\\]doc[/\\]reference[/\\]bluetooth.rst):(?P<lineno>[0-9]+): WARNING: Invalid definition: Expected identifier in nested name. \[error at [0-9]+]
|
||||
^[ \t]*
|
||||
^[ \t]*\^
|
||||
^(?P=filename):(?P=lineno): WARNING: Invalid definition: Expected identifier in nested name. \[error at [0-9]+]
|
||||
^[ \t]*
|
||||
^[ \t]*\^
|
||||
^(?P=filename):(?P=lineno): WARNING: Invalid definition: Expected end of definition. \[error at [0-9]+]
|
||||
^.*bt_mesh_model.__unnamed__.*
|
||||
^[- \t]*\^
|
||||
#
|
||||
# Bluetooth mesh pub struct definition
|
||||
#
|
||||
^(?P<filename>([\-:\\/\w\.])+[/\\]doc[/\\]reference[/\\]bluetooth[/\\]mesh[/\\]access.rst):(?P<lineno>[0-9]+): WARNING: Invalid definition: Expected end of definition. \[error at [0-9]+]
|
||||
^.*bt_mesh_model_pub.*
|
||||
^[- \t]*\^
|
||||
^(?P=filename):(?P=lineno): WARNING: Invalid definition: Expected end of definition. \[error at [0-9]+]
|
||||
^.*bt_mesh_model_pub.*
|
||||
^[- \t]*\^
|
||||
^(?P=filename):(?P=lineno): WARNING: Invalid definition: Expected end of definition. \[error at [0-9]+]
|
||||
^.*bt_mesh_model_pub.*
|
||||
^[- \t]*\^
|
||||
^(?P=filename):(?P=lineno): WARNING: Invalid definition: Expected end of definition. \[error at [0-9]+]
|
||||
^.*bt_mesh_model_pub.*
|
||||
^[- \t]*\^
|
||||
^(?P=filename):(?P=lineno): WARNING: Invalid definition: Expected end of definition. \[error at [0-9]+]
|
||||
^.*bt_mesh_model_pub.*
|
||||
^[- \t]*\^
|
||||
^(?P<filename>[-._/\w]+/doc/api/bluetooth.rst):(?P<lineno>[0-9]+): WARNING: cpp:typeOrConcept targets a member \(__packed\).$
|
||||
|
||||
@@ -1,15 +0,0 @@
|
||||
#
|
||||
# Display
|
||||
#
|
||||
#
|
||||
# include
|
||||
#
|
||||
^(?P<filename>([\-:\\/\w\.])+[/\\]doc[/\\]reference[/\\]display_api.rst):(?P<lineno>[0-9]+): WARNING: Invalid definition: Expected identifier in nested name. \[error at [0-9]+]
|
||||
^[ \t]*
|
||||
^[ \t]*\^
|
||||
^(?P=filename):(?P=lineno): WARNING: Invalid definition: Expected identifier in nested name. \[error at [0-9]+]
|
||||
^[ \t]*
|
||||
^[ \t]*\^
|
||||
^(?P=filename):(?P=lineno): WARNING: Invalid definition: Expected end of definition. \[error at [0-9]+]
|
||||
^.*mb_image.__unnamed__
|
||||
^[- \t]*\^
|
||||
@@ -1,6 +0,0 @@
|
||||
#
|
||||
^(?P<filename>([\-:\\/\w\.])+[/\\]doc[/\\]reference[/\\]file_system[/\\]index.rst):(?P<lineno>[0-9]+): WARNING: Duplicate declaration(.*)
|
||||
#
|
||||
^(?P<filename>([\-:\\/\w\.])+[/\\]doc[/\\]reference[/\\]peripherals[/\\]dma.rst):(?P<lineno>[0-9]+): WARNING: Duplicate declaration(.*)
|
||||
#
|
||||
^(?P<filename>([\-:\\/\w\.])+[/\\]doc[/\\]reference[/\\]peripherals[/\\]sensor.rst):(?P<lineno>[0-9]+): WARNING: Duplicate declaration(.*)
|
||||
18
.known-issues/doc/header_footer.conf
Normal file
18
.known-issues/doc/header_footer.conf
Normal file
@@ -0,0 +1,18 @@
|
||||
#
|
||||
# KERNELVERSION not being defined in local builds, kill that warning,
|
||||
# can ignore it
|
||||
#
|
||||
^.*/Kconfig.zephyr:[0-9]+: warning: The symbol KERNELVERSION references the non-existent environment variable KERNELVERSION.*
|
||||
#
|
||||
# Documentation generation, early message
|
||||
#
|
||||
^cd .* && doxygen doc/doxygen.config
|
||||
^srctree=.* SRCARCH=\w+ python scripts/genrest/genrest.py .*$
|
||||
# This cuts the sphinx build line; has to be separate because in the
|
||||
# middle, we have removed the KERNELVERSION one and a full regex won't match
|
||||
^sphinx-build -t \w+ -b html .*
|
||||
#
|
||||
# Documentation generation, footer message
|
||||
#
|
||||
^[ \t]*
|
||||
^Build finished. The HTML pages are in [-._/\w]+
|
||||
14
.known-issues/doc/kernel.conf
Normal file
14
.known-issues/doc/kernel.conf
Normal file
@@ -0,0 +1,14 @@
|
||||
#
|
||||
# Kernel unnamed struct definition
|
||||
#
|
||||
# FIXME: all these should match the relative filename
|
||||
#
|
||||
^(?P<filename>[-._/\w]+/doc/api/kernel_api.rst):(?P<lineno>[0-9]+): WARNING: Invalid definition: Expected identifier in nested name. \[error at [0-9]+]$
|
||||
^[ \t]*$
|
||||
^[ \t]*\^$
|
||||
^(?P=filename):(?P=lineno): WARNING: Invalid definition: Expected identifier in nested name. \[error at [0-9]+]$
|
||||
^[ \t]*$
|
||||
^[ \t]*\^$
|
||||
^(?P=filename):(?P=lineno): WARNING: Invalid definition: Expected end of definition. \[error at [0-9]+]$
|
||||
^.*k_msg.extra.*$
|
||||
^[- \t]*\^$
|
||||
@@ -1,15 +0,0 @@
|
||||
#
|
||||
# Display
|
||||
#
|
||||
#
|
||||
# include
|
||||
#
|
||||
^(?P<filename>([\-:\\/\w\.])+[/\\]doc[/\\]reference[/\\]misc_api.rst):(?P<lineno>[0-9]+): WARNING: Invalid definition: Expected identifier in nested name. \[error at [0-9]+]
|
||||
^[ \t]*
|
||||
^[ \t]*\^
|
||||
^(?P=filename):(?P=lineno): WARNING: Invalid definition: Expected identifier in nested name. \[error at [0-9]+]
|
||||
^[ \t]*
|
||||
^[ \t]*\^
|
||||
^(?P=filename):(?P=lineno): WARNING: Invalid definition: Expected end of definition. \[error at [0-9]+]
|
||||
^.*json_obj_descr.__unnamed__
|
||||
^[- \t]*\^
|
||||
@@ -4,7 +4,7 @@
|
||||
#
|
||||
# include/net/net_ip.h warnings
|
||||
#
|
||||
^(?P<filename>([\-:\\/\w\.])+[/\\]doc[/\\]reference[/\\]networking.rst):(?P<lineno>[0-9]+): WARNING: Invalid definition: Expected identifier in nested name. \[error at [0-9]+]
|
||||
^(?P<filename>[-._/\w]+/doc/api/networking.rst):(?P<lineno>[0-9]+): WARNING: Invalid definition: Expected identifier in nested name. \[error at [0-9]+]
|
||||
^[ \t]*
|
||||
^[ \t]*\^
|
||||
^(?P=filename):(?P=lineno): WARNING: Invalid definition: Expected identifier in nested name. \[error at [0-9]+]
|
||||
@@ -17,9 +17,28 @@
|
||||
^.*in[_6]+addr.in[46]_u
|
||||
^[- \t]*\^
|
||||
#
|
||||
# include/net/net_if.h warnings
|
||||
#
|
||||
^(?P<filename>[-._/\w]+/doc/api/networking.rst):(?P<lineno>[0-9]+): WARNING: Error when parsing function declaration.
|
||||
^\If the function has no return type:
|
||||
^[ \t]*Error in declarator or parameters and qualifiers
|
||||
^[ \t]*Invalid definition: Expected identifier in nested name, got keyword: struct \[error at [0-9]+]
|
||||
^.*struct net_if __aligned\(32\)
|
||||
^[- \t]*\^
|
||||
^\If the function has a return type:
|
||||
^[ \t]*Error in declarator or parameters and qualifiers
|
||||
^[ \t]*If pointer to member declarator:
|
||||
^[ \t]*Invalid definition: Expected \'::\' in pointer to member \(function\). \[error at [0-9]+]
|
||||
^.*struct net_if __aligned\(32\)
|
||||
^[- \t]*\^
|
||||
^[ \t]*If declarator-id:
|
||||
^[ \t]*Invalid definition: Expected identifier in nested name. \[error at [0-9]+]
|
||||
^.*struct net_if __aligned\(32\)
|
||||
^[- \t]*\^
|
||||
#
|
||||
# include/net/net_mgmt.h
|
||||
#
|
||||
^(?P<filename>([\-:\\/\w\.])+[/\\]doc[/\\]reference[/\\]networking.rst):(?P<lineno>[0-9]+): WARNING: Invalid definition: Expected identifier in nested name. \[error at [0-9]+]
|
||||
^(?P<filename>[-._/\w]+/doc/api/networking.rst):(?P<lineno>[0-9]+): WARNING: Invalid definition: Expected identifier in nested name. \[error at [0-9]+]
|
||||
^[ \t]*
|
||||
^[ \t]*\^
|
||||
^(?P=filename):(?P=lineno): WARNING: Invalid definition: Expected identifier in nested name. \[error at [0-9]+]
|
||||
@@ -31,7 +50,7 @@
|
||||
#
|
||||
# include/net/buf.h
|
||||
#
|
||||
^(?P<filename>([\-:\\/\w\.])+[/\\]doc[/\\]reference[/\\]networking.rst):(?P<lineno>[0-9]+): WARNING: Invalid definition: Expected identifier in nested name. \[error at [0-9]+]
|
||||
^(?P<filename>[-._/\w]+/doc/api/networking.rst):(?P<lineno>[0-9]+): WARNING: Invalid definition: Expected identifier in nested name. \[error at [0-9]+]
|
||||
^[ \t]*
|
||||
^[ \t]*\^
|
||||
^(?P=filename):(?P=lineno): WARNING: Invalid definition: Expected identifier in nested name. \[error at [0-9]+]
|
||||
@@ -43,7 +62,7 @@
|
||||
#
|
||||
# include/net/ieee802154.h
|
||||
#
|
||||
^(?P<filename>([\-:\\/\w\.])+[/\\]doc[/\\]reference[/\\]networking.rst):(?P<lineno>[0-9]+): WARNING: Invalid definition: Expected identifier in nested name. \[error at [0-9]+]
|
||||
^(?P<filename>[-._/\w]+/doc/api/networking.rst):(?P<lineno>[0-9]+): WARNING: Invalid definition: Expected identifier in nested name. \[error at [0-9]+]
|
||||
^[ \t]*
|
||||
^[ \t]*\^
|
||||
^(?P=filename):(?P=lineno): WARNING: Invalid definition: Expected identifier in nested name. \[error at [0-9]+]
|
||||
@@ -53,18 +72,42 @@
|
||||
^.*ieee802154_req_params.__unnamed__
|
||||
^[- \t]*\^
|
||||
#
|
||||
# include/net/net_context.h
|
||||
# Various warning about net_mgmt declarations
|
||||
#
|
||||
^(?P<filename>([\-:\\/\w\.])+[/\\]doc[/\\]reference[/\\]networking[/\\]net_context.rst):(?P<lineno>[0-9]+): WARNING: Invalid definition: Expected end of definition. \[error at [0-9]+]
|
||||
^.*net_context.options
|
||||
^(?P<filename>[-._/\w]+/doc/api/networking.rst):(?P<lineno>[0-9]+): WARNING: Error when parsing function declaration\.
|
||||
^If the function has no return type\:
|
||||
^[ \t]*Error in declarator or parameters and qualifiers
|
||||
^[ \t]*Invalid definition: Expected identifier in nested name\. \[error at [0-9]+\]
|
||||
^[ \t]*NET_MGMT_DEFINE_.*?$
|
||||
^[- \t]*\^
|
||||
#
|
||||
# include/net/net_stats.h
|
||||
#
|
||||
^(?P<filename>([\-:\\/\w\.])+[/\\]doc[/\\]reference[/\\]networking[/\\]net_stats.rst):(?P<lineno>[0-9]+): WARNING: Invalid definition: Expected end of definition. \[error at [0-9]+]
|
||||
^.*net_stats_tc.[a-z]+
|
||||
^If the function has a return type\:
|
||||
^[ \t]*Error in declarator
|
||||
^[ \t]*If pointer to member declarator:
|
||||
^[ \t]*Invalid definition: Expected identifier in nested name\. \[error at [0-9]+\]
|
||||
^[ \t]*NET_MGMT_DEFINE_.*?$
|
||||
^[- \t]*\^
|
||||
#
|
||||
# stray duplicate definition warnings
|
||||
^[ \t]*If declId, parameters, and qualifiers\:
|
||||
^[ \t]*Invalid definition: Expected identifier in nested name\. \[error at [0-9]+\]
|
||||
^[ \t]*NET_MGMT_DEFINE_.*?$
|
||||
^[- \t]*\^
|
||||
#
|
||||
^(?P<filename>([\-:\\/\w\.])+[/\\]doc[/\\]reference[/\\]networking[/\\]net_if.rst):(?P<lineno>[0-9]+): WARNING: Duplicate declaration(.*)
|
||||
^[ \t]*If parenthesis in noptr-declarator\:
|
||||
^[ \t]*Error in declarator
|
||||
^[ \t]*If pointer to member declarator:
|
||||
^[ \t]*Invalid definition: Expected identifier in nested name\. \[error at [0-9]+\]
|
||||
^[ \t]*NET_MGMT_DEFINE_.*?$
|
||||
^[- \t]*\^
|
||||
#
|
||||
^[ \t]*If parenthesis in noptr-declarator\:
|
||||
^[ \t]*Error in declarator or parameters and qualifiers
|
||||
^[ \t]*If pointer to member declarator:
|
||||
^[ \t]*Invalid definition: Expected \'\:\:\' in pointer to member \(function\)\. \[error at [0-9]+\]
|
||||
^[ \t]*NET_MGMT_DEFINE_.*?$
|
||||
^[- \t]*\^
|
||||
#
|
||||
^[ \t]*If declarator-id:
|
||||
^[ \t]*Invalid definition: Expecting \"\(\" in parameters_and_qualifiers\. \[error at [0-9]+\]
|
||||
^[ \t]*NET_MGMT_DEFINE_.*?$
|
||||
^[- \t]*\^
|
||||
|
||||
12
.known-issues/doc/sensor.conf
Normal file
12
.known-issues/doc/sensor.conf
Normal file
@@ -0,0 +1,12 @@
|
||||
#
|
||||
# Sensor value unnamed struct definition
|
||||
#
|
||||
^(?P<filename>[-._/\w]+/doc/api/io_interfaces.rst):(?P<lineno>[0-9]+): WARNING: Invalid definition: Expected identifier in nested name. \[error at [0-9]+]
|
||||
^[ \t]*
|
||||
^[ \t]*\^
|
||||
^(?P=filename):(?P=lineno): WARNING: Invalid definition: Expected identifier in nested name. \[error at [0-9]+]
|
||||
^[ \t]*
|
||||
^[ \t]*\^
|
||||
^(?P=filename):(?P=lineno): WARNING: Invalid definition: Expected end of definition. \[error at [0-9]+]
|
||||
^.*sensor_value.__unnamed__.*
|
||||
^[- \t]*\^
|
||||
@@ -1,7 +1,7 @@
|
||||
#
|
||||
# UART unnamed struct definition
|
||||
#doc/api/peripherals/uart.rst
|
||||
^(?P<filename>([\-:\\/\w\.])+[/\\]doc[/\\]reference[/\\]peripherals[/\\]uart.rst):(?P<lineno>[0-9]+): WARNING: Invalid definition: Expected identifier in nested name. \[error at [0-9]+]
|
||||
#
|
||||
^(?P<filename>[-._/\w]+/doc/api/io_interfaces.rst):(?P<lineno>[0-9]+): WARNING: Invalid definition: Expected identifier in nested name. \[error at [0-9]+]
|
||||
^[ \t]*
|
||||
^[ \t]*\^
|
||||
^(?P=filename):(?P=lineno): WARNING: Invalid definition: Expected identifier in nested name. \[error at [0-9]+]
|
||||
@@ -13,19 +13,3 @@
|
||||
^(?P=filename):(?P=lineno): WARNING: Invalid definition: Expected end of definition. \[error at [0-9]+]
|
||||
^.*uart_device_config.__unnamed__.*
|
||||
^[- \t]*\^
|
||||
#
|
||||
^(?P<filename>([\-:\\/\w\.])+[/\\]doc[/\\]reference[/\\]peripherals[/\\]uart.rst):(?P<lineno>[0-9]+): WARNING: Invalid definition: Expected identifier in nested name. \[error at [0-9]+]
|
||||
^[ \t]*
|
||||
^[ \t]*\^
|
||||
^(?P=filename):(?P=lineno): WARNING: Invalid definition: Expected identifier in nested name. \[error at [0-9]+]
|
||||
^[ \t]*
|
||||
^[ \t]*\^
|
||||
^(?P=filename):(?P=lineno): WARNING: Invalid definition: Expected identifier in nested name. \[error at [0-9]+]
|
||||
^[ \t]*
|
||||
^[ \t]*\^
|
||||
^(?P=filename):(?P=lineno): WARNING: Invalid definition: Expected identifier in nested name. \[error at [0-9]+]
|
||||
^[ \t]*
|
||||
^[ \t]*\^
|
||||
^(?P=filename):(?P=lineno): WARNING: Invalid definition: Expected end of definition. \[error at [0-9]+]
|
||||
^.*uart_event.data
|
||||
^[- \t]*\^
|
||||
|
||||
1
.mailmap
1
.mailmap
@@ -19,4 +19,3 @@ Naga Raja Rao Tulasi <tulasi.r@tcs.com> <tulasi.r@tcs.com>
|
||||
Felipe Neves <ryukokki.felipe@gmail.com> <ryukokki.felipe@gmail.com>
|
||||
Amir Kaplan <amir.kaplan@intel.com> <amir.kaplan@intel.com>
|
||||
Anas Nashif <anas.nashif@intel.com> <anas.nashif@intel.com>
|
||||
Ruud Derwig <Ruud.Derwig@synopsys.com> <Ruud.Derwig@synopsys.com>
|
||||
|
||||
111
.shippable.yml
111
.shippable.yml
@@ -4,24 +4,26 @@ compiler: gcc
|
||||
|
||||
env:
|
||||
global:
|
||||
- SDK=0.10.3
|
||||
- ZEPHYR_SDK_INSTALL_DIR=/opt/sdk/zephyr-sdk-0.10.3
|
||||
- ZEPHYR_TOOLCHAIN_VARIANT=zephyr
|
||||
- MATRIX_BUILDS="5"
|
||||
- SDK=0.9.1
|
||||
- SANITYCHECK_OPTIONS=" --inline-logs -R"
|
||||
- SANITYCHECK_OPTIONS_RETRY="${SANITYCHECK_OPTIONS} --only-failed --outdir=out-2nd-pass"
|
||||
- ZEPHYR_SDK_INSTALL_DIR=/opt/sdk/zephyr-sdk-0.9.1
|
||||
- ZEPHYR_GCC_VARIANT=zephyr
|
||||
- USE_CCACHE=1
|
||||
- MATRIX_BUILDS="2"
|
||||
- MATRIX_BUILDS_EXTRA="3"
|
||||
matrix:
|
||||
- MATRIX_BUILD="1"
|
||||
- MATRIX_BUILD="2"
|
||||
- MATRIX_BUILD="3"
|
||||
- MATRIX_BUILD="4"
|
||||
- MATRIX_BUILD="5"
|
||||
|
||||
build:
|
||||
cache: false
|
||||
cache: true
|
||||
cache_dir_list:
|
||||
- ${SHIPPABLE_BUILD_DIR}/ccache
|
||||
pre_ci_boot:
|
||||
image_name: zephyrprojectrtos/ci
|
||||
image_tag: v0.8.2
|
||||
image_tag: v0.1
|
||||
pull: true
|
||||
options: "-e HOME=/home/buildslave --privileged=true --tty --net=bridge --user buildslave"
|
||||
|
||||
@@ -29,30 +31,82 @@ build:
|
||||
- export CCACHE_DIR=${SHIPPABLE_BUILD_DIR}/ccache/.ccache
|
||||
- >
|
||||
if [ "$IS_PULL_REQUEST" = "true" ]; then
|
||||
./scripts/ci/run_ci.sh -c -b ${PULL_REQUEST_BASE_BRANCH} -r origin -m ${MATRIX_BUILD} -M ${MATRIX_BUILDS} -p ${PULL_REQUEST};
|
||||
else
|
||||
./scripts/ci/run_ci.sh -c -b ${BRANCH} -r origin -m ${MATRIX_BUILD} -M ${MATRIX_BUILDS};
|
||||
fi;
|
||||
git rebase origin/${PULL_REQUEST_BASE_BRANCH};
|
||||
fi
|
||||
- source zephyr-env.sh
|
||||
- ccache -c -s --max-size=2000M
|
||||
- make host-tools
|
||||
- export PREBUILT_HOST_TOOLS=${ZEPHYR_BASE}/bin
|
||||
- >
|
||||
if [ "$MATRIX_BUILD" = "3" -a "$IS_PULL_REQUEST" = "true" ]; then
|
||||
export COMMIT_RANGE=origin/${PULL_REQUEST_BASE_BRANCH}..HEAD
|
||||
echo "Building a Pull Request";
|
||||
echo "- Building Documentation";
|
||||
echo "Commit range:" ${COMMIT_RANGE}
|
||||
make htmldocs > doc.log 2>&1;
|
||||
./scripts/filter-known-issues.py --config-dir .known-issues/doc/ doc.log > doc.warnings;
|
||||
|
||||
if [ "$?" != 0 ]; then
|
||||
echo " ==> Error running filter script"
|
||||
exit 1
|
||||
fi;
|
||||
if [ -s doc.warnings ]; then
|
||||
echo " => New documentation warnings/errors";
|
||||
fi;
|
||||
echo "- Verify commit message and coding style";
|
||||
./scripts/ci/check-compliance.py --commits ${COMMIT_RANGE} || true;
|
||||
fi;
|
||||
- >
|
||||
if [ "$IS_PULL_REQUEST" = "true" ]; then
|
||||
./scripts/ci/get_modified_tests.py --commits origin/${PULL_REQUEST_BASE_BRANCH}..HEAD > modified_tests.args;
|
||||
./scripts/ci/get_modified_boards.py --commits origin/${PULL_REQUEST_BASE_BRANCH}..HEAD > modified_boards.args;
|
||||
|
||||
if [ -s modified_boards.args ]; then
|
||||
./scripts/sanitycheck --subset ${MATRIX_BUILD}/${MATRIX_BUILDS_EXTRA} +modified_boards.args || ./scripts/sanitycheck +modified_boards.args --only-failed;
|
||||
cp ./scripts/sanity_chk/last_sanity.xml modified_boards.xml;
|
||||
fi;
|
||||
if [ -s modified_tests.args ]; then
|
||||
./scripts/sanitycheck --subset ${MATRIX_BUILD}/${MATRIX_BUILDS_EXTRA} +modified_tests.args || ./scripts/sanitycheck +modified_tests.args --only-failed;
|
||||
cp ./scripts/sanity_chk/last_sanity.xml modified_tests.xml;
|
||||
fi;
|
||||
rm -f modified_tests.args modified_boards.args;
|
||||
fi
|
||||
- >
|
||||
if [ "$MATRIX_BUILD" != "3" ]; then
|
||||
./scripts/sanitycheck ${PLATFORMS} --subset ${MATRIX_BUILD}/${MATRIX_BUILDS} ${COVERAGE} ${SANITYCHECK_OPTIONS} || ./scripts/sanitycheck ${PLATFORMS} ${COVERAGE} ${SANITYCHECK_OPTIONS_RETRY} || ./scripts/sanitycheck ${PLATFORMS} ${COVERAGE} ${SANITYCHECK_OPTIONS_RETRY}
|
||||
fi;
|
||||
- ccache -s
|
||||
on_failure:
|
||||
- rm -rf sanity-out out-2nd-pass
|
||||
- mkdir -p shippable/testresults
|
||||
- >
|
||||
if [ "$IS_PULL_REQUEST" = "true" ]; then
|
||||
./scripts/ci/run_ci.sh -f -b ${PULL_REQUEST_BASE_BRANCH} -r origin -m ${MATRIX_BUILD} -M ${MATRIX_BUILDS} -p ${PULL_REQUEST};
|
||||
else
|
||||
./scripts/ci/run_ci.sh -f -b ${BRANCH} -r origin -m ${MATRIX_BUILD} -M ${MATRIX_BUILDS};
|
||||
fi;
|
||||
if [ -e compliance.xml ]; then
|
||||
cp compliance.xml shippable/testresults/;
|
||||
fi;
|
||||
- >
|
||||
if [ -e ./scripts/sanity_chk/last_sanity.xml ]; then
|
||||
cp ./scripts/sanity_chk/last_sanity.xml shippable/testresults/;
|
||||
fi;
|
||||
- >
|
||||
if [ -e ./modified_tests.xml ]; then
|
||||
cp ./modified_tests.xml shippable/testresults/;
|
||||
fi;
|
||||
on_success:
|
||||
- rm -rf sanity-out out-2nd-pass
|
||||
- mkdir -p shippable/testresults
|
||||
- >
|
||||
if [ "$IS_PULL_REQUEST" = "true" ]; then
|
||||
./scripts/ci/run_ci.sh -s -b ${PULL_REQUEST_BASE_BRANCH} -r origin -m ${MATRIX_BUILD} -M ${MATRIX_BUILDS} -p ${PULL_REQUEST};
|
||||
else
|
||||
./scripts/ci/run_ci.sh -s -b ${BRANCH} -r origin -m ${MATRIX_BUILD} -M ${MATRIX_BUILDS};
|
||||
fi;
|
||||
branches:
|
||||
only:
|
||||
- master
|
||||
- v*-branch
|
||||
- topic-*
|
||||
if [ -e compliance.xml ]; then
|
||||
cp compliance.xml shippable/testresults/;
|
||||
fi;
|
||||
- >
|
||||
if [ -e ./scripts/sanity_chk/last_sanity.xml ]; then
|
||||
cp ./scripts/sanity_chk/last_sanity.xml shippable/testresults/;
|
||||
fi;
|
||||
- >
|
||||
if [ -e ./modified_tests.xml ]; then
|
||||
cp ./modified_tests.xml shippable/testresults/;
|
||||
fi;
|
||||
|
||||
integrations:
|
||||
notifications:
|
||||
- integrationName: slack_integration
|
||||
@@ -63,7 +117,7 @@ integrations:
|
||||
only:
|
||||
- master
|
||||
on_success: never
|
||||
on_failure: never
|
||||
on_failure: always
|
||||
- integrationName: email
|
||||
type: email
|
||||
recipients:
|
||||
@@ -74,6 +128,5 @@ integrations:
|
||||
- net
|
||||
- bluetooth
|
||||
- arm
|
||||
- v1.14-branch
|
||||
on_success: never
|
||||
on_failure: never
|
||||
|
||||
@@ -1,80 +0,0 @@
|
||||
indent_with_tabs = 2 # 1=indent to level only, 2=indent with tabs
|
||||
input_tab_size = 8 # original tab size
|
||||
output_tab_size = 8 # new tab size
|
||||
indent_columns = output_tab_size
|
||||
indent_label = 1 # pos: absolute col, neg: relative column
|
||||
indent_switch_case = 0 # number
|
||||
|
||||
#
|
||||
# inter-symbol newlines
|
||||
#
|
||||
|
||||
nl_enum_brace = remove # "enum {" vs "enum \n {"
|
||||
nl_union_brace = remove # "union {" vs "union \n {"
|
||||
nl_struct_brace = remove # "struct {" vs "struct \n {"
|
||||
nl_do_brace = remove # "do {" vs "do \n {"
|
||||
nl_if_brace = remove # "if () {" vs "if () \n {"
|
||||
nl_for_brace = remove # "for () {" vs "for () \n {"
|
||||
nl_else_brace = remove # "else {" vs "else \n {"
|
||||
nl_while_brace = remove # "while () {" vs "while () \n {"
|
||||
nl_switch_brace = remove # "switch () {" vs "switch () \n {"
|
||||
nl_brace_while = remove # "} while" vs "} \n while" - cuddle while
|
||||
nl_brace_else = remove # "} \n else" vs "} else"
|
||||
nl_func_var_def_blk = 1
|
||||
nl_fcall_brace = remove # "list_for_each() {" vs "list_for_each()\n{"
|
||||
nl_fdef_brace = add # "int foo() {" vs "int foo()\n{"
|
||||
|
||||
#
|
||||
# Source code modifications
|
||||
#
|
||||
|
||||
mod_paren_on_return = ignore # "return 1;" vs "return (1);"
|
||||
mod_full_brace_if = add # "if() { } else { }" vs "if() else"
|
||||
|
||||
#
|
||||
# inter-character spacing options
|
||||
#
|
||||
|
||||
sp_sizeof_paren = remove # "sizeof (int)" vs "sizeof(int)"
|
||||
sp_before_sparen = force # "if (" vs "if("
|
||||
sp_after_sparen = force # "if () {" vs "if (){"
|
||||
sp_inside_braces = add # "{ 1 }" vs "{1}"
|
||||
sp_inside_braces_struct = add # "{ 1 }" vs "{1}"
|
||||
sp_inside_braces_enum = add # "{ 1 }" vs "{1}"
|
||||
sp_assign = add
|
||||
sp_arith = add
|
||||
sp_bool = add
|
||||
sp_compare = add
|
||||
sp_assign = add
|
||||
sp_after_comma = add
|
||||
sp_func_def_paren = remove # "int foo (){" vs "int foo(){"
|
||||
sp_func_call_paren = remove # "foo (" vs "foo("
|
||||
sp_func_proto_paren = remove # "int foo ();" vs "int foo();"
|
||||
sp_inside_fparen = remove # "func( arg )" vs "func(arg)"
|
||||
sp_else_brace = add # ignore/add/remove/force
|
||||
sp_before_ptr_star = add # ignore/add/remove/force
|
||||
sp_after_ptr_star = remove # ignore/add/remove/force
|
||||
sp_between_ptr_star = remove # ignore/add/remove/force
|
||||
sp_inside_paren = remove # remove spaces inside parens
|
||||
sp_paren_paren = remove # remove spaces between nested parens
|
||||
sp_inside_sparen = remove # remove spaces inside parens for if, while and the like
|
||||
sp_brace_else = add # ignore/add/remove/force
|
||||
sp_before_nl_cont = ignore
|
||||
sp_cmt_cpp_start = add
|
||||
sp_brace_typedef = add # }typedefd_name -> } typedefd_name
|
||||
|
||||
cmt_sp_after_star_cont = 1
|
||||
#
|
||||
# Aligning stuff
|
||||
#
|
||||
|
||||
align_with_tabs = FALSE # use tabs to align
|
||||
align_on_tabstop = TRUE # align on tabstops
|
||||
align_enum_equ_span = 4 # '=' in enum definition
|
||||
align_struct_init_span = 0 # align stuff in a structure init '= { }'
|
||||
align_right_cmt_span = 3
|
||||
align_nl_cont = TRUE
|
||||
|
||||
|
||||
|
||||
sp_pp_concat = ignore # ignore/add/remove/force
|
||||
1490
CMakeLists.txt
1490
CMakeLists.txt
File diff suppressed because it is too large
Load Diff
474
CODEOWNERS
474
CODEOWNERS
@@ -1,309 +1,177 @@
|
||||
# CODEOWNERS for autoreview assigning in github
|
||||
|
||||
# Order is important; the last matching pattern takes the most
|
||||
# precedence.
|
||||
|
||||
# Do not use wildcard on all source yet
|
||||
# * @galak @nashif
|
||||
|
||||
/.github/ @nashif @galak
|
||||
/.known-issues/ @inakypg @nashif
|
||||
/.buildkite/ @galak
|
||||
/arch/arc/ @vonhust @ruuddw
|
||||
/arch/arm/ @MaureenHelm @galak
|
||||
/arch/arm/core/cortex_m/cmse/ @ioannisg
|
||||
arch/arm/include/cortex_m/cmse.h @ioannisg
|
||||
/soc/arm/ @MaureenHelm @galak
|
||||
/soc/arm/arm/mps2/ @fvincenzo
|
||||
/soc/arm/atmel_sam/sam4s/ @fallrisk
|
||||
/soc/arm/nxp*/ @MaureenHelm
|
||||
/soc/arm/nordic_nrf/ @ioannisg
|
||||
/soc/arm/st_stm32/ @erwango
|
||||
/soc/arm/st_stm32/stm32f4/ @rsalveti @idlethread
|
||||
/soc/arm/ti_simplelink/cc32xx/ @vanti
|
||||
/soc/arm/ti_simplelink/msp432p4xx/ @Mani-Sadhasivam
|
||||
/soc/xtensa/intel_s1000/ @sathishkuttan @dcpleung @rgundi
|
||||
/arch/nios2/ @andrewboie @ramakrishnapallala
|
||||
/arch/posix/ @aescolar
|
||||
/arch/riscv32/ @kgugala @pgielda @nategraff-sifive
|
||||
/soc/posix/ @aescolar
|
||||
/soc/riscv32/ @kgugala @pgielda @nategraff-sifive
|
||||
/arch/x86/ @andrewboie @ramakrishnapallala
|
||||
/arch/x86/core/ @andrewboie
|
||||
/arch/x86/core/crt0.S @ramakrishnapallala @nashif
|
||||
/soc/x86/ @andrewboie @ramakrishnapallala
|
||||
/soc/x86/intel_quark/quark_d2000/ @nashif
|
||||
/soc/x86/intel_quark/quark_se/ @nashif
|
||||
/soc/x86/intel_quark/quark_x1000/ @nashif
|
||||
/arch/xtensa/ @andrewboie @rgundi @andyross
|
||||
/soc/xtensa/ @andrewboie @rgundi @andyross
|
||||
/boards/arc/ @vonhust @ruuddw
|
||||
/boards/arc/arduino_101_sss/ @nashif
|
||||
/boards/arc/em_starterkit/ @vonhust
|
||||
/boards/arc/quark_se_c1000_ss_devboard/ @nashif
|
||||
/boards/arm/ @MaureenHelm @galak
|
||||
/boards/arm/96b_argonkey/ @avisconti
|
||||
/boards/arm/96b_carbon/ @rsalveti @idlethread
|
||||
/boards/arm/96b_nitrogen/ @idlethread
|
||||
/boards/arm/96b_neonkey/ @Mani-Sadhasivam
|
||||
/boards/arm/96b_stm32_sensor_mez/ @Mani-Sadhasivam
|
||||
/boards/arm/cc3220sf_launchxl/ @vanti
|
||||
/boards/arm/curie_ble/ @jhedberg
|
||||
/boards/arm/disco_l475_iot1/ @erwango
|
||||
/boards/arm/frdm*/ @MaureenHelm
|
||||
/boards/arm/frdm*/doc/ @MaureenHelm @MeganHansen
|
||||
/boards/arm/hexiwear*/ @MaureenHelm
|
||||
/boards/arm/hexiwear*/doc/ @MaureenHelm @MeganHansen
|
||||
/boards/arm/lpcxpresso*/ @MaureenHelm
|
||||
/boards/arm/lpcxpresso*/doc/ @MaureenHelm @MeganHansen
|
||||
/boards/arm/mimxrt*/ @MaureenHelm
|
||||
/boards/arm/mimxrt*/doc/ @MaureenHelm @MeganHansen
|
||||
/boards/arm/mps2_an385/ @fvincenzo
|
||||
/boards/arm/msp_exp432p401r_launchxl/ @Mani-Sadhasivam
|
||||
/boards/arm/nrf51_blenano/ @rsalveti
|
||||
/boards/arm/nrf51_pca10028/ @carlescufi
|
||||
/boards/arm/nrf52_pca10040/ @carlescufi
|
||||
/boards/arm/nrf52_pca20020/ @tkln
|
||||
/boards/arm/nrf52810_pca10040/ @carlescufi
|
||||
/boards/arm/nrf52840_pca10056/ @carlescufi
|
||||
/boards/arm/nrf52840_pca10059/ @lemrey
|
||||
/boards/arm/nrf9160_pca10090/ @ioannisg
|
||||
/boards/arm/nucleo*/ @erwango
|
||||
/boards/arm/nucleo_f401re/ @rsalveti @idlethread
|
||||
/boards/arm/sam4s_xplained/ @fallrisk
|
||||
/boards/arm/v2m_beetle/ @fvincenzo
|
||||
/boards/arm/olimexino_stm32/ @ydamigos
|
||||
/boards/arm/stm32*_disco/ @erwango
|
||||
/boards/arm/stm32f3_disco/ @ydamigos
|
||||
/boards/arm/stm32*_eval/ @erwango
|
||||
/boards/nios2/ @ramakrishnapallala
|
||||
/boards/nios2/altera_max10/ @ramakrishnapallala
|
||||
/boards/posix/ @aescolar
|
||||
/boards/riscv32/ @kgugala @pgielda @nategraff-sifive
|
||||
/boards/shields/ @erwango
|
||||
/boards/x86/ @andrewboie @nashif
|
||||
/boards/x86/arduino_101/ @nashif
|
||||
/boards/x86/galileo/ @nashif
|
||||
/boards/x86/quark_d2000_crb/ @nashif
|
||||
/boards/x86/quark_se_c1000_devboard/ @nashif
|
||||
/boards/xtensa/ @nashif @dcpleung
|
||||
/boards/xtensa/intel_s1000_crb/ @sathishkuttan @dcpleung
|
||||
# All cmake related files
|
||||
/cmake/ @SebastianBoe @nashif
|
||||
/cmake/compiler/xcc/ @nashif
|
||||
/cmake/toolchain/xcc/ @nashif
|
||||
/CMakeLists.txt @SebastianBoe @nashif
|
||||
/doc/ @dbkinder
|
||||
/doc/guides/coccinelle.rst @himanshujha199640 @JuliaLawall
|
||||
/doc/CMakeLists.txt @carlescufi
|
||||
/doc/scripts/ @carlescufi
|
||||
/doc/guides/bluetooth/ @sjanc @jhedberg @Vudentz
|
||||
/doc/reference/bluetooth/ @sjanc @jhedberg @Vudentz
|
||||
/drivers/*/*mcux* @MaureenHelm
|
||||
/drivers/*/*qmsi* @nashif
|
||||
/drivers/*/*stm32* @erwango
|
||||
/drivers/*/*native_posix* @aescolar
|
||||
/drivers/adc/ @anangl
|
||||
/drivers/bluetooth/ @sjanc @jhedberg @Vudentz
|
||||
/drivers/can/ @alexanderwachter
|
||||
/drivers/clock_control/*stm32f4* @rsalveti @idlethread
|
||||
/drivers/counter/ @nordic-krch
|
||||
/drivers/display/ @vanwinkeljan
|
||||
/drivers/ethernet/ @jukkar @tbursztyka @pfalcon
|
||||
/drivers/flash/ @nashif
|
||||
/drivers/flash/*stm32* @superna9999
|
||||
/drivers/gpio/*stm32* @rsalveti @idlethread
|
||||
/drivers/hwinfo/ @alexanderwachter
|
||||
/drivers/i2s/i2s_ll_stm32* @avisconti
|
||||
/drivers/ieee802154/ @jukkar @tbursztyka
|
||||
/drivers/interrupt_controller/ @andrewboie
|
||||
/drivers/led/ @Mani-Sadhasivam
|
||||
/drivers/led_strip/ @mbolivar
|
||||
/drivers/modem/ @mike-scott
|
||||
/drivers/pci/ @gnuless
|
||||
/drivers/pinmux/stm32/ @rsalveti @idlethread
|
||||
/drivers/sensor/ @bogdan-davidoaia @MaureenHelm
|
||||
/drivers/sensor/hts*/ @avisconti
|
||||
/drivers/sensor/lis*/ @avisconti
|
||||
/drivers/sensor/lps*/ @avisconti
|
||||
/drivers/sensor/lsm*/ @avisconti
|
||||
/drivers/serial/uart_altera_jtag_hal.c @ramakrishnapallala
|
||||
/drivers/net/slip.c @jukkar @tbursztyka
|
||||
/drivers/spi/ @tbursztyka
|
||||
/drivers/spi/spi_ll_stm32.* @superna9999
|
||||
/drivers/timer/cortex_m_systick.c @ioannisg
|
||||
/drivers/timer/altera_avalon_timer_hal.c @ramakrishnapallala
|
||||
/drivers/timer/riscv_machine_timer.c @nategraff-sifive @kgugala @pgielda
|
||||
/drivers/usb/ @jfischer-phytec-iot @finikorg
|
||||
/drivers/usb/device/usb_dc_stm32.c @ydamigos @loicpoulain
|
||||
/drivers/i2c/i2c_ll_stm32* @ldts @ydamigos
|
||||
/drivers/watchdog/wdt_handlers.c @andrewboie
|
||||
/drivers/wifi/ @jukkar @tbursztyka @pfalcon
|
||||
/drivers/wifi/eswifi/ @loicpoulain
|
||||
/dts/arm/st/ @erwango
|
||||
/dts/arm/nordic/ @ioannisg @carlescufi
|
||||
/dts/arm/nxp/ @MaureenHelm
|
||||
/dts/bindings/ @galak
|
||||
/dts/bindings/can/ @alexanderwachter
|
||||
/dts/bindings/*/nordic* @anangl
|
||||
/dts/bindings/*/nxp* @MaureenHelm
|
||||
/ext/fs/ @nashif @ramakrishnapallala
|
||||
/ext/hal/cmsis/ @MaureenHelm @galak
|
||||
/ext/hal/libmetal/ @galak
|
||||
/ext/hal/nordic/ @carlescufi @anangl
|
||||
/ext/hal/nxp/ @MaureenHelm
|
||||
/ext/hal/qmsi/ @nashif
|
||||
/ext/hal/st/stm32cube/ @erwango
|
||||
/ext/hal/ti/simplelink/ @vanti
|
||||
/ext/lib/crypto/mbedtls/ @nashif
|
||||
/ext/lib/crypto/tinycrypt/ @ceolin
|
||||
/include/adc.h @anangl
|
||||
/include/app_memory/ @andrewboie
|
||||
/include/arch/arc/ @vonhust @ruuddw
|
||||
/include/arch/arc/arch.h @andrewboie
|
||||
/include/arch/arc/v2/irq.h @andrewboie
|
||||
/include/arch/arm/ @MaureenHelm @galak
|
||||
/include/arch/arm/cortex_m/irq.h @andrewboie
|
||||
/include/arch/nios2/ @andrewboie
|
||||
/include/arch/nios2/arch.h @andrewboie
|
||||
/include/arch/posix/ @aescolar
|
||||
/include/arch/riscv32/ @nategraff-sifive @kgugala @pgielda
|
||||
/include/arch/x86/ @andrewboie @ramakrishnapallala
|
||||
/include/arch/x86/arch.h @andrewboie
|
||||
/include/arch/xtensa/ @andrewboie
|
||||
/include/atomic.h @andrewboie @andyross
|
||||
/include/bluetooth/ @sjanc @jhedberg @Vudentz
|
||||
/include/cache.h @andrewboie @andyross
|
||||
/include/can.h @alexanderwachter
|
||||
/include/counter.h @nordic-krch
|
||||
/include/device.h @ramakrishnapallala @nashif
|
||||
/include/display.h @vanwinkeljan
|
||||
/include/display/ @vanwinkeljan
|
||||
/include/drivers/bluetooth/ @sjanc @jhedberg @Vudentz
|
||||
/include/drivers/modem/ @mike-scott
|
||||
/include/drivers/ioapic.h @andrewboie
|
||||
/include/drivers/loapic.h @andrewboie
|
||||
/include/drivers/mvic.h @andrewboie
|
||||
/include/fs.h @nashif @ramakrishnapallala
|
||||
/include/fs/ @nashif @ramakrishnapallala
|
||||
/include/hwinfo.h @alexanderwachter
|
||||
/include/init.h @andrewboie @andyross
|
||||
/include/irq.h @andrewboie @andyross
|
||||
/include/irq_offload.h @andrewboie @andyross
|
||||
/include/kernel.h @andrewboie @andyross
|
||||
/include/kernel_version.h @andrewboie @andyross
|
||||
/include/led.h @Mani-Sadhasivam
|
||||
/include/led_strip.h @mbolivar
|
||||
/include/linker/app_smem*.ld @andrewboie
|
||||
/include/linker/linker-defs.h @andrewboie @andyross
|
||||
/include/linker/linker-tool-gcc.h @andrewboie @andyross
|
||||
/include/linker/linker-tool.h @andrewboie @andyross
|
||||
/include/linker/section_tags.h @andrewboie @andyross
|
||||
/include/linker/sections.h @andrewboie @andyross
|
||||
/include/logging/ @nordic-krch
|
||||
/include/misc/ @andrewboie @andyross
|
||||
/include/net/ @jukkar @tbursztyka @pfalcon
|
||||
/include/net/buf.h @jukkar @jhedberg @tbursztyka @pfalcon
|
||||
/include/posix/ @pfalcon
|
||||
/include/power.h @ramakrishnapallala @nashif
|
||||
/include/sensor.h @bogdan-davidoaia
|
||||
/include/shared_irq.h @andrewboie @andyross
|
||||
/include/shell/ @jarz-nordic @nordic-krch
|
||||
/include/spi.h @tbursztyka
|
||||
/include/sw_isr_table.h @andrewboie @andyross
|
||||
/include/sys_clock.h @andrewboie @andyross
|
||||
/include/sys_io.h @andrewboie @andyross
|
||||
/include/toolchain.h @andrewboie @andyross @nashif
|
||||
/include/toolchain/ @andrewboie @andyross
|
||||
/include/zephyr.h @andrewboie @andyross
|
||||
/kernel/ @andrewboie @andyross
|
||||
/lib/gui/ @vanwinkeljan
|
||||
/lib/os/ @andrewboie @andyross
|
||||
/lib/posix/ @pfalcon
|
||||
/lib/libc/ @nashif @andrewboie
|
||||
/kernel/device.c @andrewboie @andyross @nashif
|
||||
/kernel/idle.c @andrewboie @andyross @nashif
|
||||
/samples/basic/servo_motor/*microbit* @jhe
|
||||
/samples/bluetooth/ @sjanc @jhedberg @Vudentz
|
||||
/samples/boards/intel_s1000_crb/ @sathishkuttan @rgundi @nashif
|
||||
/samples/display/ @vanwinkeljan
|
||||
/samples/drivers/CAN/ @alexanderwachter
|
||||
/samples/gui/ @vanwinkeljan
|
||||
/samples/net/ @jukkar @tbursztyka @pfalcon
|
||||
/samples/net/dns_resolve/ @jukkar @tbursztyka @pfalcon
|
||||
/samples/net/lwm2m_client/ @mike-scott
|
||||
/samples/net/mqtt_publisher/ @jukkar @tbursztyka
|
||||
/samples/net/sockets/coap_client/ @rveerama1
|
||||
/samples/net/sockets/coap_server/ @rveerama1
|
||||
/samples/net/sockets/ @jukkar @tbursztyka @pfalcon
|
||||
/samples/sensor/ @bogdan-davidoaia
|
||||
/samples/subsys/logging/ @nordic-krch @jarz-nordic
|
||||
/samples/subsys/shell/ @jarz-nordic @nordic-krch
|
||||
/samples/subsys/usb/ @jfischer-phytec-iot @finikorg
|
||||
/samples/subsys/power/ @ramakrishnapallala @pizi-nordic
|
||||
/scripts/ci/ @nashif @galak
|
||||
/scripts/coccicheck @himanshujha199640 @JuliaLawall
|
||||
/scripts/coccinelle/ @himanshujha199640 @JuliaLawall
|
||||
/scripts/elf_helper.py @andrewboie
|
||||
/scripts/sanity_chk/expr_parser.py @andrewboie @nashif
|
||||
/scripts/gen_app_partitions.py @andrewboie
|
||||
/arch/x86/gen_gdt.py @andrewboie
|
||||
/arch/x86/gen_idt.py @andrewboie
|
||||
/scripts/gen_kobject_list.py @andrewboie
|
||||
/arch/x86/gen_mmu_x86.py @andrewboie
|
||||
/scripts/gen_priv_stacks.py @agross-linaro
|
||||
/scripts/gen_syscall_header.py @andrewboie
|
||||
/scripts/gen_syscalls.py @andrewboie
|
||||
/scripts/process_gperf.py @andrewboie
|
||||
/scripts/sanity_chk/ @andrewboie @nashif
|
||||
/scripts/sanitycheck @andrewboie @nashif
|
||||
/scripts/series-push-hook.sh @erwango
|
||||
/scripts/west_commands/ @mbolivar
|
||||
/scripts/west-commands.yml @mbolivar
|
||||
/scripts/zephyr_module.py @tejlmand
|
||||
/subsys/bluetooth/ @sjanc @jhedberg @Vudentz
|
||||
/subsys/bluetooth/controller/ @carlescufi @cvinayak @thoh-ot
|
||||
/subsys/fs/ @nashif
|
||||
/subsys/fs/fcb/ @nvlsianpu
|
||||
/subsys/fs/nvs/ @Laczen
|
||||
/subsys/logging/ @nordic-krch
|
||||
/subsys/net/buf.c @jukkar @jhedberg @tbursztyka @pfalcon
|
||||
/subsys/net/ip/ @jukkar @tbursztyka @pfalcon
|
||||
/subsys/net/lib/ @jukkar @tbursztyka @pfalcon
|
||||
/subsys/net/lib/dns/ @jukkar @tbursztyka @pfalcon
|
||||
/subsys/net/lib/http/ @jukkar @tbursztyka
|
||||
/subsys/net/lib/lwm2m/ @mike-scott
|
||||
/subsys/net/lib/mqtt/ @jukkar @tbursztyka
|
||||
/subsys/net/lib/coap/ @rveerama1
|
||||
/subsys/net/lib/sockets/ @jukkar @tbursztyka @pfalcon
|
||||
/subsys/power/ @ramakrishnapallala @pizi-nordic
|
||||
/subsys/settings/ @nvlsianpu
|
||||
/subsys/shell/ @jarz-nordic @nordic-krch
|
||||
/subsys/storage/ @nvlsianpu
|
||||
/subsys/testsuite/ @nashif
|
||||
/subsys/usb/ @jfischer-phytec-iot @finikorg
|
||||
/tests/application_development/libcxx/ @pabigot
|
||||
/tests/boards/native_posix/ @aescolar
|
||||
/tests/boards/intel_s1000_crb/ @rgundi @dcpleung @sathishkuttan
|
||||
/tests/bluetooth/ @sjanc @jhedberg @Vudentz
|
||||
/tests/posix/ @pfalcon
|
||||
/tests/crypto/ @ceolin
|
||||
/tests/crypto/mbedtls/ @nashif @ceolin
|
||||
/tests/drivers/can/ @alexanderwachter
|
||||
/tests/drivers/hwinfo/ @alexanderwachter
|
||||
/tests/drivers/spi/ @tbursztyka
|
||||
/tests/drivers/uart/uart_async_api/ @Mierunski
|
||||
/tests/kernel/ @andrewboie @andyross @nashif
|
||||
/tests/lib/ @nashif
|
||||
/tests/net/ @jukkar @tbursztyka @pfalcon
|
||||
/tests/net/buf/ @jukkar @jhedberg @tbursztyka @pfalcon
|
||||
/tests/net/lib/ @jukkar @tbursztyka @pfalcon
|
||||
/tests/net/lib/http_header_fields/ @jukkar @tbursztyka
|
||||
/tests/net/lib/mqtt_packet/ @jukkar @tbursztyka
|
||||
/tests/net/lib/coap/ @rveerama1
|
||||
/tests/net/socket/ @jukkar @tbursztyka @pfalcon
|
||||
/tests/subsys/fs/ @nashif @ramakrishnapallala
|
||||
/tests/subsys/settings/ @nvlsianpu
|
||||
|
||||
# Get all docs reviewed
|
||||
*.rst @dbkinder
|
||||
*.rst @dbkinder
|
||||
.known-issues/* @inakypg @nashif
|
||||
MAINTAINERS @inakypg @nashif
|
||||
arch/arc/* @cjordan44 @ruuddw
|
||||
arch/arc/core/* @andrewboie
|
||||
arch/arm/* @MaureenHelm @galak
|
||||
arch/arm/core/* @andrewboie
|
||||
arch/arm/soc/arm/mps2/* @fvincenzo
|
||||
arch/arm/soc/st_stm32/* @erwango
|
||||
arch/arm/soc/st_stm32/stm32f4/* @rsalveti @idlethread
|
||||
arch/arm/soc/ti_simplelink/cc32xx @GAnthony
|
||||
arch/nios2/* @andrewboie
|
||||
arch/nios2/core/* @andrewboie
|
||||
arch/riscv32 @fractalclone
|
||||
arch/x86/* @andrewboie @youvedeep
|
||||
arch/x86/core/* @andrewboie
|
||||
arch/x86/core/crt0.S @youvedeep @nashif
|
||||
arch/x86/soc/intel_quark/quark_d2000/* @nashif
|
||||
arch/x86/soc/intel_quark/quark_se/* @nashif
|
||||
arch/x86/soc/intel_quark/quark_x1000/* @nashif
|
||||
arch/xtensa/* @andrewboie
|
||||
boards/arc/* @cjordan44 @ruuddw
|
||||
boards/arc/arduino_101_sss/* @nashif
|
||||
boards/arc/em_starterkit/* @cjordan44
|
||||
boards/arc/quark_se_c1000_ss_devboard/* @nashif
|
||||
boards/arm/* @MaureenHelm @galak
|
||||
boards/arm/96b_carbon/* @rsalveti @idlethread
|
||||
boards/arm/96b_nitrogen/* @idlethread
|
||||
boards/arm/arduino_101_ble/* @jhedberg
|
||||
boards/arm/cc3220sf_launchxl/* @GAnthony
|
||||
boards/arm/disco_l475_iot1/* @erwango
|
||||
boards/arm/frdm_k64f/* @MaureenHelm
|
||||
boards/arm/frdm_kw41z/* @MaureenHelm
|
||||
boards/arm/hexiwear_k64/* @MaureenHelm
|
||||
boards/arm/mps2_an385/* @fvincenzo
|
||||
boards/arm/nrf51_blenano/* @rsalveti
|
||||
boards/arm/nrf52_pca10040/* @carlescufi
|
||||
boards/arm/nucleo_f401re/* @rsalveti @idlethread
|
||||
boards/arm/v2m_beetle/* @fvincenzo
|
||||
boards/arm/olimexino_stm32/* @ydamigos
|
||||
boards/arm/stm32f3_disco/* @ydamigos
|
||||
boards/nios2/* @andrewboie
|
||||
boards/nios2/altera_max10/* @andrewboie
|
||||
boards/riscv32 @fractalclone
|
||||
boards/x86/* @andrewboie @youvedeep
|
||||
boards/x86/arduino_101/* @nashif
|
||||
boards/x86/galileo/* @nashif
|
||||
boards/x86/quark_d2000_crb/* @nashif
|
||||
boards/x86/quark_se_c1000_devboard/* @nashif
|
||||
boards/xtensa/* @andrewboie
|
||||
doc/* @dbkinder
|
||||
doc/subsystems/bluetooth/* @sjanc @jhedberg @Vudentz
|
||||
drivers/*/*qmsi* @nashif
|
||||
drivers/*/*stm32* @erwango
|
||||
drivers/bluetooth/* @sjanc @jhedberg @Vudentz
|
||||
drivers/clock_control/*stm32f4* @rsalveti @idlethread
|
||||
drivers/ethernet/* @jukkar @tbursztyka
|
||||
drivers/flash/* @nashif
|
||||
drivers/gpio/*stm32* @rsalveti @idlethread
|
||||
drivers/gpio/gpio_pulpino.c @fractalclone
|
||||
drivers/ieee802154/* @jukkar @tbursztyka
|
||||
drivers/interrupt_controller/* @andrewboie
|
||||
drivers/pinmux/stm32/* @rsalveti @idlethread
|
||||
drivers/sensor/* @bogdan-davidoaia
|
||||
drivers/serial/uart_altera_jtag.c @andrewboie
|
||||
drivers/serial/uart_riscv_qemu.c @fractalclone
|
||||
drivers/slip/* @jukkar @tbursztyka
|
||||
drivers/spi/* @tbursztyka
|
||||
drivers/spi/spi_ll_stm32.* @superna9999 @mbolivar
|
||||
drivers/timer/altera_avalon_timer.c @andrewboie
|
||||
drivers/timer/pulpino_timer.c @fractalclone
|
||||
drivers/timer/riscv_machine_timer.c @fractalclone
|
||||
drivers/usb @youvedeep @andyross
|
||||
drivers/i2c/i2c_ll_stm32* @ldts @ydamigos
|
||||
dts/arm/st/* @erwango
|
||||
ext/fs/* @nashif
|
||||
ext/hal/cmsis/* @MaureenHelm @galak
|
||||
ext/hal/nordic/mdk/* @carlescufi
|
||||
ext/hal/nxp/mcux/* @MaureenHelm
|
||||
ext/hal/qmsi/* @nashif
|
||||
ext/hal/st/stm32cube/* @erwango
|
||||
ext/lib/crypto/mbedtls/* @nashif
|
||||
ext/lib/crypto/tinycrypt/* @lpereira
|
||||
include/arch/arc/* @cjordan44 @ruuddw
|
||||
include/arch/arc/arch.h @andrewboie
|
||||
include/arch/arc/v2/irq.h @andrewboie
|
||||
include/arch/arm/* @MaureenHelm @galak
|
||||
include/arch/arm/cortex_m/irq.h @andrewboie
|
||||
include/arch/nios2/* @andrewboie
|
||||
include/arch/nios2/arch.h @andrewboie
|
||||
include/arch/riscv32 @fractalclone
|
||||
include/arch/x86/* @andrewboie @youvedeep
|
||||
include/arch/x86/arch.h @andrewboie
|
||||
include/arch/xtensa/* @andrewboie
|
||||
include/atomic.h @andrewboie @andyross
|
||||
include/bluetooth/* @sjanc @jhedberg @Vudentz
|
||||
include/cache.h @andrewboie @andyross
|
||||
include/device.h @youvedeep @nashif
|
||||
include/drivers/bluetooth/* @sjanc @jhedberg @Vudentz
|
||||
include/drivers/ioapic.h @andrewboie
|
||||
include/drivers/loapic.h @andrewboie
|
||||
include/drivers/mvic.h @andrewboie
|
||||
include/fs.h @nashif
|
||||
include/fs/* @nashif
|
||||
include/init.h @andrewboie @andyross
|
||||
include/init.h @youvedeep @nashif
|
||||
include/irq.h @andrewboie
|
||||
include/irq.h @andrewboie @andyross
|
||||
include/irq_offload.h @andrewboie @andyross
|
||||
include/kernel.h @andrewboie @andyross
|
||||
include/kernel_version.h @andrewboie @andyross
|
||||
include/linker/linker-defs.h @andrewboie @andyross
|
||||
include/linker/linker-tool-gcc.h @andrewboie @andyross
|
||||
include/linker/linker-tool.h @andrewboie @andyross
|
||||
include/linker/section_tags.h @andrewboie @andyross
|
||||
include/linker/sections.h @andrewboie @andyross
|
||||
include/misc/* @andrewboie @andyross
|
||||
include/net/* @jukkar @tbursztyka
|
||||
include/net/buf.h @jukkar @jhedberg @tbursztyka
|
||||
include/power.h @youvedeep @nashif
|
||||
include/sensor.h @bogdan-davidoaia
|
||||
include/shared_irq.h @andrewboie @andyross
|
||||
include/spi.h @tbursztyka
|
||||
include/sw_isr_table.h @andrewboie @andyross
|
||||
include/sys_clock.h @andrewboie @andyross
|
||||
include/sys_io.h @andrewboie @andyross
|
||||
include/toolchain.h @andrewboie @andyross
|
||||
include/toolchain/* @andrewboie @andyross
|
||||
include/zephyr.h @andrewboie @andyross
|
||||
kernel/* @andrewboie @andyross
|
||||
kernel/device.c @youvedeep @nashif
|
||||
kernel/idle.c @youvedeep @nashif
|
||||
samples/bluetooth/* @sjanc @jhedberg @Vudentz
|
||||
samples/boards/quark_se_c1000/power*/* @youvedeep @nashif
|
||||
samples/net/* @jukkar @tbursztyka
|
||||
samples/net/dns_resolve/* @jukkar @tbursztyka
|
||||
samples/net/http_server/* @jukkar @tbursztyka
|
||||
samples/net/lwm2m_client/* @mike-scott
|
||||
samples/net/mbedtls_sslclient/* @nashif
|
||||
samples/net/mqtt_publisher/* @jukkar @tbursztyka
|
||||
samples/net/zoap_client/* @vcgomes
|
||||
samples/net/zoap_server/* @vcgomes
|
||||
samples/sensor/* @bogdan-davidoaia
|
||||
samples/subsys/usb @youvedeep @andyross
|
||||
scripts/expr_parser.py @andrewboie
|
||||
scripts/sanity_chk/* @andrewboie
|
||||
scripts/sanitycheck @andrewboie
|
||||
subsys/bluetooth/* @sjanc @jhedberg @Vudentz
|
||||
subsys/bluetooth/controller/* @carlescufi @cvinayak
|
||||
subsys/fs/* @nashif
|
||||
subsys/net/buf.c @jukkar @jhedberg @tbursztyka
|
||||
subsys/net/ip/* @jukkar @tbursztyka
|
||||
subsys/net/lib/* @jukkar @tbursztyka
|
||||
subsys/net/lib/dns/* @jukkar @tbursztyka
|
||||
subsys/net/lib/http/* @jukkar @tbursztyka
|
||||
subsys/net/lib/lwm2m/* @mike-scott
|
||||
subsys/net/lib/mqtt/* @jukkar @tbursztyka
|
||||
subsys/net/lib/zoap/* @vcgomes
|
||||
subsys/usb @youvedeep @andyross
|
||||
tests/bluetooth/* @sjanc @jhedberg @Vudentz
|
||||
tests/crypto/* @lpereira
|
||||
tests/crypto/mbedtls/* @nashif
|
||||
tests/drivers/spi/* @tbursztyka
|
||||
tests/kernel/* @andrewboie @andyross
|
||||
tests/net/* @jukkar @tbursztyka
|
||||
tests/net/buf/* @jukkar @jhedberg @tbursztyka
|
||||
tests/net/lib/* @jukkar @tbursztyka
|
||||
tests/net/lib/http_header_fields/* @jukkar @tbursztyka
|
||||
tests/net/lib/mqtt_packet/* @jukkar @tbursztyka
|
||||
tests/net/lib/zoap/* @vcgomes
|
||||
tests/subsys/fs/* @nashif
|
||||
|
||||
@@ -1,78 +0,0 @@
|
||||
# Contributor Covenant Code of Conduct
|
||||
|
||||
## Our Pledge
|
||||
|
||||
In the interest of fostering an open and welcoming environment, we as
|
||||
contributors and maintainers pledge to making participation in our project and
|
||||
our community a harassment-free experience for everyone, regardless of age, body
|
||||
size, disability, ethnicity, sex characteristics, gender identity and expression,
|
||||
level of experience, education, socio-economic status, nationality, personal
|
||||
appearance, race, religion, or sexual identity and orientation.
|
||||
|
||||
## Our Standards
|
||||
|
||||
Examples of behavior that contributes to creating a positive environment
|
||||
include:
|
||||
|
||||
* Using welcoming and inclusive language
|
||||
* Being respectful of differing viewpoints and experiences
|
||||
* Gracefully accepting constructive criticism
|
||||
* Focusing on what is best for the community
|
||||
* Showing empathy towards other community members
|
||||
|
||||
Examples of unacceptable behavior by participants include:
|
||||
|
||||
* The use of sexualized language or imagery and unwelcome sexual attention or
|
||||
advances
|
||||
* Trolling, insulting/derogatory comments, and personal or political attacks
|
||||
* Public or private harassment
|
||||
* Publishing others' private information, such as a physical or electronic
|
||||
address, without explicit permission
|
||||
* Other conduct which could reasonably be considered inappropriate in a
|
||||
professional setting
|
||||
|
||||
## Our Responsibilities
|
||||
|
||||
Project maintainers are responsible for clarifying the standards of acceptable
|
||||
behavior and are expected to take appropriate and fair corrective action in
|
||||
response to any instances of unacceptable behavior.
|
||||
|
||||
Project maintainers have the right and responsibility to remove, edit, or
|
||||
reject comments, commits, code, wiki edits, issues, and other contributions
|
||||
that are not aligned to this Code of Conduct, or to ban temporarily or
|
||||
permanently any contributor for other behaviors that they deem inappropriate,
|
||||
threatening, offensive, or harmful.
|
||||
|
||||
## Scope
|
||||
|
||||
This Code of Conduct applies both within project spaces and in public spaces
|
||||
when an individual is representing the project or its community. Examples of
|
||||
representing a project or community include using an official project e-mail
|
||||
address, posting via an official social media account, or acting as an appointed
|
||||
representative at an online or offline event. Representation of a project may be
|
||||
further defined and clarified by project maintainers.
|
||||
|
||||
## Enforcement
|
||||
|
||||
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
||||
reported by contacting the project team at conduct@zephyrproject.org.
|
||||
Reports will be received by Kate Stewart (Linux Foundation) and Amy Occhialino
|
||||
(Intel). All complaints will be reviewed and investigated, and will result in a
|
||||
response that is deemed necessary and appropriate to the circumstances. The
|
||||
project team is obligated to maintain confidentiality with regard to the
|
||||
reporter of an incident. Further details of specific enforcement policies may
|
||||
be posted separately.
|
||||
|
||||
Project maintainers who do not follow or enforce the Code of Conduct in good
|
||||
faith may face temporary or permanent repercussions as determined by other
|
||||
members of the project's leadership.
|
||||
|
||||
## Attribution
|
||||
|
||||
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
|
||||
available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html
|
||||
|
||||
[homepage]: https://www.contributor-covenant.org
|
||||
|
||||
For answers to common questions about this code of conduct, see
|
||||
https://www.contributor-covenant.org/faq
|
||||
485
CONTRIBUTING.rst
485
CONTRIBUTING.rst
@@ -6,34 +6,475 @@ patches directly to the project. In our collaborative open source environment,
|
||||
standards and methods for submitting changes help reduce the chaos that can result
|
||||
from an active development community.
|
||||
|
||||
This document briefly summarizes the full `Contribution
|
||||
Guidelines <http://docs.zephyrproject.org/latest/contribute/index.html>`_
|
||||
documentation.
|
||||
This document explains how to participate in project conversations, log bugs
|
||||
and enhancement requests, and submit patches to the project so your patch will
|
||||
be accepted quickly in the codebase.
|
||||
|
||||
* Zephyr uses the permissive open source `Apache 2.0 license`_
|
||||
that allows you to freely use, modify, distribute and sell your own products
|
||||
that include Apache 2.0 licensed software.
|
||||
|
||||
* There are some imported or reused components of the Zephyr project that
|
||||
use other licensing and are clearly identified.
|
||||
Licensing
|
||||
*********
|
||||
|
||||
* The Developer Certificate of Origin (DCO) process is followed to
|
||||
ensure developers are following licensing criteria for their
|
||||
contributions, and documented with a ``Signed-off-by`` line in commits.
|
||||
Licensing is very important to open source projects. It helps ensure the
|
||||
software continues to be available under the terms that the author desired.
|
||||
|
||||
* Zephyr development workflow is supported on Linux, macOS, and Windows,
|
||||
(with a few exceptions).
|
||||
.. _Apache 2.0 license:
|
||||
https://github.com/zephyrproject-rtos/zephyr/blob/master/LICENSE
|
||||
|
||||
* Source code for the project is maintained in the GitHub repo:
|
||||
https://github.com/zephyrproject-rtos/zephyr
|
||||
.. _GitHub repo: https://github.com/zephyrproject-rtos/zephyr
|
||||
|
||||
* Issue and feature tracking is done using GitHub issues in this repo.
|
||||
Zephyr uses the `Apache 2.0 license`_ (as found in the LICENSE file in the
|
||||
project's `GitHub repo`_) to strike a balance between open contribution and
|
||||
allowing you to use the software however you would like to. There are some
|
||||
imported or reused components of the Zephyr project that use other licensing,
|
||||
as described in `Zephyr Licensing`_.
|
||||
|
||||
* A Continuous Integration (CI) system runs on every Pull Request (PR)
|
||||
to verify several aspects of the PR including Git commit formatting,
|
||||
Coding Style, sanity checks builds, and documentation builds.
|
||||
.. _Zephyr Licensing:
|
||||
https://www.zephyrproject.org/doc/LICENSING.html
|
||||
|
||||
* The `Zephyr devel mailing list`_ is a great place to engage with the
|
||||
community, ask questions, discuss issues, and help each other.
|
||||
The license tells you what rights you have as a developer, provided by the
|
||||
copyright holder. It is important that the contributor fully understands the
|
||||
licensing rights and agrees to them. Sometimes the copyright holder isn't the
|
||||
contributor, such as when the contributor is doing work on behalf of a
|
||||
company.
|
||||
|
||||
.. _Zephyr devel mailing list: https://lists.zephyrproject.org/g/devel
|
||||
.. _DCO:
|
||||
|
||||
Developer Certification of Origin (DCO)
|
||||
***************************************
|
||||
|
||||
To make a good faith effort to ensure licensing criteria are met, the Zephyr
|
||||
project requires the Developer Certificate of Origin (DCO) process to be
|
||||
followed.
|
||||
|
||||
The DCO is an attestation attached to every contribution made by every
|
||||
developer. In the commit message of the contribution, (described more fully
|
||||
later in this document), the developer simply adds a ``Signed-off-by``
|
||||
statement and thereby agrees to the DCO.
|
||||
|
||||
When a developer submits a patch, it is a commitment that the contributor has
|
||||
the right to submit the patch per the license. The DCO agreement is shown
|
||||
below and at http://developercertificate.org/.
|
||||
|
||||
|
||||
.. code-block:: none
|
||||
|
||||
Developer's Certificate of Origin 1.1
|
||||
|
||||
By making a contribution to this project, I certify that:
|
||||
|
||||
(a) The contribution was created in whole or in part by me and I
|
||||
have the right to submit it under the open source license
|
||||
indicated in the file; or
|
||||
|
||||
(b) The contribution is based upon previous work that, to the
|
||||
best of my knowledge, is covered under an appropriate open
|
||||
source license and I have the right under that license to
|
||||
submit that work with modifications, whether created in whole
|
||||
or in part by me, under the same open source license (unless
|
||||
I am permitted to submit under a different license), as
|
||||
Indicated in the file; or
|
||||
|
||||
(c) The contribution was provided directly to me by some other
|
||||
person who certified (a), (b) or (c) and I have not modified
|
||||
it.
|
||||
|
||||
(d) I understand and agree that this project and the contribution
|
||||
are public and that a record of the contribution (including
|
||||
all personal information I submit with it, including my
|
||||
sign-off) is maintained indefinitely and may be redistributed
|
||||
consistent with this project or the open source license(s)
|
||||
involved.
|
||||
|
||||
DCO Sign-Off Methods
|
||||
====================
|
||||
|
||||
The DCO requires a sign-off message in the following format appear on each
|
||||
commit in the pull request::
|
||||
|
||||
Signed-off-by: Zephyrus Zephyr <zephyrus@zephyrproject.org>
|
||||
|
||||
The DCO text can either be manually added to your commit body, or you can add
|
||||
either ``-s`` or ``--signoff`` to your usual Git commit commands. If you forget
|
||||
to add the sign-off you can also amend a previous commit with the sign-off by
|
||||
running ``git commit --amend -s``. If you've pushed your changes to GitHub
|
||||
already you'll need to force push your branch after this with ``git push -f``.
|
||||
|
||||
|
||||
Prerequisites
|
||||
*************
|
||||
|
||||
.. _Zephyr Project website: https://zephyrproject.org
|
||||
|
||||
As a contributor, you'll want to be familiar with the Zephyr project, how to
|
||||
configure, install, and use it as explained in the `Zephyr Project website`_
|
||||
and how to set up your development environment as introduced in the Zephyr
|
||||
`Getting Started Guide`_.
|
||||
|
||||
.. _Getting Started Guide:
|
||||
https://www.zephyrproject.org/doc/getting_started/getting_started.html
|
||||
|
||||
The examples below use a Linux host environment for Zephyr development.
|
||||
You should be familiar with common developer tools such as Git and Make, and
|
||||
platforms such as GitHub.
|
||||
|
||||
If you haven't already done so, you'll need to create a (free) GitHub account
|
||||
on http://github.com and have Git tools available on your development system.
|
||||
|
||||
Repository layout
|
||||
*****************
|
||||
|
||||
To clone the main Zephyr Project repository use::
|
||||
|
||||
$ git clone https://github.com/zephyrproject-rtos/zephyr
|
||||
|
||||
The Zephyr project directory structure is described in `Source Tree Structure`_
|
||||
documentation. In addition to the Zephyr kernel itself, you'll also find the
|
||||
sources for technical documentation, sample code, supported board
|
||||
configurations, and a collection of subsystem tests. All of these are
|
||||
available for developers to contribute to and enhance.
|
||||
|
||||
.. _Source Tree Structure:
|
||||
https://www.zephyrproject.org/doc/kernel/overview/source_tree.html
|
||||
|
||||
Pull Requests and Issues
|
||||
************************
|
||||
|
||||
.. _Zephyr Project Issues: https://jira.zephyrproject.org
|
||||
|
||||
.. _open pull requests: https://github.com/zephyrproject-rtos/zephyr/pulls
|
||||
|
||||
.. _Zephyr-devel mailing list:
|
||||
https://lists.zephyrproject.org/mailman/listinfo/zephyr-devel
|
||||
|
||||
Before starting on a patch, first check in our Jira `Zephyr Project Issues`_
|
||||
system to see what's been reported on the issue you'd like to address. Have a
|
||||
conversation on the `Zephyr-devel mailing list`_ (or the #zephyrproject IRC
|
||||
channel on freenode.net) to see what others think of your issue (and proposed
|
||||
solution). You may find others that have encountered the issue you're
|
||||
finding, or that have similar ideas for changes or additions. Send a message
|
||||
to the `Zephyr-devel mailing list`_ to introduce and discuss your idea with
|
||||
the development community.
|
||||
|
||||
It's always a good practice to search for existing or related issues before
|
||||
submitting your own. When you submit an issue (bug or feature request), the
|
||||
triage team will review and comment on the submission, typically within a few
|
||||
business days.
|
||||
|
||||
You can find all `open pull requests`_ on GitHub and open `Zephyr Project
|
||||
Issues`_ in Jira.
|
||||
|
||||
Development Tools and Git Setup
|
||||
*******************************
|
||||
|
||||
Signed-off-by
|
||||
=============
|
||||
|
||||
The name in the commit message ``Signed-off-by:`` line and your email must
|
||||
match the change authorship information. Make sure your *.git/config* is set
|
||||
up correctly::
|
||||
|
||||
$ git config --global user.name "David Developer"
|
||||
$ git config --global user.email "david.developer@company.com"
|
||||
|
||||
gitlint
|
||||
=========
|
||||
|
||||
When you submit a pull request to the project, a series of checks are
|
||||
performed to verify your commit messages meet the requirements. The same step
|
||||
done during the CI process can be performed locally using the the *gitlint*
|
||||
command.
|
||||
|
||||
Install gitlint and run it locally in your tree and branch where your patches
|
||||
have been committed::
|
||||
|
||||
$ sudo pip3 install gitlint
|
||||
$ gitlint
|
||||
|
||||
Note, gitlint only checks HEAD (the most recent commit), so you should run it
|
||||
after each commit, or use the ``--commits`` option to specify a commit range
|
||||
covering all the development patches to be submitted.
|
||||
|
||||
sanitycheck
|
||||
===========
|
||||
|
||||
To verify that your changes did not break any tests or samples, please run the
|
||||
``sanitycheck`` script locally before submitting your pull request to GitHub. To
|
||||
run the same tests the CI system runs, follow these steps from within your
|
||||
local Zephyr source working directory::
|
||||
|
||||
$ source zephyr-env.sh
|
||||
$ make host-tools
|
||||
$ export PREBUILT_HOST_TOOLS=${ZEPHYR_BASE}/bin
|
||||
$ export USE_CCACHE=1
|
||||
$ ./scripts/sanitycheck
|
||||
|
||||
The above will execute the basic sanitycheck script, which will run various
|
||||
kernel tests using the QEMU emulator. It will also do some build tests on
|
||||
various samples with advanced features that can't run in QEMU.
|
||||
|
||||
We highly recommend you run these tests locally to avoid any CI failures.
|
||||
Using CCACHE and pre-built host tools is optional, however it speeds up the
|
||||
execution time considerably.
|
||||
|
||||
|
||||
Coding Style
|
||||
************
|
||||
|
||||
Use these coding guidelines to ensure that your development complies with the
|
||||
project's style and naming conventions.
|
||||
|
||||
.. _Linux kernel coding style:
|
||||
https://kernel.org/doc/html/latest/process/coding-style.html
|
||||
|
||||
|
||||
In general, follow the `Linux kernel coding style`_, with the
|
||||
following exceptions:
|
||||
|
||||
* Add braces to every ``if`` and ``else`` body, even for single-line code
|
||||
blocks. Use the ``--ignore BRACES`` flag to make *checkpatch* stop
|
||||
complaining.
|
||||
* Use spaces instead of tabs to align comments after declarations, as needed.
|
||||
* Use C89-style single line comments, ``/* */``. The C99-style single line
|
||||
comment, ``//``, is not allowed.
|
||||
* Use ``/** */`` for doxygen comments that need to appear in the documentation.
|
||||
|
||||
The Linux kernel GPL-licensed tool ``checkpatch`` is used to check coding
|
||||
style conformity. Checkpatch is available in the scripts directory. To invoke
|
||||
it when committing code, edit your *.git/hooks/pre-commit* file to contain:
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
#!/bin/sh
|
||||
set -e exec
|
||||
exec git diff --cached | ${ZEPHYR_BASE}/scripts/checkpatch.pl - || true
|
||||
|
||||
Contribution Workflow
|
||||
*********************
|
||||
|
||||
One general practice we encourage, is to make small,
|
||||
controlled changes. This practice simplifies review, makes merging and
|
||||
rebasing easier, and keeps the change history clear and clean.
|
||||
|
||||
When contributing to the Zephyr Project, it is also important you provide as much
|
||||
information as you can about your change, update appropriate documentation,
|
||||
and test your changes thoroughly before submitting.
|
||||
|
||||
The general GitHub workflow used by Zephyr developers uses a combination of
|
||||
command line Git commands and browser interaction with GitHub. As it is with
|
||||
Git, there are multiple ways of getting a task done. We'll describe a typical
|
||||
workflow here:
|
||||
|
||||
.. _Create a Fork of Zephyr:
|
||||
https://github.com/zephyrproject-rtos/zephyr#fork-destination-box
|
||||
|
||||
#. `Create a Fork of Zephyr`_
|
||||
to your personal account on GitHub. (Click on the fork button in the top
|
||||
right corner of the Zephyr project repo page in GitHub.)
|
||||
|
||||
#. On your development computer, clone the fork you just made::
|
||||
|
||||
$ git clone https://github.com/<your github id>/zephyr
|
||||
|
||||
This would be a good time to let Git know about the upstream repo too::
|
||||
|
||||
$ git remote add upstream https://github.com/zephyrproject-rtos/zephyr.git
|
||||
|
||||
and verify the remote repos::
|
||||
|
||||
$ git remote -v
|
||||
|
||||
#. Create a topic branch (off of master) for your work (if you're addressing
|
||||
Jira issue, we suggest including the Jira issue number in the branch name)::
|
||||
|
||||
$ git checkout master
|
||||
$ git checkout -b fix_comment_typo
|
||||
|
||||
Some Zephyr subsystems do development work on a separate branch from
|
||||
master so you may need to indicate this in your checkout::
|
||||
|
||||
$ git checkout -b fix_out_of_date_patch origin/net
|
||||
|
||||
#. Make changes, test locally, change, test, test again, ... (Check out the
|
||||
prior chapter on `sanitycheck`_ as well).
|
||||
|
||||
#. When things look good, start the pull request process by adding your changed
|
||||
files::
|
||||
|
||||
$ git add [file(s) that changed, add -p if you want to be more specific]
|
||||
|
||||
You can see files that are not yet staged using::
|
||||
|
||||
$ git status
|
||||
|
||||
#. Verify changes to be committed look as you expected::
|
||||
|
||||
$ git diff --cached
|
||||
|
||||
#. Commit your changes to your local repo::
|
||||
|
||||
$ git commit -s
|
||||
|
||||
The ``-s`` option automatically adds your ``Signed-off-by:`` to your commit
|
||||
message. Your commit will be rejected without this line that indicates your
|
||||
agreement with the `DCO`_. See the `Commit Guidelines`_ section for
|
||||
specific guidelines for writing your commit messages.
|
||||
|
||||
#. Push your topic branch with your changes to your fork in your personal
|
||||
GitHub account::
|
||||
|
||||
$ git push origin fix_comment_typo
|
||||
|
||||
#. In your web browser, go to your forked repo and click on the
|
||||
``Compare & pull request`` button for the branch you just worked on and
|
||||
you want to open a pull request with.
|
||||
|
||||
#. Review the pull request changes, and verify that you are opening a
|
||||
pull request for the appropriate branch. The title and message from your
|
||||
commit message should appear as well.
|
||||
|
||||
#. If you're working on a subsystem branch that's not ``master``,
|
||||
you may need to change the intended branch for the pull request
|
||||
here, for example, by changing the base branch from ``master`` to ``net``.
|
||||
|
||||
#. GitHub will assign one or more suggested reviewers (based on the
|
||||
CODEOWNERS file in the repo). If you are a project member, you can
|
||||
select additional reviewers now too.
|
||||
|
||||
#. Click on the submit button and your pull request is sent and awaits
|
||||
review. Email will be sent as review comments are made, or you can check
|
||||
on your pull request at https://github.com/zephyrproject-rtos/zephyr/pulls.
|
||||
|
||||
#. While you're waiting for your pull request to be accepted and merged, you
|
||||
can create another branch to work on another issue. (Be sure to make your
|
||||
new branch off of master and not the previous branch.)::
|
||||
|
||||
$ git checkout master
|
||||
$ git checkout -b fix_another_issue
|
||||
|
||||
and use the same process described above to work on this new topic branch.
|
||||
|
||||
#. If reviewers do request changes to your patch, you can interactively rebase
|
||||
commit(s) to fix review issues. In your development repo::
|
||||
|
||||
$ git fetch --all
|
||||
$ git rebase --ignore-whitespace upstream/master
|
||||
|
||||
The ``--ignore-whitespace`` option stops ``git apply`` (called by rebase)
|
||||
from changing any whitespace. Continuing::
|
||||
|
||||
$ git rebase -i <offending-commit-id>^
|
||||
|
||||
In the interactive rebase editor, replace ``pick`` with ``edit`` to select
|
||||
a specific commit (if there's more than one in your pull request), or
|
||||
remove the line to delete a commit entirely. Then edit files to fix the
|
||||
issues in the review.
|
||||
|
||||
As before, inspect and test your changes. When ready, continue the
|
||||
patch submission::
|
||||
|
||||
$ git add [file(s)]
|
||||
$ git rebase --continue
|
||||
|
||||
Update commit comment if needed, and continue::
|
||||
|
||||
$ git push --force origin fix_comment_typo
|
||||
|
||||
By force pushing your update, your original pull request will be updated
|
||||
with your changes so you won't need to resubmit the pull request.
|
||||
|
||||
|
||||
Commit Guidelines
|
||||
*****************
|
||||
|
||||
Changes are submitted as Git commits. Each commit message must contain:
|
||||
|
||||
* A short and descriptive subject line that is less than 72 characters,
|
||||
followed by a blank line. The subject line must include a prefix that
|
||||
identifies the subsystem being changed, followed by a colon, and a short
|
||||
title, for example: ``doc: update wiki references to new site``.
|
||||
(If you're updating an existing file, you can use
|
||||
``git log <filename>`` to see what developers used as the prefix for
|
||||
previous patches of this file.)
|
||||
|
||||
* A change description with your logic or reasoning for the changes, followed
|
||||
by a blank line.
|
||||
|
||||
* A Signed-off-by line, ``Signed-off-by: <name> <email>`` typically added
|
||||
automatically by using ``git commit -s``
|
||||
|
||||
* If the change address a Jira issue, include a line of the form::
|
||||
|
||||
Jira: ZEP-xxx
|
||||
|
||||
|
||||
All changes and topics sent to GitHub must be well-formed, as described above.
|
||||
|
||||
Commit Message Body
|
||||
===================
|
||||
|
||||
When editing the commit message, please briefly explain what your change
|
||||
does and why it's needed. A change summary of ``"Fixes stuff"`` will be rejected. An
|
||||
empty change summary is only acceptable for trivial changes fully described by
|
||||
the commit title (e.g., ``doc: fix misspellings in CONTRIBUTING doc``)
|
||||
|
||||
The description body of the commit message must include:
|
||||
|
||||
* **what** the change does,
|
||||
* **why** you chose that approach,
|
||||
* **what** assumptions were made, and
|
||||
* **how** you know it works -- for example, which tests you ran.
|
||||
|
||||
For examples of accepted commit messages, you can refer to the Zephyr GitHub
|
||||
`changelog <https://github.com/zephyrproject-rtos/zephyr/commits/master>`__.
|
||||
|
||||
Other Commit Expectations
|
||||
=========================
|
||||
|
||||
* Commits must build cleanly when applied on top of each other, thus avoiding
|
||||
breaking bisectability.
|
||||
|
||||
* Commits must pass the *scripts/checkpatch.pl* requirements.
|
||||
|
||||
* Each commit must address a single identifiable issue and must be
|
||||
logically self-contained. Unrelated changes should be submitted as
|
||||
separate commits.
|
||||
|
||||
* You may submit pull request RFCs (requests for comments) to send work
|
||||
proposals, progress snapshots of your work, or to get early feedback on
|
||||
features or changes that will affect multiple areas in the code base.
|
||||
|
||||
Identifying Contribution Origin
|
||||
===============================
|
||||
|
||||
When adding a new file to the tree, it is important to detail the source of
|
||||
origin on the file, provide attributions, and detail the intended usage. In
|
||||
cases where the file is an original to Zephyr, the commit message should
|
||||
include the following ("Original" is the assumption if no Origin tag is
|
||||
present)::
|
||||
|
||||
Origin: Original
|
||||
|
||||
In cases where the file is imported from an external project, the commit
|
||||
message shall contain details regarding the original project, the location of
|
||||
the project, the SHA-id of the origin commit for the file, the intended
|
||||
purpose, and if the file will be maintained by the Zephyr project,
|
||||
(whether or not the Zephyr project will contain a localized branch or if
|
||||
it is a downstream copy).
|
||||
|
||||
For example, a copy of a locally maintained import::
|
||||
|
||||
Origin: Contiki OS
|
||||
License: BSD 3-Clause
|
||||
URL: http://www.contiki-os.org/
|
||||
commit: 853207acfdc6549b10eb3e44504b1a75ae1ad63a
|
||||
Purpose: Introduction of networking stack.
|
||||
Maintained-by: Zephyr
|
||||
|
||||
For example, a copy of an externally maintained import::
|
||||
|
||||
Origin: Tiny Crypt
|
||||
License: BSD 3-Clause
|
||||
URL: https://github.com/01org/tinycrypt
|
||||
commit: 08ded7f21529c39e5133688ffb93a9d0c94e5c6e
|
||||
Purpose: Introduction of TinyCrypt
|
||||
Maintained-by: External
|
||||
|
||||
56
Kbuild
Normal file
56
Kbuild
Normal file
@@ -0,0 +1,56 @@
|
||||
# vim: filetype=make
|
||||
|
||||
define filechk_configs.c
|
||||
(echo "/* file is auto-generated, do not modify ! */"; \
|
||||
echo; \
|
||||
echo "#include <toolchain.h>"; \
|
||||
echo; \
|
||||
echo "GEN_ABS_SYM_BEGIN (_ConfigAbsSyms)"; \
|
||||
echo; \
|
||||
cat $(CURDIR)/include/generated/autoconf.h | sed \
|
||||
's/".*"/1/' | awk \
|
||||
'/#define/{printf "GEN_ABSOLUTE_SYM(%s, %s);\n", $$2, $$3}'; \
|
||||
echo; \
|
||||
echo "GEN_ABS_SYM_END";)
|
||||
endef
|
||||
|
||||
misc/generated/configs.c: include/config/auto.conf FORCE
|
||||
$(call filechk,configs.c)
|
||||
|
||||
targets := misc/generated/configs.c
|
||||
targets += include/generated/offsets.h
|
||||
|
||||
|
||||
always := misc/generated/configs.c
|
||||
always += include/generated/offsets.h
|
||||
|
||||
define rule_cc_o_c_1
|
||||
$(call echo-cmd,cc_o_c_1) $(cmd_cc_o_c_1);
|
||||
endef
|
||||
|
||||
cmd_cc_o_c_1 = $(CC) $(KBUILD_CPPFLAGS) $(KBUILD_CFLAGS) $(ZEPHYRINCLUDE) -c -o $@ $<
|
||||
|
||||
arch/$(ARCH)/core/offsets/offsets.o: arch/$(ARCH)/core/offsets/offsets.c $(KCONFIG_CONFIG) \
|
||||
include/generated/generated_dts_board.h
|
||||
$(Q)mkdir -p $(dir $@)
|
||||
$(call if_changed,cc_o_c_1)
|
||||
|
||||
|
||||
define offsetchk
|
||||
$(Q)set -e; \
|
||||
$(kecho) ' CHK $@'; \
|
||||
mkdir -p $(dir $@); \
|
||||
$(srctree)/scripts/gen_offset_header.py -i $(1) -o $@.tmp; \
|
||||
if [ -r $@ ] && cmp -s $@ $@.tmp; then \
|
||||
rm -f $@.tmp; \
|
||||
else \
|
||||
$(kecho) ' UPD $@'; \
|
||||
mv -f $@.tmp $@; \
|
||||
fi
|
||||
endef
|
||||
|
||||
include/generated/offsets.h: arch/$(ARCH)/core/offsets/offsets.o \
|
||||
include/config/auto.conf FORCE
|
||||
$(call offsetchk,arch/$(ARCH)/core/offsets/offsets.o)
|
||||
|
||||
|
||||
414
Kconfig.zephyr
414
Kconfig.zephyr
@@ -6,25 +6,9 @@
|
||||
#
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
#
|
||||
|
||||
source "$(CMAKE_BINARY_DIR)/Kconfig.modules"
|
||||
|
||||
# Include these first so that any properties (e.g. defaults) below can be
|
||||
# overriden in *.defconfig files (by defining symbols in multiple locations).
|
||||
# After merging all the symbol definitions, Kconfig picks the first property
|
||||
# (e.g. the first default) with a satisfied condition.
|
||||
#
|
||||
# Board defaults should be parsed before SoC defaults, because boards usually
|
||||
# overrides SoC values.
|
||||
#
|
||||
# Note: $ARCH and $BOARD_DIR might be glob patterns.
|
||||
source "$(BOARD_DIR)/Kconfig.defconfig"
|
||||
|
||||
source "$(SOC_DIR)/$(ARCH)/*/Kconfig.defconfig"
|
||||
|
||||
source "boards/Kconfig"
|
||||
|
||||
source "$(SOC_DIR)/Kconfig"
|
||||
config KERNELVERSION
|
||||
string
|
||||
option env="KERNELVERSION"
|
||||
|
||||
source "arch/Kconfig"
|
||||
|
||||
@@ -34,388 +18,24 @@ source "dts/Kconfig"
|
||||
|
||||
source "drivers/Kconfig"
|
||||
|
||||
source "net/Kconfig"
|
||||
|
||||
source "misc/Kconfig"
|
||||
|
||||
source "lib/Kconfig"
|
||||
|
||||
source "subsys/Kconfig"
|
||||
|
||||
source "ext/Kconfig"
|
||||
|
||||
menu "Build and Link Features"
|
||||
source "tests/Kconfig"
|
||||
|
||||
menu "Linker Options"
|
||||
|
||||
choice
|
||||
prompt "Linker Orphan Section Handling"
|
||||
default LINKER_ORPHAN_SECTION_WARN
|
||||
|
||||
config LINKER_ORPHAN_SECTION_PLACE
|
||||
bool "Place"
|
||||
help
|
||||
Linker puts orphan sections in place without warnings
|
||||
or errors.
|
||||
|
||||
config LINKER_ORPHAN_SECTION_WARN
|
||||
bool "Warn"
|
||||
help
|
||||
Linker places the orphan sections in ouput and issues
|
||||
warning about those sections.
|
||||
|
||||
config LINKER_ORPHAN_SECTION_ERROR
|
||||
bool "Error"
|
||||
help
|
||||
Linker exits with error when an orphan section is found.
|
||||
|
||||
endchoice
|
||||
|
||||
config CODE_DATA_RELOCATION
|
||||
bool "Relocate code/data sections"
|
||||
depends on ARM
|
||||
help
|
||||
When selected this will relocate .text, data and .bss sections from
|
||||
the specified files and places it in the required memory region. The
|
||||
files should be specified in the CMakeList.txt file with
|
||||
a cmake API zephyr_code_relocation().
|
||||
|
||||
config HAS_FLASH_LOAD_OFFSET
|
||||
bool
|
||||
help
|
||||
This option is selected by targets having a FLASH_LOAD_OFFSET
|
||||
and FLASH_LOAD_SIZE.
|
||||
|
||||
config USE_CODE_PARTITION
|
||||
bool "link into code-partition"
|
||||
depends on HAS_FLASH_LOAD_OFFSET
|
||||
help
|
||||
When selected application will be linked into chosen code-partition.
|
||||
|
||||
config FLASH_LOAD_OFFSET
|
||||
hex "Kernel load offset"
|
||||
default $(dt_hex_val,DT_CODE_PARTITION_OFFSET) if USE_CODE_PARTITION
|
||||
default 0
|
||||
depends on HAS_FLASH_LOAD_OFFSET
|
||||
help
|
||||
This option specifies the byte offset from the beginning of flash that
|
||||
the kernel should be loaded into. Changing this value from zero will
|
||||
affect the Zephyr image's link, and will decrease the total amount of
|
||||
flash available for use by application code.
|
||||
|
||||
If unsure, leave at the default value 0.
|
||||
|
||||
config FLASH_LOAD_SIZE
|
||||
hex "Kernel load size"
|
||||
default $(dt_hex_val,DT_CODE_PARTITION_SIZE) if USE_CODE_PARTITION
|
||||
default 0
|
||||
depends on HAS_FLASH_LOAD_OFFSET
|
||||
help
|
||||
If non-zero, this option specifies the size, in bytes, of the flash
|
||||
area that the Zephyr image will be allowed to occupy. If zero, the
|
||||
image will be able to occupy from the FLASH_LOAD_OFFSET to the end of
|
||||
the device.
|
||||
|
||||
If unsure, leave at the default value 0.
|
||||
|
||||
config TEXT_SECTION_OFFSET
|
||||
hex
|
||||
prompt "TEXT section offset" if !BOOTLOADER_MCUBOOT
|
||||
default 0x200 if BOOTLOADER_MCUBOOT
|
||||
default 0
|
||||
help
|
||||
If the application is built for chain-loading by a bootloader this
|
||||
variable is required to be set to value that leaves sufficient
|
||||
space between the beginning of the image and the start of the .text
|
||||
section to store an image header or any other metadata.
|
||||
In the particular case of the MCUboot bootloader this reserves enough
|
||||
space to store the image header, which should also meet vector table
|
||||
alignment requirements on most ARM targets, although some targets
|
||||
may require smaller or larger values.
|
||||
|
||||
config HAVE_CUSTOM_LINKER_SCRIPT
|
||||
bool "Custom linker scripts provided"
|
||||
help
|
||||
Set this option if you have a custom linker script which needed to
|
||||
be define in CUSTOM_LINKER_SCRIPT.
|
||||
|
||||
config CUSTOM_LINKER_SCRIPT
|
||||
string "Path to custom linker script"
|
||||
depends on HAVE_CUSTOM_LINKER_SCRIPT
|
||||
help
|
||||
Path to the linker script to be used instead of the one define by the
|
||||
board.
|
||||
|
||||
The linker script must be based on a version provided by Zephyr since
|
||||
the kernel can expect a certain layout/certain regions.
|
||||
|
||||
This is useful when an application needs to add sections into the
|
||||
linker script and avoid having to change the script provided by
|
||||
Zephyr.
|
||||
|
||||
config CUSTOM_RODATA_LD
|
||||
bool "Include custom-rodata.ld"
|
||||
help
|
||||
Include a customized linker script fragment for inserting additional
|
||||
data and linker directives into the rodata section.
|
||||
|
||||
config CUSTOM_RWDATA_LD
|
||||
bool "Include custom-rwdata.ld"
|
||||
help
|
||||
Include a customized linker script fragment for inserting additional
|
||||
data and linker directives into the data section.
|
||||
|
||||
config CUSTOM_SECTIONS_LD
|
||||
bool "Include custom-sections.ld"
|
||||
help
|
||||
Include a customized linker script fragment for inserting additional
|
||||
arbitrary sections.
|
||||
|
||||
config LINK_WHOLE_ARCHIVE
|
||||
bool "Allow linking with --whole-archive"
|
||||
help
|
||||
This options allows linking external libraries with the
|
||||
--whole-archive option to keep all symbols.
|
||||
|
||||
config KERNEL_ENTRY
|
||||
string "Kernel entry symbol"
|
||||
default "__start"
|
||||
help
|
||||
Code entry symbol, to be set at linking phase.
|
||||
|
||||
config CHECK_LINK_MAP
|
||||
bool "Check linker map"
|
||||
default y
|
||||
help
|
||||
Run a linker address generation validity checker at the end of the
|
||||
build.
|
||||
|
||||
endmenu
|
||||
|
||||
menu "Compiler Options"
|
||||
|
||||
config NATIVE_APPLICATION
|
||||
bool "Build as a native host application"
|
||||
help
|
||||
Build as a native application that can run on the host and using
|
||||
resources and libraries provided by the host.
|
||||
|
||||
choice
|
||||
prompt "Optimization level"
|
||||
default NO_OPTIMIZATIONS if COVERAGE
|
||||
default DEBUG_OPTIMIZATIONS if DEBUG
|
||||
default SIZE_OPTIMIZATIONS
|
||||
help
|
||||
Note that these flags shall only control the compiler
|
||||
optimization level, and that no extra debug code shall be
|
||||
conditionally compiled based on them.
|
||||
|
||||
config SIZE_OPTIMIZATIONS
|
||||
bool "Optimize for size"
|
||||
help
|
||||
Compiler optimizations will be set to -Os independently of other
|
||||
options.
|
||||
|
||||
config SPEED_OPTIMIZATIONS
|
||||
bool "Optimize for speed"
|
||||
help
|
||||
Compiler optimizations will be set to -O2 independently of other
|
||||
options.
|
||||
|
||||
config DEBUG_OPTIMIZATIONS
|
||||
bool "Optimize debugging experience"
|
||||
help
|
||||
Compiler optimizations will be set to -Og independently of other
|
||||
options.
|
||||
|
||||
config NO_OPTIMIZATIONS
|
||||
bool "Optimize nothing"
|
||||
help
|
||||
Compiler optimizations will be set to -O0 independently of other
|
||||
options.
|
||||
|
||||
endchoice
|
||||
|
||||
config COMPILER_OPT
|
||||
string "Custom compiler options"
|
||||
help
|
||||
This option is a free-form string that is passed to the compiler
|
||||
when building all parts of a project (i.e. kernel).
|
||||
The compiler options specified by this string supplement the
|
||||
predefined set of compiler supplied by the build system,
|
||||
and can be used to change compiler optimization, warning and error
|
||||
messages, and so on.
|
||||
|
||||
endmenu
|
||||
|
||||
menu "Build Options"
|
||||
|
||||
config KERNEL_BIN_NAME
|
||||
string "The kernel binary name"
|
||||
default "zephyr"
|
||||
help
|
||||
This option sets the name of the generated kernel binary.
|
||||
|
||||
config OUTPUT_STAT
|
||||
bool "Create a statistics file"
|
||||
default y
|
||||
help
|
||||
Create a stat file using readelf -e <elf>
|
||||
|
||||
config OUTPUT_DISASSEMBLY
|
||||
bool "Create a disassembly file"
|
||||
default y
|
||||
help
|
||||
Create an .lst file with the assembly listing of the firmware.
|
||||
|
||||
config OUTPUT_PRINT_MEMORY_USAGE
|
||||
bool "Print memory usage to stdout"
|
||||
default y
|
||||
help
|
||||
If the toolchain supports it, this option will pass
|
||||
--print-memory-region to the linker when it is doing it's first
|
||||
linker pass. Note that the memory regions are symbolic concepts
|
||||
defined by the linker scripts and do not necessarily map
|
||||
directly to the real physical address space. Take also note that
|
||||
some platforms do two passes of the linker so the results do not
|
||||
match exactly to the final elf file. See also rom_report,
|
||||
ram_report and
|
||||
https://sourceware.org/binutils/docs/ld/MEMORY.html
|
||||
|
||||
config BUILD_OUTPUT_HEX
|
||||
bool "Build a binary in HEX format"
|
||||
help
|
||||
Build a binary in HEX format. This will build a zephyr.hex file need
|
||||
by some platforms.
|
||||
|
||||
config BUILD_OUTPUT_BIN
|
||||
bool "Build a binary in BIN format"
|
||||
default y
|
||||
help
|
||||
Build a binary in BIN format. This will build a zephyr.bin file need
|
||||
by some platforms.
|
||||
|
||||
config BUILD_OUTPUT_EXE
|
||||
bool "Build a binary in ELF format with .exe extension"
|
||||
help
|
||||
Build a binary in ELF format that can run in the host system. This
|
||||
will build a zephyr.exe file.
|
||||
|
||||
config BUILD_OUTPUT_S19
|
||||
bool "Build a binary in S19 format"
|
||||
help
|
||||
Build a binary in S19 format. This will build a zephyr.s19 file need
|
||||
by some platforms.
|
||||
|
||||
config BUILD_NO_GAP_FILL
|
||||
bool "Don't fill gaps in generated hex/bin/s19 files."
|
||||
depends on BUILD_OUTPUT_HEX || BUILD_OUTPUT_BIN || BUILD_OUTPUT_S19
|
||||
|
||||
config BUILD_OUTPUT_STRIPPED
|
||||
bool "Build a stripped binary"
|
||||
help
|
||||
Build a stripped binary. This will build a zephyr.stripped file need
|
||||
by some platforms.
|
||||
|
||||
config APPLICATION_DEFINED_SYSCALL
|
||||
bool "Scan application folder for any syscall definition"
|
||||
help
|
||||
Scan additional folders inside application source folder
|
||||
for application defined syscalls.
|
||||
|
||||
endmenu
|
||||
endmenu
|
||||
|
||||
|
||||
menu "Boot Options"
|
||||
|
||||
config IS_BOOTLOADER
|
||||
bool "Act as a bootloader"
|
||||
depends on XIP
|
||||
depends on ARM
|
||||
help
|
||||
This option indicates that Zephyr will act as a bootloader to execute
|
||||
a separate Zephyr image payload.
|
||||
|
||||
config BOOTLOADER_SRAM_SIZE
|
||||
int "SRAM reserved for bootloader"
|
||||
default 16
|
||||
depends on !XIP || IS_BOOTLOADER
|
||||
depends on ARM || XTENSA
|
||||
help
|
||||
This option specifies the amount of SRAM (measure in kB) reserved for
|
||||
a bootloader image, when either:
|
||||
- the Zephyr image itself is to act as the bootloader, or
|
||||
- Zephyr is a !XIP image, which implicitly assumes existence of a
|
||||
bootloader that loads the Zephyr !XIP image onto SRAM.
|
||||
|
||||
config BOOTLOADER_MCUBOOT
|
||||
bool "MCUboot bootloader support"
|
||||
select USE_CODE_PARTITION
|
||||
help
|
||||
This option signifies that the target uses MCUboot as a bootloader,
|
||||
or in other words that the image is to be chain-loaded by MCUboot.
|
||||
This sets several required build system and Device Tree options in
|
||||
order for the image generated to be bootable using the MCUboot open
|
||||
source bootloader. Currently this includes:
|
||||
|
||||
* Setting TEXT_SECTION_OFFSET to a default value that allows space
|
||||
for the MCUboot image header
|
||||
* Activating SW_VECTOR_RELAY on Cortex-M0 (or Armv8-M baseline)
|
||||
targets with no built-in vector relocation mechanisms
|
||||
* Including dts/common/mcuboot.overlay when building the Device
|
||||
Tree in order to place and link the image at the slot0 offset
|
||||
|
||||
config BOOTLOADER_ESP_IDF
|
||||
bool "ESP-IDF bootloader support"
|
||||
depends on SOC_ESP32
|
||||
help
|
||||
This option will trigger the compilation of the ESP-IDF bootloader
|
||||
inside the build folder.
|
||||
At flash time, the bootloader will be flashed with the zephyr image
|
||||
|
||||
config REALMODE
|
||||
bool "boot from x86 real mode"
|
||||
depends on X86
|
||||
help
|
||||
This option enabled Zephyr to start in x86 real mode, instead of
|
||||
protected mode.
|
||||
|
||||
config BOOTLOADER_KEXEC
|
||||
bool "Boot using Linux kexec() system call"
|
||||
depends on X86
|
||||
help
|
||||
This option signifies that Linux boots the kernel using kexec system call
|
||||
and utility. This method is used to boot the kernel over the network.
|
||||
|
||||
config BOOTLOADER_UNKNOWN
|
||||
bool "Generic boot loader support"
|
||||
depends on X86
|
||||
help
|
||||
This option signifies that the target has a generic bootloader
|
||||
or that it supports multiple ways of booting and it isn't clear
|
||||
at build time which method is to be used. When this option is enabled
|
||||
the board may have to do extra work to ensure a proper startup.
|
||||
|
||||
config BOOTLOADER_CONTEXT_RESTORE
|
||||
bool "Boot loader has context restore support"
|
||||
default y
|
||||
depends on SYS_POWER_DEEP_SLEEP_STATES && BOOTLOADER_CONTEXT_RESTORE_SUPPORTED
|
||||
help
|
||||
This option signifies that the target has a bootloader
|
||||
that restores CPU context upon resuming from deep sleep
|
||||
power state.
|
||||
|
||||
config REBOOT
|
||||
bool "Reboot functionality"
|
||||
select SYSTEM_CLOCK_DISABLE
|
||||
help
|
||||
Enable the sys_reboot() API. Enabling this can drag in other subsystems
|
||||
needed to perform a "safe" reboot (e.g. SYSTEM_CLOCK_DISABLE, to stop the
|
||||
system clock before issuing a reset).
|
||||
|
||||
config MISRA_SANE
|
||||
bool "MISRA standards compliance features"
|
||||
help
|
||||
Causes the source code to build in "MISRA" mode, which
|
||||
disallows some otherwise-permitted features of the C
|
||||
standard for safety reasons. Specifically variable length
|
||||
arrays are not permitted (and gcc will enforce this).
|
||||
|
||||
endmenu
|
||||
#
|
||||
# The following are for Kconfig files for default values only.
|
||||
# These should be parsed at the end.
|
||||
#
|
||||
# Board defaults should be parsed after SoC defaults
|
||||
# because board usually overrides SoC values.
|
||||
#
|
||||
source "arch/*/soc/*/Kconfig.defconfig"
|
||||
source "boards/*/*/Kconfig.defconfig"
|
||||
|
||||
493
MAINTAINERS
Normal file
493
MAINTAINERS
Normal file
@@ -0,0 +1,493 @@
|
||||
Originally from the Linux Kernel.
|
||||
# Licensed under the terms of the GNU GPL License version 2
|
||||
|
||||
Descriptions of section entries:
|
||||
|
||||
P: Person (obsolete)
|
||||
M: Mail patches to: FullName <address@domain>
|
||||
R: Designated reviewer: FullName <address@domain>
|
||||
These reviewers should be CCed on patches.
|
||||
L: Mailing list that is relevant to this area
|
||||
W: Web-page with status/info
|
||||
Q: Patchwork web based patch tracking system site
|
||||
T: SCM tree type and location.
|
||||
Type is one of: git, hg, quilt, stgit, topgit
|
||||
S: Status, one of the following:
|
||||
Supported: Someone is actually paid to look after this.
|
||||
Maintained: Someone actually looks after it.
|
||||
Odd Fixes: It has a maintainer but they don't have time to do
|
||||
much other than throw the odd patch in. See below..
|
||||
Orphan: No current maintainer [but maybe you could take the
|
||||
role as you write your new code].
|
||||
Obsolete: Old code. Something tagged obsolete generally means
|
||||
it has been replaced by a better system and you
|
||||
should be using that.
|
||||
F: Files and directories with wildcard patterns.
|
||||
A trailing slash includes all files and subdirectory files.
|
||||
F: drivers/net/ all files in and below drivers/net
|
||||
F: drivers/net/* all files in drivers/net, but not below
|
||||
F: */net/* all files in "any top level directory"/net
|
||||
One pattern per line. Multiple F: lines acceptable.
|
||||
N: Files and directories with regex patterns.
|
||||
N: [^a-z]tegra all files whose path contains the word tegra
|
||||
One pattern per line. Multiple N: lines acceptable.
|
||||
scripts/get_maintainer.pl has different behavior for files that
|
||||
match F: pattern and matches of N: patterns. By default,
|
||||
get_maintainer will not look at git log history when an F: pattern
|
||||
match occurs. When an N: match occurs, git log history is used
|
||||
to also notify the people that have git commit signatures.
|
||||
X: Files and directories that are NOT maintained, same rules as F:
|
||||
Files exclusions are tested before file matches.
|
||||
Can be useful for excluding a specific subdirectory, for instance:
|
||||
F: net/
|
||||
X: net/ipv6/
|
||||
matches all files in and below net excluding net/ipv6/
|
||||
K: Keyword perl extended regex pattern to match content in a
|
||||
patch or file. For instance:
|
||||
K: of_get_profile
|
||||
matches patches or files that contain "of_get_profile"
|
||||
K: \b(printk|pr_(info|err))\b
|
||||
matches patches or files that contain one or more of the words
|
||||
printk, pr_info or pr_err
|
||||
One regex pattern per line. Multiple K: lines acceptable.
|
||||
|
||||
Note: For the hard of thinking, this list is meant to remain in alphabetical
|
||||
order. If you could add yourselves to it in alphabetical order that would be
|
||||
so much easier [Ed]
|
||||
|
||||
Maintainers List (try to look for most precise areas first)
|
||||
|
||||
-----------------------------------
|
||||
|
||||
ARC ARCHITECTURE
|
||||
M: Ruud Derwig <Ruud.Derwig@synopsys.com>
|
||||
M: Chuck Jordan <cjordan@synopsys.com>
|
||||
S: Supported
|
||||
F: arch/arc/
|
||||
F: include/arch/arc/
|
||||
F: boards/arc/
|
||||
|
||||
ARM ARCHITECTURE
|
||||
M: Maureen Helm <maureen.helm@nxp.com>
|
||||
M: Kumar Gala <kumar.gala@linaro.org>
|
||||
S: Supported
|
||||
F: arch/arm/
|
||||
F: include/arch/arm/
|
||||
F: boards/arm/
|
||||
|
||||
ARM CORTEX MICROCONTROLLER SOFTWARE INTERFACE STANDARD (CMSIS)
|
||||
M: Maureen Helm <maureen.helm@nxp.com>
|
||||
M: Kumar Gala <kumar.gala@linaro.org>
|
||||
S: Supported
|
||||
F: ext/hal/cmsis/
|
||||
|
||||
BOARDS/ARC - ARDUINO 101 SSS
|
||||
M: Anas Nashif <anas.nashif@intel.com>
|
||||
S: Supported
|
||||
F: boards/arc/arduino_101_sss/
|
||||
|
||||
BOARDS/ARC - EM Starterkit
|
||||
M: Chuck Jordan <cjordan@synopsys.com>
|
||||
S: Supported
|
||||
F: boards/arc/em_starterkit/
|
||||
|
||||
BOARDS/ARC - QUARK SE C1000 SS Devboard
|
||||
M: Anas Nashif <anas.nashif@intel.com>
|
||||
S: Supported
|
||||
F: boards/arc/quark_se_c1000_ss_devboard/
|
||||
|
||||
BOARDS/ARM - 96Boards CARBON
|
||||
M: Amit Kucheria <amit.kucheria@linaro.org>
|
||||
M: Ricardo Salveti <ricardo.salveti@linaro.org>
|
||||
S: Supported
|
||||
F: boards/arm/96b_carbon/
|
||||
|
||||
BOARDS/ARM - 96Boards NITROGEN
|
||||
M: Amit Kucheria <amit.kucheria@linaro.org>
|
||||
S: Supported
|
||||
F: boards/arm/96b_nitrogen/
|
||||
|
||||
BOARDS/ARM - ARDUINO 101 BLE
|
||||
M: Johan Hedberg <johan.hedberg@intel.com>
|
||||
S: Supported
|
||||
F: boards/arm/arduino_101_ble/
|
||||
|
||||
BOARDS/ARM - CC32XX LAUNCHXL
|
||||
M: Gil Pitney <gil.pitney@linaro.org>
|
||||
S: Supported
|
||||
F: boards/arm/cc3220sf_launchxl/
|
||||
|
||||
BOARDS/ARM - NXP FRDM-K64F
|
||||
M: Maureen Helm <maureen.helm@nxp.com>
|
||||
S: Supported
|
||||
F: boards/arm/frdm_k64f/
|
||||
|
||||
BOARDS/ARM - NXP FRDM-KW41Z
|
||||
M: Maureen Helm <maureen.helm@nxp.com>
|
||||
S: Supported
|
||||
F: boards/arm/frdm_kw41z/
|
||||
|
||||
BOARDS/ARM - NXP Hexiwear
|
||||
M: Maureen Helm <maureen.helm@nxp.com>
|
||||
S: Supported
|
||||
F: boards/arm/hexiwear_k64/
|
||||
|
||||
BOARDS/ARM - NORDIC NRF51 REDBEAR BLENANO
|
||||
M: Ricardo Salveti <ricardo.salveti@linaro.org>
|
||||
S: Supported
|
||||
F: boards/arm/nrf51_blenano/
|
||||
|
||||
BOARDS/ARM - NORDIC NRF52 PCA10040
|
||||
M: Carles Cufi <carles.cufi@nordicsemi.no>
|
||||
S: Supported
|
||||
F: boards/arm/nrf52_pca10040/
|
||||
|
||||
BOARDS/ARM - NUCLEO-64 F401RE Devboard
|
||||
M: Amit Kucheria <amit.kucheria@linaro.org>
|
||||
M: Ricardo Salveti <ricardo.salveti@linaro.org>
|
||||
S: Supported
|
||||
F: boards/arm/nucleo_f401re/
|
||||
|
||||
BOARDS/ARM - ARM LTD V2M Beetle
|
||||
M: Vincenzo Frascino <vincenzo.frascino@linaro.org>
|
||||
S: Supported
|
||||
F: boards/arm/v2m_beetle/
|
||||
|
||||
BOARDS/NIOS2 - ALTERA MAX10
|
||||
M: Andrew Boie <andrew.p.boie@intel.com>
|
||||
S: Supported
|
||||
F: boards/nios2/altera_max10/
|
||||
|
||||
BOARDS/X86 - ARDUINO 101
|
||||
M: Anas Nashif <anas.nashif@intel.com>
|
||||
S: Supported
|
||||
F: boards/x86/arduino_101/
|
||||
|
||||
BOARDS/X86 - Galileo
|
||||
M: Anas Nashif <anas.nashif@intel.com>
|
||||
S: Supported
|
||||
F: boards/x86/galileo/
|
||||
|
||||
BOARDS/X86 - QUARK D2000 Devboard
|
||||
M: Anas Nashif <anas.nashif@intel.com>
|
||||
S: Supported
|
||||
F: boards/x86/quark_d2000_crb/
|
||||
|
||||
BOARDS/X86 - QUARK SE C1000 Devboard
|
||||
M: Anas Nashif <anas.nashif@intel.com>
|
||||
S: Supported
|
||||
F: boards/x86/quark_se_c1000_devboard/
|
||||
|
||||
BLUETOOTH
|
||||
M: Johan Hedberg <johan.hedberg@intel.com>
|
||||
M: Luiz Augusto von Dentz <luiz.dentz@gmail.com>
|
||||
M: Szymon Janc <szymon.janc@gmail.com>
|
||||
S: Supported
|
||||
W: https://www.zephyrproject.org/doc/subsystems/bluetooth/bluetooth.html
|
||||
F: subsys/bluetooth/
|
||||
F: include/bluetooth/
|
||||
F: include/drivers/bluetooth/
|
||||
F: drivers/bluetooth/
|
||||
F: samples/bluetooth/
|
||||
F: tests/bluetooth/
|
||||
F: doc/subsystems/bluetooth/
|
||||
|
||||
BLUETOOTH CONTROLLER
|
||||
M: Vinayak Chettimada <vinayak.kariappa.chettimada@nordicsemi.no>
|
||||
M: Carles Cufi <carles.cufi@nordicsemi.no>
|
||||
S: Supported
|
||||
F: subsys/bluetooth/controller/
|
||||
|
||||
CC32XX SDK
|
||||
M: Gil Pitney <gil.pitney@linaro.org>
|
||||
S: Supported
|
||||
F: ext/hal/ti/simplelink
|
||||
|
||||
CC32XX SOC - TI SIMPLELINK
|
||||
M: Gil Pitney <gil.pitney@linaro.org>
|
||||
S: Supported
|
||||
F: arch/arm/soc/ti_simplelink/cc32xx
|
||||
|
||||
DOCUMENTATION
|
||||
M: David Kinder <david.b.kinder@intel.com>
|
||||
M: Inaky Perez-Gonzalez <inaky.perez-gonzalez@intel.com>
|
||||
S: Supported
|
||||
F: doc/
|
||||
F: *.rst
|
||||
|
||||
FILE SYSTEM
|
||||
M: Anas Nashif <anas.nashif@intel.com>
|
||||
S: Supported
|
||||
F: ext/fs/
|
||||
F: subsys/fs/
|
||||
F: include/fs/
|
||||
F: include/fs.h
|
||||
F: tests/subsys/fs
|
||||
|
||||
FLASH DRIVER
|
||||
M: Anas Nashif <anas.nashif@intel.com>
|
||||
S: Supported
|
||||
F: drivers/flash/
|
||||
|
||||
INTERRUPTS
|
||||
M: Andrew Boie <andrew.p.boie@intel.com>
|
||||
S: Supported
|
||||
F: drivers/interrupt_controller/
|
||||
F: arch/arc/core/
|
||||
F: arch/arm/core/
|
||||
F: arch/nios2/core/
|
||||
F: arch/x86/core/
|
||||
F: include/irq.h
|
||||
F: include/arch/x86/arch.h
|
||||
F: include/arch/arm/cortex_m/irq.h
|
||||
F: include/arch/nios2/arch.h
|
||||
F: include/arch/arc/arch.h
|
||||
F: include/arch/arc/v2/irq.h
|
||||
F: include/drivers/loapic.h
|
||||
F: include/drivers/ioapic.h
|
||||
F: include/drivers/mvic.h
|
||||
|
||||
KERNEL CORE
|
||||
M: Andrew Boie <andrew.p.boie@intel.com>
|
||||
M: Andy Ross <andrew.j.ross@intel.com>
|
||||
S: Supported
|
||||
F: kernel/
|
||||
F: include/misc/
|
||||
F: include/toolchain/
|
||||
F: include/atomic.h
|
||||
F: include/cache.h
|
||||
F: include/init.h
|
||||
F: include/irq.h
|
||||
F: include/irq_offload.h
|
||||
F: include/kernel_version.h
|
||||
F: include/linker/linker-defs.h
|
||||
F: include/linker/linker-tool-gcc.h
|
||||
F: include/linker/linker-tool.h
|
||||
F: include/linker/section_tags.h
|
||||
F: include/linker/sections.h
|
||||
F: include/shared_irq.h
|
||||
F: include/sw_isr_table.h
|
||||
F: include/sys_clock.h
|
||||
F: include/sys_io.h
|
||||
F: include/toolchain.h
|
||||
F: include/zephyr.h
|
||||
F: include/kernel.h
|
||||
F: tests/kernel/
|
||||
|
||||
KNOWN ISSUES
|
||||
M: Anas Nashif <anas.nashif@intel.com>
|
||||
M: Inaky Perez-Gonzalez <inaky.perez-gonzalez@intel.com>
|
||||
F: .known-issues/
|
||||
|
||||
LWM2M
|
||||
M: Michael Scott <michael.scott@linaro.org>
|
||||
S: Supported
|
||||
F: subsys/net/lib/lwm2m/
|
||||
F: samples/net/lwm2m_client/
|
||||
|
||||
MAINTAINERS
|
||||
M: Anas Nashif <anas.nashif@intel.com>
|
||||
M: Inaky Perez-Gonzalez <inaky.perez-gonzalez@intel.com>
|
||||
S: Supported
|
||||
F: MAINTAINERS
|
||||
|
||||
MBEDTLS
|
||||
M: Anas Nashif <anas.nashif@intel.com>
|
||||
S: Supported
|
||||
F: ext/lib/crypto/mbedtls/
|
||||
F: samples/net/mbedtls_sslclient/
|
||||
F: tests/crypto/mbedtls/
|
||||
|
||||
MCUXPRESSO SOFTWARE DEVELOPMENT KIT (MCUX)
|
||||
M: Maureen Helm <maureen.helm@nxp.com>
|
||||
S: Supported
|
||||
F: ext/hal/nxp/mcux/
|
||||
|
||||
MPS2 - ARM LTD CORTEX-M PROTOTYPING SYSTEM
|
||||
M: Vincenzo Frascino <vincenzo.frascino@linaro.org>
|
||||
S: Supported
|
||||
F: arch/arm/soc/arm/mps2/
|
||||
F: boards/arm/mps2_an385/
|
||||
|
||||
NETWORKING
|
||||
M: Jukka Rissanen <jukka.rissanen@linux.intel.com>
|
||||
M: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
|
||||
S: Supported
|
||||
W: https://www.zephyrproject.org/doc/subsystems/networking/networking.html
|
||||
F: subsys/net/ip/
|
||||
F: subsys/net/lib/
|
||||
F: include/net/
|
||||
F: samples/net/
|
||||
F: tests/net/
|
||||
F: tests/net/lib/
|
||||
F: drivers/ethernet/
|
||||
F: drivers/ieee802154/
|
||||
F: drivers/slip/
|
||||
|
||||
NETWORK APPLICATIONS
|
||||
M: Jukka Rissanen <jukka.rissanen@linux.intel.com>
|
||||
M: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
|
||||
S: Supported
|
||||
F: subsys/net/lib/dns/
|
||||
F: subsys/net/lib/http/
|
||||
F: subsys/net/lib/mqtt/
|
||||
F: samples/net/dns_resolve/
|
||||
F: samples/net/http_server/
|
||||
F: samples/net/mqtt_publisher/
|
||||
F: tests/net/lib/http_header_fields/
|
||||
F: tests/net/lib/mqtt_packet/
|
||||
|
||||
NETWORK BUFFERS
|
||||
M: Johan Hedberg <johan.hedberg@intel.com>
|
||||
M: Jukka Rissanen <jukka.rissanen@linux.intel.com>
|
||||
M: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
|
||||
S: Supported
|
||||
W: https://www.zephyrproject.org/doc/subsystems/networking/buffers.html
|
||||
F: subsys/net/buf.c
|
||||
F: include/net/buf.h
|
||||
F: tests/net/buf/
|
||||
|
||||
NIOS II
|
||||
M: Andrew Boie <andrew.p.boie@intel.com>
|
||||
S: Supported
|
||||
F: arch/nios2/
|
||||
F: include/arch/nios2/
|
||||
F: drivers/serial/uart_altera_jtag.c
|
||||
F: drivers/timer/altera_avalon_timer.c
|
||||
F: boards/nios2/
|
||||
|
||||
NORDIC MDK
|
||||
M: Carles Cufi <carles.cufi@nordicsemi.no>
|
||||
S: Supported
|
||||
F: ext/hal/nordic/mdk/
|
||||
|
||||
POWER MANAGEMENT
|
||||
M: Anas Nashif <anas.nashif@intel.com>
|
||||
M: Youvedeep Singh <youvedeep.singh@intel.com>
|
||||
S: Supported
|
||||
F: arch/x86/core/crt0.S
|
||||
F: include/device.h
|
||||
F: include/init.h
|
||||
F: include/power.h
|
||||
F: kernel/idle.c
|
||||
F: kernel/device.c
|
||||
F: samples/boards/quark_se_c1000/power*/
|
||||
|
||||
QMSI
|
||||
M: Anas Nashif <anas.nashif@intel.com>
|
||||
S: Supported
|
||||
F: ext/hal/qmsi/
|
||||
|
||||
QMSI DRIVERS
|
||||
M: Anas Nashif <anas.nashif@intel.com>
|
||||
S: Supported
|
||||
F: drivers/*/*qmsi*
|
||||
|
||||
QUARK D2000 SOC
|
||||
M: Anas Nashif <anas.nashif@intel.com>
|
||||
S: Supported
|
||||
F: arch/x86/soc/intel_quark/quark_d2000/
|
||||
|
||||
QUARK SE C1000 SOC
|
||||
M: Anas Nashif <anas.nashif@intel.com>
|
||||
S: Supported
|
||||
F: arch/x86/soc/intel_quark/quark_se/
|
||||
|
||||
QUARK X1000 SOC
|
||||
M: Anas Nashif <anas.nashif@intel.com>
|
||||
S: Supported
|
||||
F: arch/x86/soc/intel_quark/quark_x1000/
|
||||
|
||||
SANITYCHECK
|
||||
M: Andrew Boie <andrew.p.boie@intel.com>
|
||||
S: Supported
|
||||
F: scripts/sanitycheck
|
||||
F: scripts/expr_parser.py
|
||||
F: scripts/sanity_chk/
|
||||
|
||||
SENSOR DRIVERS
|
||||
M: Bogdan Davidoaia <bogdan.davidoaia@gmail.com>
|
||||
M: Murtaza Alexandru <murtaza.alexandru1995@gmail.com>
|
||||
S: Maintained
|
||||
W: https://www.zephyrproject.org/doc/subsystems/sensor.html
|
||||
F: include/sensor.h
|
||||
F: drivers/sensor/
|
||||
F: samples/sensor/
|
||||
|
||||
STM32CUBE SDK
|
||||
M: Erwan Gouriou <erwan.gouriou@linaro.org>
|
||||
S: Supported
|
||||
F: ext/hal/st/stm32cube/
|
||||
|
||||
STM32F4X SoC FAMILY and DRIVERS
|
||||
M: Amit Kucheria <amit.kucheria@linaro.org>
|
||||
M: Ricardo Salveti <ricardo.salveti@linaro.org>
|
||||
S: Supported
|
||||
F: arch/arm/soc/st_stm32/stm32f4/
|
||||
F: drivers/pinmux/stm32/
|
||||
F: drivers/gpio/*stm32*
|
||||
F: drivers/clock_control/*stm32f4*
|
||||
|
||||
TINYCRYPT
|
||||
M: Constanza Heath <constanza.m.heath@intel.com>
|
||||
S: Supported
|
||||
F: ext/lib/crypto/tinycrypt/
|
||||
F: tests/crypto/
|
||||
|
||||
SPI
|
||||
M: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
|
||||
S: Supported
|
||||
F: drivers/spi/
|
||||
F: include/spi.h
|
||||
F: tests/drivers/spi/
|
||||
|
||||
USB
|
||||
M: Youvedeep Singh <youvedeep.singh@intel.com>
|
||||
M: Andy Ross <andrew.j.ross@intel.com>
|
||||
S: Supported
|
||||
F: subsys/usb
|
||||
F: drivers/usb
|
||||
F: samples/subsys/usb
|
||||
|
||||
X86 ARCH
|
||||
M: Andrew Boie <andrew.p.boie@intel.com>
|
||||
M: Youvedeep Singh <youvedeep.singh@intel.com>
|
||||
S: Supported
|
||||
F: arch/x86/
|
||||
F: include/arch/x86/
|
||||
F: boards/x86/
|
||||
|
||||
XTENSA ARCH
|
||||
M: Andrew Boie <andrew.p.boie@intel.com>
|
||||
S: Supported
|
||||
F: arch/xtensa
|
||||
F: include/arch/xtensa/
|
||||
F: boards/xtensa/
|
||||
|
||||
RISCV32 ARCH
|
||||
M: Jean-Paul Etienne <fractalclone@gmail.com>
|
||||
S: Supported
|
||||
F: arch/riscv32
|
||||
F: include/arch/riscv32
|
||||
F: boards/riscv32
|
||||
F: drivers/serial/uart_riscv_qemu.c
|
||||
F: drivers/timer/pulpino_timer.c
|
||||
F: drivers/timer/riscv_machine_timer.c
|
||||
F: drivers/gpio/gpio_pulpino.c
|
||||
|
||||
ZOAP
|
||||
M: Vinicius Costa Gomes <vinicius.gomes@intel.com>
|
||||
S: Supported
|
||||
F: subsys/net/lib/zoap/
|
||||
F: samples/net/zoap_client/
|
||||
F: samples/net/zoap_server/
|
||||
F: tests/net/lib/zoap/
|
||||
|
||||
THE REST
|
||||
M: Anas Nashif <anas.nashif@intel.com>
|
||||
M: Kumar Gala <kumar.gala@linaro.org>
|
||||
L: devel@lists.zephyrproject.com
|
||||
T: git https://github.com/zephyrproject-rtos/zephyr
|
||||
S: Buried alive in reporters
|
||||
F: *
|
||||
F: */
|
||||
148
Makefile.inc
Normal file
148
Makefile.inc
Normal file
@@ -0,0 +1,148 @@
|
||||
# vim: filetype=make
|
||||
#
|
||||
|
||||
UNAME := $(shell uname)
|
||||
ifeq (MINGW, $(findstring MINGW, $(UNAME)))
|
||||
DQUOTE = '
|
||||
# '
|
||||
PROJECT_BASE ?= $(shell sh -c "pwd -W")
|
||||
else
|
||||
DQUOTE = "
|
||||
# "
|
||||
PROJECT_BASE ?= $(CURDIR)
|
||||
endif
|
||||
|
||||
ifdef BOARD
|
||||
KBUILD_DEFCONFIG_PATH=$(wildcard $(ZEPHYR_BASE)/boards/*/*/$(BOARD)_defconfig)
|
||||
ifeq ($(KBUILD_DEFCONFIG_PATH),)
|
||||
$(error Board $(BOARD) not found!)
|
||||
endif
|
||||
else
|
||||
$(error BOARD is not defined!)
|
||||
endif
|
||||
|
||||
# Choose a default output directory if one wasn't supplied. Note that
|
||||
# PRISTINE_O depends on whether this is default or not. If building
|
||||
# in-tree, we want to remove the whole outdir and not just the BOARD
|
||||
# specified (thus "pristine"). Out of tree, we can obviously remove
|
||||
# only what we were told to build.
|
||||
ifndef O
|
||||
PRISTINE_O = outdir
|
||||
O = $(PROJECT_BASE)/outdir/$(BOARD)
|
||||
else
|
||||
PRISTINE_O = $(O)
|
||||
endif
|
||||
|
||||
# Turn O into an absolute path; we call the main Kbuild with $(MAKE) -C
|
||||
# which changes the working directory, relative paths don't work right.
|
||||
# Need to create the directory first to make realpath happy
|
||||
|
||||
ifneq ($(MAKECMDGOALS),help)
|
||||
$(shell mkdir -p $(O))
|
||||
override O := $(realpath $(O))
|
||||
endif
|
||||
|
||||
export ARCH QEMU_EXTRA_FLAGS PROJECT_BASE
|
||||
|
||||
override CONF_FILE := $(strip $(subst $(DQUOTE),,$(CONF_FILE)))
|
||||
|
||||
SOURCE_DIR ?= $(PROJECT_BASE)/src/
|
||||
override SOURCE_DIR := $(realpath $(SOURCE_DIR))
|
||||
override SOURCE_DIR := $(subst \,/,$(SOURCE_DIR))
|
||||
override SOURCE_DIR_PARENT := $(patsubst %, %/.., $(SOURCE_DIR))
|
||||
override SOURCE_DIR_PARENT := $(abspath $(SOURCE_DIR_PARENT))
|
||||
override SOURCE_DIR_PARENT := $(subst \,/,$(SOURCE_DIR_PARENT))
|
||||
export SOURCE_DIR SOURCE_DIR_PARENT
|
||||
|
||||
ifeq ("$(origin V)", "command line")
|
||||
KBUILD_VERBOSE = $(V)
|
||||
endif
|
||||
ifndef KBUILD_VERBOSE
|
||||
KBUILD_VERBOSE = 0
|
||||
endif
|
||||
|
||||
ifeq ($(KBUILD_VERBOSE),1)
|
||||
Q =
|
||||
S =
|
||||
else
|
||||
Q = @
|
||||
S = -s
|
||||
endif
|
||||
|
||||
export CFLAGS
|
||||
|
||||
zephyrmake = +$(MAKE) -C $(ZEPHYR_BASE) O=$(1) \
|
||||
PROJECT=$(PROJECT_BASE) SOURCE_DIR=$(DQUOTE)$(SOURCE_DIR)$(DQUOTE) $(2)
|
||||
|
||||
BOARDCONFIG = $(O)/.board_$(BOARD)
|
||||
|
||||
DOTCONFIG = $(O)/.config
|
||||
|
||||
all: $(DOTCONFIG)
|
||||
$(Q)$(call zephyrmake,$(O),$@)
|
||||
|
||||
debug: $(DOTCONFIG)
|
||||
$(Q)$(call zephyrmake,$(O),$@)
|
||||
|
||||
flash: $(DOTCONFIG)
|
||||
$(Q)$(call zephyrmake,$(O),$@)
|
||||
|
||||
run: $(DOTCONFIG)
|
||||
$(Q)$(call zephyrmake,$(O),$@)
|
||||
|
||||
ifeq ($(MAKECMDGOALS),debugserver)
|
||||
ARCH = $(notdir $(subst /$(BOARD),,$(wildcard $(ZEPHYR_BASE)/boards/*/$(BOARD))))
|
||||
BOARD_DIR = $(dir $(wildcard $(ZEPHYR_BASE)/boards/*/*/$(BOARD)_defconfig))
|
||||
-include $(BOARD_DIR)/Makefile.board
|
||||
-include $(ZEPHYR_BASE)/scripts/Makefile.toolchain.$(ZEPHYR_GCC_VARIANT)
|
||||
BOARD_NAME = $(BOARD)
|
||||
export BOARD_NAME
|
||||
endif
|
||||
|
||||
debugserver: FORCE
|
||||
$(Q)$(CONFIG_SHELL) $(ZEPHYR_BASE)/scripts/support/$(DEBUG_SCRIPT) debugserver
|
||||
|
||||
initconfig: $(DOTCONFIG)
|
||||
|
||||
$(BOARDCONFIG):
|
||||
@rm -f $(O)/.board_*
|
||||
@touch $@
|
||||
|
||||
ram_report: initconfig
|
||||
$(Q)$(call zephyrmake,$(O),$@)
|
||||
|
||||
rom_report: initconfig
|
||||
$(Q)$(call zephyrmake,$(O),$@)
|
||||
|
||||
outputexports: initconfig
|
||||
$(Q)$(call zephyrmake,$(O),$@)
|
||||
|
||||
dts: initconfig
|
||||
$(Q)$(call zephyrmake,$(O),$@)
|
||||
|
||||
config-sanitycheck: dts
|
||||
$(Q)$(call zephyrmake,$(O),$@)
|
||||
|
||||
menuconfig: initconfig
|
||||
$(Q)$(call zephyrmake,$(O),$@)
|
||||
|
||||
help:
|
||||
$(Q)$(MAKE) -s -C $(ZEPHYR_BASE) $@
|
||||
|
||||
# Catch all
|
||||
%:
|
||||
$(Q)$(call zephyrmake,$(O),$@)
|
||||
|
||||
$(DOTCONFIG): $(BOARDCONFIG) $(KBUILD_DEFCONFIG_PATH) $(CONF_FILE)
|
||||
$(Q)$(CONFIG_SHELL) $(ZEPHYR_BASE)/scripts/kconfig/merge_config.sh \
|
||||
-q -m -O $(O) $(KBUILD_DEFCONFIG_PATH) $(OVERLAY_CONFIG) $(CONF_FILE) \
|
||||
$(wildcard $(O)/*.conf)
|
||||
$(Q)$(MAKE) $(S) -C $(ZEPHYR_BASE) O=$(O) PROJECT=$(PROJECT_BASE) oldnoconfig
|
||||
|
||||
pristine:
|
||||
$(Q)rm -rf $(PRISTINE_O)
|
||||
|
||||
PHONY += FORCE initconfig
|
||||
FORCE:
|
||||
|
||||
.PHONY: $(PHONY)
|
||||
4
Makefile.test
Normal file
4
Makefile.test
Normal file
@@ -0,0 +1,4 @@
|
||||
|
||||
OVERLAY_CONFIG += $(ZEPHYR_BASE)/tests/include/test.config
|
||||
|
||||
include ${ZEPHYR_BASE}/Makefile.inc
|
||||
86
README.rst
86
README.rst
@@ -1,17 +1,10 @@
|
||||
Zephyr Project
|
||||
##############
|
||||
|
||||
.. raw:: html
|
||||
|
||||
<a href="https://www.zephyrproject.org">
|
||||
<p align="center">
|
||||
<img src="doc/images/Zephyr-Project.png">
|
||||
</p>
|
||||
</a>
|
||||
|
||||
<a href="https://bestpractices.coreinfrastructure.org/projects/74"><img
|
||||
src="https://bestpractices.coreinfrastructure.org/projects/74/badge"></a>
|
||||
<img
|
||||
src="https://api.shippable.com/projects/58ffb2b8baa5e307002e1d79/badge?branch=master">
|
||||
|
||||
|
||||
The Zephyr Project is a scalable real-time operating system (RTOS) supporting
|
||||
multiple hardware architectures, optimized for resource constrained devices,
|
||||
@@ -22,21 +15,13 @@ 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
|
||||
Intel x86, ARC, NIOS II, Tensilica Xtensa, and RISC V, and a large number of
|
||||
`supported boards`_.
|
||||
|
||||
.. below included in doc/introduction/introduction.rst
|
||||
|
||||
.. start_include_here
|
||||
|
||||
Getting Started
|
||||
***************
|
||||
|
||||
To start developing Zephyr applications refer to the `Getting Started Guide`_
|
||||
in the `Zephyr Documentation`_ pages.
|
||||
A brief introduction to Zephyr can be found in the `Zephyr Introduction`_
|
||||
page.
|
||||
|
||||
Community Support
|
||||
*****************
|
||||
|
||||
@@ -59,10 +44,11 @@ support systems:
|
||||
* **Zephyr Project Website**: The https://zephyrproject.org website is the
|
||||
central source of information about the Zephyr Project. On this site, you'll
|
||||
find background and current information about the project as well as all the
|
||||
relevant links to project material.
|
||||
relevant links to project material. For a quick start, refer to the
|
||||
`Zephyr Introduction`_ and `Getting Started Guide`_.
|
||||
|
||||
* **Releases**: Source code for Zephyr kernel releases are available at
|
||||
https://zephyrproject.org/developers/#downloads. On this page,
|
||||
https://zephyrproject.org/downloads. On this page,
|
||||
you'll find release information, and links to download or clone source
|
||||
code from our GitHub repository. You'll also find links for the Zephyr
|
||||
SDK, a moderated collection of tools and libraries used to develop your
|
||||
@@ -79,55 +65,37 @@ support systems:
|
||||
|
||||
* **Documentation**: Extensive Project technical documentation is developed
|
||||
along with the Zephyr kernel itself, and can be found at
|
||||
http://docs.zephyrproject.org. Additional documentation is maintained in
|
||||
https://zephyrproject.org/doc. Additional documentation is maintained in
|
||||
the `Zephyr GitHub wiki`_.
|
||||
|
||||
* **Cross-reference**: Source code cross-reference for the Zephyr
|
||||
kernel and samples code is available at
|
||||
https://elixir.bootlin.com/zephyr/latest/source.
|
||||
|
||||
* **Issue Reporting and Tracking**: Requirements and Issue tracking is done in
|
||||
the Github issues system: https://github.com/zephyrproject-rtos/zephyr/issues.
|
||||
You can browse through the reported issues and submit issues of your own.
|
||||
our JIRA system: https://jira.zephyrproject.org. You can browse through the
|
||||
reported issues and submit issues of your own.
|
||||
|
||||
* **Security-related Issue Reporting and Tracking**: For security-related
|
||||
inquiries or reporting suspected security-related bugs in the Zephyr OS,
|
||||
please send email to vulnerabilities@zephyrproject.org. We will assess and
|
||||
fix flaws according to our security policy outlined in the Zephyr Project
|
||||
* **Security-related Issue Reporting**: For security-related inquiries or
|
||||
reporting suspected security-related bugs in the Zephyr OS, please
|
||||
send email to vulnerabilities@zephyrproject.org. We will assess and fix
|
||||
flaws according to our security policy outlined in the Zephyr Project
|
||||
`Security Overview`_.
|
||||
|
||||
Security related issue tracking is done in JIRA. The location of this JIRA
|
||||
is https://zephyrprojectsec.atlassian.net.
|
||||
|
||||
* **Mailing List**: The `Zephyr Development mailing list`_ is perhaps the most convenient
|
||||
* **Mailing List**: The `Zephyr Mailing Lists`_ are perhaps the most convenient
|
||||
way to track developer discussions and to ask your own support questions to
|
||||
the Zephyr project community. There are also specific `Zephyr mailing list
|
||||
subgroups`_ for announcements, builds, marketing, and Technical
|
||||
Steering Committee notes, for example.
|
||||
You can read through the message archives to follow
|
||||
the Zephyr project community.
|
||||
You can also read through message archives to follow
|
||||
past posts and discussions, a good thing to do to discover more about the
|
||||
Zephyr project.
|
||||
|
||||
* **Chatting**: You can chat online with the Zephyr project developer
|
||||
community and other users in two ways:
|
||||
* **IRC Chatting**: You can chat online with the Zephyr project developer
|
||||
community and other users in our IRC channel #zephyrproject on the
|
||||
freenode.net IRC server. You can use the http://webchat.freenode.net web
|
||||
client or use a client-side application such as pidgin.
|
||||
|
||||
* On `Slack`_: Zephyr has dedicated channels on Slack. To register, use the
|
||||
following `Slack Invite`_.
|
||||
|
||||
* IRC channel #zephyrproject on the freenode.net IRC server. You can use the
|
||||
http://webchat.freenode.net web client or use a client-side application such
|
||||
as pidgin (Note that all discussions have moved to Slack, although we still
|
||||
have many developers still available on the IRC channel).
|
||||
|
||||
.. _Slack Invite: https://tinyurl.com/yarkuemx
|
||||
.. _Slack: https://zephyrproject.slack.com
|
||||
.. _supported boards: http://docs.zephyrproject.org/latest/boards
|
||||
.. _Zephyr Documentation: http://docs.zephyrproject.org
|
||||
.. _Zephyr Introduction: http://docs.zephyrproject.org/latest/introduction/index.html
|
||||
.. _Getting Started Guide: http://docs.zephyrproject.org/latest/getting_started/index.html
|
||||
.. _Contribution Guide: http://docs.zephyrproject.org/latest/contribute/index.html
|
||||
.. _supported boards: https://www.zephyrproject.org/doc/boards/boards.html
|
||||
.. _Zephyr Introduction: https://www.zephyrproject.org/doc/introduction/introducing_zephyr.html
|
||||
.. _Getting Started Guide: https://www.zephyrproject.org/doc/getting_started/getting_started.html
|
||||
.. _Contribution Guide: https://www.zephyrproject.org/doc/contribute/contribute_guidelines.html
|
||||
.. _Zephyr GitHub wiki: https://github.com/zephyrproject-rtos/zephyr/wiki
|
||||
.. _Zephyr Development mailing list: https://lists.zephyrproject.org/g/devel
|
||||
.. _Zephyr mailing list subgroups: https://lists.zephyrproject.org/g/main/subgroups
|
||||
.. _Sample and Demo Code Examples: http://docs.zephyrproject.org/latest/samples/index.html
|
||||
.. _Security Overview: http://docs.zephyrproject.org/latest/security/index.html
|
||||
.. _Zephyr Mailing Lists: https://lists.zephyrproject.org/
|
||||
.. _Sample and Demo Code Examples: https://www.zephyrproject.org/doc/samples/samples.html
|
||||
.. _Security Overview: https://www.zephyrproject.org/doc/security/security-overview.html
|
||||
|
||||
5
VERSION
5
VERSION
@@ -1,5 +0,0 @@
|
||||
VERSION_MAJOR = 1
|
||||
VERSION_MINOR = 14
|
||||
PATCHLEVEL = 3
|
||||
VERSION_TWEAK = 0
|
||||
EXTRAVERSION =
|
||||
@@ -1,6 +0,0 @@
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
add_definitions(-D__ZEPHYR_SUPERVISOR__)
|
||||
|
||||
add_subdirectory(common)
|
||||
add_subdirectory(${ARCH_DIR}/${ARCH} arch/${ARCH})
|
||||
510
arch/Kconfig
510
arch/Kconfig
@@ -8,11 +8,6 @@
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
#
|
||||
|
||||
# Include these first so that any properties (e.g. defaults) below can be
|
||||
# overriden (by defining symbols in multiple locations)
|
||||
|
||||
# Note: $ARCH might be a glob pattern
|
||||
source "$(ARCH_DIR)/$(ARCH)/Kconfig"
|
||||
|
||||
choice
|
||||
prompt "Architecture"
|
||||
@@ -20,447 +15,64 @@ choice
|
||||
|
||||
config ARC
|
||||
bool "ARC architecture"
|
||||
select HAS_DTS
|
||||
|
||||
config ARM
|
||||
bool "ARM architecture"
|
||||
select ARCH_HAS_THREAD_ABORT
|
||||
select HAS_DTS
|
||||
|
||||
config X86
|
||||
bool "x86 architecture"
|
||||
select ATOMIC_OPERATIONS_BUILTIN
|
||||
select HAS_DTS
|
||||
|
||||
config X86_64
|
||||
bool "x86_64 architecture"
|
||||
select ATOMIC_OPERATIONS_BUILTIN
|
||||
select SCHED_IPI_SUPPORTED
|
||||
|
||||
config NIOS2
|
||||
bool "Nios II Gen 2 architecture"
|
||||
select ATOMIC_OPERATIONS_C
|
||||
select HAS_DTS
|
||||
|
||||
config RISCV32
|
||||
bool "RISCV32 architecture"
|
||||
select HAS_DTS
|
||||
|
||||
config XTENSA
|
||||
bool "Xtensa architecture"
|
||||
select HAS_DTS
|
||||
|
||||
config ARCH_POSIX
|
||||
bool "POSIX (native) architecture"
|
||||
select ATOMIC_OPERATIONS_BUILTIN
|
||||
select ARCH_HAS_CUSTOM_SWAP_TO_MAIN
|
||||
select ARCH_HAS_CUSTOM_BUSY_WAIT
|
||||
select ARCH_HAS_THREAD_ABORT
|
||||
select NATIVE_APPLICATION
|
||||
select HAS_COVERAGE_SUPPORT
|
||||
|
||||
endchoice
|
||||
|
||||
|
||||
menu "General Architecture Options"
|
||||
|
||||
module = ARCH
|
||||
module-str = arch
|
||||
source "subsys/logging/Kconfig.template.log_config"
|
||||
|
||||
module = MPU
|
||||
module-str = mpu
|
||||
source "subsys/logging/Kconfig.template.log_config"
|
||||
|
||||
config BIG_ENDIAN
|
||||
bool
|
||||
help
|
||||
This option tells the build system that the target system is
|
||||
big-endian. Little-endian architecture is the default and
|
||||
should leave this option unselected. This option is selected
|
||||
by arch/$ARCH/Kconfig, soc/**/Kconfig, or boards/**/Kconfig
|
||||
and the user should generally avoid modifying it. The option
|
||||
is used to select linker script OUTPUT_FORMAT and command
|
||||
line option for gen_isr_tables.py.
|
||||
|
||||
if ARC || ARM || NIOS2 || X86
|
||||
|
||||
config SRAM_SIZE
|
||||
int "SRAM Size in kB"
|
||||
default $(dt_int_val,DT_SRAM_SIZE)
|
||||
help
|
||||
This option specifies the size of the SRAM in kB. It is normally set by
|
||||
the board's defconfig file and the user should generally avoid modifying
|
||||
it via the menu configuration.
|
||||
|
||||
config SRAM_BASE_ADDRESS
|
||||
hex "SRAM Base Address"
|
||||
default $(dt_hex_val,DT_SRAM_BASE_ADDRESS)
|
||||
help
|
||||
This option specifies the base address of the SRAM on the board. It is
|
||||
normally set by the board's defconfig file and the user should generally
|
||||
avoid modifying it via the menu configuration.
|
||||
|
||||
config FLASH_SIZE
|
||||
int "Flash Size in kB"
|
||||
default $(dt_int_val,DT_FLASH_SIZE) if (XIP && ARM) || !ARM
|
||||
help
|
||||
This option specifies the size of the flash in kB. It is normally set by
|
||||
the board's defconfig file and the user should generally avoid modifying
|
||||
it via the menu configuration.
|
||||
|
||||
config FLASH_BASE_ADDRESS
|
||||
hex "Flash Base Address"
|
||||
default $(dt_hex_val,DT_FLASH_BASE_ADDRESS) if (XIP && ARM) || !ARM
|
||||
help
|
||||
This option specifies the base address of the flash on the board. It is
|
||||
normally set by the board's defconfig file and the user should generally
|
||||
avoid modifying it via the menu configuration.
|
||||
|
||||
endif # ARM || ARC || NIOS2 || X86
|
||||
|
||||
if ARCH_HAS_TRUSTED_EXECUTION
|
||||
|
||||
config TRUSTED_EXECUTION_SECURE
|
||||
bool "Trusted Execution: Secure firmware image"
|
||||
help
|
||||
Select this option to enable building a Secure firmware
|
||||
image for a platform that supports Trusted Execution. A
|
||||
Secure firmware image will execute in Secure state. It may
|
||||
allow the CPU to execute in Non-Secure (Normal) state.
|
||||
Therefore, a Secure firmware image shall be able to
|
||||
configure security attributions of CPU resources (memory
|
||||
areas, peripherals, interrupts, etc.) as well as to handle
|
||||
faults, related to security violations. It may optionally
|
||||
allow certain functions to be called from the Non-Secure
|
||||
(Normal) domain.
|
||||
|
||||
config TRUSTED_EXECUTION_NONSECURE
|
||||
depends on !TRUSTED_EXECUTION_SECURE
|
||||
bool "Trusted Execution: Non-Secure firmware image"
|
||||
help
|
||||
Select this option to enable building a Non-Secure
|
||||
firmware image for a platform that supports Trusted
|
||||
Execution. A Non-Secure firmware image will execute
|
||||
in Non-Secure (Normal) state. Therefore, it shall not
|
||||
access CPU resources (memory areas, peripherals,
|
||||
interrupts etc.) belonging to the Secure domain.
|
||||
|
||||
endif # ARCH_HAS_TRUSTED_EXECUTION
|
||||
|
||||
config HW_STACK_PROTECTION
|
||||
bool "Hardware Stack Protection"
|
||||
depends on ARCH_HAS_STACK_PROTECTION
|
||||
help
|
||||
Select this option to enable hardware-based platform features to
|
||||
catch stack overflows when the system is running in privileged
|
||||
mode. If CONFIG_USERSPACE is not enabled, the system is always
|
||||
running in privileged mode.
|
||||
|
||||
Note that this does not necessarily prevent corruption and assertions
|
||||
about the overall system state when a fault is triggered cannot be
|
||||
made.
|
||||
|
||||
config USERSPACE
|
||||
bool "User mode threads"
|
||||
depends on ARCH_HAS_USERSPACE
|
||||
help
|
||||
When enabled, threads may be created or dropped down to user mode,
|
||||
which has significantly restricted permissions and must interact
|
||||
with the kernel via system calls. See Zephyr documentation for more
|
||||
details about this feature.
|
||||
|
||||
If a user thread overflows its stack, this will be caught and the
|
||||
kernel itself will be shielded from harm. Enabling this option
|
||||
may or may not catch stack overflows when the system is in
|
||||
privileged mode or handling a system call; to ensure these are always
|
||||
caught, enable CONFIG_HW_STACK_PROTECTION.
|
||||
|
||||
config PRIVILEGED_STACK_SIZE
|
||||
int "Size of privileged stack"
|
||||
default 1024
|
||||
depends on ARCH_HAS_USERSPACE
|
||||
help
|
||||
This option sets the privileged stack region size that will be used
|
||||
in addition to the user mode thread stack. During normal execution,
|
||||
this region will be inaccessible from user mode. During system calls,
|
||||
this region will be utilized by the system call.
|
||||
|
||||
config PRIVILEGED_STACK_TEXT_AREA
|
||||
int "Privileged stacks text area"
|
||||
default 512 if COVERAGE_GCOV
|
||||
default 256
|
||||
depends on ARCH_HAS_USERSPACE
|
||||
help
|
||||
Stack text area size for privileged stacks.
|
||||
|
||||
config KOBJECT_TEXT_AREA
|
||||
int "Size if kobject text area"
|
||||
default 512 if COVERAGE_GCOV
|
||||
default 512 if NO_OPTIMIZATIONS
|
||||
default 256
|
||||
depends on ARCH_HAS_USERSPACE
|
||||
help
|
||||
Size of kernel object text area. Used in linker script.
|
||||
|
||||
config STACK_GROWS_UP
|
||||
bool "Stack grows towards higher memory addresses"
|
||||
help
|
||||
Select this option if the architecture has upward growing thread
|
||||
stacks. This is not common.
|
||||
|
||||
config MAX_THREAD_BYTES
|
||||
int "Bytes to use when tracking object thread permissions"
|
||||
default 2
|
||||
depends on USERSPACE
|
||||
help
|
||||
Every kernel object will have an associated bitfield to store
|
||||
thread permissions for that object. This controls the size of the
|
||||
bitfield (in bytes) and imposes a limit on how many threads can
|
||||
be created in the system.
|
||||
|
||||
config DYNAMIC_OBJECTS
|
||||
bool "Allow kernel objects to be allocated at runtime"
|
||||
depends on USERSPACE
|
||||
help
|
||||
Enabling this option allows for kernel objects to be requested from
|
||||
the calling thread's resource pool, at a slight cost in performance
|
||||
due to the supplemental run-time tables required to validate such
|
||||
objects.
|
||||
|
||||
Objects allocated in this way can be freed with a supervisor-only
|
||||
API call, or when the number of references to that object drops to
|
||||
zero.
|
||||
|
||||
config SIMPLE_FATAL_ERROR_HANDLER
|
||||
bool "Simple system fatal error handler"
|
||||
default y if !MULTITHREADING
|
||||
help
|
||||
Provides an implementation of _SysFatalErrorHandler() that hard hangs
|
||||
instead of aborting the faulting thread, and does not print anything,
|
||||
for footprint-concerned systems. Only enable this option if you do not
|
||||
want debug capabilities in case of system fatal error.
|
||||
|
||||
if ARCH_HAS_NOCACHE_MEMORY_SUPPORT
|
||||
|
||||
config NOCACHE_MEMORY
|
||||
bool "Support for uncached memory"
|
||||
help
|
||||
Add a "nocache" read-write memory section that is configured to
|
||||
not be cached. This memory section can be used to perform DMA
|
||||
transfers when cache coherence issues are not optimal or can not
|
||||
be solved using cache maintenance operations.
|
||||
|
||||
endif # ARCH_HAS_NOCACHE_MEMORY_SUPPORT
|
||||
|
||||
menu "Interrupt Configuration"
|
||||
#
|
||||
# Interrupt related configs
|
||||
#
|
||||
config DYNAMIC_INTERRUPTS
|
||||
bool "Enable installation of IRQs at runtime"
|
||||
help
|
||||
Enable installation of interrupts at runtime, which will move some
|
||||
interrupt-related data structures to RAM instead of ROM, and
|
||||
on some architectures increase code size.
|
||||
|
||||
config GEN_ISR_TABLES
|
||||
bool "Use generated IRQ tables"
|
||||
help
|
||||
This option controls whether a platform uses the gen_isr_tables
|
||||
script to generate its interrupt tables. This mechanism will create
|
||||
an appropriate hardware vector table and/or software IRQ table.
|
||||
|
||||
config GEN_IRQ_VECTOR_TABLE
|
||||
bool "Generate an interrupt vector table"
|
||||
default y
|
||||
depends on GEN_ISR_TABLES
|
||||
help
|
||||
This option controls whether a platform using gen_isr_tables
|
||||
needs an interrupt vector table created. Only disable this if the
|
||||
platform does not use a vector table at all, or requires the vector
|
||||
table to be in a format that is not an array of function pointers
|
||||
indexed by IRQ line. In the latter case, the vector table must be
|
||||
supplied by the application or architecture code.
|
||||
|
||||
config GEN_SW_ISR_TABLE
|
||||
bool "Generate a software ISR table"
|
||||
default y
|
||||
depends on GEN_ISR_TABLES
|
||||
help
|
||||
This option controls whether a platform using gen_isr_tables
|
||||
needs a software ISR table table created. This is an array of struct
|
||||
_isr_table_entry containing the interrupt service routine and supplied
|
||||
parameter.
|
||||
|
||||
config GEN_IRQ_START_VECTOR
|
||||
int
|
||||
default 0
|
||||
depends on GEN_ISR_TABLES
|
||||
help
|
||||
On some architectures, part of the vector table may be reserved for
|
||||
system exceptions and is declared separately from the tables
|
||||
created by gen_isr_tables.py. When creating these tables, this value
|
||||
will be subtracted from CONFIG_NUM_IRQS to properly size them.
|
||||
This is a hidden option which needs to be set per architecture and
|
||||
left alone.
|
||||
|
||||
|
||||
config IRQ_OFFLOAD
|
||||
bool "Enable IRQ offload"
|
||||
help
|
||||
Enable irq_offload() API which allows functions to be synchronously
|
||||
run in interrupt context. Mainly useful for test cases.
|
||||
|
||||
endmenu # Interrupt configuration
|
||||
|
||||
endmenu
|
||||
|
||||
#
|
||||
# Architecture Capabilities
|
||||
#
|
||||
config ARCH_HAS_TRUSTED_EXECUTION
|
||||
bool
|
||||
|
||||
config ARCH_HAS_STACK_PROTECTION
|
||||
bool
|
||||
|
||||
config ARCH_HAS_USERSPACE
|
||||
bool
|
||||
|
||||
config ARCH_HAS_EXECUTABLE_PAGE_BIT
|
||||
bool
|
||||
|
||||
config ARCH_HAS_NOCACHE_MEMORY_SUPPORT
|
||||
bool
|
||||
|
||||
config ARCH_HAS_RAMFUNC_SUPPORT
|
||||
bool
|
||||
|
||||
#
|
||||
# Other architecture related options
|
||||
#
|
||||
|
||||
config ARCH_HAS_THREAD_ABORT
|
||||
bool
|
||||
|
||||
#
|
||||
# Hidden PM feature configs which are to be selected by
|
||||
# individual SoC.
|
||||
#
|
||||
config HAS_SYS_POWER_STATE_SLEEP_1
|
||||
config SYS_POWER_LOW_POWER_STATE_SUPPORTED
|
||||
# Hidden
|
||||
bool
|
||||
default n
|
||||
help
|
||||
This option signifies that the target supports the SYS_POWER_STATE_SLEEP_1
|
||||
configuration option.
|
||||
This option signifies that the target supports the SYS_POWER_LOW_POWER_STATE
|
||||
configuration option.
|
||||
|
||||
config HAS_SYS_POWER_STATE_SLEEP_2
|
||||
config SYS_POWER_DEEP_SLEEP_SUPPORTED
|
||||
# Hidden
|
||||
bool
|
||||
default n
|
||||
help
|
||||
This option signifies that the target supports the SYS_POWER_STATE_SLEEP_2
|
||||
configuration option.
|
||||
|
||||
config HAS_SYS_POWER_STATE_SLEEP_3
|
||||
# Hidden
|
||||
bool
|
||||
help
|
||||
This option signifies that the target supports the SYS_POWER_STATE_SLEEP_3
|
||||
configuration option.
|
||||
|
||||
config HAS_SYS_POWER_STATE_DEEP_SLEEP_1
|
||||
# Hidden
|
||||
bool
|
||||
help
|
||||
This option signifies that the target supports the SYS_POWER_STATE_DEEP_SLEEP_1
|
||||
configuration option.
|
||||
|
||||
config HAS_SYS_POWER_STATE_DEEP_SLEEP_2
|
||||
# Hidden
|
||||
bool
|
||||
help
|
||||
This option signifies that the target supports the SYS_POWER_STATE_DEEP_SLEEP_2
|
||||
configuration option.
|
||||
|
||||
config HAS_SYS_POWER_STATE_DEEP_SLEEP_3
|
||||
# Hidden
|
||||
bool
|
||||
help
|
||||
This option signifies that the target supports the SYS_POWER_STATE_DEEP_SLEEP_3
|
||||
configuration option.
|
||||
This option signifies that the target supports the SYS_POWER_DEEP_SLEEP
|
||||
configuration option.
|
||||
|
||||
config BOOTLOADER_CONTEXT_RESTORE_SUPPORTED
|
||||
# Hidden
|
||||
bool
|
||||
default n
|
||||
help
|
||||
This option signifies that the target has options of bootloaders
|
||||
that support context restore upon resume from deep sleep
|
||||
This option signifies that the target has options of bootloaders
|
||||
that support context restore upon resume from deep sleep
|
||||
|
||||
|
||||
# End hidden CPU family configs
|
||||
#
|
||||
|
||||
config CPU_HAS_TEE
|
||||
config SIMPLE_FATAL_ERROR_HANDLER
|
||||
prompt "Simple system fatal error handler"
|
||||
bool
|
||||
default n
|
||||
default y if !MULTITHREADING
|
||||
help
|
||||
This option is enabled when the CPU has support for Trusted
|
||||
Execution Environment (e.g. when it has a security attribution
|
||||
unit).
|
||||
|
||||
config CPU_HAS_FPU
|
||||
bool
|
||||
help
|
||||
This option is enabled when the CPU has hardware floating point
|
||||
unit.
|
||||
|
||||
config CPU_HAS_MPU
|
||||
bool
|
||||
# Omit prompt to signify "hidden" option
|
||||
help
|
||||
This option is enabled when the CPU has a Memory Protection Unit (MPU).
|
||||
|
||||
config MEMORY_PROTECTION
|
||||
bool
|
||||
# Omit prompt to signify "hidden" option
|
||||
help
|
||||
This option is enabled when Memory Protection features are supported.
|
||||
Memory protection support is currently available on ARC, ARM, and x86
|
||||
architectures.
|
||||
|
||||
config MPU_REQUIRES_POWER_OF_TWO_ALIGNMENT
|
||||
bool
|
||||
# Omit prompt to signify "hidden" option
|
||||
help
|
||||
This option is enabled when the MPU requires a power of two alignment
|
||||
and size for MPU regions.
|
||||
|
||||
config MPU_REQUIRES_NON_OVERLAPPING_REGIONS
|
||||
bool
|
||||
# Omit prompt to signify "hidden" option
|
||||
help
|
||||
This option is enabled when the MPU requires the active (i.e. enabled)
|
||||
MPU regions to be non-overlapping with each other.
|
||||
|
||||
menuconfig FLOAT
|
||||
bool "Floating point"
|
||||
depends on CPU_HAS_FPU
|
||||
help
|
||||
This option allows threads to use the floating point registers.
|
||||
By default, only a single thread may use the registers.
|
||||
|
||||
Disabling this option means that any thread that uses a
|
||||
floating point register will get a fatal exception.
|
||||
|
||||
if FLOAT
|
||||
|
||||
config FP_SHARING
|
||||
bool "Floating point register sharing"
|
||||
help
|
||||
This option allows multiple threads to use the floating point
|
||||
registers.
|
||||
|
||||
endif # FLOAT
|
||||
Provides an implementation of _SysFatalErrorHandler() that hard hangs
|
||||
instead of aborting the faulting thread, and does not print anything,
|
||||
for footprint-concerned systems. Only enable this option if you do not
|
||||
want debug capabilities in case of system fatal error.
|
||||
|
||||
#
|
||||
# End hidden PM feature configs
|
||||
@@ -469,34 +81,88 @@ endif # FLOAT
|
||||
config ARCH
|
||||
string
|
||||
help
|
||||
System architecture string.
|
||||
System architecture string.
|
||||
|
||||
config SOC
|
||||
string
|
||||
help
|
||||
SoC name which can be found under soc/<arch>/<soc name>.
|
||||
This option holds the directory name used by the build system to locate
|
||||
the correct linker and header files for the SoC.
|
||||
SoC name which can be found under arch/<arch>/soc/<soc name>.
|
||||
This option holds the directory name used by the build system to locate
|
||||
the correct linker and header files for the SoC. This option will go away
|
||||
once all SoCs are using family/series structure.
|
||||
|
||||
config SOC_SERIES
|
||||
string
|
||||
help
|
||||
SoC series name which can be found under soc/<arch>/<family>/<series>.
|
||||
This option holds the directory name used by the build system to locate
|
||||
the correct linker and header files.
|
||||
SoC series name which can be found under arch/<arch>/soc/<family>/<series>.
|
||||
This option holds the directory name used by the build system to locate
|
||||
the correct linker and header files.
|
||||
|
||||
config SOC_FAMILY
|
||||
string
|
||||
help
|
||||
SoC family name which can be found under soc/<arch>/<family>.
|
||||
This option holds the directory name used by the build system to locate
|
||||
the correct linker and header files.
|
||||
SoC family name which can be found under arch/<arch>/soc/<family>.
|
||||
This option holds the directory name used by the build system to locate
|
||||
the correct linker and header files.
|
||||
|
||||
config BOARD
|
||||
string
|
||||
help
|
||||
This option holds the name of the board and is used to locate the files
|
||||
related to the board in the source tree (under boards/).
|
||||
The Board is the first location where we search for a linker.ld file,
|
||||
if not found we look for the linker file in
|
||||
soc/<arch>/<family>/<series>
|
||||
This option holds the name of the board and is used to locate the files
|
||||
related to the board in the source tree (under boards/).
|
||||
The Board is the first location where we search for a linker.ld file,
|
||||
if not found we look for the linker file in
|
||||
arch/<arch>/soc/<family>/<series>
|
||||
|
||||
#
|
||||
# Interrupt related configs
|
||||
#
|
||||
|
||||
config GEN_ISR_TABLES
|
||||
bool
|
||||
prompt "Use generated IRQ tables"
|
||||
default n
|
||||
help
|
||||
This option controls whether a platform uses the gen_isr_tables
|
||||
script to generate its interrupt tables. This mechanism will create
|
||||
an appropriate hardware vector table and/or software IRQ table.
|
||||
|
||||
config GEN_IRQ_VECTOR_TABLE
|
||||
bool
|
||||
prompt "Generate an interrupt vector table"
|
||||
default y
|
||||
depends on GEN_ISR_TABLES
|
||||
help
|
||||
This option controls whether a platform using gen_isr_tables
|
||||
needs an interrupt vector table created. Only disable this if the
|
||||
platform does not use a vector table at all, or requires the vector
|
||||
table to be in a format that is not an array of function pointers
|
||||
indexed by IRQ line. In the latter case, the vector table must be
|
||||
supplied by the application or architecture code.
|
||||
|
||||
config GEN_SW_ISR_TABLE
|
||||
bool
|
||||
prompt "Generate a software ISR table"
|
||||
default y
|
||||
depends on GEN_ISR_TABLES
|
||||
help
|
||||
This option controls whether a platform using gen_isr_tables
|
||||
needs a software ISR table table created. This is an array of struct
|
||||
_isr_table_entry containing the interrupt service routine and supplied
|
||||
parameter.
|
||||
|
||||
config GEN_IRQ_START_VECTOR
|
||||
int
|
||||
default 0
|
||||
depends on GEN_ISR_TABLES
|
||||
help
|
||||
On some architectures, part of the vector table may be reserved for
|
||||
system exceptions and is declared separately from the tables
|
||||
created by gen_isr_tables.py. When creating these tables, this value
|
||||
will be subtracted from CONFIG_NUM_IRQS to properly size them.
|
||||
This is a hidden option which needs to be set per architecture and
|
||||
left alone.
|
||||
|
||||
source "arch/*/Kconfig"
|
||||
|
||||
source "boards/Kconfig"
|
||||
|
||||
1
arch/Makefile
Normal file
1
arch/Makefile
Normal file
@@ -0,0 +1 @@
|
||||
obj-y += common/ $(ARCH)/
|
||||
@@ -1,13 +0,0 @@
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
# Enable debug support in mdb
|
||||
# Dwarf version 2 can be recognized by mdb
|
||||
# The default dwarf version in gdb is not recognized by mdb
|
||||
zephyr_cc_option(-g3 -gdwarf-2)
|
||||
|
||||
# Without this (poorly named) option, compiler may generate undefined
|
||||
# references to abort().
|
||||
# See https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63691
|
||||
zephyr_cc_option(-fno-delete-null-pointer-checks)
|
||||
|
||||
add_subdirectory(core)
|
||||
6
arch/arc/Kbuild
Normal file
6
arch/arc/Kbuild
Normal file
@@ -0,0 +1,6 @@
|
||||
subdir-ccflags-y +=-I$(srctree)/include/drivers
|
||||
subdir-ccflags-y +=-I$(srctree)/drivers
|
||||
subdir-asflags-y += $(subdir-ccflags-y)
|
||||
|
||||
obj-y += soc/$(SOC_PATH)/
|
||||
obj-y += core/
|
||||
255
arch/arc/Kconfig
255
arch/arc/Kconfig
@@ -6,12 +6,39 @@
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
#
|
||||
|
||||
choice
|
||||
prompt "ARC SoC Selection"
|
||||
depends on ARC
|
||||
|
||||
source "arch/arc/soc/*/Kconfig.soc"
|
||||
endchoice
|
||||
|
||||
|
||||
menu "ARC Options"
|
||||
depends on ARC
|
||||
|
||||
config ARCH
|
||||
default "arc"
|
||||
|
||||
config ARCH_DEFCONFIG
|
||||
string
|
||||
default "arch/arc/defconfig"
|
||||
|
||||
config CPU_HAS_MPU
|
||||
bool
|
||||
# Omit prompt to signify "hidden" option
|
||||
default n
|
||||
help
|
||||
This option is enabled when the CPU has a Memory Protection Unit (MPU).
|
||||
|
||||
config CPU_HAS_FPU
|
||||
# Hidden config selected by CPU family
|
||||
bool
|
||||
default n
|
||||
help
|
||||
This option is enabled when the CPU has hardware floating point
|
||||
unit.
|
||||
|
||||
menu "ARC EM4 processor options"
|
||||
|
||||
config CPU_ARCEM4
|
||||
@@ -20,7 +47,7 @@ config CPU_ARCEM4
|
||||
select CPU_ARCV2
|
||||
select ATOMIC_OPERATIONS_C
|
||||
help
|
||||
This option signifies the use of an ARC EM4 CPU
|
||||
This option signifies the use of an ARC EM4 CPU
|
||||
|
||||
endmenu
|
||||
|
||||
@@ -28,8 +55,6 @@ menu "ARCv2 Family Options"
|
||||
|
||||
config CPU_ARCV2
|
||||
bool
|
||||
select ARCH_HAS_STACK_PROTECTION if ARC_HAS_STACK_CHECKING || ARC_MPU
|
||||
select ARCH_HAS_USERSPACE if ARC_MPU
|
||||
default y
|
||||
help
|
||||
This option signifies the use of a CPU of the ARCv2 family.
|
||||
@@ -43,7 +68,8 @@ config DATA_ENDIANNESS_LITTLE
|
||||
implemented as big endian.
|
||||
|
||||
config NUM_IRQ_PRIO_LEVELS
|
||||
int "Number of supported interrupt priority levels"
|
||||
int
|
||||
prompt "Number of supported interrupt priority levels"
|
||||
range 1 16
|
||||
help
|
||||
Interrupt priorities available will be 0 to NUM_IRQ_PRIO_LEVELS-1.
|
||||
@@ -52,7 +78,8 @@ config NUM_IRQ_PRIO_LEVELS
|
||||
The BSP must provide a valid default for proper operation.
|
||||
|
||||
config NUM_IRQS
|
||||
int "Upper limit of interrupt numbers/IDs used"
|
||||
int
|
||||
prompt "Upper limit of interrupt numbers/IDs used"
|
||||
range 17 256
|
||||
help
|
||||
Interrupts available will be 0 to NUM_IRQS-1.
|
||||
@@ -63,74 +90,55 @@ config NUM_IRQS
|
||||
vector table.
|
||||
|
||||
config RGF_NUM_BANKS
|
||||
int "Number of General Purpose Register Banks"
|
||||
int
|
||||
prompt "Number of General Purpose Register Banks"
|
||||
depends on CPU_ARCV2
|
||||
range 1 2
|
||||
default 2
|
||||
help
|
||||
The ARC CPU can be configured to have more than one register
|
||||
bank. If fast interrupts are supported (FIRQ), the 2nd
|
||||
register bank, in the set, will be used by FIRQ interrupts.
|
||||
If fast interrupts are supported but there is only 1
|
||||
register bank, the fast interrupt handler must save
|
||||
and restore general purpose registers.
|
||||
The ARC CPU can be configured to have more than one register
|
||||
bank. If fast interrupts are supported (FIRQ), the 2nd
|
||||
register bank, in the set, will be used by FIRQ interrupts.
|
||||
If fast interrupts are supported but there is only 1
|
||||
register bank, the fast interrupt handler must save
|
||||
and restore general purpose registers.
|
||||
|
||||
config ARC_FIRQ
|
||||
bool "FIRQ enable"
|
||||
default y
|
||||
help
|
||||
Fast interrupts are supported (FIRQ). If FIRQ enabled, for interrupts
|
||||
with highest priority, status32 and pc will be saved in aux regs,
|
||||
other regs will be saved according to the number of register bank;
|
||||
If FIRQ is disabled, the handle of interrupts with highest priority
|
||||
will be same with other interrupts.
|
||||
|
||||
config ARC_HAS_STACK_CHECKING
|
||||
bool "ARC has STACK_CHECKING"
|
||||
default y
|
||||
help
|
||||
ARC is configured with STACK_CHECKING which is a mechanism for
|
||||
checking stack accesses and raising an exception when a stack
|
||||
overflow or underflow is detected.
|
||||
|
||||
config ARC_STACK_CHECKING
|
||||
bool
|
||||
help
|
||||
Use ARC STACK_CHECKING to do stack protection
|
||||
|
||||
config ARC_STACK_PROTECTION
|
||||
bool
|
||||
default y if HW_STACK_PROTECTION
|
||||
select ARC_STACK_CHECKING if ARC_HAS_STACK_CHECKING
|
||||
select MPU_STACK_GUARD if (!ARC_STACK_CHECKING && ARC_MPU)
|
||||
config ARC_STACK_CHECKING
|
||||
bool "Enable Stack Checking"
|
||||
depends on CPU_ARCV2
|
||||
select THREAD_STACK_INFO
|
||||
default n
|
||||
help
|
||||
This option enables either:
|
||||
- The ARC stack checking, or
|
||||
- the MPU-based stack guard
|
||||
to cause a system fatal error
|
||||
if the bounds of the current process stack are overflowed.
|
||||
The two stack guard options are mutually exclusive. The
|
||||
selection of the ARC stack checking is
|
||||
prioritized over the MPU-based stack guard.
|
||||
ARCV2 has a special feature allowing to check stack overflows. This
|
||||
enables code that allows using this debug feature
|
||||
|
||||
config FAULT_DUMP
|
||||
int "Fault dump level"
|
||||
int
|
||||
prompt "Fault dump level"
|
||||
default 2
|
||||
range 0 2
|
||||
help
|
||||
Different levels for display information when a fault occurs.
|
||||
Different levels for display information when a fault occurs.
|
||||
|
||||
2: The default. Display specific and verbose information. Consumes
|
||||
2: The default. Display specific and verbose information. Consumes
|
||||
the most memory (long strings).
|
||||
|
||||
1: Display general and short information. Consumes less memory
|
||||
1: Display general and short information. Consumes less memory
|
||||
(short strings).
|
||||
|
||||
0: Off.
|
||||
0: Off.
|
||||
|
||||
config IRQ_OFFLOAD
|
||||
bool "Enable IRQ offload"
|
||||
default n
|
||||
help
|
||||
Enable irq_offload() API which allows functions to be synchronously
|
||||
run in interrupt context. Uses one entry in the IDT. Mainly useful
|
||||
for test cases.
|
||||
|
||||
config XIP
|
||||
default y if !UART_NSIM
|
||||
default n if NSIM
|
||||
default y
|
||||
|
||||
config GEN_ISR_TABLES
|
||||
default y
|
||||
@@ -139,28 +147,53 @@ config GEN_IRQ_START_VECTOR
|
||||
default 16
|
||||
|
||||
config HARVARD
|
||||
bool "Harvard Architecture"
|
||||
prompt "Harvard Architecture"
|
||||
bool
|
||||
default n
|
||||
help
|
||||
The ARC CPU can be configured to have two busses;
|
||||
one for instruction fetching and another that serves as a data bus.
|
||||
The ARC CPU can be configured to have two busses;
|
||||
one for instruction fetching and another that serves as a data bus.
|
||||
|
||||
config CODE_DENSITY
|
||||
bool "Code Density Option"
|
||||
help
|
||||
Enable code density option to get better code density
|
||||
|
||||
config ARC_HAS_SECURE
|
||||
prompt "Code Density Option"
|
||||
bool
|
||||
# a hidden option
|
||||
default n
|
||||
help
|
||||
This option is enabled when ARC core supports secure mode
|
||||
Enable code density option to get better code density
|
||||
|
||||
menu "Floating Point Options"
|
||||
depends on CPU_HAS_FPU
|
||||
|
||||
config FLOAT
|
||||
bool
|
||||
prompt "Floating point registers"
|
||||
default n
|
||||
help
|
||||
This option allows tasks and fibers to use the floating point registers.
|
||||
By default, only a single task or fiber may use the registers.
|
||||
|
||||
Disabling this option means that any task or fiber that uses a
|
||||
floating point register will get a fatal exception.
|
||||
|
||||
config FP_SHARING
|
||||
bool
|
||||
prompt "Floating point register sharing"
|
||||
depends on FLOAT
|
||||
default n
|
||||
help
|
||||
This option allows multiple tasks and fibers to use the floating point
|
||||
registers.
|
||||
|
||||
endmenu
|
||||
|
||||
menu "ARC MPU Options"
|
||||
depends on CPU_HAS_MPU
|
||||
|
||||
config ARC_MPU_ENABLE
|
||||
bool "Enable MPU"
|
||||
depends on CPU_HAS_MPU
|
||||
select ARC_MPU
|
||||
default n
|
||||
help
|
||||
Enable MPU
|
||||
|
||||
@@ -168,35 +201,99 @@ source "arch/arc/core/mpu/Kconfig"
|
||||
|
||||
endmenu
|
||||
|
||||
config CACHE_LINE_SIZE_DETECT
|
||||
bool "Detect d-cache line size at runtime"
|
||||
config ICCM_SIZE
|
||||
int "ICCM Size in kB"
|
||||
help
|
||||
This option enables querying the d-cache build register for finding
|
||||
the d-cache line size at the expense of taking more memory and code
|
||||
and a slightly increased boot time.
|
||||
This option specifies the size of the ICCM in kB. It is normally set by
|
||||
the board's defconfig file and the user should generally avoid modifying
|
||||
it via the menu configuration.
|
||||
|
||||
If the CPU's d-cache line size is known in advance, disable this
|
||||
option and manually enter the value for CACHE_LINE_SIZE.
|
||||
config ICCM_BASE_ADDRESS
|
||||
hex "ICCM Base Address"
|
||||
help
|
||||
This option specifies the base address of the ICCM on the board. It is
|
||||
normally set by the board's defconfig file and the user should generally
|
||||
avoid modifying it via the menu configuration.
|
||||
|
||||
config DCCM_SIZE
|
||||
int "DCCM Size in kB"
|
||||
help
|
||||
This option specifies the size of the DCCM in kB. It is normally set by
|
||||
the board's defconfig file and the user should generally avoid modifying
|
||||
it via the menu configuration.
|
||||
|
||||
config DCCM_BASE_ADDRESS
|
||||
hex "DCCM Base Address"
|
||||
help
|
||||
This option specifies the base address of the DCCM on the board. It is
|
||||
normally set by the board's defconfig file and the user should generally
|
||||
avoid modifying it via the menu configuration.
|
||||
|
||||
config SRAM_SIZE
|
||||
int "SRAM Size in kB"
|
||||
help
|
||||
This option specifies the size of the SRAM in kB. It is normally set by
|
||||
the board's defconfig file and the user should generally avoid modifying
|
||||
it via the menu configuration.
|
||||
|
||||
config SRAM_BASE_ADDRESS
|
||||
hex "SRAM Base Address"
|
||||
help
|
||||
This option specifies the base address of the SRAM on the board. It is
|
||||
normally set by the board's defconfig file and the user should generally
|
||||
avoid modifying it via the menu configuration.
|
||||
|
||||
config FLASH_SIZE
|
||||
int "Flash Size in kB"
|
||||
help
|
||||
This option specifies the size of the flash in kB. It is normally set by
|
||||
the board's defconfig file and the user should generally avoid modifying
|
||||
it via the menu configuration.
|
||||
|
||||
config FLASH_BASE_ADDRESS
|
||||
hex "Flash Base Address"
|
||||
help
|
||||
This option specifies the base address of the flash on the board. It is
|
||||
normally set by the board's defconfig file and the user should generally
|
||||
avoid modifying it via the menu configuration.
|
||||
|
||||
config CACHE_LINE_SIZE_DETECT
|
||||
bool
|
||||
prompt "Detect d-cache line size at runtime"
|
||||
default n
|
||||
help
|
||||
This option enables querying the d-cache build register for finding
|
||||
the d-cache line size at the expense of taking more memory and code
|
||||
and a slightly increased boot time.
|
||||
|
||||
If the CPU's d-cache line size is known in advance, disable this
|
||||
option and manually enter the value for CACHE_LINE_SIZE.
|
||||
|
||||
config CACHE_LINE_SIZE
|
||||
int "Cache line size" if !CACHE_LINE_SIZE_DETECT
|
||||
int
|
||||
prompt "Cache line size" if !CACHE_LINE_SIZE_DETECT
|
||||
default 32
|
||||
help
|
||||
Size in bytes of a CPU d-cache line.
|
||||
Size in bytes of a CPU d-cache line.
|
||||
|
||||
Detect automatically at runtime by selecting CACHE_LINE_SIZE_DETECT.
|
||||
Detect automatically at runtime by selecting CACHE_LINE_SIZE_DETECT.
|
||||
|
||||
config ARCH_CACHE_FLUSH_DETECT
|
||||
bool
|
||||
default n
|
||||
|
||||
config CACHE_FLUSHING
|
||||
bool "Enable d-cache flushing mechanism"
|
||||
bool
|
||||
default n
|
||||
prompt "Enable d-cache flushing mechanism"
|
||||
help
|
||||
This links in the sys_cache_flush() function, which provides a
|
||||
way to flush multiple lines of the d-cache.
|
||||
If the d-cache is present, set this to y.
|
||||
If the d-cache is NOT present, set this to n.
|
||||
This links in the sys_cache_flush() function, which provides a
|
||||
way to flush multiple lines of the d-cache.
|
||||
If the d-cache is present, set this to y.
|
||||
If the d-cache is NOT present, set this to n.
|
||||
|
||||
endmenu
|
||||
|
||||
source "arch/arc/soc/*/Kconfig"
|
||||
|
||||
endmenu
|
||||
|
||||
24
arch/arc/Makefile
Normal file
24
arch/arc/Makefile
Normal file
@@ -0,0 +1,24 @@
|
||||
# Enable debug support in mdb
|
||||
# Dwarf version 2 can be recognized by mdb
|
||||
# The default dwarf version in gdb is not recognized by mdb
|
||||
cflags-y += $(call cc-option, -g3 -gdwarf-2)
|
||||
|
||||
cflags-y += $(call cc-option,-ffunction-sections,) $(call cc-option,-fdata-sections,)
|
||||
|
||||
# Without this (poorly named) option, compiler may generate undefined
|
||||
# references to abort().
|
||||
# See https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63691
|
||||
cflags-y += $(call cc-option,-fno-delete-null-pointer-checks)
|
||||
|
||||
cflags-$(CONFIG_LTO) = $(call cc-option,-flto,)
|
||||
|
||||
include $(srctree)/arch/$(ARCH)/soc/$(SOC_PATH)/Makefile
|
||||
|
||||
KBUILD_CFLAGS += $(cflags-y)
|
||||
KBUILD_CXXFLAGS += $(cflags-y)
|
||||
|
||||
soc-cxxflags ?= $(soc-cflags)
|
||||
soc-aflags ?= $(soc-cflags)
|
||||
KBUILD_CFLAGS += $(soc-cflags)
|
||||
KBUILD_CXXFLAGS += $(soc-cxxflags)
|
||||
KBUILD_AFLAGS += $(soc-aflags)
|
||||
@@ -1,29 +0,0 @@
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
zephyr_library()
|
||||
|
||||
zephyr_library_sources(
|
||||
thread.c
|
||||
thread_entry_wrapper.S
|
||||
cpu_idle.S
|
||||
fatal.c
|
||||
fault.c
|
||||
fault_s.S
|
||||
irq_manage.c
|
||||
cache.c
|
||||
timestamp.c
|
||||
isr_wrapper.S
|
||||
regular_irq.S
|
||||
swap.S
|
||||
sys_fatal_error_handler.c
|
||||
prep_c.c
|
||||
reset.S
|
||||
vector_table.c
|
||||
)
|
||||
|
||||
zephyr_library_sources_ifdef(CONFIG_ARC_FIRQ fast_irq.S)
|
||||
|
||||
zephyr_library_sources_if_kconfig(irq_offload.c)
|
||||
zephyr_library_sources_ifdef(CONFIG_ATOMIC_OPERATIONS_CUSTOM atomic.c)
|
||||
add_subdirectory_ifdef(CONFIG_ARC_CORE_MPU mpu)
|
||||
zephyr_library_sources_ifdef(CONFIG_USERSPACE userspace.S)
|
||||
20
arch/arc/core/Makefile
Normal file
20
arch/arc/core/Makefile
Normal file
@@ -0,0 +1,20 @@
|
||||
ccflags-y += -I$(srctree)/kernel/include
|
||||
ccflags-y +=-I$(srctree)/arch/$(ARCH)/include
|
||||
|
||||
obj-y += thread.o thread_entry_wrapper.o \
|
||||
cpu_idle.o fast_irq.o fatal.o fault.o \
|
||||
fault_s.o irq_manage.o cache.o timestamp.o \
|
||||
isr_wrapper.o regular_irq.o swap.o \
|
||||
sys_fatal_error_handler.o
|
||||
|
||||
obj-y += prep_c.o \
|
||||
reset.o \
|
||||
vector_table.o
|
||||
|
||||
obj-$(CONFIG_IRQ_OFFLOAD) += irq_offload.o
|
||||
|
||||
# Some ARC cores like the EM4 lack the atomic LLOCK/SCOND and
|
||||
# can't use these.
|
||||
obj-$(CONFIG_ATOMIC_OPERATIONS_CUSTOM) += atomic.o
|
||||
|
||||
obj-$(CONFIG_CPU_HAS_MPU) += mpu/
|
||||
@@ -20,10 +20,9 @@
|
||||
#include <cache.h>
|
||||
#include <linker/linker-defs.h>
|
||||
#include <arch/arc/v2/aux_regs.h>
|
||||
#include <kernel_internal.h>
|
||||
#include <nano_internal.h>
|
||||
#include <misc/__assert.h>
|
||||
#include <init.h>
|
||||
#include <stdbool.h>
|
||||
|
||||
#if defined(CONFIG_CACHE_FLUSHING)
|
||||
|
||||
@@ -49,19 +48,19 @@
|
||||
#define DC_CTRL_OP_SUCCEEDED 0x4 /* d-cache operation succeeded */
|
||||
|
||||
|
||||
static bool dcache_available(void)
|
||||
static int dcache_available(void)
|
||||
{
|
||||
unsigned long val = z_arc_v2_aux_reg_read(_ARC_V2_D_CACHE_BUILD);
|
||||
unsigned long val = _arc_v2_aux_reg_read(_ARC_V2_D_CACHE_BUILD);
|
||||
|
||||
val &= 0xff; /* extract version */
|
||||
return (val == 0) ? false : true;
|
||||
return (val == 0)?0:1;
|
||||
}
|
||||
|
||||
static void dcache_dc_ctrl(u32_t dcache_en_mask)
|
||||
{
|
||||
if (dcache_available()) {
|
||||
z_arc_v2_aux_reg_write(_ARC_V2_DC_CTRL, dcache_en_mask);
|
||||
}
|
||||
if (!dcache_available())
|
||||
return;
|
||||
_arc_v2_aux_reg_write(_ARC_V2_DC_CTRL, dcache_en_mask);
|
||||
}
|
||||
|
||||
static void dcache_enable(void)
|
||||
@@ -91,7 +90,7 @@ static void dcache_flush_mlines(u32_t start_addr, u32_t size)
|
||||
u32_t end_addr;
|
||||
unsigned int key;
|
||||
|
||||
if (!dcache_available() || (size == 0U)) {
|
||||
if (!dcache_available() || (size == 0)) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -101,16 +100,15 @@ static void dcache_flush_mlines(u32_t start_addr, u32_t size)
|
||||
key = irq_lock(); /* --enter critical section-- */
|
||||
|
||||
do {
|
||||
z_arc_v2_aux_reg_write(_ARC_V2_DC_FLDL, start_addr);
|
||||
_arc_v2_aux_reg_write(_ARC_V2_DC_FLDL, start_addr);
|
||||
__asm__ volatile("nop_s");
|
||||
__asm__ volatile("nop_s");
|
||||
__asm__ volatile("nop_s");
|
||||
/* wait for flush completion */
|
||||
do {
|
||||
if ((z_arc_v2_aux_reg_read(_ARC_V2_DC_CTRL) &
|
||||
DC_CTRL_FLUSH_STATUS) == 0) {
|
||||
if ((_arc_v2_aux_reg_read(_ARC_V2_DC_CTRL) &
|
||||
DC_CTRL_FLUSH_STATUS) == 0)
|
||||
break;
|
||||
}
|
||||
} while (1);
|
||||
start_addr += DCACHE_LINE_SIZE;
|
||||
} while (start_addr <= end_addr);
|
||||
@@ -149,10 +147,10 @@ static void init_dcache_line_size(void)
|
||||
{
|
||||
u32_t val;
|
||||
|
||||
val = z_arc_v2_aux_reg_read(_ARC_V2_D_CACHE_BUILD);
|
||||
__ASSERT((val&0xff) != 0U, "d-cache is not present");
|
||||
val = _arc_v2_aux_reg_read(_ARC_V2_D_CACHE_BUILD);
|
||||
__ASSERT((val&0xff) != 0, "d-cache is not present");
|
||||
val = ((val>>16) & 0xf) + 1;
|
||||
val *= 16U;
|
||||
val *= 16;
|
||||
sys_cache_line_size = (size_t) val;
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -35,9 +35,9 @@ SECTION_VAR(BSS, k_cpu_sleep_mode)
|
||||
|
||||
SECTION_FUNC(TEXT, k_cpu_idle)
|
||||
|
||||
#ifdef CONFIG_TRACING
|
||||
#ifdef CONFIG_KERNEL_EVENT_LOGGER_SLEEP
|
||||
push_s blink
|
||||
jl z_sys_trace_idle
|
||||
jl _sys_k_event_logger_enter_sleep
|
||||
pop_s blink
|
||||
#endif
|
||||
|
||||
@@ -56,9 +56,9 @@ SECTION_FUNC(TEXT, k_cpu_idle)
|
||||
*/
|
||||
SECTION_FUNC(TEXT, k_cpu_atomic_idle)
|
||||
|
||||
#ifdef CONFIG_TRACING
|
||||
#ifdef CONFIG_KERNEL_EVENT_LOGGER_SLEEP
|
||||
push_s blink
|
||||
jl z_sys_trace_idle
|
||||
jl _sys_k_event_logger_enter_sleep
|
||||
pop_s blink
|
||||
#endif
|
||||
|
||||
|
||||
@@ -60,21 +60,14 @@ SECTION_FUNC(TEXT, _firq_enter)
|
||||
* This has already been done by _isr_wrapper.
|
||||
*/
|
||||
#ifdef CONFIG_ARC_STACK_CHECKING
|
||||
#ifdef CONFIG_ARC_HAS_SECURE
|
||||
lr r2, [_ARC_V2_SEC_STAT]
|
||||
bclr r2, r2, _ARC_V2_SEC_STAT_SSC_BIT
|
||||
/* sflag r2 */
|
||||
/* sflag instruction is not supported in current ARC GNU */
|
||||
.long 0x00bf302f
|
||||
#else
|
||||
/* disable stack checking */
|
||||
lr r2, [_ARC_V2_STATUS32]
|
||||
bclr r2, r2, _ARC_V2_STATUS32_SC_BIT
|
||||
kflag r2
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if CONFIG_RGF_NUM_BANKS != 1
|
||||
#ifndef CONFIG_FIRQ_NO_LPCC
|
||||
/*
|
||||
* Save LP_START/LP_COUNT/LP_END because called handler might use.
|
||||
* Save these in callee saved registers to avoid using memory.
|
||||
@@ -83,6 +76,7 @@ SECTION_FUNC(TEXT, _firq_enter)
|
||||
mov r23,lp_count
|
||||
lr r24, [_ARC_V2_LP_START]
|
||||
lr r25, [_ARC_V2_LP_END]
|
||||
#endif
|
||||
#endif
|
||||
|
||||
ld r1, [exc_nest_count]
|
||||
@@ -129,35 +123,37 @@ firq_nest:
|
||||
|
||||
SECTION_FUNC(TEXT, _firq_exit)
|
||||
|
||||
pop sp
|
||||
|
||||
#if CONFIG_RGF_NUM_BANKS != 1
|
||||
#ifndef CONFIG_FIRQ_NO_LPCC
|
||||
/* restore lp_count, lp_start, lp_end from r23-r25 */
|
||||
mov lp_count,r23
|
||||
sr r24, [_ARC_V2_LP_START]
|
||||
sr r25, [_ARC_V2_LP_END]
|
||||
#endif
|
||||
#endif
|
||||
/* check if we're a nested interrupt: if so, let the interrupted
|
||||
* interrupt handle the reschedule */
|
||||
mov r1, exc_nest_count
|
||||
ld r0, [r1]
|
||||
sub r0, r0, 1
|
||||
cmp r0, 0
|
||||
bne.d _firq_no_reschedule
|
||||
st r0, [r1]
|
||||
/* see comments in _rirq_exit */
|
||||
lr r0, [_ARC_V2_AUX_IRQ_ACT]
|
||||
and r0, r0, 0xffff
|
||||
ffs r1, r0
|
||||
fls r2, r0
|
||||
cmp r1, r2
|
||||
jne _firq_no_reschedule
|
||||
|
||||
#ifdef CONFIG_STACK_SENTINEL
|
||||
bl z_check_stack_sentinel
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_PREEMPT_ENABLED
|
||||
|
||||
mov_s r1, _kernel
|
||||
ld_s r2, [r1, _kernel_offset_to_current]
|
||||
|
||||
/*
|
||||
* Non-preemptible thread ? Do not schedule (see explanation of
|
||||
* preempt field in kernel_struct.h).
|
||||
*/
|
||||
ldh_s r0, [r2, _thread_offset_to_preempt]
|
||||
brhs r0, _NON_PREEMPT_THRESHOLD, _firq_no_reschedule
|
||||
|
||||
/* Check if the current thread (in r2) is the cached thread */
|
||||
ld_s r0, [r1, _kernel_offset_to_ready_q_cache]
|
||||
brne r0, r2, _firq_reschedule
|
||||
@@ -168,8 +164,6 @@ SECTION_FUNC(TEXT, _firq_exit)
|
||||
|
||||
.balign 4
|
||||
_firq_no_reschedule:
|
||||
pop sp
|
||||
|
||||
/*
|
||||
* Keeping this code block close to those that use it allows using brxx
|
||||
* instruction instead of a pair of cmp and bxx
|
||||
@@ -213,7 +207,6 @@ _firq_no_reschedule:
|
||||
|
||||
.balign 4
|
||||
_firq_reschedule:
|
||||
pop sp
|
||||
|
||||
#if CONFIG_RGF_NUM_BANKS != 1
|
||||
/*
|
||||
@@ -222,36 +215,11 @@ _firq_reschedule:
|
||||
* registers from the interrupted thread.
|
||||
*/
|
||||
|
||||
#if defined(CONFIG_USERSPACE)
|
||||
/* when USERSPACE is configured, here need to consider the case where firq comes
|
||||
* out in user mode, according to ARCv2 ISA and nsim, the following micro ops
|
||||
* will be executed:
|
||||
* sp<-reg bank1'sp
|
||||
* switch between sp and _ARC_V2_USER_SP
|
||||
* then:
|
||||
* sp is the sp of kernel stack of interrupted thread
|
||||
* _ARC_V2_USER_SP is reg bank1'sp
|
||||
* the sp of user stack of interrupted thread is reg bank0'sp
|
||||
* if firq comes out in kernel mode, the following micro ops will be executed:
|
||||
* sp<-reg bank'sp
|
||||
* so, sw needs to do necessary handling to set up the correct sp
|
||||
*/
|
||||
lr r0, [_ARC_V2_AUX_IRQ_ACT]
|
||||
bbit0 r0, 31, _firq_from_kernel
|
||||
aex sp, [_ARC_V2_USER_SP]
|
||||
lr r0, [_ARC_V2_STATUS32]
|
||||
and r0, r0, ~_ARC_V2_STATUS32_RB(7)
|
||||
kflag r0
|
||||
aex sp, [_ARC_V2_USER_SP]
|
||||
b _firq_create_irq_stack_frame
|
||||
_firq_from_kernel:
|
||||
#endif
|
||||
/* chose register bank #0 */
|
||||
lr r0, [_ARC_V2_STATUS32]
|
||||
and r0, r0, ~_ARC_V2_STATUS32_RB(7)
|
||||
kflag r0
|
||||
|
||||
_firq_create_irq_stack_frame:
|
||||
/* we're back on the outgoing thread's stack */
|
||||
_create_irq_stack_frame
|
||||
|
||||
@@ -266,24 +234,6 @@ _firq_create_irq_stack_frame:
|
||||
st ilink, [sp, ___isf_t_pc_OFFSET] /* ilink into pc */
|
||||
#endif
|
||||
|
||||
#if defined(CONFIG_USERSPACE)
|
||||
/*
|
||||
* when USERSPACE is enabled, according to ARCv2 ISA, SP will be switched
|
||||
* if interrupt comes out in user mode, and will be recorded in bit 31
|
||||
* (U bit) of IRQ_ACT. when interrupt exits, SP will be switched back
|
||||
* according to U bit.
|
||||
*
|
||||
* need to remember the user/kernel status of interrupted thread, will be
|
||||
* restored when thread switched back
|
||||
*
|
||||
*/
|
||||
lr r4, [_ARC_V2_AUX_IRQ_ACT]
|
||||
and r3, r4, 0x80000000
|
||||
push_s r3
|
||||
|
||||
bclr r4, r4, 31
|
||||
sr r4, [_ARC_V2_AUX_IRQ_ACT]
|
||||
#endif
|
||||
mov_s r1, _kernel
|
||||
ld_s r2, [r1, _kernel_offset_to_current]
|
||||
|
||||
@@ -295,7 +245,11 @@ _firq_create_irq_stack_frame:
|
||||
st_s r2, [r1, _kernel_offset_to_current]
|
||||
|
||||
#ifdef CONFIG_ARC_STACK_CHECKING
|
||||
_load_stack_check_regs
|
||||
/* Use stack top and base registers from restored context */
|
||||
ld r3, [r2, _thread_offset_to_stack_base]
|
||||
sr r3, [_ARC_V2_KSTACK_BASE]
|
||||
ld r3, [r2, _thread_offset_to_stack_top]
|
||||
sr r3, [_ARC_V2_KSTACK_TOP]
|
||||
#endif
|
||||
/*
|
||||
* _load_callee_saved_regs expects incoming thread in r2.
|
||||
@@ -303,22 +257,14 @@ _firq_create_irq_stack_frame:
|
||||
*/
|
||||
_load_callee_saved_regs
|
||||
|
||||
#if defined(CONFIG_MPU_STACK_GUARD) || defined(CONFIG_USERSPACE)
|
||||
#ifdef CONFIG_MPU_STACK_GUARD
|
||||
push_s r2
|
||||
mov r0, r2
|
||||
bl configure_mpu_thread
|
||||
bl configure_mpu_stack_guard
|
||||
pop_s r2
|
||||
#endif
|
||||
|
||||
#if defined(CONFIG_USERSPACE)
|
||||
/*
|
||||
* see comments in regular_irq.S
|
||||
*/
|
||||
lr r0, [_ARC_V2_AUX_IRQ_ACT]
|
||||
bclr r0, r0, 31
|
||||
sr r0, [_ARC_V2_AUX_IRQ_ACT]
|
||||
#endif
|
||||
ld r3, [r2, _thread_offset_to_relinquish_cause]
|
||||
ld_s r3, [r2, _thread_offset_to_relinquish_cause]
|
||||
|
||||
breq r3, _CAUSE_RIRQ, _firq_return_from_rirq
|
||||
nop
|
||||
@@ -330,7 +276,7 @@ _firq_create_irq_stack_frame:
|
||||
.balign 4
|
||||
_firq_return_from_coop:
|
||||
|
||||
ld r3, [r2, _thread_offset_to_intlock_key]
|
||||
ld_s r3, [r2, _thread_offset_to_intlock_key]
|
||||
st 0, [r2, _thread_offset_to_intlock_key]
|
||||
|
||||
/* pc into ilink */
|
||||
@@ -340,7 +286,7 @@ _firq_return_from_coop:
|
||||
pop_s r0 /* status32 into r0 */
|
||||
/*
|
||||
* There are only two interrupt lock states: locked and unlocked. When
|
||||
* entering z_swap(), they are always locked, so the IE bit is unset in
|
||||
* entering _Swap(), they are always locked, so the IE bit is unset in
|
||||
* status32. If the incoming thread had them locked recursively, it
|
||||
* means that the IE bit should stay unset. The only time the bit
|
||||
* has to change is if they were not locked recursively.
|
||||
@@ -349,45 +295,19 @@ _firq_return_from_coop:
|
||||
or.nz r0, r0, _ARC_V2_STATUS32_IE
|
||||
sr r0, [_ARC_V2_STATUS32_P0]
|
||||
|
||||
#ifdef CONFIG_TRACING
|
||||
push_s blink
|
||||
push_s r2
|
||||
|
||||
bl sys_trace_thread_switched_in
|
||||
|
||||
pop_s r2
|
||||
pop_s blink
|
||||
#endif
|
||||
|
||||
ld r0, [r2, _thread_offset_to_return_value]
|
||||
ld_s r0, [r2, _thread_offset_to_return_value]
|
||||
rtie
|
||||
|
||||
.balign 4
|
||||
_firq_return_from_rirq:
|
||||
_firq_return_from_firq:
|
||||
|
||||
#if defined(CONFIG_USERSPACE)
|
||||
/*
|
||||
* need to recover the user/kernel status of interrupted thread
|
||||
*/
|
||||
pop_s r3
|
||||
lr r2, [_ARC_V2_AUX_IRQ_ACT]
|
||||
or r2, r2, r3
|
||||
sr r2, [_ARC_V2_AUX_IRQ_ACT]
|
||||
#endif
|
||||
_pop_irq_stack_frame
|
||||
|
||||
ld ilink, [sp, -4] /* status32 into ilink */
|
||||
sr ilink, [_ARC_V2_STATUS32_P0]
|
||||
ld ilink, [sp, -8] /* pc into ilink */
|
||||
|
||||
#ifdef CONFIG_TRACING
|
||||
push_s blink
|
||||
|
||||
bl sys_trace_thread_switched_in
|
||||
|
||||
pop_s blink
|
||||
#endif
|
||||
/* LP registers are already restored, just switch back to bank 0 */
|
||||
rtie
|
||||
|
||||
|
||||
@@ -17,7 +17,10 @@
|
||||
#include <toolchain.h>
|
||||
#include <arch/cpu.h>
|
||||
#include <misc/printk.h>
|
||||
#include <logging/log_ctrl.h>
|
||||
|
||||
const NANO_ESF _default_esf = {
|
||||
0xdeaddead, /* placeholder */
|
||||
};
|
||||
|
||||
/**
|
||||
*
|
||||
@@ -25,7 +28,7 @@
|
||||
*
|
||||
* This routine is called when fatal error conditions are detected by software
|
||||
* and is responsible only for reporting the error. Once reported, it then
|
||||
* invokes the user provided routine z_SysFatalErrorHandler() which is
|
||||
* invokes the user provided routine _SysFatalErrorHandler() which is
|
||||
* responsible for implementing the error handling policy.
|
||||
*
|
||||
* The caller is expected to always provide a usable ESF. In the event that the
|
||||
@@ -34,16 +37,18 @@
|
||||
*
|
||||
* @return This function does not return.
|
||||
*/
|
||||
void z_NanoFatalErrorHandler(unsigned int reason, const NANO_ESF *pEsf)
|
||||
FUNC_NORETURN void _NanoFatalErrorHandler(unsigned int reason,
|
||||
const NANO_ESF *pEsf)
|
||||
{
|
||||
LOG_PANIC();
|
||||
|
||||
switch (reason) {
|
||||
case _NANO_ERR_HW_EXCEPTION:
|
||||
break;
|
||||
|
||||
#if defined(CONFIG_STACK_CANARIES) || defined(CONFIG_ARC_STACK_CHECKING) \
|
||||
|| defined(CONFIG_STACK_SENTINEL) || defined(CONFIG_MPU_STACK_GUARD)
|
||||
case _NANO_ERR_INVALID_TASK_EXIT:
|
||||
printk("***** Invalid Exit Software Error! *****\n");
|
||||
break;
|
||||
|
||||
#if defined(CONFIG_STACK_CANARIES) || defined(CONFIG_ARC_STACK_CHECKING)
|
||||
case _NANO_ERR_STACK_CHK_FAIL:
|
||||
printk("***** Stack Check Fail! *****\n");
|
||||
break;
|
||||
@@ -65,13 +70,10 @@ void z_NanoFatalErrorHandler(unsigned int reason, const NANO_ESF *pEsf)
|
||||
printk("**** Unknown Fatal Error %d! ****\n", reason);
|
||||
break;
|
||||
}
|
||||
|
||||
printk("Current thread ID = %p\n", k_current_get());
|
||||
|
||||
if (reason == _NANO_ERR_HW_EXCEPTION) {
|
||||
printk("Faulting instruction address = 0x%lx\n",
|
||||
z_arc_v2_aux_reg_read(_ARC_V2_ERET));
|
||||
}
|
||||
printk("Current thread ID = %p\n"
|
||||
"Faulting instruction address = 0x%lx\n",
|
||||
k_current_get(),
|
||||
_arc_v2_aux_reg_read(_ARC_V2_ERET));
|
||||
|
||||
/*
|
||||
* Now that the error has been reported, call the user implemented
|
||||
@@ -81,12 +83,8 @@ void z_NanoFatalErrorHandler(unsigned int reason, const NANO_ESF *pEsf)
|
||||
* decide.
|
||||
*/
|
||||
|
||||
z_SysFatalErrorHandler(reason, pEsf);
|
||||
}
|
||||
_SysFatalErrorHandler(reason, pEsf);
|
||||
|
||||
FUNC_NORETURN void z_arch_syscall_oops(void *ssf_ptr)
|
||||
{
|
||||
LOG_PANIC();
|
||||
z_SysFatalErrorHandler(_NANO_ERR_KERNEL_OOPS, ssf_ptr);
|
||||
CODE_UNREACHABLE;
|
||||
for (;;)
|
||||
;
|
||||
}
|
||||
|
||||
@@ -18,149 +18,26 @@
|
||||
#include <kernel.h>
|
||||
#include <kernel_structs.h>
|
||||
#include <misc/printk.h>
|
||||
#include <exc_handle.h>
|
||||
#include <logging/log_ctrl.h>
|
||||
|
||||
u32_t arc_exc_saved_sp;
|
||||
|
||||
#ifdef CONFIG_USERSPACE
|
||||
Z_EXC_DECLARE(z_arch_user_string_nlen);
|
||||
|
||||
static const struct z_exc_handle exceptions[] = {
|
||||
Z_EXC_HANDLE(z_arch_user_string_nlen)
|
||||
};
|
||||
#endif
|
||||
|
||||
#if defined(CONFIG_MPU_STACK_GUARD)
|
||||
|
||||
#define IS_MPU_GUARD_VIOLATION(guard_start, fault_addr, stack_ptr) \
|
||||
((fault_addr >= guard_start) && \
|
||||
(fault_addr < (guard_start + STACK_GUARD_SIZE)) && \
|
||||
(stack_ptr <= (guard_start + STACK_GUARD_SIZE)))
|
||||
|
||||
/**
|
||||
* @brief Assess occurrence of current thread's stack corruption
|
||||
*
|
||||
* This function performs an assessment whether a memory fault (on a
|
||||
* given memory address) is the result of stack memory corruption of
|
||||
* the current thread.
|
||||
*
|
||||
* Thread stack corruption for supervisor threads or user threads in
|
||||
* privilege mode (when User Space is supported) is reported upon an
|
||||
* attempt to access the stack guard area (if MPU Stack Guard feature
|
||||
* is supported). Additionally the current thread stack pointer
|
||||
* must be pointing inside or below the guard area.
|
||||
*
|
||||
* Thread stack corruption for user threads in user mode is reported,
|
||||
* if the current stack pointer is pointing below the start of the current
|
||||
* thread's stack.
|
||||
*
|
||||
* Notes:
|
||||
* - we assume a fully descending stack,
|
||||
* - we assume a stacking error has occurred,
|
||||
* - the function shall be called when handling MPU privilege violation
|
||||
*
|
||||
* If stack corruption is detected, the function returns the lowest
|
||||
* allowed address where the Stack Pointer can safely point to, to
|
||||
* prevent from errors when un-stacking the corrupted stack frame
|
||||
* upon exception return.
|
||||
*
|
||||
* @param fault_addr memory address on which memory access violation
|
||||
* has been reported.
|
||||
* @param sp stack pointer when exception comes out
|
||||
*
|
||||
* @return The lowest allowed stack frame pointer, if error is a
|
||||
* thread stack corruption, otherwise return 0.
|
||||
*/
|
||||
static u32_t z_check_thread_stack_fail(const u32_t fault_addr, u32_t sp)
|
||||
{
|
||||
const struct k_thread *thread = _current;
|
||||
|
||||
if (!thread) {
|
||||
return 0;
|
||||
}
|
||||
#if defined(CONFIG_USERSPACE)
|
||||
if (thread->arch.priv_stack_start) {
|
||||
/* User thread */
|
||||
if (z_arc_v2_aux_reg_read(_ARC_V2_ERSTATUS)
|
||||
& _ARC_V2_STATUS32_U) {
|
||||
/* Thread's user stack corruption */
|
||||
#ifdef CONFIG_ARC_HAS_SECURE
|
||||
sp = z_arc_v2_aux_reg_read(_ARC_V2_SEC_U_SP);
|
||||
#else
|
||||
sp = z_arc_v2_aux_reg_read(_ARC_V2_USER_SP);
|
||||
#endif
|
||||
if (sp <= (u32_t)thread->stack_obj) {
|
||||
return (u32_t)thread->stack_obj;
|
||||
}
|
||||
} else {
|
||||
/* User thread in privilege mode */
|
||||
if (IS_MPU_GUARD_VIOLATION(
|
||||
thread->arch.priv_stack_start - STACK_GUARD_SIZE,
|
||||
fault_addr, sp)) {
|
||||
/* Thread's privilege stack corruption */
|
||||
return thread->arch.priv_stack_start;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
/* Supervisor thread */
|
||||
if (IS_MPU_GUARD_VIOLATION((u32_t)thread->stack_obj,
|
||||
fault_addr, sp)) {
|
||||
/* Supervisor thread stack corruption */
|
||||
return (u32_t)thread->stack_obj + STACK_GUARD_SIZE;
|
||||
}
|
||||
}
|
||||
#else /* CONFIG_USERSPACE */
|
||||
if (IS_MPU_GUARD_VIOLATION(thread->stack_info.start,
|
||||
fault_addr, sp)) {
|
||||
/* Thread stack corruption */
|
||||
return thread->stack_info.start + STACK_GUARD_SIZE;
|
||||
}
|
||||
#endif /* CONFIG_USERSPACE */
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
/*
|
||||
* @brief Fault handler
|
||||
*
|
||||
* This routine is called when fatal error conditions are detected by hardware
|
||||
* and is responsible only for reporting the error. Once reported, it then
|
||||
* invokes the user provided routine z_SysFatalErrorHandler() which is
|
||||
* invokes the user provided routine _SysFatalErrorHandler() which is
|
||||
* responsible for implementing the error handling policy.
|
||||
*
|
||||
* @return This function does not return.
|
||||
*/
|
||||
void _Fault(NANO_ESF *esf)
|
||||
void _Fault(void)
|
||||
{
|
||||
u32_t vector, code, parameter;
|
||||
u32_t exc_addr = z_arc_v2_aux_reg_read(_ARC_V2_EFA);
|
||||
u32_t ecr = z_arc_v2_aux_reg_read(_ARC_V2_ECR);
|
||||
u32_t exc_addr = _arc_v2_aux_reg_read(_ARC_V2_EFA);
|
||||
u32_t ecr = _arc_v2_aux_reg_read(_ARC_V2_ECR);
|
||||
|
||||
LOG_PANIC();
|
||||
|
||||
#ifdef CONFIG_USERSPACE
|
||||
for (int i = 0; i < ARRAY_SIZE(exceptions); i++) {
|
||||
u32_t start = (u32_t)exceptions[i].start;
|
||||
u32_t end = (u32_t)exceptions[i].end;
|
||||
|
||||
if (esf->pc >= start && esf->pc < end) {
|
||||
esf->pc = (u32_t)(exceptions[i].fixup);
|
||||
return;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
vector = Z_ARC_V2_ECR_VECTOR(ecr);
|
||||
code = Z_ARC_V2_ECR_CODE(ecr);
|
||||
parameter = Z_ARC_V2_ECR_PARAMETER(ecr);
|
||||
|
||||
|
||||
/* exception raised by kernel */
|
||||
if (vector == 0x9 && parameter == _TRAP_S_CALL_RUNTIME_EXCEPT) {
|
||||
z_NanoFatalErrorHandler(esf->r0, esf);
|
||||
return;
|
||||
}
|
||||
vector = _ARC_V2_ECR_VECTOR(ecr);
|
||||
code = _ARC_V2_ECR_CODE(ecr);
|
||||
parameter = _ARC_V2_ECR_PARAMETER(ecr);
|
||||
|
||||
printk("Exception vector: 0x%x, cause code: 0x%x, parameter 0x%x\n",
|
||||
vector, code, parameter);
|
||||
@@ -168,22 +45,10 @@ void _Fault(NANO_ESF *esf)
|
||||
#ifdef CONFIG_ARC_STACK_CHECKING
|
||||
/* Vector 6 = EV_ProV. Regardless of code, parameter 2 means stack
|
||||
* check violation
|
||||
* stack check and mpu violation can come out together, then
|
||||
* parameter = 0x2 | [0x4 | 0x8 | 0x1]
|
||||
*/
|
||||
if (vector == 6U && parameter & 0x2) {
|
||||
z_NanoFatalErrorHandler(_NANO_ERR_STACK_CHK_FAIL, esf);
|
||||
return;
|
||||
if (vector == 6 && parameter == 2) {
|
||||
_NanoFatalErrorHandler(_NANO_ERR_STACK_CHK_FAIL, &_default_esf);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_MPU_STACK_GUARD
|
||||
if (vector == 0x6 && ((parameter == 0x4) || (parameter == 0x24))) {
|
||||
if (z_check_thread_stack_fail(exc_addr, arc_exc_saved_sp)) {
|
||||
z_NanoFatalErrorHandler(_NANO_ERR_STACK_CHK_FAIL, esf);
|
||||
return;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
z_NanoFatalErrorHandler(_NANO_ERR_HW_EXCEPTION, esf);
|
||||
_NanoFatalErrorHandler(_NANO_ERR_HW_EXCEPTION, &_default_esf);
|
||||
}
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2014 Wind River Systems, Inc.
|
||||
* Copyright (c) 2018 Synopsys.
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
@@ -16,10 +15,9 @@
|
||||
#include <linker/sections.h>
|
||||
#include <arch/cpu.h>
|
||||
#include <swap_macros.h>
|
||||
#include <syscall.h>
|
||||
|
||||
GTEXT(_Fault)
|
||||
GTEXT(z_do_kernel_oops)
|
||||
|
||||
GTEXT(__reset)
|
||||
GTEXT(__memory_error)
|
||||
GTEXT(__instruction_error)
|
||||
@@ -34,15 +32,8 @@ GTEXT(__ev_extension)
|
||||
GTEXT(__ev_div_zero)
|
||||
GTEXT(__ev_dc_error)
|
||||
GTEXT(__ev_maligned)
|
||||
#ifdef CONFIG_IRQ_OFFLOAD
|
||||
GTEXT(z_irq_do_offload);
|
||||
#endif
|
||||
|
||||
GDATA(exc_nest_count)
|
||||
GDATA(arc_exc_saved_sWWp)
|
||||
|
||||
/* the necessary stack size for exception handling */
|
||||
#define EXCEPTION_STACK_SIZE 384
|
||||
|
||||
/*
|
||||
* @brief Fault handler installed in the fault and reserved vectors
|
||||
@@ -56,157 +47,39 @@ SECTION_SUBSEC_FUNC(TEXT,__fault,__ev_tlb_miss_d)
|
||||
SECTION_SUBSEC_FUNC(TEXT,__fault,__ev_prot_v)
|
||||
SECTION_SUBSEC_FUNC(TEXT,__fault,__ev_privilege_v)
|
||||
SECTION_SUBSEC_FUNC(TEXT,__fault,__ev_swi)
|
||||
#ifndef CONFIG_IRQ_OFFLOAD
|
||||
SECTION_SUBSEC_FUNC(TEXT,__fault,__ev_trap)
|
||||
#endif
|
||||
SECTION_SUBSEC_FUNC(TEXT,__fault,__ev_extension)
|
||||
SECTION_SUBSEC_FUNC(TEXT,__fault,__ev_div_zero)
|
||||
SECTION_SUBSEC_FUNC(TEXT,__fault,__ev_dc_error)
|
||||
SECTION_SUBSEC_FUNC(TEXT,__fault,__ev_maligned)
|
||||
|
||||
_exc_entry:
|
||||
st sp, [arc_exc_saved_sp]
|
||||
/*
|
||||
* re-use the top part of interrupt stack as exception
|
||||
* stack. If this top part is used by interrupt handling,
|
||||
* and exception is raised, then here it's guaranteed that
|
||||
* exception handling has necessary stack to use
|
||||
* Before invoking exception handler, the kernel switches to an exception
|
||||
* stack, to save the faulting thread's registers.
|
||||
* The exception is fatal and all the kernel can do is just print
|
||||
* a diagnostic message and halt.
|
||||
*/
|
||||
mov_s sp, _interrupt_stack
|
||||
add sp, sp, EXCEPTION_STACK_SIZE
|
||||
|
||||
/*
|
||||
* save caller saved registers
|
||||
* this stack frame is set up in exception stack,
|
||||
* not in the original sp (thread stack or interrupt stack).
|
||||
* Because the exception may be raised by stack checking or
|
||||
* mpu protect violation related to stack. If this stack frame
|
||||
* is setup in original sp, double exception may be raised during
|
||||
* _create_irq_stack_frame, which is unrecoverable.
|
||||
*/
|
||||
_create_irq_stack_frame
|
||||
|
||||
#ifdef CONFIG_ARC_HAS_SECURE
|
||||
lr r0,[_ARC_V2_ERSEC_STAT]
|
||||
st_s r0, [sp, ___isf_t_sec_stat_OFFSET]
|
||||
#endif
|
||||
lr r0,[_ARC_V2_ERSTATUS]
|
||||
st_s r0, [sp, ___isf_t_status32_OFFSET]
|
||||
lr r0,[_ARC_V2_ERET]
|
||||
st_s r0, [sp, ___isf_t_pc_OFFSET] /* eret into pc */
|
||||
|
||||
/* sp is parameter of _Fault */
|
||||
mov r0, sp
|
||||
jl _Fault
|
||||
|
||||
_exc_return:
|
||||
|
||||
#ifdef CONFIG_PREEMPT_ENABLED
|
||||
mov_s r1, _kernel
|
||||
ld_s r2, [r1, _kernel_offset_to_current]
|
||||
|
||||
/* check if the current thread needs to be rescheduled */
|
||||
ld_s r0, [r1, _kernel_offset_to_ready_q_cache]
|
||||
breq r0, r2, _exc_return_from_exc
|
||||
|
||||
ld_s r2, [r1, _kernel_offset_to_ready_q_cache]
|
||||
st_s r2, [r1, _kernel_offset_to_current]
|
||||
|
||||
#ifdef CONFIG_ARC_HAS_SECURE
|
||||
/*
|
||||
* sync up the ERSEC_STAT.ERM and SEC_STAT.IRM.
|
||||
* use a fake interrupt return to simulate an exception turn.
|
||||
* ERM and IRM record which mode the cpu should return, 1: secure
|
||||
* 0: normal
|
||||
*/
|
||||
lr r3,[_ARC_V2_ERSEC_STAT]
|
||||
btst r3, 31
|
||||
bset.nz r3, r3, 3
|
||||
bclr.z r3, r3, 3
|
||||
/* sflag r3 */
|
||||
/* sflag instruction is not supported in current ARC GNU */
|
||||
.long 0x00ff302f
|
||||
#endif
|
||||
/* clear AE bit to forget this was an exception */
|
||||
lr r3, [_ARC_V2_STATUS32]
|
||||
and r3,r3,(~_ARC_V2_STATUS32_AE)
|
||||
kflag r3
|
||||
/* pretend lowest priority interrupt happened to use common handler */
|
||||
lr r3, [_ARC_V2_AUX_IRQ_ACT]
|
||||
or r3,r3,(1<<(CONFIG_NUM_IRQ_PRIO_LEVELS-1)) /* use lowest */
|
||||
sr r3, [_ARC_V2_AUX_IRQ_ACT]
|
||||
|
||||
/* Assumption: r2 has current thread */
|
||||
b _rirq_common_interrupt_swap
|
||||
#ifdef CONFIG_ARC_STACK_CHECKING
|
||||
push_s r2
|
||||
/* disable stack checking */
|
||||
lr r2, [_ARC_V2_STATUS32]
|
||||
bclr r2, r2, _ARC_V2_STATUS32_SC_BIT
|
||||
kflag r2
|
||||
pop_s r2
|
||||
#endif
|
||||
|
||||
_exc_return_from_exc:
|
||||
ld_s r0, [sp, ___isf_t_pc_OFFSET]
|
||||
sr r0, [_ARC_V2_ERET]
|
||||
|
||||
_pop_irq_stack_frame
|
||||
ld sp, [arc_exc_saved_sp]
|
||||
rtie
|
||||
|
||||
|
||||
SECTION_SUBSEC_FUNC(TEXT,__fault,__ev_trap)
|
||||
/* get the id of trap_s */
|
||||
lr ilink, [_ARC_V2_ECR]
|
||||
and ilink, ilink, 0x3f
|
||||
#ifdef CONFIG_USERSPACE
|
||||
cmp ilink, _TRAP_S_CALL_SYSTEM_CALL
|
||||
bne _do_non_syscall_trap
|
||||
/* do sys_call */
|
||||
mov ilink, K_SYSCALL_LIMIT
|
||||
cmp r6, ilink
|
||||
blo valid_syscall_id
|
||||
|
||||
mov r0, r6
|
||||
mov r6, K_SYSCALL_BAD
|
||||
|
||||
valid_syscall_id:
|
||||
/* create a sys call frame
|
||||
* caller regs (r0 - 12) are saved in _create_irq_stack_frame
|
||||
* ok to use them later
|
||||
*/
|
||||
_create_irq_stack_frame
|
||||
#ifdef CONFIG_ARC_HAS_SECURE
|
||||
lr r0, [_ARC_V2_ERSEC_STAT]
|
||||
st_s r0, [sp, ___isf_t_sec_stat_OFFSET]
|
||||
#endif
|
||||
lr r0, [_ARC_V2_ERET]
|
||||
st_s r0, [sp, ___isf_t_pc_OFFSET] /* eret into pc */
|
||||
lr r0, [_ARC_V2_ERSTATUS]
|
||||
st_s r0, [sp, ___isf_t_status32_OFFSET]
|
||||
|
||||
|
||||
bclr r0, r0, _ARC_V2_STATUS32_U_BIT
|
||||
sr r0, [_ARC_V2_ERSTATUS]
|
||||
|
||||
mov r0, _arc_do_syscall
|
||||
sr r0, [_ARC_V2_ERET]
|
||||
|
||||
rtie
|
||||
|
||||
_do_non_syscall_trap:
|
||||
#endif /* CONFIG_USERSPACE */
|
||||
#ifdef CONFIG_IRQ_OFFLOAD
|
||||
/*
|
||||
* IRQ_OFFLOAD is to simulate interrupt handling through exception,
|
||||
* so its entry is different with normal exception handling, it is
|
||||
* handled in isr stack
|
||||
*/
|
||||
cmp ilink, _TRAP_S_SCALL_IRQ_OFFLOAD
|
||||
bne _exc_entry
|
||||
/* save caller saved registers */
|
||||
_create_irq_stack_frame
|
||||
|
||||
#ifdef CONFIG_ARC_HAS_SECURE
|
||||
lr r0,[_ARC_V2_ERSEC_STAT]
|
||||
st_s r0, [sp, ___isf_t_sec_stat_OFFSET]
|
||||
#endif
|
||||
lr r0,[_ARC_V2_ERSTATUS]
|
||||
st_s r0, [sp, ___isf_t_status32_OFFSET]
|
||||
lr r0,[_ARC_V2_ERET]
|
||||
st_s r0, [sp, ___isf_t_pc_OFFSET] /* eret into pc */
|
||||
|
||||
|
||||
ld r1, [exc_nest_count]
|
||||
add r0, r1, 1
|
||||
st r0, [exc_nest_count]
|
||||
@@ -220,24 +93,93 @@ _do_non_syscall_trap:
|
||||
exc_nest_handle:
|
||||
push_s r0
|
||||
|
||||
jl z_irq_do_offload
|
||||
jl _Fault
|
||||
|
||||
pop sp
|
||||
|
||||
mov r1, exc_nest_count
|
||||
ld r0, [r1]
|
||||
sub r0, r0, 1
|
||||
cmp r0, 0
|
||||
bne.d _exc_return_from_exc
|
||||
st r0, [r1]
|
||||
|
||||
#ifdef CONFIG_PREEMPT_ENABLED
|
||||
/* if _Fault returns, restore the registers */
|
||||
_pop_irq_stack_frame
|
||||
|
||||
rtie
|
||||
|
||||
#ifdef CONFIG_IRQ_OFFLOAD
|
||||
GTEXT(_irq_do_offload);
|
||||
|
||||
SECTION_SUBSEC_FUNC(TEXT,__fault,__ev_trap)
|
||||
/*
|
||||
* Before invoking exception handler, the kernel switches to an exception
|
||||
* stack to save the faulting thread's registers.
|
||||
* The exception is fatal and all the kernel can do is just print
|
||||
* a diagnostic message and halt.
|
||||
*/
|
||||
|
||||
#ifdef CONFIG_ARC_STACK_CHECKING
|
||||
push_s r2
|
||||
/* disable stack checking */
|
||||
lr r2, [_ARC_V2_STATUS32]
|
||||
bclr r2, r2, _ARC_V2_STATUS32_SC_BIT
|
||||
kflag r2
|
||||
pop_s r2
|
||||
#endif
|
||||
|
||||
/* save caller saved registers */
|
||||
_create_irq_stack_frame
|
||||
|
||||
lr r0,[_ARC_V2_ERSTATUS]
|
||||
st_s r0, [sp, ___isf_t_status32_OFFSET]
|
||||
lr r0,[_ARC_V2_ERET]
|
||||
st_s r0, [sp, ___isf_t_pc_OFFSET] /* eret into pc */
|
||||
|
||||
ld r1, [exc_nest_count]
|
||||
add r0, r1, 1
|
||||
st r0, [exc_nest_count]
|
||||
cmp r1, 0
|
||||
|
||||
bgt.d trap_nest_handle
|
||||
mov r0, sp
|
||||
|
||||
mov r1, _kernel
|
||||
ld sp, [r1, _kernel_offset_to_irq_stack]
|
||||
trap_nest_handle:
|
||||
push_s r0
|
||||
|
||||
jl _irq_do_offload
|
||||
|
||||
pop sp
|
||||
|
||||
/* check if we're a nested interrupt: if so, let the
|
||||
* interrupted interrupt handle the reschedule
|
||||
*/
|
||||
mov r1, exc_nest_count
|
||||
ld r0, [r1]
|
||||
sub r0, r0, 1
|
||||
cmp r0, 0
|
||||
beq.d _trap_check_for_swap
|
||||
st r0, [r1]
|
||||
|
||||
_trap_return:
|
||||
_pop_irq_stack_frame
|
||||
rtie
|
||||
|
||||
.balign 4
|
||||
_trap_check_for_swap:
|
||||
mov_s r1, _kernel
|
||||
ld_s r2, [r1, _kernel_offset_to_current]
|
||||
/*
|
||||
* Non-preemptible thread ? Do not schedule (see explanation of
|
||||
* preempt field in kernel_struct.h).
|
||||
*/
|
||||
ldh_s r0, [r2, _thread_offset_to_preempt]
|
||||
brhs r0, _NON_PREEMPT_THRESHOLD, _trap_return
|
||||
|
||||
/* check if the current thread needs to be rescheduled */
|
||||
ld_s r0, [r1, _kernel_offset_to_ready_q_cache]
|
||||
breq r0, r2, _exc_return_from_irqoffload_trap
|
||||
breq r0, r2, _trap_return
|
||||
|
||||
_save_callee_saved_regs
|
||||
|
||||
@@ -247,21 +189,6 @@ exc_nest_handle:
|
||||
ld_s r2, [r1, _kernel_offset_to_ready_q_cache]
|
||||
st_s r2, [r1, _kernel_offset_to_current]
|
||||
|
||||
#ifdef CONFIG_ARC_HAS_SECURE
|
||||
/*
|
||||
* sync up the ERSEC_STAT.ERM and SEC_STAT.IRM.
|
||||
* use a fake interrupt return to simulate an exception turn.
|
||||
* ERM and IRM record which mode the cpu should return, 1: secure
|
||||
* 0: normal
|
||||
*/
|
||||
lr r3,[_ARC_V2_ERSEC_STAT]
|
||||
btst r3, 31
|
||||
bset.nz r3, r3, 3
|
||||
bclr.z r3, r3, 3
|
||||
/* sflag r3 */
|
||||
/* sflag instruction is not supported in current ARC GNU */
|
||||
.long 0x00ff302f
|
||||
#endif
|
||||
/* clear AE bit to forget this was an exception */
|
||||
lr r3, [_ARC_V2_STATUS32]
|
||||
and r3,r3,(~_ARC_V2_STATUS32_AE)
|
||||
@@ -273,10 +200,5 @@ exc_nest_handle:
|
||||
|
||||
/* Assumption: r2 has current thread */
|
||||
b _rirq_common_interrupt_swap
|
||||
#endif
|
||||
|
||||
_exc_return_from_irqoffload_trap:
|
||||
_pop_irq_stack_frame
|
||||
rtie
|
||||
#endif /* CONFIG_IRQ_OFFLOAD */
|
||||
b _exc_entry
|
||||
|
||||
@@ -24,7 +24,6 @@
|
||||
#include <linker/sections.h>
|
||||
#include <sw_isr_table.h>
|
||||
#include <irq.h>
|
||||
#include <misc/printk.h>
|
||||
|
||||
/*
|
||||
* @brief Enable an interrupt line
|
||||
@@ -36,11 +35,11 @@
|
||||
* @return N/A
|
||||
*/
|
||||
|
||||
void z_arch_irq_enable(unsigned int irq)
|
||||
void _arch_irq_enable(unsigned int irq)
|
||||
{
|
||||
unsigned int key = irq_lock();
|
||||
int key = irq_lock();
|
||||
|
||||
z_arc_v2_irq_unit_int_enable(irq);
|
||||
_arc_v2_irq_unit_int_enable(irq);
|
||||
irq_unlock(key);
|
||||
}
|
||||
|
||||
@@ -53,11 +52,11 @@ void z_arch_irq_enable(unsigned int irq)
|
||||
* @return N/A
|
||||
*/
|
||||
|
||||
void z_arch_irq_disable(unsigned int irq)
|
||||
void _arch_irq_disable(unsigned int irq)
|
||||
{
|
||||
unsigned int key = irq_lock();
|
||||
int key = irq_lock();
|
||||
|
||||
z_arc_v2_irq_unit_int_disable(irq);
|
||||
_arc_v2_irq_unit_int_disable(irq);
|
||||
irq_unlock(key);
|
||||
}
|
||||
|
||||
@@ -75,15 +74,15 @@ void z_arch_irq_disable(unsigned int irq)
|
||||
* @return N/A
|
||||
*/
|
||||
|
||||
void z_irq_priority_set(unsigned int irq, unsigned int prio, u32_t flags)
|
||||
void _irq_priority_set(unsigned int irq, unsigned int prio, u32_t flags)
|
||||
{
|
||||
ARG_UNUSED(flags);
|
||||
|
||||
unsigned int key = irq_lock();
|
||||
int key = irq_lock();
|
||||
|
||||
__ASSERT(prio < CONFIG_NUM_IRQ_PRIO_LEVELS,
|
||||
"invalid priority %d for irq %d", prio, irq);
|
||||
z_arc_v2_irq_unit_prio_set(irq, prio);
|
||||
_arc_v2_irq_unit_prio_set(irq, prio);
|
||||
irq_unlock(key);
|
||||
}
|
||||
|
||||
@@ -96,22 +95,12 @@ void z_irq_priority_set(unsigned int irq, unsigned int prio, u32_t flags)
|
||||
* @return N/A
|
||||
*/
|
||||
|
||||
void z_irq_spurious(void *unused)
|
||||
#include <misc/printk.h>
|
||||
void _irq_spurious(void *unused)
|
||||
{
|
||||
ARG_UNUSED(unused);
|
||||
printk("z_irq_spurious(). Spinning...\n");
|
||||
for (;;) {
|
||||
printk("_irq_spurious(). Spinning...\n");
|
||||
for (;;)
|
||||
;
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef CONFIG_DYNAMIC_INTERRUPTS
|
||||
int z_arch_irq_connect_dynamic(unsigned int irq, unsigned int priority,
|
||||
void (*routine)(void *parameter), void *parameter,
|
||||
u32_t flags)
|
||||
{
|
||||
z_isr_install(irq, routine, parameter);
|
||||
z_irq_priority_set(irq, priority, flags);
|
||||
return irq;
|
||||
}
|
||||
#endif /* CONFIG_DYNAMIC_INTERRUPTS */
|
||||
|
||||
@@ -15,22 +15,20 @@ static irq_offload_routine_t offload_routine;
|
||||
static void *offload_param;
|
||||
|
||||
/* Called by trap_s exception handler */
|
||||
void z_irq_do_offload(void)
|
||||
void _irq_do_offload(void)
|
||||
{
|
||||
offload_routine(offload_param);
|
||||
}
|
||||
|
||||
void irq_offload(irq_offload_routine_t routine, void *parameter)
|
||||
{
|
||||
unsigned int key;
|
||||
int key;
|
||||
|
||||
key = irq_lock();
|
||||
offload_routine = routine;
|
||||
offload_param = parameter;
|
||||
|
||||
__asm__ volatile ("trap_s %[id]"
|
||||
:
|
||||
: [id] "i"(_TRAP_S_SCALL_IRQ_OFFLOAD) : );
|
||||
__asm__ volatile ("trap_s 0");
|
||||
|
||||
irq_unlock(key);
|
||||
}
|
||||
|
||||
@@ -19,7 +19,6 @@
|
||||
#include <sw_isr_table.h>
|
||||
#include <kernel_structs.h>
|
||||
#include <arch/cpu.h>
|
||||
#include <swap_macros.h>
|
||||
|
||||
GTEXT(_isr_wrapper)
|
||||
GTEXT(_isr_demux)
|
||||
@@ -45,7 +44,7 @@ SECTION_VAR(BSS, saved_sp)
|
||||
#endif
|
||||
|
||||
#if defined(CONFIG_SYS_POWER_MANAGEMENT)
|
||||
GTEXT(z_sys_power_save_idle_exit)
|
||||
GTEXT(_sys_power_save_idle_exit)
|
||||
#endif
|
||||
|
||||
/*
|
||||
@@ -95,7 +94,7 @@ The context switch code adopts this standard so that it is easier to follow:
|
||||
transition from outgoing thread to incoming thread
|
||||
|
||||
Not loading _kernel into r0 allows loading _kernel without stomping on
|
||||
the parameter in r0 in z_swap().
|
||||
the parameter in r0 in _Swap().
|
||||
|
||||
|
||||
ARCv2 processors have two kinds of interrupts: fast (FIRQ) and regular. The
|
||||
@@ -121,8 +120,8 @@ registers (to avoid stack accesses). It is possible to register a FIRQ
|
||||
handler that operates outside of the kernel, but care must be taken to only
|
||||
use instructions that only use the banked registers.
|
||||
|
||||
The kernel is able to handle transitions to and from FIRQ, RIRQ and threads.
|
||||
The contexts are saved 'lazily': the minimum amount of work is
|
||||
The kernel is able to handle transitions to and from FIRQ, RIRQ and threads
|
||||
(fibers/task). The contexts are saved 'lazily': the minimum amount of work is
|
||||
done upfront, and the rest is done when needed:
|
||||
|
||||
o RIRQ
|
||||
@@ -130,7 +129,7 @@ o RIRQ
|
||||
All needed regisers to run C code in the ISR are saved automatically
|
||||
on the outgoing thread's stack: loop, status32, pc, and the caller-
|
||||
saved GPRs. That stack frame layout is pre-determined. If returning
|
||||
to a thread, the stack is popped and no registers have to be saved by
|
||||
to a fiber, the stack is popped and no registers have to be saved by
|
||||
the kernel. If a context switch is required, the callee-saved GPRs
|
||||
are then saved in the thread control structure (TCS).
|
||||
|
||||
@@ -152,7 +151,7 @@ o FIRQ
|
||||
During early initialization, the sp in the 2nd register bank is made to
|
||||
refer to _firq_stack. This allows for the FIRQ handler to use its own stack.
|
||||
GPRs are banked, loop registers are saved in unused callee saved regs upon
|
||||
interrupt entry. If returning to a thread, loop registers are restored and the
|
||||
interrupt entry. If returning to a fiber, loop registers are restored and the
|
||||
CPU switches back to bank 0 for the GPRs. If a context switch is
|
||||
needed, at this point only are all the registers saved. First, a
|
||||
stack frame with the same layout as the automatic RIRQ one is created
|
||||
@@ -195,7 +194,7 @@ From FIRQ:
|
||||
|
||||
o to coop
|
||||
|
||||
The address of the returning instruction from z_swap() is loaded in ilink and
|
||||
The address of the returning instruction from _Swap() is loaded in ilink and
|
||||
the saved status32 in status32_p0, taking care to adjust the interrupt lock
|
||||
state desired in status32_p0. The return value is put in r0.
|
||||
|
||||
@@ -230,7 +229,6 @@ From RIRQ:
|
||||
*/
|
||||
|
||||
SECTION_FUNC(TEXT, _isr_wrapper)
|
||||
#if CONFIG_ARC_FIRQ
|
||||
#if CONFIG_RGF_NUM_BANKS == 1
|
||||
st r0,[saved_r0]
|
||||
#endif
|
||||
@@ -288,20 +286,30 @@ rirq_path:
|
||||
mov.nz r2, _rirq_enter
|
||||
j_s [r2]
|
||||
#endif
|
||||
#else
|
||||
mov r3, _rirq_exit
|
||||
mov r2, _rirq_enter
|
||||
j_s [r2]
|
||||
#endif
|
||||
|
||||
#if defined(CONFIG_TRACING)
|
||||
GTEXT(z_sys_trace_isr_enter)
|
||||
#ifdef CONFIG_KERNEL_EVENT_LOGGER_SLEEP
|
||||
GTEXT(_sys_k_event_logger_exit_sleep)
|
||||
|
||||
.macro log_sleep_k_event
|
||||
clri r0 /* do not interrupt event logger operations */
|
||||
push_s r0
|
||||
push_s blink
|
||||
jl _sys_k_event_logger_exit_sleep
|
||||
pop_s blink
|
||||
pop_s r0
|
||||
seti r0
|
||||
.endm
|
||||
#else
|
||||
#define log_sleep_k_event
|
||||
#endif
|
||||
#if defined(CONFIG_KERNEL_EVENT_LOGGER_INTERRUPT)
|
||||
GTEXT(_sys_k_event_logger_interrupt)
|
||||
|
||||
.macro log_interrupt_k_event
|
||||
clri r0 /* do not interrupt event logger operations */
|
||||
push_s r0
|
||||
push_s blink
|
||||
jl z_sys_trace_isr_enter
|
||||
jl _sys_k_event_logger_interrupt
|
||||
pop_s blink
|
||||
pop_s r0
|
||||
seti r0
|
||||
@@ -321,7 +329,7 @@ GTEXT(z_sys_trace_isr_enter)
|
||||
|
||||
st 0, [r1, _kernel_offset_to_idle] /* zero idle duration */
|
||||
push_s blink
|
||||
jl z_sys_power_save_idle_exit
|
||||
jl _sys_power_save_idle_exit
|
||||
pop_s blink
|
||||
|
||||
_skip_sys_power_save_idle_exit:
|
||||
@@ -337,25 +345,18 @@ _skip_sys_power_save_idle_exit:
|
||||
SECTION_FUNC(TEXT, _isr_demux)
|
||||
push_s r3
|
||||
|
||||
/* according to ARCv2 ISA, r25, r30 are caller-saved
|
||||
* scratch registers, possibly used by interrupt handlers
|
||||
*/
|
||||
push r25
|
||||
push r30
|
||||
|
||||
#ifdef CONFIG_EXECUTION_BENCHMARKING
|
||||
bl read_timer_start_of_isr
|
||||
#endif
|
||||
/* cannot be done before this point because we must be able to run C */
|
||||
/* r0 is available to be stomped here, and exit_tickless_idle uses it */
|
||||
exit_tickless_idle
|
||||
log_interrupt_k_event
|
||||
log_sleep_k_event
|
||||
|
||||
lr r0, [_ARC_V2_ICAUSE]
|
||||
/* handle software triggered interrupt */
|
||||
lr r3, [_ARC_V2_AUX_IRQ_HINT]
|
||||
brne r3, r0, irq_hint_handled
|
||||
sr 0, [_ARC_V2_AUX_IRQ_HINT]
|
||||
lr r3, [_ARC_V2_AUX_IRQ_HINT]
|
||||
brne r3, r0, irq_hint_handled
|
||||
sr 0, [_ARC_V2_AUX_IRQ_HINT]
|
||||
irq_hint_handled:
|
||||
|
||||
sub r0, r0, 16
|
||||
@@ -364,18 +365,9 @@ irq_hint_handled:
|
||||
add3 r0, r1, r0 /* table entries are 8-bytes wide */
|
||||
|
||||
ld_s r1, [r0, 4] /* ISR into r1 */
|
||||
#ifdef CONFIG_EXECUTION_BENCHMARKING
|
||||
push_s r0
|
||||
push_s r1
|
||||
bl read_timer_end_of_isr
|
||||
pop_s r1
|
||||
pop_s r0
|
||||
#endif
|
||||
jl_s.d [r1]
|
||||
ld_s r0, [r0] /* delay slot: ISR parameter into r0 */
|
||||
|
||||
pop r30
|
||||
pop r25
|
||||
/* back from ISR, jump to exit stub */
|
||||
pop_s r3
|
||||
j_s [r3]
|
||||
|
||||
@@ -1,6 +0,0 @@
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
zephyr_library()
|
||||
|
||||
zephyr_library_sources_if_kconfig(arc_core_mpu.c)
|
||||
zephyr_library_sources_if_kconfig(arc_mpu.c)
|
||||
@@ -6,30 +6,34 @@
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
#
|
||||
config ARC_MPU_VER
|
||||
int "ARC MPU version"
|
||||
int
|
||||
prompt "ARC MPU version"
|
||||
range 2 4
|
||||
default 2
|
||||
help
|
||||
ARC MPU has several versions. For MPU v2, the minimum region is 2048 bytes;
|
||||
For MPU v3, the minimum region is 32 bytes
|
||||
ARC MPU has several versions. For MPU v2, the minimum region is 2048 bytes;
|
||||
For MPU v3, the minimum region is 32 bytes
|
||||
|
||||
config ARC_CORE_MPU
|
||||
bool "ARC Core MPU functionalities"
|
||||
depends on CPU_HAS_MPU
|
||||
default n
|
||||
help
|
||||
ARC core MPU functionalities
|
||||
|
||||
config MPU_STACK_GUARD
|
||||
bool "Thread Stack Guards"
|
||||
depends on ARC_CORE_MPU
|
||||
depends on ARC_CORE_MPU && !ARC_STACK_CHECKING
|
||||
select THREAD_STACK_INFO
|
||||
default n
|
||||
help
|
||||
Enable thread stack guards via MPU. ARC supports built-in stack protection.
|
||||
If your core supports that, it is preferred over MPU stack guard
|
||||
|
||||
config ARC_MPU
|
||||
bool "ARC MPU Support"
|
||||
depends on CPU_HAS_MPU
|
||||
select ARC_CORE_MPU
|
||||
select THREAD_STACK_INFO
|
||||
select MEMORY_PROTECTION
|
||||
select MPU_REQUIRES_POWER_OF_TWO_ALIGNMENT if ARC_MPU_VER = 2
|
||||
default n
|
||||
help
|
||||
Target has ARC MPU (currently only works for EMSK 2.2/2.3 ARCEM7D)
|
||||
Target has ARC MPU (currently only works for EMSK 2.2 ARCEM7D)
|
||||
|
||||
2
arch/arc/core/mpu/Makefile
Normal file
2
arch/arc/core/mpu/Makefile
Normal file
@@ -0,0 +1,2 @@
|
||||
obj-$(CONFIG_ARC_CORE_MPU) += arc_core_mpu.o
|
||||
obj-$(CONFIG_ARC_MPU) += arc_mpu.o
|
||||
@@ -10,70 +10,21 @@
|
||||
#include <soc.h>
|
||||
#include <arch/arc/v2/mpu/arc_core_mpu.h>
|
||||
|
||||
#if defined(CONFIG_MPU_STACK_GUARD)
|
||||
/*
|
||||
* @brief Configure MPU for the thread
|
||||
* @brief Configure MPU stack guard
|
||||
*
|
||||
* This function configures per thread memory map reprogramming the MPU.
|
||||
* This function configures per thread stack guards reprogramming the MPU.
|
||||
* The functionality is meant to be used during context switch.
|
||||
*
|
||||
* @param thread thread info data structure.
|
||||
*/
|
||||
void configure_mpu_thread(struct k_thread *thread)
|
||||
void configure_mpu_stack_guard(struct k_thread *thread)
|
||||
{
|
||||
arc_core_mpu_disable();
|
||||
arc_core_mpu_configure_thread(thread);
|
||||
arc_core_mpu_configure(THREAD_STACK_GUARD_REGION,
|
||||
thread->stack_info.start - STACK_GUARD_SIZE,
|
||||
thread->stack_info.size);
|
||||
arc_core_mpu_enable();
|
||||
}
|
||||
|
||||
#if defined(CONFIG_USERSPACE)
|
||||
|
||||
int z_arch_mem_domain_max_partitions_get(void)
|
||||
{
|
||||
return arc_core_mpu_get_max_domain_partition_regions();
|
||||
}
|
||||
|
||||
/*
|
||||
* Reset MPU region for a single memory partition
|
||||
*/
|
||||
void z_arch_mem_domain_partition_remove(struct k_mem_domain *domain,
|
||||
u32_t partition_id)
|
||||
{
|
||||
arc_core_mpu_disable();
|
||||
arc_core_mpu_remove_mem_partition(domain, partition_id);
|
||||
arc_core_mpu_enable();
|
||||
}
|
||||
|
||||
/*
|
||||
* Configure MPU memory domain
|
||||
*/
|
||||
void z_arch_mem_domain_configure(struct k_thread *thread)
|
||||
{
|
||||
arc_core_mpu_disable();
|
||||
arc_core_mpu_configure_mem_domain(thread);
|
||||
arc_core_mpu_enable();
|
||||
}
|
||||
|
||||
/*
|
||||
* Destroy MPU regions for the mem domain
|
||||
*/
|
||||
void z_arch_mem_domain_destroy(struct k_mem_domain *domain)
|
||||
{
|
||||
arc_core_mpu_disable();
|
||||
arc_core_mpu_remove_mem_domain(domain);
|
||||
arc_core_mpu_enable();
|
||||
}
|
||||
|
||||
void _arch_mem_domain_partition_add(struct k_mem_domain *domain,
|
||||
u32_t partition_id)
|
||||
{
|
||||
/* No-op on this architecture */
|
||||
}
|
||||
|
||||
/*
|
||||
* Validate the given buffer is user accessible or not
|
||||
*/
|
||||
int z_arch_buffer_validate(void *addr, size_t size, int write)
|
||||
{
|
||||
return arc_core_mpu_buffer_validate(addr, size, write);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2019 Synopsys.
|
||||
* Copyright (c) 2017 Synopsys.
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
@@ -11,49 +11,232 @@
|
||||
#include <arch/arc/v2/aux_regs.h>
|
||||
#include <arch/arc/v2/mpu/arc_mpu.h>
|
||||
#include <arch/arc/v2/mpu/arc_core_mpu.h>
|
||||
#include <linker/linker-defs.h>
|
||||
#include <logging/sys_log.h>
|
||||
|
||||
#define LOG_LEVEL CONFIG_MPU_LOG_LEVEL
|
||||
#include <logging/log.h>
|
||||
LOG_MODULE_REGISTER(mpu);
|
||||
|
||||
#define AUX_MPU_RDB_VALID_MASK (0x1)
|
||||
#define AUX_MPU_EN_ENABLE (0x40000000)
|
||||
#define AUX_MPU_EN_DISABLE (0xBFFFFFFF)
|
||||
|
||||
#define AUX_MPU_RDP_REGION_SIZE(bits) \
|
||||
(((bits - 1) & 0x3) | (((bits - 1) & 0x1C) << 7))
|
||||
#define AUX_MPU_RDP_ATTR_MASK (0xFFF)
|
||||
|
||||
#define _ARC_V2_MPU_EN (0x409)
|
||||
#define _ARC_V2_MPU_RDB0 (0x422)
|
||||
#define _ARC_V2_MPU_RDP0 (0x423)
|
||||
|
||||
/* For MPU version 2, the minimum protection region size is 2048 bytes */
|
||||
/* FOr MPU version 3, the minimum protection region size is 32 bytes */
|
||||
#if CONFIG_ARC_MPU_VER == 2
|
||||
#define ARC_FEATURE_MPU_ALIGNMENT_BITS 11
|
||||
#elif CONFIG_ARC_MPU_VER == 3
|
||||
#define ARC_FEATURE_MPU_ALIGNMENT_BITS 5
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief Get the number of supported MPU regions
|
||||
* @brief Get the number of supported mpu regions
|
||||
*
|
||||
*/
|
||||
static inline u8_t get_num_regions(void)
|
||||
static inline u8_t _get_num_regions(void)
|
||||
{
|
||||
u32_t num = z_arc_v2_aux_reg_read(_ARC_V2_MPU_BUILD);
|
||||
u32_t num = _arc_v2_aux_reg_read(_ARC_V2_MPU_BUILD);
|
||||
|
||||
num = (num & 0xFF00U) >> 8U;
|
||||
num = (num & 0xFF00) >> 8;
|
||||
|
||||
return (u8_t)num;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* This internal function is utilized by the MPU driver to parse the intent
|
||||
* type (i.e. THREAD_STACK_REGION) and return the correct parameter set.
|
||||
*/
|
||||
static inline u32_t get_region_attr_by_type(u32_t type)
|
||||
static inline u32_t _get_region_attr_by_type(u32_t type, u32_t size)
|
||||
{
|
||||
switch (type) {
|
||||
case THREAD_STACK_USER_REGION:
|
||||
return REGION_RAM_ATTR;
|
||||
case THREAD_STACK_REGION:
|
||||
return AUX_MPU_ATTR_KW | AUX_MPU_ATTR_KR;
|
||||
case THREAD_APP_DATA_REGION:
|
||||
return REGION_RAM_ATTR;
|
||||
return 0;
|
||||
case THREAD_STACK_GUARD_REGION:
|
||||
/* no Write and Execute to guard region */
|
||||
return AUX_MPU_ATTR_UR | AUX_MPU_ATTR_KR;
|
||||
/* no Read, Write and Execute to guard region */
|
||||
return AUX_MPU_RDP_REGION_SIZE(
|
||||
ARC_FEATURE_MPU_ALIGNMENT_BITS);
|
||||
default:
|
||||
/* unknown type */
|
||||
/* Size 0 region */
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
#if CONFIG_ARC_MPU_VER == 2
|
||||
#include "arc_mpu_v2_internal.h"
|
||||
#elif CONFIG_ARC_MPU_VER == 3
|
||||
#include "arc_mpu_v3_internal.h"
|
||||
#endif
|
||||
static inline void _region_init(u32_t index, u32_t region_addr,
|
||||
u32_t region_attr)
|
||||
{
|
||||
|
||||
index = 2 * index;
|
||||
|
||||
_arc_v2_aux_reg_write(_ARC_V2_MPU_RDP0 + index, region_attr);
|
||||
_arc_v2_aux_reg_write(_ARC_V2_MPU_RDB0 + index, region_addr);
|
||||
}
|
||||
|
||||
|
||||
/* ARC Core MPU Driver API Implementation for ARC MPU */
|
||||
|
||||
/**
|
||||
* @brief enable the MPU
|
||||
*/
|
||||
void arc_core_mpu_enable(void)
|
||||
{
|
||||
/* Enable MPU */
|
||||
_arc_v2_aux_reg_write(_ARC_V2_MPU_EN,
|
||||
_arc_v2_aux_reg_read(_ARC_V2_MPU_EN) | AUX_MPU_EN_ENABLE);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief disable the MPU
|
||||
*/
|
||||
void arc_core_mpu_disable(void)
|
||||
{
|
||||
/* Disable MPU */
|
||||
_arc_v2_aux_reg_write(_ARC_V2_MPU_EN,
|
||||
_arc_v2_aux_reg_read(_ARC_V2_MPU_EN) & AUX_MPU_EN_DISABLE);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @brief configure the base address and size for an MPU region
|
||||
*
|
||||
* @param type MPU region type
|
||||
* @param base base address in RAM
|
||||
* @param size size of the region
|
||||
*/
|
||||
void arc_core_mpu_configure(u8_t type, u32_t base, u32_t size)
|
||||
{
|
||||
u32_t region_index;
|
||||
u32_t region_attr;
|
||||
|
||||
SYS_LOG_DBG("Region info: 0x%x 0x%x", base, size);
|
||||
/*
|
||||
* The new MPU regions are allocated per type before
|
||||
* the statically configured regions.
|
||||
*
|
||||
* For ARC MPU v2, MPU regions can be overlapped, smaller
|
||||
* region index has higher priority.
|
||||
*/
|
||||
|
||||
region_index = _get_num_regions() - mpu_config.num_regions;
|
||||
|
||||
if (type > region_index) {
|
||||
return;
|
||||
}
|
||||
|
||||
region_index -= type;
|
||||
region_attr = _get_region_attr_by_type(type, size);
|
||||
|
||||
if (region_attr == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
base |= AUX_MPU_RDB_VALID_MASK;
|
||||
|
||||
_region_init(region_index, base, region_attr);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief configure the default region
|
||||
*
|
||||
* @param region_attr region attribute of default region
|
||||
*/
|
||||
void arc_core_mpu_default(u32_t region_attr)
|
||||
{
|
||||
u32_t val = _arc_v2_aux_reg_read(_ARC_V2_MPU_EN) &
|
||||
(~AUX_MPU_RDP_ATTR_MASK);
|
||||
|
||||
region_attr &= AUX_MPU_RDP_ATTR_MASK;
|
||||
|
||||
_arc_v2_aux_reg_write(_ARC_V2_MPU_EN, region_attr | val);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @brief configure the mpu region
|
||||
*
|
||||
* @param index MPU region index
|
||||
* @param base base address
|
||||
* @param region_attr region attribute
|
||||
*/
|
||||
void arc_core_mpu_region(u32_t index, u32_t base, u32_t region_attr)
|
||||
{
|
||||
if (index >= _get_num_regions()) {
|
||||
return;
|
||||
}
|
||||
|
||||
base |= AUX_MPU_RDB_VALID_MASK;
|
||||
region_attr &= AUX_MPU_RDP_ATTR_MASK;
|
||||
|
||||
_region_init(index, base, region_attr);
|
||||
}
|
||||
|
||||
/* ARC MPU Driver Initial Setup */
|
||||
|
||||
/*
|
||||
* @brief MPU default configuration
|
||||
*
|
||||
* This function provides the default configuration mechanism for the Memory
|
||||
* Protection Unit (MPU).
|
||||
*/
|
||||
static void _arc_mpu_config(void)
|
||||
{
|
||||
u32_t r_index;
|
||||
u32_t num_regions;
|
||||
u32_t i;
|
||||
|
||||
num_regions = _get_num_regions();
|
||||
|
||||
/* ARC MPU supports up to 16 Regions */
|
||||
if (mpu_config.num_regions > num_regions) {
|
||||
return;
|
||||
}
|
||||
|
||||
/*
|
||||
* the MPU regions are filled in the reverse order.
|
||||
* According to ARCv2 ISA, the mpu region with smaller
|
||||
* index has higher priority. The static background mpu
|
||||
* regions in mpu_config will be in the bottom. Then
|
||||
* the special type regions will be above.
|
||||
*
|
||||
*/
|
||||
r_index = num_regions - mpu_config.num_regions;
|
||||
/* Disable MPU */
|
||||
arc_core_mpu_disable();
|
||||
|
||||
/* clear the regions reserved for special type */
|
||||
for (i = 0; i < r_index; i++) {
|
||||
_region_init(i, 0, 0);
|
||||
}
|
||||
|
||||
/* configure the static regions */
|
||||
for (r_index = 0; i < num_regions; i++) {
|
||||
_region_init(i,
|
||||
mpu_config.mpu_regions[r_index].base
|
||||
| AUX_MPU_RDB_VALID_MASK,
|
||||
mpu_config.mpu_regions[r_index].attr);
|
||||
r_index++;
|
||||
}
|
||||
|
||||
/* default region: no read, write and execute */
|
||||
arc_core_mpu_default(0);
|
||||
|
||||
/* Enable MPU */
|
||||
arc_core_mpu_enable();
|
||||
}
|
||||
|
||||
static int arc_mpu_init(struct device *arg)
|
||||
{
|
||||
ARG_UNUSED(arg);
|
||||
|
||||
_arc_mpu_config();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
SYS_INIT(arc_mpu_init, PRE_KERNEL_1,
|
||||
CONFIG_KERNEL_INIT_PRIORITY_DEFAULT);
|
||||
|
||||
@@ -1,479 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2019 Synopsys.
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
#ifndef ZEPHYR_ARCH_ARC_CORE_MPU_ARC_MPU_V2_INTERNAL_H_
|
||||
#define ZEPHYR_ARCH_ARC_CORE_MPU_ARC_MPU_V2_INTERNAL_H_
|
||||
|
||||
#define AUX_MPU_RDB_VALID_MASK (0x1)
|
||||
#define AUX_MPU_EN_ENABLE (0x40000000)
|
||||
#define AUX_MPU_EN_DISABLE (0xBFFFFFFF)
|
||||
|
||||
#define AUX_MPU_RDP_REGION_SIZE(bits) \
|
||||
(((bits - 1) & 0x3) | (((bits - 1) & 0x1C) << 7))
|
||||
|
||||
#define AUX_MPU_RDP_ATTR_MASK (0x1FC)
|
||||
#define AUX_MPU_RDP_SIZE_MASK (0xE03)
|
||||
|
||||
#define _ARC_V2_MPU_EN (0x409)
|
||||
#define _ARC_V2_MPU_RDB0 (0x422)
|
||||
#define _ARC_V2_MPU_RDP0 (0x423)
|
||||
|
||||
/* For MPU version 2, the minimum protection region size is 2048 bytes */
|
||||
#define ARC_FEATURE_MPU_ALIGNMENT_BITS 11
|
||||
|
||||
/**
|
||||
* This internal function initializes a MPU region
|
||||
*/
|
||||
static inline void _region_init(u32_t index, u32_t region_addr, u32_t size,
|
||||
u32_t region_attr)
|
||||
{
|
||||
u8_t bits = find_msb_set(size) - 1;
|
||||
|
||||
index = index * 2U;
|
||||
|
||||
if (bits < ARC_FEATURE_MPU_ALIGNMENT_BITS) {
|
||||
bits = ARC_FEATURE_MPU_ALIGNMENT_BITS;
|
||||
}
|
||||
|
||||
if ((1 << bits) < size) {
|
||||
bits++;
|
||||
}
|
||||
|
||||
if (size > 0) {
|
||||
region_attr &= ~(AUX_MPU_RDP_SIZE_MASK);
|
||||
region_attr |= AUX_MPU_RDP_REGION_SIZE(bits);
|
||||
region_addr |= AUX_MPU_RDB_VALID_MASK;
|
||||
} else {
|
||||
region_addr = 0U;
|
||||
}
|
||||
|
||||
z_arc_v2_aux_reg_write(_ARC_V2_MPU_RDP0 + index, region_attr);
|
||||
z_arc_v2_aux_reg_write(_ARC_V2_MPU_RDB0 + index, region_addr);
|
||||
}
|
||||
|
||||
/**
|
||||
* This internal function is utilized by the MPU driver to parse the intent
|
||||
* type (i.e. THREAD_STACK_REGION) and return the correct region index.
|
||||
*/
|
||||
static inline int get_region_index_by_type(u32_t type)
|
||||
{
|
||||
/*
|
||||
* The new MPU regions are allocated per type after the statically
|
||||
* configured regions. The type is one-indexed rather than
|
||||
* zero-indexed.
|
||||
*
|
||||
* For ARC MPU v2, the smaller index has higher priority, so the
|
||||
* index is allocated in reverse order. Static regions start from
|
||||
* the biggest index, then thread related regions.
|
||||
*
|
||||
*/
|
||||
switch (type) {
|
||||
case THREAD_STACK_USER_REGION:
|
||||
return get_num_regions() - mpu_config.num_regions
|
||||
- THREAD_STACK_REGION;
|
||||
case THREAD_STACK_REGION:
|
||||
case THREAD_APP_DATA_REGION:
|
||||
case THREAD_STACK_GUARD_REGION:
|
||||
return get_num_regions() - mpu_config.num_regions - type;
|
||||
case THREAD_DOMAIN_PARTITION_REGION:
|
||||
#if defined(CONFIG_MPU_STACK_GUARD)
|
||||
return get_num_regions() - mpu_config.num_regions - type;
|
||||
#else
|
||||
/*
|
||||
* Start domain partition region from stack guard region
|
||||
* since stack guard is not enabled.
|
||||
*/
|
||||
return get_num_regions() - mpu_config.num_regions - type + 1;
|
||||
#endif
|
||||
default:
|
||||
__ASSERT(0, "Unsupported type");
|
||||
return -EINVAL;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* This internal function checks if region is enabled or not
|
||||
*/
|
||||
static inline bool _is_enabled_region(u32_t r_index)
|
||||
{
|
||||
return ((z_arc_v2_aux_reg_read(_ARC_V2_MPU_RDB0 + r_index * 2U)
|
||||
& AUX_MPU_RDB_VALID_MASK) == AUX_MPU_RDB_VALID_MASK);
|
||||
}
|
||||
|
||||
/**
|
||||
* This internal function check if the given buffer in in the region
|
||||
*/
|
||||
static inline bool _is_in_region(u32_t r_index, u32_t start, u32_t size)
|
||||
{
|
||||
u32_t r_addr_start;
|
||||
u32_t r_addr_end;
|
||||
u32_t r_size_lshift;
|
||||
|
||||
r_addr_start = z_arc_v2_aux_reg_read(_ARC_V2_MPU_RDB0 + r_index * 2U)
|
||||
& (~AUX_MPU_RDB_VALID_MASK);
|
||||
r_size_lshift = z_arc_v2_aux_reg_read(_ARC_V2_MPU_RDP0 + r_index * 2U)
|
||||
& AUX_MPU_RDP_SIZE_MASK;
|
||||
r_size_lshift = (r_size_lshift & 0x3) | ((r_size_lshift >> 7) & 0x1C);
|
||||
r_addr_end = r_addr_start + (1 << (r_size_lshift + 1));
|
||||
|
||||
if (start >= r_addr_start && (start + size) <= r_addr_end) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* This internal function check if the region is user accessible or not
|
||||
*/
|
||||
static inline bool _is_user_accessible_region(u32_t r_index, int write)
|
||||
{
|
||||
u32_t r_ap;
|
||||
|
||||
r_ap = z_arc_v2_aux_reg_read(_ARC_V2_MPU_RDP0 + r_index * 2U);
|
||||
|
||||
r_ap &= AUX_MPU_RDP_ATTR_MASK;
|
||||
|
||||
if (write) {
|
||||
return ((r_ap & (AUX_MPU_ATTR_UW | AUX_MPU_ATTR_KW)) ==
|
||||
(AUX_MPU_ATTR_UW | AUX_MPU_ATTR_KW));
|
||||
}
|
||||
|
||||
return ((r_ap & (AUX_MPU_ATTR_UR | AUX_MPU_ATTR_KR)) ==
|
||||
(AUX_MPU_ATTR_UR | AUX_MPU_ATTR_KR));
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief configure the base address and size for an MPU region
|
||||
*
|
||||
* @param type MPU region type
|
||||
* @param base base address in RAM
|
||||
* @param size size of the region
|
||||
*/
|
||||
static inline int _mpu_configure(u8_t type, u32_t base, u32_t size)
|
||||
{
|
||||
s32_t region_index = get_region_index_by_type(type);
|
||||
u32_t region_attr = get_region_attr_by_type(type);
|
||||
|
||||
LOG_DBG("Region info: 0x%x 0x%x", base, size);
|
||||
|
||||
if (region_attr == 0U || region_index < 0) {
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
/*
|
||||
* For ARC MPU v2, MPU regions can be overlapped, smaller
|
||||
* region index has higher priority.
|
||||
*/
|
||||
_region_init(region_index, base, size, region_attr);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* ARC Core MPU Driver API Implementation for ARC MPUv2 */
|
||||
|
||||
/**
|
||||
* @brief enable the MPU
|
||||
*/
|
||||
void arc_core_mpu_enable(void)
|
||||
{
|
||||
/* Enable MPU */
|
||||
z_arc_v2_aux_reg_write(_ARC_V2_MPU_EN,
|
||||
z_arc_v2_aux_reg_read(_ARC_V2_MPU_EN) | AUX_MPU_EN_ENABLE);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief disable the MPU
|
||||
*/
|
||||
void arc_core_mpu_disable(void)
|
||||
{
|
||||
/* Disable MPU */
|
||||
z_arc_v2_aux_reg_write(_ARC_V2_MPU_EN,
|
||||
z_arc_v2_aux_reg_read(_ARC_V2_MPU_EN) & AUX_MPU_EN_DISABLE);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief configure the thread's MPU regions
|
||||
*
|
||||
* @param thread the target thread
|
||||
*/
|
||||
void arc_core_mpu_configure_thread(struct k_thread *thread)
|
||||
{
|
||||
|
||||
#if defined(CONFIG_MPU_STACK_GUARD)
|
||||
#if defined(CONFIG_USERSPACE)
|
||||
if ((thread->base.user_options & K_USER) != 0) {
|
||||
/* the areas before and after the user stack of thread is
|
||||
* kernel only. These area can be used as stack guard.
|
||||
* -----------------------
|
||||
* | kernel only area |
|
||||
* |---------------------|
|
||||
* | user stack |
|
||||
* |---------------------|
|
||||
* |privilege stack guard|
|
||||
* |---------------------|
|
||||
* | privilege stack |
|
||||
* -----------------------
|
||||
*/
|
||||
if (_mpu_configure(THREAD_STACK_GUARD_REGION,
|
||||
thread->arch.priv_stack_start - STACK_GUARD_SIZE,
|
||||
STACK_GUARD_SIZE) < 0) {
|
||||
LOG_ERR("thread %p's stack guard failed", thread);
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
if (_mpu_configure(THREAD_STACK_GUARD_REGION,
|
||||
thread->stack_info.start - STACK_GUARD_SIZE,
|
||||
STACK_GUARD_SIZE) < 0) {
|
||||
LOG_ERR("thread %p's stack guard failed", thread);
|
||||
return;
|
||||
}
|
||||
}
|
||||
#else
|
||||
if (_mpu_configure(THREAD_STACK_GUARD_REGION,
|
||||
thread->stack_info.start - STACK_GUARD_SIZE,
|
||||
STACK_GUARD_SIZE) < 0) {
|
||||
LOG_ERR("thread %p's stack guard failed", thread);
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(CONFIG_USERSPACE)
|
||||
/* configure stack region of user thread */
|
||||
if (thread->base.user_options & K_USER) {
|
||||
LOG_DBG("configure user thread %p's stack", thread);
|
||||
if (_mpu_configure(THREAD_STACK_USER_REGION,
|
||||
(u32_t)thread->stack_obj, thread->stack_info.size) < 0) {
|
||||
LOG_ERR("user thread %p's stack failed", thread);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
LOG_DBG("configure thread %p's domain", thread);
|
||||
arc_core_mpu_configure_mem_domain(thread);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @brief configure the default region
|
||||
*
|
||||
* @param region_attr region attribute of default region
|
||||
*/
|
||||
void arc_core_mpu_default(u32_t region_attr)
|
||||
{
|
||||
u32_t val = z_arc_v2_aux_reg_read(_ARC_V2_MPU_EN) &
|
||||
(~AUX_MPU_RDP_ATTR_MASK);
|
||||
|
||||
region_attr &= AUX_MPU_RDP_ATTR_MASK;
|
||||
|
||||
z_arc_v2_aux_reg_write(_ARC_V2_MPU_EN, region_attr | val);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief configure the MPU region
|
||||
*
|
||||
* @param index MPU region index
|
||||
* @param base base address
|
||||
* @param region_attr region attribute
|
||||
*/
|
||||
int arc_core_mpu_region(u32_t index, u32_t base, u32_t size,
|
||||
u32_t region_attr)
|
||||
{
|
||||
if (index >= get_num_regions()) {
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
region_attr &= AUX_MPU_RDP_ATTR_MASK;
|
||||
|
||||
_region_init(index, base, size, region_attr);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
#if defined(CONFIG_USERSPACE)
|
||||
|
||||
/**
|
||||
* @brief configure MPU regions for the memory partitions of the memory domain
|
||||
*
|
||||
* @param thread the thread which has memory domain
|
||||
*/
|
||||
void arc_core_mpu_configure_mem_domain(struct k_thread *thread)
|
||||
{
|
||||
int region_index =
|
||||
get_region_index_by_type(THREAD_DOMAIN_PARTITION_REGION);
|
||||
u32_t num_partitions;
|
||||
struct k_mem_partition *pparts;
|
||||
struct k_mem_domain *mem_domain = NULL;
|
||||
|
||||
if (thread) {
|
||||
mem_domain = thread->mem_domain_info.mem_domain;
|
||||
}
|
||||
|
||||
if (mem_domain) {
|
||||
LOG_DBG("configure domain: %p", mem_domain);
|
||||
num_partitions = mem_domain->num_partitions;
|
||||
pparts = mem_domain->partitions;
|
||||
} else {
|
||||
LOG_DBG("disable domain partition regions");
|
||||
num_partitions = 0U;
|
||||
pparts = NULL;
|
||||
}
|
||||
|
||||
for (; region_index >= 0; region_index--) {
|
||||
if (num_partitions) {
|
||||
LOG_DBG("set region 0x%x 0x%x 0x%x",
|
||||
region_index, pparts->start, pparts->size);
|
||||
_region_init(region_index, pparts->start,
|
||||
pparts->size, pparts->attr);
|
||||
num_partitions--;
|
||||
} else {
|
||||
/* clear the left mpu entries */
|
||||
_region_init(region_index, 0, 0, 0);
|
||||
}
|
||||
pparts++;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief remove MPU regions for the memory partitions of the memory domain
|
||||
*
|
||||
* @param mem_domain the target memory domain
|
||||
*/
|
||||
void arc_core_mpu_remove_mem_domain(struct k_mem_domain *mem_domain)
|
||||
{
|
||||
ARG_UNUSED(mem_domain);
|
||||
|
||||
int region_index =
|
||||
get_region_index_by_type(THREAD_DOMAIN_PARTITION_REGION);
|
||||
|
||||
for (; region_index >= 0; region_index--) {
|
||||
_region_init(region_index, 0, 0, 0);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief reset MPU region for a single memory partition
|
||||
*
|
||||
* @param domain the target memory domain
|
||||
* @param partition_id memory partition id
|
||||
*/
|
||||
void arc_core_mpu_remove_mem_partition(struct k_mem_domain *domain,
|
||||
u32_t part_id)
|
||||
{
|
||||
ARG_UNUSED(domain);
|
||||
|
||||
int region_index =
|
||||
get_region_index_by_type(THREAD_DOMAIN_PARTITION_REGION);
|
||||
|
||||
LOG_DBG("disable region 0x%x", region_index + part_id);
|
||||
/* Disable region */
|
||||
_region_init(region_index + part_id, 0, 0, 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief get the maximum number of free regions for memory domain partitions
|
||||
*/
|
||||
int arc_core_mpu_get_max_domain_partition_regions(void)
|
||||
{
|
||||
return get_region_index_by_type(THREAD_DOMAIN_PARTITION_REGION) + 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief validate the given buffer is user accessible or not
|
||||
*/
|
||||
int arc_core_mpu_buffer_validate(void *addr, size_t size, int write)
|
||||
{
|
||||
int r_index;
|
||||
|
||||
/*
|
||||
* For ARC MPU v2, smaller region number takes priority.
|
||||
* we can stop the iteration immediately once we find the
|
||||
* matched region that grants permission or denies access.
|
||||
*
|
||||
*/
|
||||
for (r_index = 0; r_index < get_num_regions(); r_index++) {
|
||||
if (!_is_enabled_region(r_index) ||
|
||||
!_is_in_region(r_index, (u32_t)addr, size)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (_is_user_accessible_region(r_index, write)) {
|
||||
return 0;
|
||||
} else {
|
||||
return -EPERM;
|
||||
}
|
||||
}
|
||||
|
||||
return -EPERM;
|
||||
}
|
||||
#endif /* CONFIG_USERSPACE */
|
||||
|
||||
/* ARC MPU Driver Initial Setup */
|
||||
/*
|
||||
* @brief MPU default initialization and configuration
|
||||
*
|
||||
* This function provides the default configuration mechanism for the Memory
|
||||
* Protection Unit (MPU).
|
||||
*/
|
||||
static int arc_mpu_init(struct device *arg)
|
||||
{
|
||||
ARG_UNUSED(arg);
|
||||
|
||||
u32_t num_regions;
|
||||
u32_t i;
|
||||
|
||||
num_regions = get_num_regions();
|
||||
|
||||
/* ARC MPU supports up to 16 Regions */
|
||||
if (mpu_config.num_regions > num_regions) {
|
||||
__ASSERT(0,
|
||||
"Request to configure: %u regions (supported: %u)\n",
|
||||
mpu_config.num_regions, num_regions);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
/* Disable MPU */
|
||||
arc_core_mpu_disable();
|
||||
|
||||
int r_index;
|
||||
/*
|
||||
* the MPU regions are filled in the reverse order.
|
||||
* According to ARCv2 ISA, the MPU region with smaller
|
||||
* index has higher priority. The static background MPU
|
||||
* regions in mpu_config will be in the bottom. Then
|
||||
* the special type regions will be above.
|
||||
*
|
||||
*/
|
||||
r_index = num_regions - mpu_config.num_regions;
|
||||
|
||||
/* clear all the regions first */
|
||||
for (i = 0U; i < r_index; i++) {
|
||||
_region_init(i, 0, 0, 0);
|
||||
}
|
||||
|
||||
/* configure the static regions */
|
||||
for (i = 0U; i < mpu_config.num_regions; i++) {
|
||||
_region_init(r_index,
|
||||
mpu_config.mpu_regions[i].base,
|
||||
mpu_config.mpu_regions[i].size,
|
||||
mpu_config.mpu_regions[i].attr);
|
||||
r_index++;
|
||||
}
|
||||
|
||||
/* default region: no read, write and execute */
|
||||
arc_core_mpu_default(0);
|
||||
|
||||
/* Enable MPU */
|
||||
arc_core_mpu_enable();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
SYS_INIT(arc_mpu_init, PRE_KERNEL_1,
|
||||
CONFIG_KERNEL_INIT_PRIORITY_DEFAULT);
|
||||
|
||||
#endif /* ZEPHYR_ARCH_ARC_CORE_MPU_ARC_MPU_V2_INTERNAL_H_ */
|
||||
@@ -1,680 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2019 Synopsys.
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
#ifndef ZEPHYR_ARCH_ARC_CORE_MPU_ARC_MPU_V3_INTERNAL_H_
|
||||
#define ZEPHYR_ARCH_ARC_CORE_MPU_ARC_MPU_V3_INTERNAL_H_
|
||||
|
||||
#define AUX_MPU_RPER_SID1 0x10000
|
||||
/* valid mask: SID1+secure+valid */
|
||||
#define AUX_MPU_RPER_VALID_MASK ((0x1) | AUX_MPU_RPER_SID1 | AUX_MPU_ATTR_S)
|
||||
|
||||
#define AUX_MPU_RPER_ATTR_MASK (0x1FF)
|
||||
|
||||
#define _ARC_V2_MPU_EN (0x409)
|
||||
|
||||
/* aux regs added in MPU version 3 */
|
||||
#define _ARC_V2_MPU_INDEX (0x448) /* MPU index */
|
||||
#define _ARC_V2_MPU_RSTART (0x449) /* MPU region start address */
|
||||
#define _ARC_V2_MPU_REND (0x44A) /* MPU region end address */
|
||||
#define _ARC_V2_MPU_RPER (0x44B) /* MPU region permission register */
|
||||
#define _ARC_V2_MPU_PROBE (0x44C) /* MPU probe register */
|
||||
|
||||
|
||||
/* For MPU version 3, the minimum protection region size is 32 bytes */
|
||||
#define ARC_FEATURE_MPU_ALIGNMENT_BITS 5
|
||||
|
||||
#define CALC_REGION_END_ADDR(start, size) \
|
||||
(start + size - (1 << ARC_FEATURE_MPU_ALIGNMENT_BITS))
|
||||
|
||||
#if defined(CONFIG_USERSPACE) && defined(CONFIG_MPU_STACK_GUARD)
|
||||
/* 1 for stack guard , 1 for user thread, 1 for split */
|
||||
#define MPU_REGION_NUM_FOR_THREAD 3
|
||||
#elif defined(CONFIG_USERSPACE) || defined(CONFIG_MPU_STACK_GUARD)
|
||||
/* 1 for stack guard or user thread stack , 1 for split */
|
||||
#define MPU_REGION_NUM_FOR_THREAD 2
|
||||
#else
|
||||
#define MPU_REGION_NUM_FOR_THREAD 0
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief internal structure holding information of
|
||||
* memory areas where dynamic MPU programming is allowed.
|
||||
*/
|
||||
struct dynamic_region_info {
|
||||
u8_t index;
|
||||
u32_t base;
|
||||
u32_t size;
|
||||
u32_t attr;
|
||||
};
|
||||
|
||||
#define MPU_DYNAMIC_REGION_AREAS_NUM 2
|
||||
|
||||
static u8_t static_regions_num;
|
||||
static u8_t dynamic_regions_num;
|
||||
static u8_t dynamic_region_index;
|
||||
|
||||
/**
|
||||
* Global array, holding the MPU region index of
|
||||
* the memory region inside which dynamic memory
|
||||
* regions may be configured.
|
||||
*/
|
||||
static struct dynamic_region_info dyn_reg_info[MPU_DYNAMIC_REGION_AREAS_NUM];
|
||||
|
||||
static inline void _region_init(u32_t index, u32_t region_addr, u32_t size,
|
||||
u32_t region_attr)
|
||||
{
|
||||
if (size < (1 << ARC_FEATURE_MPU_ALIGNMENT_BITS)) {
|
||||
size = (1 << ARC_FEATURE_MPU_ALIGNMENT_BITS);
|
||||
}
|
||||
|
||||
if (region_attr) {
|
||||
region_attr &= AUX_MPU_RPER_ATTR_MASK;
|
||||
region_attr |= AUX_MPU_RPER_VALID_MASK;
|
||||
}
|
||||
|
||||
z_arc_v2_aux_reg_write(_ARC_V2_MPU_INDEX, index);
|
||||
z_arc_v2_aux_reg_write(_ARC_V2_MPU_RSTART, region_addr);
|
||||
z_arc_v2_aux_reg_write(_ARC_V2_MPU_REND,
|
||||
CALC_REGION_END_ADDR(region_addr, size));
|
||||
z_arc_v2_aux_reg_write(_ARC_V2_MPU_RPER, region_attr);
|
||||
}
|
||||
|
||||
static inline void _region_set_attr(u32_t index, u32_t attr)
|
||||
{
|
||||
z_arc_v2_aux_reg_write(_ARC_V2_MPU_INDEX, index);
|
||||
z_arc_v2_aux_reg_write(_ARC_V2_MPU_RPER, attr |
|
||||
AUX_MPU_RPER_VALID_MASK);
|
||||
}
|
||||
|
||||
static inline u32_t _region_get_attr(u32_t index)
|
||||
{
|
||||
z_arc_v2_aux_reg_write(_ARC_V2_MPU_INDEX, index);
|
||||
|
||||
return z_arc_v2_aux_reg_read(_ARC_V2_MPU_RPER);
|
||||
}
|
||||
|
||||
static inline u32_t _region_get_start(u32_t index)
|
||||
{
|
||||
z_arc_v2_aux_reg_write(_ARC_V2_MPU_INDEX, index);
|
||||
|
||||
return z_arc_v2_aux_reg_read(_ARC_V2_MPU_RSTART);
|
||||
}
|
||||
|
||||
static inline void _region_set_start(u32_t index, u32_t start)
|
||||
{
|
||||
z_arc_v2_aux_reg_write(_ARC_V2_MPU_INDEX, index);
|
||||
z_arc_v2_aux_reg_write(_ARC_V2_MPU_RSTART, start);
|
||||
}
|
||||
|
||||
static inline u32_t _region_get_end(u32_t index)
|
||||
{
|
||||
z_arc_v2_aux_reg_write(_ARC_V2_MPU_INDEX, index);
|
||||
|
||||
return z_arc_v2_aux_reg_read(_ARC_V2_MPU_REND) +
|
||||
(1 << ARC_FEATURE_MPU_ALIGNMENT_BITS);
|
||||
}
|
||||
|
||||
static inline void _region_set_end(u32_t index, u32_t end)
|
||||
{
|
||||
z_arc_v2_aux_reg_write(_ARC_V2_MPU_INDEX, index);
|
||||
z_arc_v2_aux_reg_write(_ARC_V2_MPU_REND, end -
|
||||
(1 << ARC_FEATURE_MPU_ALIGNMENT_BITS));
|
||||
}
|
||||
|
||||
/**
|
||||
* This internal function probes the given addr's MPU index.if not
|
||||
* in MPU, returns error
|
||||
*/
|
||||
static inline int _mpu_probe(u32_t addr)
|
||||
{
|
||||
u32_t val;
|
||||
|
||||
z_arc_v2_aux_reg_write(_ARC_V2_MPU_PROBE, addr);
|
||||
val = z_arc_v2_aux_reg_read(_ARC_V2_MPU_INDEX);
|
||||
|
||||
/* if no match or multiple regions match, return error */
|
||||
if (val & 0xC0000000) {
|
||||
return -EINVAL;
|
||||
} else {
|
||||
return val;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* This internal function allocates a dynamic MPU region and returns
|
||||
* the index or error
|
||||
*/
|
||||
static inline int _dynamic_region_allocate_index(void)
|
||||
{
|
||||
if (dynamic_region_index >= get_num_regions()) {
|
||||
LOG_ERR("no enough mpu entries %d", dynamic_region_index);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
return dynamic_region_index++;
|
||||
}
|
||||
|
||||
/**
|
||||
* This internal function checks if MPU region is enabled or not
|
||||
*/
|
||||
static inline bool _is_enabled_region(u32_t r_index)
|
||||
{
|
||||
z_arc_v2_aux_reg_write(_ARC_V2_MPU_INDEX, r_index);
|
||||
return ((z_arc_v2_aux_reg_read(_ARC_V2_MPU_RPER) &
|
||||
AUX_MPU_RPER_VALID_MASK) == AUX_MPU_RPER_VALID_MASK);
|
||||
}
|
||||
|
||||
/**
|
||||
* This internal function checks the area given by (start, size)
|
||||
* and returns the index if the area match one MPU entry
|
||||
*/
|
||||
static inline int _get_region_index(u32_t start, u32_t size)
|
||||
{
|
||||
int index = _mpu_probe(start);
|
||||
|
||||
if (index > 0 && index == _mpu_probe(start + size - 1)) {
|
||||
return index;
|
||||
}
|
||||
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
/**
|
||||
* This internal function check if the region is user accessible or not
|
||||
*/
|
||||
static inline bool _is_user_accessible_region(u32_t r_index, int write)
|
||||
{
|
||||
u32_t r_ap;
|
||||
|
||||
z_arc_v2_aux_reg_write(_ARC_V2_MPU_INDEX, r_index);
|
||||
r_ap = z_arc_v2_aux_reg_read(_ARC_V2_MPU_RPER);
|
||||
r_ap &= AUX_MPU_RPER_ATTR_MASK;
|
||||
|
||||
if (write) {
|
||||
return ((r_ap & (AUX_MPU_ATTR_UW | AUX_MPU_ATTR_KW)) ==
|
||||
(AUX_MPU_ATTR_UW | AUX_MPU_ATTR_KW));
|
||||
}
|
||||
|
||||
return ((r_ap & (AUX_MPU_ATTR_UR | AUX_MPU_ATTR_KR)) ==
|
||||
(AUX_MPU_ATTR_UR | AUX_MPU_ATTR_KR));
|
||||
}
|
||||
|
||||
/* @brief allocate and init a dynamic MPU region
|
||||
*
|
||||
* This internal function performs the allocation and initialization of
|
||||
* a dynamic MPU region
|
||||
*
|
||||
* @param base region base
|
||||
* @param size region size
|
||||
* @param attr region attribute
|
||||
* @return <0 failure, >0 allocated dynamic region index
|
||||
*/
|
||||
static int _dynamic_region_allocate_and_init(u32_t base, u32_t size,
|
||||
u32_t attr)
|
||||
{
|
||||
int u_region_index = _get_region_index(base, size);
|
||||
int region_index;
|
||||
|
||||
LOG_DBG("Region info: base 0x%x size 0x%x attr 0x%x", base, size, attr);
|
||||
|
||||
if (u_region_index == -EINVAL) {
|
||||
/* no underlying region */
|
||||
|
||||
region_index = _dynamic_region_allocate_index();
|
||||
|
||||
if (region_index > 0) {
|
||||
/* a new region */
|
||||
_region_init(region_index, base, size, attr);
|
||||
}
|
||||
|
||||
return region_index;
|
||||
}
|
||||
|
||||
/*
|
||||
* The new memory region is to be placed inside the underlying
|
||||
* region, possibly splitting the underlying region into two.
|
||||
*/
|
||||
|
||||
u32_t u_region_start = _region_get_start(u_region_index);
|
||||
u32_t u_region_end = _region_get_end(u_region_index);
|
||||
u32_t u_region_attr = _region_get_attr(u_region_index);
|
||||
u32_t end = base + size;
|
||||
|
||||
|
||||
if ((base == u_region_start) && (end == u_region_end)) {
|
||||
/* The new region overlaps entirely with the
|
||||
* underlying region. In this case we simply
|
||||
* update the partition attributes of the
|
||||
* underlying region with those of the new
|
||||
* region.
|
||||
*/
|
||||
_region_init(u_region_index, base, size, attr);
|
||||
region_index = u_region_index;
|
||||
} else if (base == u_region_start) {
|
||||
/* The new region starts exactly at the start of the
|
||||
* underlying region; the start of the underlying
|
||||
* region needs to be set to the end of the new region.
|
||||
*/
|
||||
_region_set_start(u_region_index, base + size);
|
||||
_region_set_attr(u_region_index, u_region_attr);
|
||||
|
||||
region_index = _dynamic_region_allocate_index();
|
||||
|
||||
if (region_index > 0) {
|
||||
_region_init(region_index, base, size, attr);
|
||||
}
|
||||
|
||||
} else if (end == u_region_end) {
|
||||
/* The new region ends exactly at the end of the
|
||||
* underlying region; the end of the underlying
|
||||
* region needs to be set to the start of the
|
||||
* new region.
|
||||
*/
|
||||
_region_set_end(u_region_index, base);
|
||||
_region_set_attr(u_region_index, u_region_attr);
|
||||
|
||||
region_index = _dynamic_region_allocate_index();
|
||||
|
||||
if (region_index > 0) {
|
||||
_region_init(region_index, base, size, attr);
|
||||
}
|
||||
|
||||
} else {
|
||||
/* The new region lies strictly inside the
|
||||
* underlying region, which needs to split
|
||||
* into two regions.
|
||||
*/
|
||||
|
||||
_region_set_end(u_region_index, base);
|
||||
_region_set_attr(u_region_index, u_region_attr);
|
||||
|
||||
region_index = _dynamic_region_allocate_index();
|
||||
|
||||
if (region_index > 0) {
|
||||
_region_init(region_index, base, size, attr);
|
||||
|
||||
region_index = _dynamic_region_allocate_index();
|
||||
|
||||
if (region_index > 0) {
|
||||
_region_init(region_index, base + size,
|
||||
u_region_end - end, u_region_attr);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return region_index;
|
||||
}
|
||||
|
||||
/* @brief reset the dynamic MPU regions
|
||||
*
|
||||
* This internal function performs the reset of dynamic MPU regions
|
||||
*/
|
||||
static void _mpu_reset_dynamic_regions(void)
|
||||
{
|
||||
u32_t i;
|
||||
u32_t num_regions = get_num_regions();
|
||||
|
||||
for (i = static_regions_num; i < num_regions; i++) {
|
||||
_region_init(i, 0, 0, 0);
|
||||
}
|
||||
|
||||
for (i = 0U; i < dynamic_regions_num; i++) {
|
||||
_region_init(
|
||||
dyn_reg_info[i].index,
|
||||
dyn_reg_info[i].base,
|
||||
dyn_reg_info[i].size,
|
||||
dyn_reg_info[i].attr);
|
||||
}
|
||||
|
||||
/* dynamic regions are after static regions */
|
||||
dynamic_region_index = static_regions_num;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief configure the base address and size for an MPU region
|
||||
*
|
||||
* @param type MPU region type
|
||||
* @param base base address in RAM
|
||||
* @param size size of the region
|
||||
*/
|
||||
static inline int _mpu_configure(u8_t type, u32_t base, u32_t size)
|
||||
{
|
||||
u32_t region_attr = get_region_attr_by_type(type);
|
||||
|
||||
return _dynamic_region_allocate_and_init(base, size, region_attr);
|
||||
}
|
||||
|
||||
/* ARC Core MPU Driver API Implementation for ARC MPUv3 */
|
||||
|
||||
/**
|
||||
* @brief enable the MPU
|
||||
*/
|
||||
void arc_core_mpu_enable(void)
|
||||
{
|
||||
#define MPU_ENABLE_ATTR 0
|
||||
arc_core_mpu_default(MPU_ENABLE_ATTR);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief disable the MPU
|
||||
*/
|
||||
void arc_core_mpu_disable(void)
|
||||
{
|
||||
/* MPU is always enabled, use default region to
|
||||
* simulate MPU disable
|
||||
*/
|
||||
arc_core_mpu_default(REGION_ALL_ATTR);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief configure the thread's mpu regions
|
||||
*
|
||||
* @param thread the target thread
|
||||
*/
|
||||
void arc_core_mpu_configure_thread(struct k_thread *thread)
|
||||
{
|
||||
/* the mpu entries of ARC MPUv3 are divided into 2 parts:
|
||||
* static entries: global mpu entries, not changed in context switch
|
||||
* dynamic entries: MPU entries changed in context switch and
|
||||
* memory domain configure, including:
|
||||
* MPU entries for user thread stack
|
||||
* MPU entries for stack guard
|
||||
* MPU entries for mem domain
|
||||
* MPU entries for other thread specific regions
|
||||
* before configuring thread specific mpu entries, need to reset dynamic
|
||||
* entries
|
||||
*/
|
||||
_mpu_reset_dynamic_regions();
|
||||
#if defined(CONFIG_MPU_STACK_GUARD)
|
||||
#if defined(CONFIG_USERSPACE)
|
||||
if ((thread->base.user_options & K_USER) != 0U) {
|
||||
/* the areas before and after the user stack of thread is
|
||||
* kernel only. These area can be used as stack guard.
|
||||
* -----------------------
|
||||
* | kernel only area |
|
||||
* |---------------------|
|
||||
* | user stack |
|
||||
* |---------------------|
|
||||
* |privilege stack guard|
|
||||
* |---------------------|
|
||||
* | privilege stack |
|
||||
* -----------------------
|
||||
*/
|
||||
if (_mpu_configure(THREAD_STACK_GUARD_REGION,
|
||||
thread->arch.priv_stack_start - STACK_GUARD_SIZE,
|
||||
STACK_GUARD_SIZE) < 0) {
|
||||
LOG_ERR("thread %p's stack guard failed", thread);
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
if (_mpu_configure(THREAD_STACK_GUARD_REGION,
|
||||
thread->stack_info.start - STACK_GUARD_SIZE,
|
||||
STACK_GUARD_SIZE) < 0) {
|
||||
LOG_ERR("thread %p's stack guard failed", thread);
|
||||
return;
|
||||
}
|
||||
}
|
||||
#else
|
||||
if (_mpu_configure(THREAD_STACK_GUARD_REGION,
|
||||
thread->stack_info.start - STACK_GUARD_SIZE,
|
||||
STACK_GUARD_SIZE) < 0) {
|
||||
LOG_ERR("thread %p's stack guard failed", thread);
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(CONFIG_USERSPACE)
|
||||
u32_t num_partitions;
|
||||
struct k_mem_partition *pparts;
|
||||
struct k_mem_domain *mem_domain = thread->mem_domain_info.mem_domain;
|
||||
|
||||
/* configure stack region of user thread */
|
||||
if (thread->base.user_options & K_USER) {
|
||||
LOG_DBG("configure user thread %p's stack", thread);
|
||||
if (_mpu_configure(THREAD_STACK_USER_REGION,
|
||||
(u32_t)thread->stack_obj, thread->stack_info.size) < 0) {
|
||||
LOG_ERR("thread %p's stack failed", thread);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
/* configure thread's memory domain */
|
||||
if (mem_domain) {
|
||||
LOG_DBG("configure thread %p's domain: %p",
|
||||
thread, mem_domain);
|
||||
num_partitions = mem_domain->num_partitions;
|
||||
pparts = mem_domain->partitions;
|
||||
} else {
|
||||
num_partitions = 0U;
|
||||
pparts = NULL;
|
||||
}
|
||||
|
||||
for (u32_t i = 0; i < num_partitions; i++) {
|
||||
if (pparts->size) {
|
||||
if (_dynamic_region_allocate_and_init(pparts->start,
|
||||
pparts->size, pparts->attr) < 0) {
|
||||
LOG_ERR(
|
||||
"thread %p's mem region: %p failed",
|
||||
thread, pparts);
|
||||
return;
|
||||
}
|
||||
}
|
||||
pparts++;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief configure the default region
|
||||
*
|
||||
* @param region_attr region attribute of default region
|
||||
*/
|
||||
void arc_core_mpu_default(u32_t region_attr)
|
||||
{
|
||||
u32_t val = z_arc_v2_aux_reg_read(_ARC_V2_MPU_EN) &
|
||||
(~AUX_MPU_RPER_ATTR_MASK);
|
||||
|
||||
region_attr &= AUX_MPU_RPER_ATTR_MASK;
|
||||
|
||||
z_arc_v2_aux_reg_write(_ARC_V2_MPU_EN, region_attr | val);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief configure the MPU region
|
||||
*
|
||||
* @param index MPU region index
|
||||
* @param base base address
|
||||
* @param size region size
|
||||
* @param region_attr region attribute
|
||||
*/
|
||||
int arc_core_mpu_region(u32_t index, u32_t base, u32_t size,
|
||||
u32_t region_attr)
|
||||
{
|
||||
if (index >= get_num_regions()) {
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
region_attr &= AUX_MPU_RPER_ATTR_MASK;
|
||||
|
||||
_region_init(index, base, size, region_attr);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
#if defined(CONFIG_USERSPACE)
|
||||
/**
|
||||
* @brief configure MPU regions for the memory partitions of the memory domain
|
||||
*
|
||||
* @param thread the thread which has memory domain
|
||||
*/
|
||||
void arc_core_mpu_configure_mem_domain(struct k_thread *thread)
|
||||
{
|
||||
arc_core_mpu_configure_thread(thread);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief remove MPU regions for the memory partitions of the memory domain
|
||||
*
|
||||
* @param mem_domain the target memory domain
|
||||
*/
|
||||
void arc_core_mpu_remove_mem_domain(struct k_mem_domain *mem_domain)
|
||||
{
|
||||
u32_t num_partitions;
|
||||
struct k_mem_partition *pparts;
|
||||
int index;
|
||||
|
||||
if (mem_domain) {
|
||||
LOG_DBG("configure domain: %p", mem_domain);
|
||||
num_partitions = mem_domain->num_partitions;
|
||||
pparts = mem_domain->partitions;
|
||||
} else {
|
||||
LOG_DBG("disable domain partition regions");
|
||||
num_partitions = 0U;
|
||||
pparts = NULL;
|
||||
}
|
||||
|
||||
for (u32_t i = 0; i < num_partitions; i++) {
|
||||
if (pparts->size) {
|
||||
index = _get_region_index(pparts->start,
|
||||
pparts->size);
|
||||
if (index > 0) {
|
||||
_region_set_attr(index,
|
||||
REGION_KERNEL_RAM_ATTR);
|
||||
}
|
||||
}
|
||||
pparts++;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief reset MPU region for a single memory partition
|
||||
*
|
||||
* @param partition_id memory partition id
|
||||
*/
|
||||
void arc_core_mpu_remove_mem_partition(struct k_mem_domain *domain,
|
||||
u32_t partition_id)
|
||||
{
|
||||
struct k_mem_partition *partition = &domain->partitions[partition_id];
|
||||
|
||||
int region_index = _get_region_index(partition->start,
|
||||
partition->size);
|
||||
|
||||
if (region_index < 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
LOG_DBG("remove region 0x%x", region_index);
|
||||
_region_set_attr(region_index, REGION_KERNEL_RAM_ATTR);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief get the maximum number of free regions for memory domain partitions
|
||||
*/
|
||||
int arc_core_mpu_get_max_domain_partition_regions(void)
|
||||
{
|
||||
/* consider the worst case: each partition requires split */
|
||||
return (get_num_regions() - MPU_REGION_NUM_FOR_THREAD) / 2;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief validate the given buffer is user accessible or not
|
||||
*/
|
||||
int arc_core_mpu_buffer_validate(void *addr, size_t size, int write)
|
||||
{
|
||||
int r_index;
|
||||
|
||||
unsigned int key = z_arch_irq_lock();
|
||||
/*
|
||||
* For ARC MPU v3, overlapping is not supported.
|
||||
* we can stop the iteration immediately once we find the
|
||||
* matched region that grants permission or denies access.
|
||||
*/
|
||||
r_index = _mpu_probe((u32_t)addr);
|
||||
/* match and the area is in one region */
|
||||
if (r_index >= 0 && r_index == _mpu_probe((u32_t)addr + (size - 1))) {
|
||||
if (_is_user_accessible_region(r_index, write)) {
|
||||
r_index = 0;
|
||||
} else {
|
||||
r_index = -EPERM;
|
||||
}
|
||||
} else {
|
||||
r_index = -EPERM;
|
||||
}
|
||||
z_arch_irq_unlock(key);
|
||||
|
||||
return r_index;
|
||||
}
|
||||
#endif /* CONFIG_USERSPACE */
|
||||
|
||||
/* ARC MPU Driver Initial Setup */
|
||||
/*
|
||||
* @brief MPU default initialization and configuration
|
||||
*
|
||||
* This function provides the default configuration mechanism for the Memory
|
||||
* Protection Unit (MPU).
|
||||
*/
|
||||
static int arc_mpu_init(struct device *arg)
|
||||
{
|
||||
ARG_UNUSED(arg);
|
||||
u32_t num_regions;
|
||||
u32_t i;
|
||||
|
||||
num_regions = get_num_regions();
|
||||
|
||||
/* ARC MPU supports up to 16 Regions */
|
||||
if (mpu_config.num_regions > num_regions) {
|
||||
__ASSERT(0,
|
||||
"Request to configure: %u regions (supported: %u)\n",
|
||||
mpu_config.num_regions, num_regions);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
/* Disable MPU */
|
||||
arc_core_mpu_disable();
|
||||
|
||||
for (i = 0U; i < mpu_config.num_regions; i++) {
|
||||
_region_init(i,
|
||||
mpu_config.mpu_regions[i].base,
|
||||
mpu_config.mpu_regions[i].size,
|
||||
mpu_config.mpu_regions[i].attr);
|
||||
|
||||
/* record the static region which can be split */
|
||||
if (mpu_config.mpu_regions[i].attr & REGION_DYNAMIC) {
|
||||
if (dynamic_regions_num >
|
||||
MPU_DYNAMIC_REGION_AREAS_NUM) {
|
||||
LOG_ERR("no enough dynamic regions %d",
|
||||
dynamic_regions_num);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
dyn_reg_info[dynamic_regions_num].index = i;
|
||||
dyn_reg_info[dynamic_regions_num].base =
|
||||
mpu_config.mpu_regions[i].base;
|
||||
dyn_reg_info[dynamic_regions_num].size =
|
||||
mpu_config.mpu_regions[i].size;
|
||||
dyn_reg_info[dynamic_regions_num].attr =
|
||||
mpu_config.mpu_regions[i].attr;
|
||||
|
||||
dynamic_regions_num++;
|
||||
}
|
||||
}
|
||||
|
||||
static_regions_num = mpu_config.num_regions;
|
||||
|
||||
for (; i < num_regions; i++) {
|
||||
_region_init(i, 0, 0, 0);
|
||||
}
|
||||
|
||||
/* Enable MPU */
|
||||
arc_core_mpu_enable();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
SYS_INIT(arc_mpu_init, PRE_KERNEL_1,
|
||||
CONFIG_KERNEL_INIT_PRIORITY_DEFAULT);
|
||||
|
||||
#endif /* ZEPHYR_ARCH_ARC_CORE_MPU_ARC_MPU_V3_INTERNAL_H_ */
|
||||
@@ -30,12 +30,7 @@ GEN_OFFSET_SYM(_thread_arch_t, intlock_key);
|
||||
GEN_OFFSET_SYM(_thread_arch_t, relinquish_cause);
|
||||
GEN_OFFSET_SYM(_thread_arch_t, return_value);
|
||||
#ifdef CONFIG_ARC_STACK_CHECKING
|
||||
GEN_OFFSET_SYM(_thread_arch_t, k_stack_base);
|
||||
GEN_OFFSET_SYM(_thread_arch_t, k_stack_top);
|
||||
#ifdef CONFIG_USERSPACE
|
||||
GEN_OFFSET_SYM(_thread_arch_t, u_stack_base);
|
||||
GEN_OFFSET_SYM(_thread_arch_t, u_stack_top);
|
||||
#endif
|
||||
GEN_OFFSET_SYM(_thread_arch_t, stack_base);
|
||||
#endif
|
||||
|
||||
/* ARCv2-specific IRQ stack frame structure member offsets */
|
||||
@@ -63,9 +58,6 @@ GEN_OFFSET_SYM(_isf_t, ldi_base);
|
||||
GEN_OFFSET_SYM(_isf_t, jli_base);
|
||||
#endif
|
||||
GEN_OFFSET_SYM(_isf_t, pc);
|
||||
#ifdef CONFIG_ARC_HAS_SECURE
|
||||
GEN_OFFSET_SYM(_isf_t, sec_stat);
|
||||
#endif
|
||||
GEN_OFFSET_SYM(_isf_t, status32);
|
||||
GEN_ABSOLUTE_SYM(___isf_t_SIZEOF, sizeof(_isf_t));
|
||||
|
||||
@@ -87,14 +79,6 @@ GEN_OFFSET_SYM(_callee_saved_stack_t, r24);
|
||||
GEN_OFFSET_SYM(_callee_saved_stack_t, r25);
|
||||
GEN_OFFSET_SYM(_callee_saved_stack_t, r26);
|
||||
GEN_OFFSET_SYM(_callee_saved_stack_t, fp);
|
||||
#ifdef CONFIG_USERSPACE
|
||||
#ifdef CONFIG_ARC_HAS_SECURE
|
||||
GEN_OFFSET_SYM(_callee_saved_stack_t, kernel_sp);
|
||||
GEN_OFFSET_SYM(_callee_saved_stack_t, user_sp);
|
||||
#else
|
||||
GEN_OFFSET_SYM(_callee_saved_stack_t, user_sp);
|
||||
#endif
|
||||
#endif
|
||||
GEN_OFFSET_SYM(_callee_saved_stack_t, r30);
|
||||
#ifdef CONFIG_FP_SHARING
|
||||
GEN_OFFSET_SYM(_callee_saved_stack_t, r58);
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
*
|
||||
*
|
||||
* Initialization of full C support: zero the .bss, copy the .data if XIP,
|
||||
* call z_cstart().
|
||||
* call _Cstart().
|
||||
*
|
||||
* Stack is available in this module, but not the global data/bss until their
|
||||
* initialization is performed.
|
||||
@@ -21,7 +21,7 @@
|
||||
#include <linker/linker-defs.h>
|
||||
#include <arch/arc/v2/aux_regs.h>
|
||||
#include <kernel_structs.h>
|
||||
#include <kernel_internal.h>
|
||||
#include <nano_internal.h>
|
||||
|
||||
|
||||
/* XXX - keep for future use in full-featured cache APIs */
|
||||
@@ -40,14 +40,14 @@ static void disable_icache(void)
|
||||
{
|
||||
unsigned int val;
|
||||
|
||||
val = z_arc_v2_aux_reg_read(_ARC_V2_I_CACHE_BUILD);
|
||||
val = _arc_v2_aux_reg_read(_ARC_V2_I_CACHE_BUILD);
|
||||
val &= 0xff; /* version field */
|
||||
if (val == 0) {
|
||||
return; /* skip if i-cache is not present */
|
||||
}
|
||||
z_arc_v2_aux_reg_write(_ARC_V2_IC_IVIC, 0);
|
||||
_arc_v2_aux_reg_write(_ARC_V2_IC_IVIC, 0);
|
||||
__asm__ __volatile__ ("nop");
|
||||
z_arc_v2_aux_reg_write(_ARC_V2_IC_CTRL, 1);
|
||||
_arc_v2_aux_reg_write(_ARC_V2_IC_CTRL, 1);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -64,12 +64,12 @@ static void invalidate_dcache(void)
|
||||
{
|
||||
unsigned int val;
|
||||
|
||||
val = z_arc_v2_aux_reg_read(_ARC_V2_D_CACHE_BUILD);
|
||||
val = _arc_v2_aux_reg_read(_ARC_V2_D_CACHE_BUILD);
|
||||
val &= 0xff; /* version field */
|
||||
if (val == 0) {
|
||||
return; /* skip if d-cache is not present */
|
||||
}
|
||||
z_arc_v2_aux_reg_write(_ARC_V2_DC_IVDC, 1);
|
||||
_arc_v2_aux_reg_write(_ARC_V2_DC_IVDC, 1);
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -87,25 +87,21 @@ static void invalidate_dcache(void)
|
||||
|
||||
static void adjust_vector_table_base(void)
|
||||
{
|
||||
#ifdef CONFIG_ARC_HAS_SECURE
|
||||
#undef _ARC_V2_IRQ_VECT_BASE
|
||||
#define _ARC_V2_IRQ_VECT_BASE _ARC_V2_IRQ_VECT_BASE_S
|
||||
#endif
|
||||
extern struct vector_table _VectorTable;
|
||||
unsigned int vbr;
|
||||
/* if the compiled-in vector table is different
|
||||
* from the base address known by the ARC CPU,
|
||||
* set the vector base to the compiled-in address.
|
||||
*/
|
||||
vbr = z_arc_v2_aux_reg_read(_ARC_V2_IRQ_VECT_BASE);
|
||||
vbr = _arc_v2_aux_reg_read(_ARC_V2_IRQ_VECT_BASE);
|
||||
vbr &= 0xfffffc00;
|
||||
if (vbr != (unsigned int)&_VectorTable) {
|
||||
z_arc_v2_aux_reg_write(_ARC_V2_IRQ_VECT_BASE,
|
||||
_arc_v2_aux_reg_write(_ARC_V2_IRQ_VECT_BASE,
|
||||
(unsigned int)&_VectorTable);
|
||||
}
|
||||
}
|
||||
|
||||
extern FUNC_NORETURN void z_cstart(void);
|
||||
extern FUNC_NORETURN void _Cstart(void);
|
||||
/**
|
||||
*
|
||||
* @brief Prepare to and run C code
|
||||
@@ -117,10 +113,10 @@ extern FUNC_NORETURN void z_cstart(void);
|
||||
|
||||
void _PrepC(void)
|
||||
{
|
||||
z_icache_setup();
|
||||
_icache_setup();
|
||||
adjust_vector_table_base();
|
||||
z_bss_zero();
|
||||
z_data_copy();
|
||||
z_cstart();
|
||||
_bss_zero();
|
||||
_data_copy();
|
||||
_Cstart();
|
||||
CODE_UNREACHABLE;
|
||||
}
|
||||
|
||||
@@ -53,18 +53,10 @@ SECTION_FUNC(TEXT, _rirq_enter)
|
||||
|
||||
|
||||
#ifdef CONFIG_ARC_STACK_CHECKING
|
||||
#ifdef CONFIG_ARC_HAS_SECURE
|
||||
lr r2, [_ARC_V2_SEC_STAT]
|
||||
bclr r2, r2, _ARC_V2_SEC_STAT_SSC_BIT
|
||||
/* sflag r2 */
|
||||
/* sflag instruction is not supported in current ARC GNU */
|
||||
.long 0x00bf302f
|
||||
#else
|
||||
/* disable stack checking */
|
||||
lr r2, [_ARC_V2_STATUS32]
|
||||
bclr r2, r2, _ARC_V2_STATUS32_SC_BIT
|
||||
kflag r2
|
||||
#endif
|
||||
#endif
|
||||
clri
|
||||
ld r1, [exc_nest_count]
|
||||
@@ -99,28 +91,9 @@ SECTION_FUNC(TEXT, _rirq_exit)
|
||||
mov r1, exc_nest_count
|
||||
ld r0, [r1]
|
||||
sub r0, r0, 1
|
||||
cmp r0, 0
|
||||
bne.d _rirq_return_from_rirq
|
||||
st r0, [r1]
|
||||
/*
|
||||
* using exc_nest_count to decide whether is nest int is not reliable.
|
||||
* a better option is to use IRQ_ACT
|
||||
* A case is: a high priority int preempts a low priority int before
|
||||
* rirq_enter/firq_enter, then in _rirq_exit/_firq_exit, it will see
|
||||
* exc_nest_cout is 0, this will lead to possible thread switch, but
|
||||
* a low priority int is still pending.
|
||||
*
|
||||
* If multi bits in IRQ_ACT are set, i.e. last bit != fist bit, it's
|
||||
* in nest interrupt
|
||||
*/
|
||||
lr r0, [_ARC_V2_AUX_IRQ_ACT]
|
||||
and r0, r0, 0xffff
|
||||
ffs r1, r0
|
||||
fls r2, r0
|
||||
cmp r1, r2
|
||||
jne _rirq_return_from_rirq
|
||||
|
||||
#ifdef CONFIG_STACK_SENTINEL
|
||||
bl z_check_stack_sentinel
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_PREEMPT_ENABLED
|
||||
|
||||
@@ -132,6 +105,16 @@ SECTION_FUNC(TEXT, _rirq_exit)
|
||||
* point on until return from interrupt.
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
* Non-preemptible thread ? Do not schedule (see explanation of
|
||||
* preempt field in kernel_struct.h).
|
||||
*/
|
||||
ldh_s r0, [r2, _thread_offset_to_preempt]
|
||||
mov r3, _NON_PREEMPT_THRESHOLD
|
||||
cmp_s r0, r3
|
||||
bhs.d _rirq_no_reschedule
|
||||
|
||||
/*
|
||||
* Both (a)reschedule and (b)non-reschedule cases need to load the
|
||||
* current thread's stack, but don't have to use it until the decision
|
||||
@@ -152,24 +135,6 @@ SECTION_FUNC(TEXT, _rirq_exit)
|
||||
.balign 4
|
||||
_rirq_reschedule:
|
||||
|
||||
#if defined(CONFIG_USERSPACE)
|
||||
/*
|
||||
* when USERSPACE is enabled, according to ARCv2 ISA, SP will be switched
|
||||
* if interrupt comes out in user mode, and will be recorded in bit 31
|
||||
* (U bit) of IRQ_ACT. when interrupt exits, SP will be switched back
|
||||
* according to U bit.
|
||||
*
|
||||
* need to remember the user/kernel status of interrupted thread, will be
|
||||
* restored when thread switched back
|
||||
*
|
||||
*/
|
||||
lr r4, [_ARC_V2_AUX_IRQ_ACT]
|
||||
and r3, r4, 0x80000000
|
||||
push_s r3
|
||||
|
||||
bclr r4, r4, 31
|
||||
sr r4, [_ARC_V2_AUX_IRQ_ACT]
|
||||
#endif
|
||||
/* _save_callee_saved_regs expects outgoing thread in r2 */
|
||||
_save_callee_saved_regs
|
||||
|
||||
@@ -184,7 +149,11 @@ _rirq_common_interrupt_swap:
|
||||
/* r2 contains pointer to new thread */
|
||||
|
||||
#ifdef CONFIG_ARC_STACK_CHECKING
|
||||
_load_stack_check_regs
|
||||
/* Use stack top and base registers from restored context */
|
||||
ld r3, [r2, _thread_offset_to_stack_base]
|
||||
sr r3, [_ARC_V2_KSTACK_BASE]
|
||||
ld r3, [r2, _thread_offset_to_stack_top]
|
||||
sr r3, [_ARC_V2_KSTACK_TOP]
|
||||
#endif
|
||||
/*
|
||||
* _load_callee_saved_regs expects incoming thread in r2.
|
||||
@@ -192,15 +161,14 @@ _rirq_common_interrupt_swap:
|
||||
*/
|
||||
_load_callee_saved_regs
|
||||
|
||||
#if defined(CONFIG_MPU_STACK_GUARD) || defined(CONFIG_USERSPACE)
|
||||
#ifdef CONFIG_MPU_STACK_GUARD
|
||||
push_s r2
|
||||
mov r0, r2
|
||||
bl configure_mpu_thread
|
||||
bl configure_mpu_stack_guard
|
||||
pop_s r2
|
||||
#endif
|
||||
|
||||
|
||||
ld r3, [r2, _thread_offset_to_relinquish_cause]
|
||||
ld_s r3, [r2, _thread_offset_to_relinquish_cause]
|
||||
|
||||
breq r3, _CAUSE_RIRQ, _rirq_return_from_rirq
|
||||
nop
|
||||
@@ -212,30 +180,27 @@ _rirq_common_interrupt_swap:
|
||||
.balign 4
|
||||
_rirq_return_from_coop:
|
||||
|
||||
/*
|
||||
* status32, sec_stat (when CONFIG_ARC_HAS_SECURE is enabled) and pc
|
||||
* (blink) are already on the stack in the right order
|
||||
*/
|
||||
ld_s r0, [sp, ___isf_t_status32_OFFSET - ___isf_t_pc_OFFSET]
|
||||
/* status32 and pc (blink) are already on the stack in the right order */
|
||||
|
||||
/* update status32.ie (explanation in firq_exit:_firq_return_from_coop) */
|
||||
|
||||
ld r3, [r2, _thread_offset_to_intlock_key]
|
||||
ld_s r0, [sp, 4]
|
||||
ld_s r3, [r2, _thread_offset_to_intlock_key]
|
||||
st 0, [r2, _thread_offset_to_intlock_key]
|
||||
cmp r3, 0
|
||||
or.ne r0, r0, _ARC_V2_STATUS32_IE
|
||||
|
||||
st_s r0, [sp, ___isf_t_status32_OFFSET - ___isf_t_pc_OFFSET]
|
||||
st_s r0, [sp, 4]
|
||||
|
||||
/* carve fake stack */
|
||||
sub sp, sp, ___isf_t_pc_OFFSET
|
||||
|
||||
/* update return value on stack */
|
||||
ld r0, [r2, _thread_offset_to_return_value]
|
||||
st_s r0, [sp, ___isf_t_r0_OFFSET]
|
||||
/*
|
||||
* a) status32/pc are already on the stack
|
||||
* b) a real value will be pushed in r0
|
||||
*/
|
||||
sub sp, sp, (___isf_t_SIZEOF - 12)
|
||||
|
||||
/* reset zero-overhead loops */
|
||||
st 0, [sp, ___isf_t_lp_end_OFFSET]
|
||||
/* push return value on stack */
|
||||
ld_s r0, [r2, _thread_offset_to_return_value]
|
||||
push_s r0
|
||||
|
||||
/*
|
||||
* r13 is part of both the callee and caller-saved register sets because
|
||||
@@ -253,31 +218,11 @@ _rirq_return_from_coop:
|
||||
|
||||
/* fall through to rtie instruction */
|
||||
|
||||
/* stack now has the IRQ stack frame layout, pointing to sp */
|
||||
/* rtie will pop the rest from the stack */
|
||||
rtie
|
||||
|
||||
#endif /* CONFIG_PREEMPT_ENABLED */
|
||||
|
||||
.balign 4
|
||||
_rirq_return_from_firq:
|
||||
_rirq_return_from_rirq:
|
||||
#if defined(CONFIG_USERSPACE)
|
||||
/*
|
||||
* need to recover the user/kernel status of interrupted thread
|
||||
*/
|
||||
pop_s r3
|
||||
lr r2, [_ARC_V2_AUX_IRQ_ACT]
|
||||
or r2, r2, r3
|
||||
sr r2, [_ARC_V2_AUX_IRQ_ACT]
|
||||
#endif
|
||||
#ifdef CONFIG_TRACING
|
||||
push_s blink
|
||||
|
||||
bl sys_trace_thread_switched_in
|
||||
|
||||
pop_s blink
|
||||
#endif
|
||||
_rirq_no_reschedule:
|
||||
|
||||
rtie
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
* Reset handler that prepares the system for running C code.
|
||||
*/
|
||||
|
||||
// #include <board.h>
|
||||
#include <toolchain.h>
|
||||
#include <linker/sections.h>
|
||||
#include <arch/cpu.h>
|
||||
@@ -44,33 +45,9 @@ GTEXT(__start)
|
||||
SECTION_FUNC(TEXT,__reset)
|
||||
SECTION_FUNC(TEXT,__start)
|
||||
|
||||
/* lock interrupts: will get unlocked when switch to main task
|
||||
* also make sure the processor in the correct status
|
||||
*/
|
||||
mov r0, 0
|
||||
kflag r0
|
||||
#if defined(CONFIG_BOOT_TIME_MEASUREMENT) && defined(CONFIG_ARCV2_TIMER)
|
||||
/*
|
||||
* ARCV2 timer (timer0) is a free run timer, let it start to count
|
||||
* here.
|
||||
*/
|
||||
mov r0, 0xffffffff
|
||||
sr r0, [_ARC_V2_TMR0_LIMIT]
|
||||
mov r0, 0
|
||||
sr r0, [_ARC_V2_TMR0_COUNT]
|
||||
#endif
|
||||
/* interrupt related init */
|
||||
sr r0, [_ARC_V2_AUX_IRQ_ACT]
|
||||
sr r0, [_ARC_V2_AUX_IRQ_CTRL]
|
||||
sr r0, [_ARC_V2_AUX_IRQ_HINT]
|
||||
/* lock interrupts: will get unlocked when switch to main task */
|
||||
clri
|
||||
|
||||
/* \todo: MPU init, gp for small data? */
|
||||
|
||||
#if CONFIG_USERSPACE
|
||||
lr r0, [_ARC_V2_STATUS32]
|
||||
bset r0, r0, _ARC_V2_STATUS32_US_BIT
|
||||
kflag r0
|
||||
#endif
|
||||
mov r1, 1
|
||||
|
||||
invalidate_and_disable_icache:
|
||||
@@ -97,9 +74,9 @@ invalidate_dcache:
|
||||
|
||||
done_cache_invalidate:
|
||||
|
||||
#if defined(CONFIG_SYS_POWER_DEEP_SLEEP_STATES) && \
|
||||
#if defined(CONFIG_SYS_POWER_DEEP_SLEEP) && \
|
||||
!defined(CONFIG_BOOTLOADER_CONTEXT_RESTORE)
|
||||
jl @_sys_resume_from_deep_sleep
|
||||
jl @_sys_soc_resume_from_deep_sleep
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_INIT_STACKS
|
||||
|
||||
@@ -51,7 +51,7 @@ GDATA(_kernel)
|
||||
* not has already been taken and a context switch must happen.
|
||||
*
|
||||
* @return may contain a return value setup by a call to
|
||||
* z_set_thread_return_value()
|
||||
* _set_thread_return_value()
|
||||
*
|
||||
* C function prototype:
|
||||
*
|
||||
@@ -61,38 +61,23 @@ GDATA(_kernel)
|
||||
|
||||
SECTION_FUNC(TEXT, __swap)
|
||||
|
||||
#ifdef CONFIG_EXECUTION_BENCHMARKING
|
||||
mov r1, _kernel
|
||||
ld_s r2, [r1, _kernel_offset_to_current]
|
||||
_save_callee_saved_regs
|
||||
push_s r31
|
||||
|
||||
bl read_timer_start_of_swap
|
||||
|
||||
pop_s r31
|
||||
mov r1, _kernel
|
||||
ld_s r2, [r1, _kernel_offset_to_current]
|
||||
_load_callee_saved_regs
|
||||
st sp, [r2, _thread_offset_to_sp]
|
||||
#endif
|
||||
|
||||
/* interrupts are locked, interrupt key is in r0 */
|
||||
|
||||
mov r1, _kernel
|
||||
ld_s r2, [r1, _kernel_offset_to_current]
|
||||
|
||||
/* save intlock key */
|
||||
st r0, [r2, _thread_offset_to_intlock_key]
|
||||
st_s r0, [r2, _thread_offset_to_intlock_key]
|
||||
st _CAUSE_COOP, [r2, _thread_offset_to_relinquish_cause]
|
||||
|
||||
/*
|
||||
* Carve space for the return value. Setting it to a default of
|
||||
* Carve space for the return value. Setting it to a defafult of
|
||||
* -EAGAIN eliminates the need for the timeout code to set it.
|
||||
* If another value is ever needed, it can be modified with
|
||||
* z_set_thread_return_value().
|
||||
* _set_thread_return_value().
|
||||
*/
|
||||
ld r3, [_k_neg_eagain]
|
||||
st r3, [r2, _thread_offset_to_return_value]
|
||||
st_s r3, [r2, _thread_offset_to_return_value]
|
||||
|
||||
/*
|
||||
* Save status32 and blink on the stack before the callee-saved registers.
|
||||
@@ -100,25 +85,11 @@ SECTION_FUNC(TEXT, __swap)
|
||||
*/
|
||||
lr r3, [_ARC_V2_STATUS32]
|
||||
push_s r3
|
||||
|
||||
#ifdef CONFIG_ARC_HAS_SECURE
|
||||
lr r3, [_ARC_V2_SEC_STAT]
|
||||
push_s r3
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_ARC_STACK_CHECKING
|
||||
#ifdef CONFIG_ARC_HAS_SECURE
|
||||
bclr r3, r3, _ARC_V2_SEC_STAT_SSC_BIT
|
||||
/* sflag r3 */
|
||||
/* sflag instruction is not supported in current ARC GNU */
|
||||
.long 0x00ff302f
|
||||
#else
|
||||
/* disable stack checking during swap */
|
||||
bclr r3, r3, _ARC_V2_STATUS32_SC_BIT
|
||||
kflag r3
|
||||
#endif
|
||||
#endif
|
||||
|
||||
push_s blink
|
||||
|
||||
_save_callee_saved_regs
|
||||
@@ -128,21 +99,25 @@ SECTION_FUNC(TEXT, __swap)
|
||||
|
||||
/* entering here, r2 contains the new current thread */
|
||||
#ifdef CONFIG_ARC_STACK_CHECKING
|
||||
_load_stack_check_regs
|
||||
/* Use stack top and base registers from restored context */
|
||||
ld r3, [r2, _thread_offset_to_stack_base]
|
||||
sr r3, [_ARC_V2_KSTACK_BASE]
|
||||
ld r3, [r2, _thread_offset_to_stack_top]
|
||||
sr r3, [_ARC_V2_KSTACK_TOP]
|
||||
#endif
|
||||
/* XXX - can be moved to delay slot of _CAUSE_RIRQ ? */
|
||||
st_s r2, [r1, _kernel_offset_to_current]
|
||||
|
||||
_load_callee_saved_regs
|
||||
|
||||
#if defined(CONFIG_MPU_STACK_GUARD) || defined(CONFIG_USERSPACE)
|
||||
#ifdef CONFIG_MPU_STACK_GUARD
|
||||
push_s r2
|
||||
mov r0, r2
|
||||
bl configure_mpu_thread
|
||||
bl configure_mpu_stack_guard
|
||||
pop_s r2
|
||||
#endif
|
||||
|
||||
ld r3, [r2, _thread_offset_to_relinquish_cause]
|
||||
ld_s r3, [r2, _thread_offset_to_relinquish_cause]
|
||||
|
||||
breq r3, _CAUSE_RIRQ, _swap_return_from_rirq
|
||||
nop
|
||||
@@ -154,40 +129,17 @@ SECTION_FUNC(TEXT, __swap)
|
||||
.balign 4
|
||||
_swap_return_from_coop:
|
||||
|
||||
ld r1, [r2, _thread_offset_to_intlock_key]
|
||||
ld_s r1, [r2, _thread_offset_to_intlock_key]
|
||||
st 0, [r2, _thread_offset_to_intlock_key]
|
||||
ld r0, [r2, _thread_offset_to_return_value]
|
||||
ld_s r0, [r2, _thread_offset_to_return_value]
|
||||
|
||||
lr ilink, [_ARC_V2_STATUS32]
|
||||
bbit1 ilink, _ARC_V2_STATUS32_AE_BIT, _return_from_exc
|
||||
|
||||
pop_s blink /* pc into blink */
|
||||
#ifdef CONFIG_ARC_HAS_SECURE
|
||||
pop_s r3 /* pop SEC_STAT */
|
||||
/* sflag r3 */
|
||||
/* sflag instruction is not supported in current ARC GNU */
|
||||
.long 0x00ff302f
|
||||
#endif
|
||||
#ifdef CONFIG_EXECUTION_BENCHMARKING
|
||||
b _capture_value_for_benchmarking
|
||||
#endif
|
||||
return_loc:
|
||||
|
||||
pop_s r3 /* status32 into r3 */
|
||||
kflag r3 /* write status32 */
|
||||
|
||||
#ifdef CONFIG_TRACING
|
||||
push_s blink
|
||||
push_s r1
|
||||
push_s r0
|
||||
|
||||
bl sys_trace_thread_switched_in
|
||||
|
||||
pop_s r0
|
||||
pop_s r1
|
||||
pop_s blink
|
||||
#endif
|
||||
|
||||
j_s.d [blink] /* always execute delay slot */
|
||||
seti r1 /* delay slot */
|
||||
|
||||
@@ -196,47 +148,23 @@ return_loc:
|
||||
_swap_return_from_rirq:
|
||||
_swap_return_from_firq:
|
||||
|
||||
#if defined(CONFIG_USERSPACE)
|
||||
/*
|
||||
* need to recover the user/kernel status of interrupted thread
|
||||
*/
|
||||
pop_s r3
|
||||
lr r2, [_ARC_V2_AUX_IRQ_ACT]
|
||||
or r2, r2, r3
|
||||
sr r2, [_ARC_V2_AUX_IRQ_ACT]
|
||||
#endif
|
||||
lr r3, [_ARC_V2_STATUS32]
|
||||
bbit1 r3, _ARC_V2_STATUS32_AE_BIT, _return_from_exc_irq
|
||||
|
||||
/* pretend interrupt happened to use rtie instruction */
|
||||
|
||||
#ifdef CONFIG_ARC_HAS_SECURE
|
||||
lr r3, [_ARC_V2_SEC_STAT]
|
||||
/* set SEC_STAT.IRM = SECURE for interrupt return */
|
||||
bset r3, r3, 3
|
||||
/* sflag r3 */
|
||||
/* sflag instruction is not supported in current ARC GNU */
|
||||
.long 0x00ff302f
|
||||
#endif
|
||||
|
||||
lr r3, [_ARC_V2_AUX_IRQ_ACT]
|
||||
/* use lowest interrupt priority */
|
||||
or r3, r3, (1<<(CONFIG_NUM_IRQ_PRIO_LEVELS-1))
|
||||
brne r3,0,_swap_already_in_irq
|
||||
|
||||
or r3,r3,(1<<(CONFIG_NUM_IRQ_PRIO_LEVELS-1)) /* use lowest */
|
||||
sr r3, [_ARC_V2_AUX_IRQ_ACT]
|
||||
|
||||
#ifdef CONFIG_TRACING
|
||||
push_s blink
|
||||
|
||||
bl sys_trace_thread_switched_in
|
||||
|
||||
pop_s blink
|
||||
#endif
|
||||
_swap_already_in_irq:
|
||||
rtie
|
||||
|
||||
.balign 4
|
||||
_return_from_exc_irq:
|
||||
_pop_irq_stack_frame
|
||||
sub_s sp, sp, ___isf_t_status32_OFFSET - ___isf_t_pc_OFFSET + 4
|
||||
sub_s sp, sp, 8
|
||||
|
||||
_return_from_exc:
|
||||
|
||||
@@ -244,37 +172,8 @@ _return_from_exc:
|
||||
ld ilink, [sp] /* pc into ilink */
|
||||
sr ilink, [_ARC_V2_ERET]
|
||||
|
||||
/* SEC_STAT is bypassed when CONFIG_ARC_HAS_SECURE */
|
||||
|
||||
/* put status32 into estatus */
|
||||
ld ilink, [sp, ___isf_t_status32_OFFSET - ___isf_t_pc_OFFSET]
|
||||
ld ilink, [sp, 4] /* status32 into ilink */
|
||||
sr ilink, [_ARC_V2_ERSTATUS]
|
||||
add_s sp, sp, ___isf_t_status32_OFFSET - ___isf_t_pc_OFFSET + 4
|
||||
|
||||
#ifdef CONFIG_TRACING
|
||||
push_s blink
|
||||
|
||||
bl sys_trace_thread_switched_in
|
||||
|
||||
pop_s blink
|
||||
#endif
|
||||
add_s sp, sp, 8
|
||||
rtie
|
||||
|
||||
|
||||
#ifdef CONFIG_EXECUTION_BENCHMARKING
|
||||
.balign 4
|
||||
_capture_value_for_benchmarking:
|
||||
mov r1, _kernel
|
||||
ld_s r2, [r1, _kernel_offset_to_current]
|
||||
_save_callee_saved_regs
|
||||
push_s blink
|
||||
|
||||
bl read_timer_end_of_swap
|
||||
|
||||
pop_s blink
|
||||
mov r1, _kernel
|
||||
ld_s r2, [r1, _kernel_offset_to_current]
|
||||
_load_callee_saved_regs
|
||||
st sp, [r2, _thread_offset_to_sp]
|
||||
b return_loc
|
||||
#endif /* CONFIG_EXECUTION_BENCHMARKING */
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
* @file
|
||||
* @brief ARCv2 system fatal error handler
|
||||
*
|
||||
* This module provides the z_SysFatalErrorHandler() routine for ARCv2 BSPs.
|
||||
* This module provides the _SysFatalErrorHandler() routine for ARCv2 BSPs.
|
||||
*/
|
||||
|
||||
#include <kernel.h>
|
||||
@@ -37,32 +37,23 @@
|
||||
*
|
||||
* @return N/A
|
||||
*/
|
||||
__weak void z_SysFatalErrorHandler(unsigned int reason,
|
||||
FUNC_NORETURN __weak void _SysFatalErrorHandler(unsigned int reason,
|
||||
const NANO_ESF *pEsf)
|
||||
{
|
||||
ARG_UNUSED(pEsf);
|
||||
|
||||
#if !defined(CONFIG_SIMPLE_FATAL_ERROR_HANDLER)
|
||||
#if defined(CONFIG_STACK_SENTINEL)
|
||||
if (reason == _NANO_ERR_STACK_CHK_FAIL) {
|
||||
goto hang_system;
|
||||
}
|
||||
#endif
|
||||
if (reason == _NANO_ERR_KERNEL_PANIC) {
|
||||
goto hang_system;
|
||||
}
|
||||
|
||||
if (z_is_thread_essential()) {
|
||||
printk("Fatal fault in essential thread! Spinning...\n");
|
||||
if (k_is_in_isr() || _is_thread_essential()) {
|
||||
printk("Fatal fault in %s! Spinning...\n",
|
||||
k_is_in_isr() ? "ISR" : "essential thread");
|
||||
goto hang_system;
|
||||
}
|
||||
|
||||
printk("Fatal fault in thread %p! Aborting.\n", _current);
|
||||
|
||||
k_thread_abort(_current);
|
||||
|
||||
return;
|
||||
|
||||
hang_system:
|
||||
#else
|
||||
ARG_UNUSED(reason);
|
||||
@@ -71,4 +62,5 @@ hang_system:
|
||||
for (;;) {
|
||||
k_cpu_idle();
|
||||
}
|
||||
CODE_UNREACHABLE;
|
||||
}
|
||||
|
||||
@@ -19,17 +19,9 @@
|
||||
#ifdef CONFIG_INIT_STACKS
|
||||
#include <string.h>
|
||||
#endif /* CONFIG_INIT_STACKS */
|
||||
|
||||
#ifdef CONFIG_USERSPACE
|
||||
#include <arch/arc/v2/mpu/arc_core_mpu.h>
|
||||
#endif
|
||||
|
||||
/* initial stack frame */
|
||||
struct init_stack_frame {
|
||||
u32_t pc;
|
||||
#ifdef CONFIG_ARC_HAS_SECURE
|
||||
u32_t sec_stat;
|
||||
#endif
|
||||
u32_t status32;
|
||||
u32_t r3;
|
||||
u32_t r2;
|
||||
@@ -46,7 +38,7 @@ struct init_stack_frame {
|
||||
* needed anymore.
|
||||
*
|
||||
* The initial context is a basic stack frame that contains arguments for
|
||||
* z_thread_entry() return address, that points at z_thread_entry()
|
||||
* _thread_entry() return address, that points at _thread_entry()
|
||||
* and status register.
|
||||
*
|
||||
* <options> is currently unused.
|
||||
@@ -62,218 +54,62 @@ struct init_stack_frame {
|
||||
*
|
||||
* @return N/A
|
||||
*/
|
||||
void z_new_thread(struct k_thread *thread, k_thread_stack_t *stack,
|
||||
size_t stackSize, k_thread_entry_t pEntry,
|
||||
void _new_thread(struct k_thread *thread, k_thread_stack_t stack,
|
||||
size_t stackSize, _thread_entry_t pEntry,
|
||||
void *parameter1, void *parameter2, void *parameter3,
|
||||
int priority, unsigned int options)
|
||||
{
|
||||
char *pStackMem = Z_THREAD_STACK_BUFFER(stack);
|
||||
Z_ASSERT_VALID_PRIO(priority, pEntry);
|
||||
char *pStackMem = K_THREAD_STACK_BUFFER(stack);
|
||||
_ASSERT_VALID_PRIO(priority, pEntry);
|
||||
|
||||
char *stackEnd;
|
||||
char *stackAdjEnd;
|
||||
char *stackEnd = pStackMem + stackSize;
|
||||
struct init_stack_frame *pInitCtx;
|
||||
|
||||
#if CONFIG_USERSPACE
|
||||
_new_thread_init(thread, pStackMem, stackSize, priority, options);
|
||||
|
||||
size_t stackAdjSize;
|
||||
size_t offset = 0;
|
||||
|
||||
/* adjust stack and stack size */
|
||||
#if CONFIG_ARC_MPU_VER == 2
|
||||
stackAdjSize = Z_ARC_MPUV2_SIZE_ALIGN(stackSize);
|
||||
#elif CONFIG_ARC_MPU_VER == 3
|
||||
stackAdjSize = STACK_SIZE_ALIGN(stackSize);
|
||||
#endif
|
||||
stackEnd = pStackMem + stackAdjSize;
|
||||
|
||||
#if CONFIG_STACK_POINTER_RANDOM
|
||||
offset = stackAdjSize - stackSize;
|
||||
#endif
|
||||
|
||||
if (options & K_USER) {
|
||||
thread->arch.priv_stack_start =
|
||||
(u32_t)(stackEnd + STACK_GUARD_SIZE);
|
||||
|
||||
stackAdjEnd = (char *)STACK_ROUND_DOWN(stackEnd +
|
||||
Z_ARCH_THREAD_STACK_RESERVED);
|
||||
|
||||
/* reserve 4 bytes for the start of user sp */
|
||||
stackAdjEnd -= 4;
|
||||
(*(u32_t *)stackAdjEnd) = STACK_ROUND_DOWN(
|
||||
(u32_t)stackEnd - offset);
|
||||
|
||||
#ifdef CONFIG_THREAD_USERSPACE_LOCAL_DATA
|
||||
/* reserve stack space for the userspace local data struct */
|
||||
thread->userspace_local_data =
|
||||
(struct _thread_userspace_local_data *)
|
||||
STACK_ROUND_DOWN(stackEnd -
|
||||
sizeof(*thread->userspace_local_data) - offset);
|
||||
/* update the start of user sp */
|
||||
(*(u32_t *)stackAdjEnd) = (u32_t) thread->userspace_local_data;
|
||||
#endif
|
||||
|
||||
} else {
|
||||
/* for kernel thread, the privilege stack is merged into thread stack */
|
||||
/* if MPU_STACK_GUARD is enabled, reserve the the stack area
|
||||
* |---------------------| |----------------|
|
||||
* | user stack | | stack guard |
|
||||
* |---------------------| to |----------------|
|
||||
* | stack guard | | kernel thread |
|
||||
* |---------------------| | stack |
|
||||
* | privilege stack | | |
|
||||
* ---------------------------------------------
|
||||
*/
|
||||
pStackMem += STACK_GUARD_SIZE;
|
||||
stackAdjSize = stackAdjSize + CONFIG_PRIVILEGED_STACK_SIZE;
|
||||
stackEnd += Z_ARCH_THREAD_STACK_RESERVED;
|
||||
|
||||
thread->arch.priv_stack_start = 0;
|
||||
|
||||
#ifdef CONFIG_THREAD_USERSPACE_LOCAL_DATA
|
||||
/* reserve stack space for the userspace local data struct */
|
||||
stackAdjEnd = (char *)STACK_ROUND_DOWN(stackEnd
|
||||
- sizeof(*thread->userspace_local_data) - offset);
|
||||
thread->userspace_local_data =
|
||||
(struct _thread_userspace_local_data *)stackAdjEnd;
|
||||
#else
|
||||
stackAdjEnd = (char *)STACK_ROUND_DOWN(stackEnd - offset);
|
||||
#endif
|
||||
}
|
||||
|
||||
z_new_thread_init(thread, pStackMem, stackAdjSize, priority, options);
|
||||
|
||||
/* carve the thread entry struct from the "base" of
|
||||
the privileged stack */
|
||||
pInitCtx = (struct init_stack_frame *)(
|
||||
stackAdjEnd - sizeof(struct init_stack_frame));
|
||||
|
||||
/* fill init context */
|
||||
pInitCtx->status32 = 0U;
|
||||
if (options & K_USER) {
|
||||
pInitCtx->pc = ((u32_t)z_user_thread_entry_wrapper);
|
||||
} else {
|
||||
pInitCtx->pc = ((u32_t)z_thread_entry_wrapper);
|
||||
}
|
||||
|
||||
/*
|
||||
* enable US bit, US is read as zero in user mode. This will allow use
|
||||
* mode sleep instructions, and it enables a form of denial-of-service
|
||||
* attack by putting the processor in sleep mode, but since interrupt
|
||||
* level/mask can't be set from user space that's not worse than
|
||||
* executing a loop without yielding.
|
||||
*/
|
||||
pInitCtx->status32 |= _ARC_V2_STATUS32_US;
|
||||
#else /* For no USERSPACE feature */
|
||||
pStackMem += Z_ARCH_THREAD_STACK_RESERVED;
|
||||
stackEnd = pStackMem + stackSize;
|
||||
|
||||
z_new_thread_init(thread, pStackMem, stackSize, priority, options);
|
||||
|
||||
stackAdjEnd = stackEnd;
|
||||
|
||||
pInitCtx = (struct init_stack_frame *)(
|
||||
STACK_ROUND_DOWN(stackAdjEnd) -
|
||||
sizeof(struct init_stack_frame));
|
||||
|
||||
pInitCtx->status32 = 0U;
|
||||
pInitCtx->pc = ((u32_t)z_thread_entry_wrapper);
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_ARC_HAS_SECURE
|
||||
pInitCtx->sec_stat = z_arc_v2_aux_reg_read(_ARC_V2_SEC_STAT);
|
||||
#endif
|
||||
/* carve the thread entry struct from the "base" of the stack */
|
||||
pInitCtx = (struct init_stack_frame *)(STACK_ROUND_DOWN(stackEnd) -
|
||||
sizeof(struct init_stack_frame));
|
||||
|
||||
pInitCtx->pc = ((u32_t)_thread_entry_wrapper);
|
||||
pInitCtx->r0 = (u32_t)pEntry;
|
||||
pInitCtx->r1 = (u32_t)parameter1;
|
||||
pInitCtx->r2 = (u32_t)parameter2;
|
||||
pInitCtx->r3 = (u32_t)parameter3;
|
||||
|
||||
/* stack check configuration */
|
||||
#ifdef CONFIG_ARC_STACK_CHECKING
|
||||
#ifdef CONFIG_ARC_HAS_SECURE
|
||||
pInitCtx->sec_stat |= _ARC_V2_SEC_STAT_SSC;
|
||||
#else
|
||||
pInitCtx->status32 |= _ARC_V2_STATUS32_SC;
|
||||
#endif
|
||||
#ifdef CONFIG_USERSPACE
|
||||
if (options & K_USER) {
|
||||
thread->arch.u_stack_top = (u32_t)pStackMem;
|
||||
thread->arch.u_stack_base = (u32_t)stackEnd;
|
||||
thread->arch.k_stack_top =
|
||||
(u32_t)(stackEnd + STACK_GUARD_SIZE);
|
||||
thread->arch.k_stack_base = (u32_t)
|
||||
(stackEnd + Z_ARCH_THREAD_STACK_RESERVED);
|
||||
} else {
|
||||
thread->arch.k_stack_top = (u32_t)pStackMem;
|
||||
thread->arch.k_stack_base = (u32_t)stackEnd;
|
||||
thread->arch.u_stack_top = 0;
|
||||
thread->arch.u_stack_base = 0;
|
||||
}
|
||||
#else
|
||||
thread->arch.k_stack_top = (u32_t) pStackMem;
|
||||
thread->arch.k_stack_base = (u32_t) stackEnd;
|
||||
#endif
|
||||
#endif
|
||||
/*
|
||||
* seti instruction in the end of the z_swap() will
|
||||
* For now set the interrupt priority to 15
|
||||
* we can leave interrupt enable flag set to 0 as
|
||||
* seti instruction in the end of the _Swap() will
|
||||
* enable the interrupts based on intlock_key
|
||||
* value.
|
||||
*
|
||||
*/
|
||||
#ifdef CONFIG_ARC_STACK_CHECKING
|
||||
pInitCtx->status32 = _ARC_V2_STATUS32_SC | _ARC_V2_STATUS32_E(_ARC_V2_DEF_IRQ_LEVEL);
|
||||
thread->arch.stack_base = (u32_t) stackEnd;
|
||||
#else
|
||||
pInitCtx->status32 = _ARC_V2_STATUS32_E(_ARC_V2_DEF_IRQ_LEVEL);
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_THREAD_MONITOR
|
||||
/*
|
||||
* In debug mode thread->entry give direct access to the thread entry
|
||||
* and the corresponding parameters.
|
||||
*/
|
||||
thread->entry = (struct __thread_entry *)(pInitCtx);
|
||||
#endif
|
||||
|
||||
/*
|
||||
* intlock_key is constructed based on ARCv2 ISA Programmer's
|
||||
* Reference Manual CLRI instruction description:
|
||||
* dst[31:6] dst[5] dst[4] dst[3:0]
|
||||
* 26'd0 1 STATUS32.IE STATUS32.E[3:0]
|
||||
*/
|
||||
thread->arch.intlock_key = 0x30 | (_ARC_V2_DEF_IRQ_LEVEL & 0xf);
|
||||
thread->arch.intlock_key = 0x3F;
|
||||
thread->arch.relinquish_cause = _CAUSE_COOP;
|
||||
thread->callee_saved.sp =
|
||||
(u32_t)pInitCtx - ___callee_saved_stack_t_SIZEOF;
|
||||
|
||||
/* initial values in all other regs/k_thread entries are irrelevant */
|
||||
|
||||
thread_monitor_init(thread);
|
||||
}
|
||||
|
||||
|
||||
#ifdef CONFIG_USERSPACE
|
||||
|
||||
FUNC_NORETURN void z_arch_user_mode_enter(k_thread_entry_t user_entry,
|
||||
void *p1, void *p2, void *p3)
|
||||
{
|
||||
|
||||
/*
|
||||
* adjust the thread stack layout
|
||||
* |----------------| |---------------------|
|
||||
* | stack guard | | user stack |
|
||||
* |----------------| to |---------------------|
|
||||
* | kernel thread | | stack guard |
|
||||
* | stack | |---------------------|
|
||||
* | | | privilege stack |
|
||||
* ---------------------------------------------
|
||||
*/
|
||||
_current->stack_info.start = (u32_t)_current->stack_obj;
|
||||
_current->stack_info.size -= CONFIG_PRIVILEGED_STACK_SIZE;
|
||||
|
||||
_current->arch.priv_stack_start =
|
||||
(u32_t)(_current->stack_info.start +
|
||||
_current->stack_info.size + STACK_GUARD_SIZE);
|
||||
|
||||
#ifdef CONFIG_ARC_STACK_CHECKING
|
||||
_current->arch.k_stack_top = _current->arch.priv_stack_start;
|
||||
_current->arch.k_stack_base = _current->arch.priv_stack_start +
|
||||
CONFIG_PRIVILEGED_STACK_SIZE;
|
||||
_current->arch.u_stack_top = _current->stack_info.start;
|
||||
_current->arch.u_stack_base = _current->stack_info.start +
|
||||
_current->stack_info.size;
|
||||
#endif
|
||||
|
||||
/* possible optimizaiton: no need to load mem domain anymore */
|
||||
/* need to lock cpu here ? */
|
||||
configure_mpu_thread(_current);
|
||||
|
||||
z_arc_userspace_enter(user_entry, p1, p2, p3,
|
||||
(u32_t)_current->stack_obj,
|
||||
_current->stack_info.size);
|
||||
CODE_UNREACHABLE;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -6,30 +6,31 @@
|
||||
|
||||
/**
|
||||
* @file
|
||||
* @brief Wrapper for z_thread_entry
|
||||
* @brief Wrapper for _thread_entry
|
||||
*
|
||||
* Wrapper for z_thread_entry routine when called from the initial context.
|
||||
* Wrapper for _thread_entry routine when called from the initial context.
|
||||
*/
|
||||
|
||||
#include <toolchain.h>
|
||||
#include <linker/sections.h>
|
||||
|
||||
GTEXT(z_thread_entry_wrapper)
|
||||
GTEXT(_thread_entry_wrapper)
|
||||
GTEXT(_thread_entry)
|
||||
|
||||
/*
|
||||
* @brief Wrapper for z_thread_entry
|
||||
* @brief Wrapper for _thread_entry
|
||||
*
|
||||
* The routine pops parameters for the z_thread_entry from stack frame, prepared
|
||||
* by the z_new_thread() routine.
|
||||
* The routine pops parameters for the _thread_entry from stack frame, prepared
|
||||
* by the _new_thread() routine.
|
||||
*
|
||||
* @return N/A
|
||||
*/
|
||||
|
||||
SECTION_FUNC(TEXT, z_thread_entry_wrapper)
|
||||
SECTION_FUNC(TEXT, _thread_entry_wrapper)
|
||||
|
||||
pop_s r3
|
||||
pop_s r2
|
||||
pop_s r1
|
||||
pop_s r0
|
||||
j z_thread_entry
|
||||
j _thread_entry
|
||||
nop
|
||||
|
||||
@@ -15,6 +15,9 @@
|
||||
#include <toolchain.h>
|
||||
#include <kernel_structs.h>
|
||||
|
||||
extern volatile u64_t _sys_clock_tick_count;
|
||||
extern int sys_clock_hw_cycles_per_tick;
|
||||
|
||||
/*
|
||||
* @brief Read 64-bit timestamp value
|
||||
*
|
||||
@@ -23,17 +26,17 @@
|
||||
*
|
||||
* @return 64-bit time stamp value
|
||||
*/
|
||||
u64_t z_tsc_read(void)
|
||||
u64_t _tsc_read(void)
|
||||
{
|
||||
unsigned int key;
|
||||
u64_t t;
|
||||
u32_t count;
|
||||
|
||||
key = irq_lock();
|
||||
t = (u64_t)z_tick_get();
|
||||
count = z_arc_v2_aux_reg_read(_ARC_V2_TMR0_COUNT);
|
||||
t = (u64_t)_sys_clock_tick_count;
|
||||
count = _arc_v2_aux_reg_read(_ARC_V2_TMR0_COUNT);
|
||||
irq_unlock(key);
|
||||
t *= (u64_t)sys_clock_hw_cycles_per_tick();
|
||||
t *= (u64_t)sys_clock_hw_cycles_per_tick;
|
||||
t += (u64_t)count;
|
||||
return t;
|
||||
}
|
||||
|
||||
@@ -1,319 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2018 Synopsys.
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
#include <offsets_short.h>
|
||||
#include <toolchain.h>
|
||||
#include <linker/sections.h>
|
||||
#include <kernel_structs.h>
|
||||
#include <arch/cpu.h>
|
||||
#include <syscall.h>
|
||||
#include <swap_macros.h>
|
||||
|
||||
.macro clear_scratch_regs
|
||||
mov r1, 0
|
||||
mov r2, 0
|
||||
mov r3, 0
|
||||
mov r4, 0
|
||||
mov r5, 0
|
||||
mov r6, 0
|
||||
mov r7, 0
|
||||
mov r8, 0
|
||||
mov r9, 0
|
||||
mov r10, 0
|
||||
mov r11, 0
|
||||
mov r12, 0
|
||||
.endm
|
||||
|
||||
.macro clear_callee_regs
|
||||
mov r25, 0
|
||||
mov r24, 0
|
||||
mov r23, 0
|
||||
mov r22, 0
|
||||
mov r21, 0
|
||||
mov r20, 0
|
||||
mov r19, 0
|
||||
mov r18, 0
|
||||
mov r17, 0
|
||||
mov r16, 0
|
||||
|
||||
mov r15, 0
|
||||
mov r14, 0
|
||||
mov r13, 0
|
||||
.endm
|
||||
|
||||
GTEXT(z_arc_userspace_enter)
|
||||
GTEXT(_arc_do_syscall)
|
||||
GTEXT(z_user_thread_entry_wrapper)
|
||||
GTEXT(z_arch_user_string_nlen)
|
||||
GTEXT(z_arch_user_string_nlen_fault_start)
|
||||
GTEXT(z_arch_user_string_nlen_fault_end)
|
||||
GTEXT(z_arch_user_string_nlen_fixup)
|
||||
/*
|
||||
* @brief Wrapper for z_thread_entry in the case of user thread
|
||||
* The init parameters are in privileged stack
|
||||
*
|
||||
* @return N/A
|
||||
*/
|
||||
SECTION_FUNC(TEXT, z_user_thread_entry_wrapper)
|
||||
pop_s r3
|
||||
pop_s r2
|
||||
pop_s r1
|
||||
pop_s r0
|
||||
/* the start of user sp is in r5 */
|
||||
pop r5
|
||||
/* start of privilege stack in blink */
|
||||
mov blink, sp
|
||||
|
||||
st.aw r0, [r5, -4]
|
||||
st.aw r1, [r5, -4]
|
||||
st.aw r2, [r5, -4]
|
||||
st.aw r3, [r5, -4]
|
||||
|
||||
/*
|
||||
* when CONFIG_INIT_STACKS is enable, stack will be initialized
|
||||
* in z_new_thread_init.
|
||||
*/
|
||||
j _arc_go_to_user_space
|
||||
|
||||
/**
|
||||
*
|
||||
* User space entry function
|
||||
*
|
||||
* This function is the entry point to user mode from privileged execution.
|
||||
* The conversion is one way, and threads which transition to user mode do
|
||||
* not transition back later, unless they are doing system calls.
|
||||
*
|
||||
*/
|
||||
SECTION_FUNC(TEXT, z_arc_userspace_enter)
|
||||
/*
|
||||
* In ARCv2, the U bit can only be set through exception return
|
||||
*/
|
||||
#ifdef CONFIG_ARC_STACK_CHECKING
|
||||
/* disable stack checking as the stack should be initialized */
|
||||
#ifdef CONFIG_ARC_HAS_SECURE
|
||||
lr blink, [_ARC_V2_SEC_STAT]
|
||||
bclr blink, blink, _ARC_V2_SEC_STAT_SSC_BIT
|
||||
/* sflag blink */
|
||||
/* sflag instruction is not supported in current ARC GNU */
|
||||
.long 0x07ff302f
|
||||
#else
|
||||
lr blink, [_ARC_V2_STATUS32]
|
||||
bclr blink, blink, _ARC_V2_STATUS32_SC_BIT
|
||||
kflag blink
|
||||
#endif
|
||||
#endif
|
||||
/* the end of user stack in r5 */
|
||||
add r5, r4, r5
|
||||
/* start of privilege stack */
|
||||
add blink, r5, CONFIG_PRIVILEGED_STACK_SIZE+STACK_GUARD_SIZE
|
||||
mov sp, r5
|
||||
|
||||
push_s r0
|
||||
push_s r1
|
||||
push_s r2
|
||||
push_s r3
|
||||
|
||||
mov r5, sp /* skip r0, r1, r2, r3 */
|
||||
|
||||
#ifdef CONFIG_INIT_STACKS
|
||||
mov r0, 0xaaaaaaaa
|
||||
#else
|
||||
mov r0, 0x0
|
||||
#endif
|
||||
_clear_user_stack:
|
||||
st.ab r0, [r4, 4]
|
||||
cmp r4, r5
|
||||
jlt _clear_user_stack
|
||||
|
||||
#ifdef CONFIG_ARC_STACK_CHECKING
|
||||
mov r1, _kernel
|
||||
ld_s r2, [r1, _kernel_offset_to_current]
|
||||
|
||||
_load_stack_check_regs
|
||||
|
||||
#ifdef CONFIG_ARC_HAS_SECURE
|
||||
lr r0, [_ARC_V2_SEC_STAT]
|
||||
bset r0, r0, _ARC_V2_SEC_STAT_SSC_BIT
|
||||
/* sflag r0 */
|
||||
/* sflag instruction is not supported in current ARC GNU */
|
||||
.long 0x003f302f
|
||||
#else
|
||||
lr r0, [_ARC_V2_STATUS32]
|
||||
bset r0, r0, _ARC_V2_STATUS32_SC_BIT
|
||||
kflag r0
|
||||
#endif
|
||||
#endif
|
||||
|
||||
_arc_go_to_user_space:
|
||||
lr r0, [_ARC_V2_STATUS32]
|
||||
bset r0, r0, _ARC_V2_STATUS32_U_BIT
|
||||
|
||||
mov r1, z_thread_entry_wrapper
|
||||
|
||||
sr r0, [_ARC_V2_ERSTATUS]
|
||||
sr r1, [_ARC_V2_ERET]
|
||||
|
||||
/* fake exception return */
|
||||
lr r0, [_ARC_V2_STATUS32]
|
||||
bset r0, r0, _ARC_V2_STATUS32_AE_BIT
|
||||
kflag r0
|
||||
|
||||
#ifdef CONFIG_ARC_HAS_SECURE
|
||||
lr r0, [_ARC_V2_SEC_STAT]
|
||||
/* the mode returns from exception return is secure mode */
|
||||
bset r0, r0, 31
|
||||
sr r0, [_ARC_V2_ERSEC_STAT]
|
||||
sr r5, [_ARC_V2_SEC_U_SP]
|
||||
#else
|
||||
/* when exception returns from kernel to user, sp and _ARC_V2_USER_SP
|
||||
* will be switched
|
||||
*/
|
||||
sr r5, [_ARC_V2_USER_SP]
|
||||
#endif
|
||||
mov sp, blink
|
||||
|
||||
mov r0, 0
|
||||
|
||||
clear_callee_regs
|
||||
|
||||
clear_scratch_regs
|
||||
|
||||
mov fp, 0
|
||||
mov r29, 0
|
||||
mov r30, 0
|
||||
mov blink, 0
|
||||
|
||||
#ifdef CONFIG_EXECUTION_BENCHMARKING
|
||||
b _capture_value_for_benchmarking_userspace
|
||||
return_loc_userspace_enter:
|
||||
#endif /* CONFIG_EXECUTION_BENCHMARKING */
|
||||
|
||||
rtie
|
||||
|
||||
/**
|
||||
*
|
||||
* Userspace system call function
|
||||
*
|
||||
* This function is used to do system calls from unprivileged code. This
|
||||
* function is responsible for the following:
|
||||
* 1) Dispatching the system call
|
||||
* 2) Restoring stack and calling back to the caller of the system call
|
||||
*
|
||||
*/
|
||||
SECTION_FUNC(TEXT, _arc_do_syscall)
|
||||
/*
|
||||
* r0-r5: arg1-arg6, r6 is call id which is already checked in
|
||||
* trap_s handler, r7 is the system call stack frame pointer
|
||||
* need to recover r0, r1, r2 because they will be modified in
|
||||
* _create_irq_stack_frame. If a specific syscall frame (different
|
||||
* with irq stack frame) is defined, the cover of r0, r1, r2 can be
|
||||
* optimized.
|
||||
*/
|
||||
ld_s r0, [sp, ___isf_t_r0_OFFSET]
|
||||
ld_s r1, [sp, ___isf_t_r1_OFFSET]
|
||||
ld_s r2, [sp, ___isf_t_r2_OFFSET]
|
||||
|
||||
mov r7, sp
|
||||
|
||||
mov blink, _k_syscall_table
|
||||
ld.as r6, [blink, r6]
|
||||
|
||||
jl [r6]
|
||||
|
||||
/* save return value */
|
||||
st_s r0, [sp, ___isf_t_r0_OFFSET]
|
||||
|
||||
mov r29, 0
|
||||
mov r30, 0
|
||||
|
||||
/* through fake exception return, go back to the caller */
|
||||
lr r0, [_ARC_V2_STATUS32]
|
||||
bset r0, r0, _ARC_V2_STATUS32_AE_BIT
|
||||
kflag r0
|
||||
|
||||
#ifdef CONFIG_ARC_HAS_SECURE
|
||||
ld_s r0, [sp, ___isf_t_sec_stat_OFFSET]
|
||||
sr r0, [_ARC_V2_ERSEC_STAT]
|
||||
#endif
|
||||
ld_s r0, [sp, ___isf_t_status32_OFFSET]
|
||||
sr r0, [_ARC_V2_ERSTATUS]
|
||||
|
||||
ld_s r0, [sp, ___isf_t_pc_OFFSET] /* eret into pc */
|
||||
sr r0, [_ARC_V2_ERET]
|
||||
|
||||
_pop_irq_stack_frame
|
||||
|
||||
rtie
|
||||
|
||||
|
||||
/*
|
||||
* size_t z_arch_user_string_nlen(const char *s, size_t maxsize, int *err_arg)
|
||||
*/
|
||||
SECTION_FUNC(TEXT, z_arch_user_string_nlen)
|
||||
/* int err; */
|
||||
sub_s sp,sp,0x4
|
||||
|
||||
/* Initial error value (-1 failure), store at [sp,0] */
|
||||
mov_s r3, -1
|
||||
st_s r3, [sp, 0]
|
||||
|
||||
/* Loop setup.
|
||||
* r12 (position locator) = s - 1
|
||||
* r0 (length counter return value)) = 0
|
||||
* lp_count = maxsize + 1
|
||||
* */
|
||||
sub r12, r0, 0x1
|
||||
mov_s r0, 0
|
||||
add_s r1, r1, 1
|
||||
mov lp_count, r1
|
||||
|
||||
strlen_loop:
|
||||
z_arch_user_string_nlen_fault_start:
|
||||
/* is the byte at ++r12 a NULL? if so, we're done. Might fault! */
|
||||
ldb.aw r1, [r12, 1]
|
||||
|
||||
z_arch_user_string_nlen_fault_end:
|
||||
brne_s r1, 0, not_null
|
||||
|
||||
strlen_done:
|
||||
/* Success, set err to 0 */
|
||||
mov_s r1, 0
|
||||
st_s r1, [sp, 0]
|
||||
|
||||
z_arch_user_string_nlen_fixup:
|
||||
/* *err_arg = err; Pop stack and return */
|
||||
ld_s r1, [sp, 0]
|
||||
add_s sp, sp, 4
|
||||
j_s.d [blink]
|
||||
st_s r1, [r2, 0]
|
||||
|
||||
not_null:
|
||||
/* check if we've hit the maximum, if so we're done. */
|
||||
brne.d.nt lp_count, 0x1, inc_len
|
||||
sub lp_count, lp_count, 0x1
|
||||
b_s strlen_done
|
||||
|
||||
inc_len:
|
||||
/* increment length measurement, loop again */
|
||||
add_s r0, r0, 1
|
||||
b_s strlen_loop
|
||||
|
||||
#ifdef CONFIG_EXECUTION_BENCHMARKING
|
||||
.balign 4
|
||||
_capture_value_for_benchmarking_userspace:
|
||||
mov r1, _kernel
|
||||
ld_s r2, [r1, _kernel_offset_to_current]
|
||||
_save_callee_saved_regs
|
||||
push_s blink
|
||||
|
||||
bl read_timer_end_of_userspace_enter
|
||||
|
||||
pop_s blink
|
||||
mov r1, _kernel
|
||||
ld_s r2, [r1, _kernel_offset_to_current]
|
||||
_load_callee_saved_regs
|
||||
b return_loc_userspace_enter
|
||||
#endif
|
||||
@@ -46,7 +46,7 @@ struct vector_table {
|
||||
u32_t unused_2;
|
||||
};
|
||||
|
||||
struct vector_table _VectorTable Z_GENERIC_SECTION(.exc_vector_table) = {
|
||||
struct vector_table _VectorTable _GENERIC_SECTION(.exc_vector_table) = {
|
||||
(u32_t)__reset,
|
||||
(u32_t)__memory_error,
|
||||
(u32_t)__instruction_error,
|
||||
|
||||
6
arch/arc/defconfig
Normal file
6
arch/arc/defconfig
Normal file
@@ -0,0 +1,6 @@
|
||||
CONFIG_ARC=y
|
||||
CONFIG_SYS_CLOCK_HW_CYCLES_PER_SEC=32000000
|
||||
CONFIG_CPU_ARCEM4=y
|
||||
CONFIG_CPU_ARCV2=y
|
||||
CONFIG_ARCV2_INTERRUPT_UNIT=y
|
||||
CONFIG_ARCV2_TIMER=y
|
||||
@@ -17,8 +17,8 @@
|
||||
* symbols" in the offsets.o module.
|
||||
*/
|
||||
|
||||
#ifndef ZEPHYR_ARCH_ARC_INCLUDE_KERNEL_ARCH_DATA_H_
|
||||
#define ZEPHYR_ARCH_ARC_INCLUDE_KERNEL_ARCH_DATA_H_
|
||||
#ifndef _kernel_arch_data__h_
|
||||
#define _kernel_arch_data__h_
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
@@ -32,48 +32,13 @@ extern "C" {
|
||||
|
||||
#ifndef _ASMLANGUAGE
|
||||
#include <kernel.h>
|
||||
#include <kernel_internal.h>
|
||||
#include <nano_internal.h>
|
||||
#include <zephyr/types.h>
|
||||
#include <misc/util.h>
|
||||
#include <misc/dlist.h>
|
||||
#endif
|
||||
|
||||
#ifndef _ASMLANGUAGE
|
||||
#ifdef CONFIG_ARC_HAS_SECURE
|
||||
struct _irq_stack_frame {
|
||||
u32_t lp_end;
|
||||
u32_t lp_start;
|
||||
u32_t lp_count;
|
||||
#ifdef CONFIG_CODE_DENSITY
|
||||
/*
|
||||
* Currently unsupported. This is where those registers are
|
||||
* automatically pushed on the stack by the CPU when taking a regular
|
||||
* IRQ.
|
||||
*/
|
||||
u32_t ei_base;
|
||||
u32_t ldi_base;
|
||||
u32_t jli_base;
|
||||
#endif
|
||||
u32_t r0;
|
||||
u32_t r1;
|
||||
u32_t r2;
|
||||
u32_t r3;
|
||||
u32_t r4;
|
||||
u32_t r5;
|
||||
u32_t r6;
|
||||
u32_t r7;
|
||||
u32_t r8;
|
||||
u32_t r9;
|
||||
u32_t r10;
|
||||
u32_t r11;
|
||||
u32_t r12;
|
||||
u32_t r13;
|
||||
u32_t blink;
|
||||
u32_t pc;
|
||||
u32_t sec_stat;
|
||||
u32_t status32;
|
||||
};
|
||||
#else
|
||||
struct _irq_stack_frame {
|
||||
u32_t r0;
|
||||
u32_t r1;
|
||||
@@ -106,7 +71,6 @@ struct _irq_stack_frame {
|
||||
u32_t pc;
|
||||
u32_t status32;
|
||||
};
|
||||
#endif
|
||||
|
||||
typedef struct _irq_stack_frame _isf_t;
|
||||
|
||||
@@ -129,15 +93,6 @@ struct _callee_saved_stack {
|
||||
u32_t r25;
|
||||
u32_t r26;
|
||||
u32_t fp; /* r27 */
|
||||
|
||||
#ifdef CONFIG_USERSPACE
|
||||
#ifdef CONFIG_ARC_HAS_SECURE
|
||||
u32_t user_sp;
|
||||
u32_t kernel_sp;
|
||||
#else
|
||||
u32_t user_sp;
|
||||
#endif
|
||||
#endif
|
||||
/* r28 is the stack pointer and saved separately */
|
||||
/* r29 is ILINK and does not need to be saved */
|
||||
u32_t r30;
|
||||
@@ -188,4 +143,4 @@ typedef struct _kernel_arch _kernel_arch_t;
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* ZEPHYR_ARCH_ARC_INCLUDE_KERNEL_ARCH_DATA_H_ */
|
||||
#endif /* _kernel_arch_data__h_ */
|
||||
|
||||
@@ -17,8 +17,8 @@
|
||||
* symbols" in the offsets.o module.
|
||||
*/
|
||||
|
||||
#ifndef ZEPHYR_ARCH_ARC_INCLUDE_KERNEL_ARCH_FUNC_H_
|
||||
#define ZEPHYR_ARCH_ARC_INCLUDE_KERNEL_ARCH_FUNC_H_
|
||||
#ifndef _kernel_arch_func__h_
|
||||
#define _kernel_arch_func__h_
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
@@ -33,15 +33,29 @@ extern "C" {
|
||||
|
||||
static ALWAYS_INLINE void kernel_arch_init(void)
|
||||
{
|
||||
z_irq_setup();
|
||||
_irq_setup();
|
||||
}
|
||||
|
||||
static ALWAYS_INLINE void
|
||||
z_set_thread_return_value(struct k_thread *thread, unsigned int value)
|
||||
_set_thread_return_value(struct k_thread *thread, unsigned int value)
|
||||
{
|
||||
thread->arch.return_value = value;
|
||||
}
|
||||
|
||||
static ALWAYS_INLINE int _is_in_isr(void)
|
||||
{
|
||||
u32_t act = _arc_v2_aux_reg_read(_ARC_V2_AUX_IRQ_ACT);
|
||||
#if CONFIG_IRQ_OFFLOAD
|
||||
/* Check if we're in a TRAP_S exception as well */
|
||||
if (_arc_v2_aux_reg_read(_ARC_V2_STATUS32) & _ARC_V2_STATUS32_AE &&
|
||||
_ARC_V2_ECR_VECTOR(_arc_v2_aux_reg_read(_ARC_V2_ECR)) == EXC_EV_TRAP
|
||||
) {
|
||||
return 1;
|
||||
}
|
||||
#endif
|
||||
return ((act & 0xffff) != 0);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief Indicates the interrupt number of the highest priority
|
||||
@@ -49,20 +63,20 @@ z_set_thread_return_value(struct k_thread *thread, unsigned int value)
|
||||
*
|
||||
* @return IRQ number
|
||||
*/
|
||||
static ALWAYS_INLINE int Z_INTERRUPT_CAUSE(void)
|
||||
static ALWAYS_INLINE int _INTERRUPT_CAUSE(void)
|
||||
{
|
||||
u32_t irq_num = z_arc_v2_aux_reg_read(_ARC_V2_ICAUSE);
|
||||
u32_t irq_num = _arc_v2_aux_reg_read(_ARC_V2_ICAUSE);
|
||||
|
||||
return irq_num;
|
||||
}
|
||||
|
||||
#define z_is_in_isr z_arc_v2_irq_unit_is_in_isr
|
||||
|
||||
extern void z_thread_entry_wrapper(void);
|
||||
extern void z_user_thread_entry_wrapper(void);
|
||||
extern void _thread_entry_wrapper(void);
|
||||
|
||||
extern void z_arc_userspace_enter(k_thread_entry_t user_entry, void *p1,
|
||||
void *p2, void *p3, u32_t stack, u32_t size);
|
||||
static inline void _IntLibInit(void)
|
||||
{
|
||||
/* nothing needed, here because the kernel requires it */
|
||||
}
|
||||
|
||||
#endif /* _ASMLANGUAGE */
|
||||
|
||||
@@ -70,4 +84,4 @@ extern void z_arc_userspace_enter(k_thread_entry_t user_entry, void *p1,
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* ZEPHYR_ARCH_ARC_INCLUDE_KERNEL_ARCH_FUNC_H_ */
|
||||
#endif /* _kernel_arch_func__h_ */
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
* @file
|
||||
* @brief Per-arch thread definition
|
||||
*
|
||||
* This file contains definitions for
|
||||
* This file contains defintions for
|
||||
*
|
||||
* struct _thread_arch
|
||||
* struct _callee_saved
|
||||
@@ -17,12 +17,12 @@
|
||||
* necessary to instantiate instances of struct k_thread.
|
||||
*/
|
||||
|
||||
#ifndef ZEPHYR_ARCH_ARC_INCLUDE_KERNEL_ARCH_THREAD_H_
|
||||
#define ZEPHYR_ARCH_ARC_INCLUDE_KERNEL_ARCH_THREAD_H_
|
||||
#ifndef _kernel_arch_thread__h_
|
||||
#define _kernel_arch_thread__h_
|
||||
|
||||
/*
|
||||
* Reason a thread has relinquished control: threads can only be in the NONE
|
||||
* or COOP state, threads can be one in the four.
|
||||
* Reason a thread has relinquished control: fibers can only be in the NONE
|
||||
* or COOP state, tasks can be one in the four.
|
||||
*/
|
||||
#define _CAUSE_NONE 0
|
||||
#define _CAUSE_COOP 1
|
||||
@@ -54,23 +54,14 @@ struct _thread_arch {
|
||||
/* one of the _CAUSE_xxxx definitions above */
|
||||
int relinquish_cause;
|
||||
|
||||
/* return value from z_swap */
|
||||
/* return value from _Swap */
|
||||
unsigned int return_value;
|
||||
|
||||
#ifdef CONFIG_ARC_STACK_CHECKING
|
||||
/* High address of stack region, stack grows downward from this
|
||||
* location. Usesd for hardware stack checking
|
||||
*/
|
||||
u32_t k_stack_base;
|
||||
u32_t k_stack_top;
|
||||
#ifdef CONFIG_USERSPACE
|
||||
u32_t u_stack_base;
|
||||
u32_t u_stack_top;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_USERSPACE
|
||||
u32_t priv_stack_start;
|
||||
u32_t stack_base;
|
||||
#endif
|
||||
};
|
||||
|
||||
@@ -78,4 +69,4 @@ typedef struct _thread_arch _thread_arch_t;
|
||||
|
||||
#endif /* _ASMLANGUAGE */
|
||||
|
||||
#endif /* ZEPHYR_ARCH_ARC_INCLUDE_KERNEL_ARCH_THREAD_H_ */
|
||||
#endif /* _kernel_arch_thread__h_ */
|
||||
|
||||
36
arch/arc/include/kernel_event_logger_arch.h
Normal file
36
arch/arc/include/kernel_event_logger_arch.h
Normal file
@@ -0,0 +1,36 @@
|
||||
/*
|
||||
* Copyright (c) 2016 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file
|
||||
* @brief Kernel event logger support for ARM
|
||||
*/
|
||||
|
||||
#ifndef __KERNEL_EVENT_LOGGER_ARCH_H__
|
||||
#define __KERNEL_EVENT_LOGGER_ARCH_H__
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief Get the identification of the current interrupt.
|
||||
*
|
||||
* This routine obtain the key of the interrupt that is currently processed
|
||||
* if it is called from a ISR context.
|
||||
*
|
||||
* @return The key of the interrupt that is currently being processed.
|
||||
*/
|
||||
int _sys_current_irq_key_get(void)
|
||||
{
|
||||
return _INTERRUPT_CAUSE();
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __KERNEL_EVENT_LOGGER_ARCH_H__ */
|
||||
@@ -4,8 +4,8 @@
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
#ifndef ZEPHYR_ARCH_ARC_INCLUDE_OFFSETS_SHORT_ARCH_H_
|
||||
#define ZEPHYR_ARCH_ARC_INCLUDE_OFFSETS_SHORT_ARCH_H_
|
||||
#ifndef _offsets_short_arch__h_
|
||||
#define _offsets_short_arch__h_
|
||||
|
||||
#include <offsets.h>
|
||||
|
||||
@@ -26,21 +26,15 @@
|
||||
#define _thread_offset_to_return_value \
|
||||
(___thread_t_arch_OFFSET + ___thread_arch_t_return_value_OFFSET)
|
||||
|
||||
#define _thread_offset_to_k_stack_base \
|
||||
(___thread_t_arch_OFFSET + ___thread_arch_t_k_stack_base_OFFSET)
|
||||
|
||||
#define _thread_offset_to_k_stack_top \
|
||||
(___thread_t_arch_OFFSET + ___thread_arch_t_k_stack_top_OFFSET)
|
||||
|
||||
#define _thread_offset_to_u_stack_base \
|
||||
(___thread_t_arch_OFFSET + ___thread_arch_t_u_stack_base_OFFSET)
|
||||
|
||||
#define _thread_offset_to_u_stack_top \
|
||||
(___thread_t_arch_OFFSET + ___thread_arch_t_u_stack_top_OFFSET)
|
||||
#define _thread_offset_to_stack_base \
|
||||
(___thread_t_arch_OFFSET + ___thread_arch_t_stack_base_OFFSET)
|
||||
|
||||
#define _thread_offset_to_sp \
|
||||
(___thread_t_callee_saved_OFFSET + ___callee_saved_t_sp_OFFSET)
|
||||
|
||||
#define _thread_offset_to_stack_top \
|
||||
(___thread_t_stack_info_OFFSET + ___thread_stack_info_t_start_OFFSET)
|
||||
|
||||
/* end - threads */
|
||||
|
||||
#endif /* ZEPHYR_ARCH_ARC_INCLUDE_OFFSETS_SHORT_ARCH_H_ */
|
||||
#endif /* _offsets_short_arch__h_ */
|
||||
|
||||
@@ -6,8 +6,8 @@
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
#ifndef ZEPHYR_ARCH_ARC_INCLUDE_SWAP_MACROS_H_
|
||||
#define ZEPHYR_ARCH_ARC_INCLUDE_SWAP_MACROS_H_
|
||||
#ifndef _SWAP_MACROS__H_
|
||||
#define _SWAP_MACROS__H_
|
||||
|
||||
#include <kernel_structs.h>
|
||||
#include <offsets_short.h>
|
||||
@@ -41,18 +41,6 @@ extern "C" {
|
||||
st r25, [sp, ___callee_saved_stack_t_r25_OFFSET]
|
||||
st r26, [sp, ___callee_saved_stack_t_r26_OFFSET]
|
||||
st fp, [sp, ___callee_saved_stack_t_fp_OFFSET]
|
||||
|
||||
#ifdef CONFIG_USERSPACE
|
||||
#ifdef CONFIG_ARC_HAS_SECURE
|
||||
lr r13, [_ARC_V2_SEC_U_SP]
|
||||
st r13, [sp, ___callee_saved_stack_t_user_sp_OFFSET]
|
||||
lr r13, [_ARC_V2_SEC_K_SP]
|
||||
st r13, [sp, ___callee_saved_stack_t_kernel_sp_OFFSET]
|
||||
#else
|
||||
lr r13, [_ARC_V2_USER_SP]
|
||||
st r13, [sp, ___callee_saved_stack_t_user_sp_OFFSET]
|
||||
#endif
|
||||
#endif
|
||||
st r30, [sp, ___callee_saved_stack_t_r30_OFFSET]
|
||||
|
||||
#ifdef CONFIG_FP_SHARING
|
||||
@@ -76,13 +64,13 @@ extern "C" {
|
||||
|
||||
#endif
|
||||
|
||||
/* save stack pointer in struct k_thread */
|
||||
/* save stack pointer in struct tcs */
|
||||
st sp, [r2, _thread_offset_to_sp]
|
||||
.endm
|
||||
|
||||
/* entering this macro, current is in r2 */
|
||||
.macro _load_callee_saved_regs
|
||||
/* restore stack pointer from struct k_thread */
|
||||
/* restore stack pointer from struct tcs */
|
||||
ld sp, [r2, _thread_offset_to_sp]
|
||||
|
||||
#ifdef CONFIG_FP_SHARING
|
||||
@@ -105,18 +93,6 @@ extern "C" {
|
||||
sr r13, [_ARC_V2_FPU_DPFP2H]
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_USERSPACE
|
||||
#ifdef CONFIG_ARC_HAS_SECURE
|
||||
ld r13, [sp, ___callee_saved_stack_t_user_sp_OFFSET]
|
||||
sr r13, [_ARC_V2_SEC_U_SP]
|
||||
ld r13, [sp, ___callee_saved_stack_t_kernel_sp_OFFSET]
|
||||
sr r13, [_ARC_V2_SEC_K_SP]
|
||||
#else
|
||||
ld_s r13, [sp, ___callee_saved_stack_t_user_sp_OFFSET]
|
||||
sr r13, [_ARC_V2_USER_SP]
|
||||
#endif
|
||||
#endif
|
||||
|
||||
ld_s r13, [sp, ___callee_saved_stack_t_r13_OFFSET]
|
||||
@@ -236,46 +212,16 @@ extern "C" {
|
||||
* The pc and status32 values will still be on the stack. We cannot
|
||||
* pop them yet because the callers of _pop_irq_stack_frame must reload
|
||||
* status32 differently depending on the execution context they are
|
||||
* running in (z_swap(), firq or exception).
|
||||
* running in (_Swap(), firq or exception).
|
||||
*/
|
||||
add_s sp, sp, ___isf_t_SIZEOF
|
||||
|
||||
.endm
|
||||
|
||||
/*
|
||||
* To use this macor, r2 should have the value of thread struct pointer to
|
||||
* _kernel.current. r3 is a scratch reg.
|
||||
*/
|
||||
.macro _load_stack_check_regs
|
||||
#ifdef CONFIG_ARC_HAS_SECURE
|
||||
ld r3, [r2, _thread_offset_to_k_stack_base]
|
||||
sr r3, [_ARC_V2_S_KSTACK_BASE]
|
||||
ld r3, [r2, _thread_offset_to_k_stack_top]
|
||||
sr r3, [_ARC_V2_S_KSTACK_TOP]
|
||||
#ifdef CONFIG_USERSPACE
|
||||
ld r3, [r2, _thread_offset_to_u_stack_base]
|
||||
sr r3, [_ARC_V2_S_USTACK_BASE]
|
||||
ld r3, [r2, _thread_offset_to_u_stack_top]
|
||||
sr r3, [_ARC_V2_S_USTACK_TOP]
|
||||
#endif
|
||||
#else /* CONFIG_ARC_HAS_SECURE */
|
||||
ld r3, [r2, _thread_offset_to_k_stack_base]
|
||||
sr r3, [_ARC_V2_KSTACK_BASE]
|
||||
ld r3, [r2, _thread_offset_to_k_stack_top]
|
||||
sr r3, [_ARC_V2_KSTACK_TOP]
|
||||
#ifdef CONFIG_USERSPACE
|
||||
ld r3, [r2, _thread_offset_to_u_stack_base]
|
||||
sr r3, [_ARC_V2_USTACK_BASE]
|
||||
ld r3, [r2, _thread_offset_to_u_stack_top]
|
||||
sr r3, [_ARC_V2_USTACK_TOP]
|
||||
#endif
|
||||
#endif /* CONFIG_ARC_HAS_SECURE */
|
||||
.endm
|
||||
|
||||
#endif /* _ASMLANGUAGE */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* ZEPHYR_ARCH_ARC_INCLUDE_SWAP_MACROS_H_ */
|
||||
#endif /* _SWAP_MACROS__H_ */
|
||||
|
||||
@@ -1,36 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2016 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file
|
||||
* @brief Kernel event logger support for ARM
|
||||
*/
|
||||
|
||||
#ifndef ZEPHYR_ARCH_ARC_INCLUDE_TRACING_ARCH_H_
|
||||
#define ZEPHYR_ARCH_ARC_INCLUDE_TRACING_ARCH_H_
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief Get the identification of the current interrupt.
|
||||
*
|
||||
* This routine obtain the key of the interrupt that is currently processed
|
||||
* if it is called from a ISR context.
|
||||
*
|
||||
* @return The key of the interrupt that is currently being processed.
|
||||
*/
|
||||
int z_sys_current_irq_key_get(void)
|
||||
{
|
||||
return Z_INTERRUPT_CAUSE();
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* ZEPHYR_ARCH_ARC_INCLUDE_TRACING_ARCH_H_ */
|
||||
@@ -12,8 +12,8 @@
|
||||
* ARCv2 processor architecture.
|
||||
*/
|
||||
|
||||
#ifndef ZEPHYR_ARCH_ARC_INCLUDE_V2_CACHE_H_
|
||||
#define ZEPHYR_ARCH_ARC_INCLUDE_V2_CACHE_H_
|
||||
#ifndef _ARCV2_CACHE__H_
|
||||
#define _ARCV2_CACHE__H_
|
||||
|
||||
#include <arch/cpu.h>
|
||||
|
||||
@@ -34,7 +34,7 @@ extern "C" {
|
||||
*
|
||||
* Enables the i-cache and sets it to direct access mode.
|
||||
*/
|
||||
static ALWAYS_INLINE void z_icache_setup(void)
|
||||
static ALWAYS_INLINE void _icache_setup(void)
|
||||
{
|
||||
u32_t icache_config = (
|
||||
IC_CACHE_DIRECT | /* direct mapping (one-way assoc.) */
|
||||
@@ -42,11 +42,11 @@ static ALWAYS_INLINE void z_icache_setup(void)
|
||||
);
|
||||
u32_t val;
|
||||
|
||||
val = z_arc_v2_aux_reg_read(_ARC_V2_I_CACHE_BUILD);
|
||||
val = _arc_v2_aux_reg_read(_ARC_V2_I_CACHE_BUILD);
|
||||
val &= 0xff;
|
||||
if (val != 0U) { /* is i-cache present? */
|
||||
if (val != 0) { /* is i-cache present? */
|
||||
/* configure i-cache */
|
||||
z_arc_v2_aux_reg_write(_ARC_V2_IC_CTRL, icache_config);
|
||||
_arc_v2_aux_reg_write(_ARC_V2_IC_CTRL, icache_config);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -56,4 +56,4 @@ static ALWAYS_INLINE void z_icache_setup(void)
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* ZEPHYR_ARCH_ARC_INCLUDE_V2_CACHE_H_ */
|
||||
#endif /* _ARCV2_CACHE__H_ */
|
||||
|
||||
@@ -12,8 +12,8 @@
|
||||
* other definitions for the ARCv2 processor architecture.
|
||||
*/
|
||||
|
||||
#ifndef ZEPHYR_ARCH_ARC_INCLUDE_V2_IRQ_H_
|
||||
#define ZEPHYR_ARCH_ARC_INCLUDE_V2_IRQ_H_
|
||||
#ifndef _ARCV2_IRQ__H_
|
||||
#define _ARCV2_IRQ__H_
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
@@ -21,7 +21,6 @@ extern "C" {
|
||||
|
||||
#define _ARC_V2_AUX_IRQ_CTRL_BLINK (1 << 9)
|
||||
#define _ARC_V2_AUX_IRQ_CTRL_LOOP_REGS (1 << 10)
|
||||
#define _ARC_V2_AUX_IRQ_CTRL_U (1 << 11)
|
||||
#define _ARC_V2_AUX_IRQ_CTRL_LP (1 << 13)
|
||||
#define _ARC_V2_AUX_IRQ_CTRL_14_REGS 7
|
||||
#define _ARC_V2_AUX_IRQ_CTRL_16_REGS 8
|
||||
@@ -36,11 +35,11 @@ extern "C" {
|
||||
extern K_THREAD_STACK_DEFINE(_interrupt_stack, CONFIG_ISR_STACK_SIZE);
|
||||
|
||||
/*
|
||||
* z_irq_setup
|
||||
* _irq_setup
|
||||
*
|
||||
* Configures interrupt handling parameters
|
||||
*/
|
||||
static ALWAYS_INLINE void z_irq_setup(void)
|
||||
static ALWAYS_INLINE void _irq_setup(void)
|
||||
{
|
||||
u32_t aux_irq_ctrl_value = (
|
||||
_ARC_V2_AUX_IRQ_CTRL_LOOP_REGS | /* save lp_xxx registers */
|
||||
@@ -52,10 +51,10 @@ static ALWAYS_INLINE void z_irq_setup(void)
|
||||
);
|
||||
|
||||
k_cpu_sleep_mode = _ARC_V2_WAKE_IRQ_LEVEL;
|
||||
z_arc_v2_aux_reg_write(_ARC_V2_AUX_IRQ_CTRL, aux_irq_ctrl_value);
|
||||
_arc_v2_aux_reg_write(_ARC_V2_AUX_IRQ_CTRL, aux_irq_ctrl_value);
|
||||
|
||||
_kernel.irq_stack =
|
||||
Z_THREAD_STACK_BUFFER(_interrupt_stack) + CONFIG_ISR_STACK_SIZE;
|
||||
K_THREAD_STACK_BUFFER(_interrupt_stack) + CONFIG_ISR_STACK_SIZE;
|
||||
}
|
||||
|
||||
#endif /* _ASMLANGUAGE */
|
||||
@@ -64,4 +63,4 @@ static ALWAYS_INLINE void z_irq_setup(void)
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* ZEPHYR_ARCH_ARC_INCLUDE_V2_IRQ_H_ */
|
||||
#endif /* _ARCV2_IRQ__H_ */
|
||||
|
||||
@@ -18,8 +18,8 @@
|
||||
* Refer to the ARCv2 manual for an explanation of the exceptions.
|
||||
*/
|
||||
|
||||
#ifndef ZEPHYR_ARCH_ARC_INCLUDE_VECTOR_TABLE_H_
|
||||
#define ZEPHYR_ARCH_ARC_INCLUDE_VECTOR_TABLE_H_
|
||||
#ifndef _VECTOR_TABLE__H_
|
||||
#define _VECTOR_TABLE__H_
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
@@ -29,6 +29,7 @@ extern "C" {
|
||||
|
||||
#ifdef _ASMLANGUAGE
|
||||
|
||||
#include <board.h>
|
||||
#include <toolchain.h>
|
||||
#include <linker/sections.h>
|
||||
|
||||
@@ -76,4 +77,4 @@ extern void __ev_maligned(void);
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* ZEPHYR_ARCH_ARC_INCLUDE_VECTOR_TABLE_H_ */
|
||||
#endif /* _VECTOR_TABLE__H_ */
|
||||
|
||||
8
arch/arc/soc/em11d/Kbuild
Normal file
8
arch/arc/soc/em11d/Kbuild
Normal file
@@ -0,0 +1,8 @@
|
||||
ccflags-y +=-I$(srctree)/arch/arc/soc/
|
||||
ccflags-y +=-I$(srctree)/include
|
||||
ccflags-y +=-I$(srctree)/include/drivers
|
||||
ccflags-y +=-I$(srctree)/drivers
|
||||
|
||||
asflags-y := ${ccflags-y}
|
||||
|
||||
obj-y = soc.o soc_config.o
|
||||
63
arch/arc/soc/em11d/Kconfig.defconfig
Normal file
63
arch/arc/soc/em11d/Kconfig.defconfig
Normal file
@@ -0,0 +1,63 @@
|
||||
#
|
||||
# Copyright (c) 2014 Wind River Systems, Inc.
|
||||
# Copyright (c) 2016 Synopsys, Inc. All rights reserved.
|
||||
#
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
#
|
||||
|
||||
if SOC_EM11D
|
||||
|
||||
config SOC
|
||||
default em11d
|
||||
|
||||
config NUM_IRQ_PRIO_LEVELS
|
||||
# This processor supports 4 priority levels:
|
||||
# 0 for Fast Interrupts (FIRQs) and 1-3 for Regular Interrupts (IRQs).
|
||||
default 4
|
||||
|
||||
config NUM_IRQS
|
||||
# must be > the highest interrupt number used
|
||||
default 38 if BOARD_EM_STARTERKIT_R23
|
||||
default 36 if BOARD_EM_STARTERKIT_R22
|
||||
|
||||
config RGF_NUM_BANKS
|
||||
default 2
|
||||
|
||||
config SYS_CLOCK_HW_CYCLES_PER_SEC
|
||||
default 20000000
|
||||
|
||||
config HARVARD
|
||||
def_bool n
|
||||
|
||||
config FLASH_BASE_ADDRESS
|
||||
default 0x00000000
|
||||
|
||||
config FLASH_SIZE
|
||||
default 0
|
||||
# em11d has no FLASH so size is 0.
|
||||
|
||||
config SRAM_BASE_ADDRESS
|
||||
default 0x10000000
|
||||
|
||||
config SRAM_SIZE
|
||||
default 131072
|
||||
|
||||
config ICCM_BASE_ADDRESS
|
||||
default 0x00000000
|
||||
|
||||
config ICCM_SIZE
|
||||
default 64
|
||||
|
||||
config DCCM_BASE_ADDRESS
|
||||
default 0x80000000
|
||||
|
||||
config DCCM_SIZE
|
||||
default 64
|
||||
|
||||
config CACHE_FLUSHING
|
||||
def_bool y
|
||||
|
||||
config FP_FPU_DA
|
||||
def_bool y
|
||||
|
||||
endif #SOC_EM11D
|
||||
5
arch/arc/soc/em11d/Kconfig.soc
Normal file
5
arch/arc/soc/em11d/Kconfig.soc
Normal file
@@ -0,0 +1,5 @@
|
||||
|
||||
config SOC_EM11D
|
||||
bool "Synopsys ARC EM11D"
|
||||
select CPU_HAS_FPU
|
||||
|
||||
16
arch/arc/soc/em11d/Makefile
Normal file
16
arch/arc/soc/em11d/Makefile
Normal file
@@ -0,0 +1,16 @@
|
||||
# -mcpu=em4_fpuda is added to KBUILD_CFLAGS to make cc-option check the options correctly
|
||||
KBUILD_CFLAGS += -mcpu=em4_fpuda
|
||||
|
||||
soc-cflags += $(call cc-option, -mcpu=em4_fpuda -mno-sdata -mdiv-rem -mswap -mnorm) \
|
||||
$(call cc-option,-mmpy-option=6 -mbarrel-shifter) \
|
||||
$(call cc-option,--param l1-cache-size=16384) \
|
||||
$(call cc-option,--param l1-cache-line-size=32)
|
||||
|
||||
ifeq ($(CONFIG_CODE_DENSITY), y)
|
||||
soc-cflags += $(call cc-option, -mcode-density)
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_FLOAT), y)
|
||||
soc-cflags += $(call cc-option, -mfpu=fpuda_all)
|
||||
endif
|
||||
|
||||
32
arch/arc/soc/em11d/linker.ld
Normal file
32
arch/arc/soc/em11d/linker.ld
Normal file
@@ -0,0 +1,32 @@
|
||||
/*
|
||||
* Copyright (c) 2016 Synopsys, Inc. All rights reserved.
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
/**
|
||||
* @brief Linker script for the Synopsys EM Starterkit v2.2 EM11D platform.
|
||||
*/
|
||||
|
||||
/*
|
||||
* DRAM base address and size
|
||||
*
|
||||
* DRAM includes the exception vector table at reset, which is at
|
||||
* the beginning of the region.
|
||||
*/
|
||||
#define SRAM_START CONFIG_SRAM_BASE_ADDRESS
|
||||
#define SRAM_SIZE CONFIG_SRAM_SIZE
|
||||
/* TODO: Using SRAM config for now, even though this is really DRAM. */
|
||||
|
||||
/* Instruction Closely Coupled Memory (ICCM) base address and size */
|
||||
#define ICCM_START CONFIG_ICCM_BASE_ADDRESS
|
||||
#define ICCM_SIZE CONFIG_ICCM_SIZE
|
||||
|
||||
/*
|
||||
* DCCM base address and size. DCCM is the data memory.
|
||||
*/
|
||||
/* Data Closely Coupled Memory (DCCM) base address and size */
|
||||
#define DCCM_START CONFIG_DCCM_BASE_ADDRESS
|
||||
#define DCCM_SIZE CONFIG_DCCM_SIZE
|
||||
|
||||
#include <arch/arc/v2/linker.ld>
|
||||
137
arch/arc/soc/em11d/soc.h
Normal file
137
arch/arc/soc/em11d/soc.h
Normal file
@@ -0,0 +1,137 @@
|
||||
/*
|
||||
* Copyright (c) 2016-2017 Synopsys, Inc. All rights reserved.
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
/**
|
||||
* @brief Board configuration macros for EM Starter kit board
|
||||
*
|
||||
* This header file is used to specify and describe board-level
|
||||
* aspects for the target.
|
||||
*/
|
||||
|
||||
#ifndef _SOC__H_
|
||||
#define _SOC__H_
|
||||
|
||||
#include <misc/util.h>
|
||||
|
||||
/* default system clock */
|
||||
/* On the EM Starter Kit board, the peripheral bus clock frequency is 50Mhz */
|
||||
#define SYSCLK_DEFAULT_IOSC_HZ MHZ(50)
|
||||
|
||||
|
||||
/* ARC EM Core IRQs */
|
||||
#define IRQ_TIMER0 16
|
||||
#define IRQ_TIMER1 17
|
||||
|
||||
#define IRQ_CORE_DMA_COMPLETE 20
|
||||
#define IRQ_CORE_DMA_ERROR 21
|
||||
|
||||
#ifndef _ASMLANGUAGE
|
||||
|
||||
#include <misc/util.h>
|
||||
#include <drivers/rand32.h>
|
||||
|
||||
#define ARCV2_TIMER0_INT_LVL IRQ_TIMER0
|
||||
#define ARCV2_TIMER0_INT_PRI 0
|
||||
|
||||
#define ARCV2_TIMER1_INT_LVL IRQ_TIMER1
|
||||
#define ARCV2_TIMER1_INT_PRI 1
|
||||
|
||||
#define CONFIG_ARCV2_TIMER1_INT_LVL IRQ_TIMER1
|
||||
#define CONFIG_ARCV2_TIMER1_INT_PRI 1
|
||||
|
||||
#define INT_ENABLE_ARC ~(0x00000001 << 8)
|
||||
#define INT_ENABLE_ARC_BIT_POS (8)
|
||||
|
||||
/* I2C */
|
||||
/* I2C_0 is on Pmod2 connector */
|
||||
#define I2C_DW_0_BASE_ADDR 0xF0004000
|
||||
|
||||
/* I2C_1 is on Pmod4 connector */
|
||||
#define I2C_DW_1_BASE_ADDR 0xF0005000
|
||||
|
||||
#define I2C_DW_IRQ_FLAGS 0
|
||||
|
||||
/* GPIO */
|
||||
#define GPIO_DW_0_BASE_ADDR 0xF0002000 /* GPIO 0 : PORTA */
|
||||
#define GPIO_DW_0_BITS 32
|
||||
#define GPIO_DW_PORT_0_INT_MASK 0 /* n/a */
|
||||
#define GPIO_DW_0_IRQ_FLAGS 0 /* Defaults */
|
||||
|
||||
#define GPIO_DW_1_BASE_ADDR 0xF000200C /* GPIO 1 : PORTB */
|
||||
#define GPIO_DW_1_BITS 9 /* 9 LEDs on board */
|
||||
#define GPIO_DW_PORT_1_INT_MASK 0 /* n/a */
|
||||
|
||||
#define GPIO_DW_2_BASE_ADDR 0xF0002018 /* GPIO 2 : PORTC */
|
||||
#define GPIO_DW_2_BITS 32
|
||||
#define GPIO_DW_PORT_2_INT_MASK 0 /* n/a */
|
||||
|
||||
#define GPIO_DW_3_BASE_ADDR 0xF0002024 /* GPIO 3 : PORTD */
|
||||
#define GPIO_DW_3_BITS 12
|
||||
#define GPIO_DW_PORT_3_INT_MASK 0 /* n/a */
|
||||
|
||||
/* SPI */
|
||||
#define SPI_DW_SPI_CLOCK SYSCLK_DEFAULT_IOSC_HZ
|
||||
|
||||
#define SPI_DW_PORT_0_REGS 0xF0006000
|
||||
#define SPI_DW_PORT_1_REGS 0xF0007000
|
||||
|
||||
#define SPI_DW_IRQ_FLAGS 0
|
||||
|
||||
/*
|
||||
* SPI Chip Select Assignments on EM Starter Kit
|
||||
*
|
||||
* CS0 Pmod6 - pin 1 - J6
|
||||
* CS1 Pmod5 - pin 1 - J5 & Pmod 6 - pin 7 - J6
|
||||
* CS2 Pmod6 - pin 8 - J6
|
||||
* CS3 SDCard (onboard)
|
||||
* CS4 Internal SPI Slave - loopback
|
||||
* CS5 SPI-Flash (onboard)
|
||||
*/
|
||||
|
||||
/*
|
||||
* UARTs: UART0 & UART1 & UART2
|
||||
*/
|
||||
#define UART_NS16550_PORT_0_BASE_ADDR 0xF0008000
|
||||
#define UART_NS16550_PORT_0_CLK_FREQ SYSCLK_DEFAULT_IOSC_HZ
|
||||
|
||||
#define UART_NS16550_PORT_1_BASE_ADDR 0xF0009000
|
||||
#define UART_NS16550_PORT_1_CLK_FREQ SYSCLK_DEFAULT_IOSC_HZ
|
||||
|
||||
#define UART_NS16550_PORT_2_BASE_ADDR 0xF000A000
|
||||
#define UART_NS16550_PORT_2_CLK_FREQ SYSCLK_DEFAULT_IOSC_HZ
|
||||
|
||||
#define UART_IRQ_FLAGS 0 /* Default */
|
||||
|
||||
/**
|
||||
* Peripheral Interrupt Connection Configurations
|
||||
*/
|
||||
#ifdef CONFIG_BOARD_EM_STARTERKIT_R23
|
||||
#define GPIO_DW_0_IRQ 24
|
||||
#define I2C_DW_0_IRQ 25
|
||||
#define I2C_DW_1_IRQ 26
|
||||
#define SPI_DW_PORT_0_IRQ 27
|
||||
#define SPI_DW_PORT_1_IRQ 28
|
||||
#define UART_NS16550_PORT_0_IRQ 29
|
||||
#define UART_NS16550_PORT_1_IRQ 30
|
||||
#define UART_NS16550_PORT_2_IRQ 31
|
||||
#else /* CONFIG_BOARD_EM_STARTERKIT_R23 */
|
||||
#define GPIO_DW_0_IRQ 22
|
||||
#define I2C_DW_0_IRQ 23
|
||||
#define I2C_DW_1_IRQ 24
|
||||
#define SPI_DW_PORT_0_IRQ 25
|
||||
#define SPI_DW_PORT_1_IRQ 26
|
||||
#define UART_NS16550_PORT_0_IRQ 27
|
||||
#define UART_NS16550_PORT_1_IRQ 28
|
||||
#define UART_NS16550_PORT_2_IRQ 29
|
||||
#endif /* !CONFIG_BOARD_EM_STARTERKIT_R23 */
|
||||
|
||||
#define GPIO_DW_1_IRQ 0 /* can't interrupt */
|
||||
#define GPIO_DW_2_IRQ 0 /* can't interrupt */
|
||||
#define GPIO_DW_3_IRQ 0 /* can't interrupt */
|
||||
|
||||
#endif /* !_ASMLANGUAGE */
|
||||
|
||||
#endif /* _SOC__H_ */
|
||||
35
arch/arc/soc/em11d/soc_config.c
Normal file
35
arch/arc/soc/em11d/soc_config.c
Normal file
@@ -0,0 +1,35 @@
|
||||
/*
|
||||
* Copyright (c) 2016 Synopsys, Inc. All rights reserved.
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
#include <device.h>
|
||||
#include <init.h>
|
||||
#include "soc.h"
|
||||
|
||||
|
||||
#ifdef CONFIG_UART_NS16550
|
||||
|
||||
static int uart_ns16550_init(struct device *dev)
|
||||
{
|
||||
ARG_UNUSED(dev);
|
||||
|
||||
/* On ARC EM Starter kit board,
|
||||
* send the UART the command to clear the interrupt
|
||||
*/
|
||||
#ifdef CONFIG_UART_NS16550_PORT_0
|
||||
sys_write32(0, UART_NS16550_PORT_0_BASE_ADDR+0x4);
|
||||
sys_write32(0, UART_NS16550_PORT_0_BASE_ADDR+0x10);
|
||||
#endif /* CONFIG_UART_NS16550_PORT_0 */
|
||||
#ifdef CONFIG_UART_NS16550_PORT_1
|
||||
sys_write32(0, UART_NS16550_PORT_1_BASE_ADDR+0x4);
|
||||
sys_write32(0, UART_NS16550_PORT_1_BASE_ADDR+0x10);
|
||||
#endif /* CONFIG_UART_NS16550_PORT_1 */
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
SYS_INIT(uart_ns16550_init, PRE_KERNEL_1, CONFIG_KERNEL_INIT_PRIORITY_DEFAULT);
|
||||
|
||||
#endif /* CONFIG_UART_NS16550 */
|
||||
10
arch/arc/soc/em7d/Kbuild
Normal file
10
arch/arc/soc/em7d/Kbuild
Normal file
@@ -0,0 +1,10 @@
|
||||
ccflags-y +=-I$(srctree)/arch/arc/soc/
|
||||
ccflags-y +=-I$(srctree)/include
|
||||
ccflags-y +=-I$(srctree)/include/drivers
|
||||
ccflags-y +=-I$(srctree)/drivers
|
||||
|
||||
asflags-y := ${ccflags-y}
|
||||
|
||||
obj-y += soc.o soc_config.o
|
||||
|
||||
obj-$(CONFIG_ARC_MPU_ENABLE) += arc_mpu_regions.o
|
||||
61
arch/arc/soc/em7d/Kconfig.defconfig
Normal file
61
arch/arc/soc/em7d/Kconfig.defconfig
Normal file
@@ -0,0 +1,61 @@
|
||||
#
|
||||
# Copyright (c) 2014 Wind River Systems, Inc.
|
||||
# Copyright (c) 2016 Synopsys, Inc. All rights reserved.
|
||||
#
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
#
|
||||
|
||||
if SOC_EM7D
|
||||
|
||||
config SOC
|
||||
default em7d
|
||||
|
||||
config NUM_IRQ_PRIO_LEVELS
|
||||
# This processor supports 4 priority levels:
|
||||
# 0 for Fast Interrupts (FIRQs) and 1-3 for Regular Interrupts (IRQs).
|
||||
default 4
|
||||
|
||||
config NUM_IRQS
|
||||
# must be > the highest interrupt number used
|
||||
default 38 if BOARD_EM_STARTERKIT_R23
|
||||
default 36 if BOARD_EM_STARTERKIT_R22
|
||||
|
||||
config RGF_NUM_BANKS
|
||||
default 1
|
||||
|
||||
config SYS_CLOCK_HW_CYCLES_PER_SEC
|
||||
default 25000000 if BOARD_EM_STARTERKIT_R23
|
||||
default 30000000 if BOARD_EM_STARTERKIT_R22
|
||||
|
||||
config HARVARD
|
||||
def_bool n
|
||||
|
||||
config FLASH_BASE_ADDRESS
|
||||
default 0x00000000
|
||||
|
||||
config FLASH_SIZE
|
||||
default 0
|
||||
# em7d has no FLASH so size is 0.
|
||||
|
||||
config SRAM_BASE_ADDRESS
|
||||
default 0x10000000
|
||||
|
||||
config SRAM_SIZE
|
||||
default 131072
|
||||
|
||||
config ICCM_BASE_ADDRESS
|
||||
default 0x00000000
|
||||
|
||||
config ICCM_SIZE
|
||||
default 256
|
||||
|
||||
config DCCM_BASE_ADDRESS
|
||||
default 0x80000000
|
||||
|
||||
config DCCM_SIZE
|
||||
default 128
|
||||
|
||||
config CACHE_FLUSHING
|
||||
def_bool y
|
||||
|
||||
endif #SOC_EM7D
|
||||
4
arch/arc/soc/em7d/Kconfig.soc
Normal file
4
arch/arc/soc/em7d/Kconfig.soc
Normal file
@@ -0,0 +1,4 @@
|
||||
|
||||
config SOC_EM7D
|
||||
bool "Synopsys ARC EM7D"
|
||||
select CPU_HAS_MPU
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user