├── .github
└── workflows
│ ├── basic-two-tier.yml
│ ├── basic.yml
│ └── caller-basic-two-tier.yml
├── .gitignore
├── .jenkins
├── AVH-as-Jenkins-Node
│ ├── configuration-as-code
│ │ └── snippets.yaml
│ ├── jobDSL
│ │ └── jobDSL.groovy
│ └── pipeline
│ │ └── Jenkinsfile
├── README.md
└── Using-AVH-Module
│ ├── jobDSL
│ └── jobDSL.groovy
│ └── pipeline
│ └── Jenkinsfile
├── README.md
├── basic
├── README.md
├── RTE
│ └── Device
│ │ └── SSE-300-MPS3
│ │ ├── RTE_Device.h
│ │ ├── cmsis_driver_config.h
│ │ ├── device_cfg.h
│ │ ├── fvp_sse300_mps3_s.sct
│ │ ├── platform_base_address.h
│ │ ├── region_defs.h
│ │ ├── region_limits.h
│ │ ├── startup_fvp_sse300_mps3.c
│ │ └── system_SSE300MPS3.c
├── avh.yml
├── basic.debug.cprj
├── build.py
├── fvp_config.txt
├── main.c
├── mdk_config.txt
├── requirements.txt
└── retarget_stdio.c
├── create_debug_test.png
└── infrastructure
└── cloudformation
├── .images
├── vht_cloudformation_ack.png
├── vht_cloudformation_create_progress.png
├── vht_cloudformation_create_stack.png
├── vht_cloudformation_main.png
├── vht_cloudformation_output.png
├── vht_cloudformation_stack_completed.png
├── vht_cloudformation_stack_details.png
└── vht_cloudformation_stack_resources.png
├── Arm-AVH-CloudFormation-Template.yaml
├── Arm-AVH-EFS-Setup.yaml
├── README.md
└── misc
└── efs
├── install_manual_packs_into_efs.sh
├── setup_avh_efs_for_packs.sh
└── user_data.txt
/.github/workflows/basic-two-tier.yml:
--------------------------------------------------------------------------------
1 | # ===================================================================================================
2 | # Please use this workflow if your github repo is public and you want to have external contributions.
3 | # ===================================================================================================
4 |
5 | # This workflow is triggered whenever "Caller Arm Virtual Hardware basic example" workflow is completed (which is called by PR).
6 | # This workflow ideally should be triggered also by PR, but forked PR has limited permissions which does not
7 | # allow to use `configure-aws-credentials` actions and using secrets.
8 | # It will update its status back to the caller PR as "Arm Virtual Hardware basic example" check name
9 |
10 | # This is a basic workflow to help you get started with Actions on CMSIS projects
11 | # See also https://community.arm.com/developer/tools-software/tools/b/tools-software-ides-blog/posts/infrastructure-for-continuous-integration-tests
12 | #
13 | # The repository needs to provide the following secrets
14 | # - AWS_ACCESS_KEY_ID The id of the access key.
15 | # - AWS_SECRET_ACCESS_KEY The access key secret.
16 | # - AWS_DEFAULT_REGION The data center region to be used.
17 | # - AWS_S3_BUCKET_NAME The name of the S3 storage bucket to be used for data exchange.
18 | # - AWS_IAM_PROFILE The IAM profile to be used.
19 | # - AWS_SECURITY_GROUP_ID The id of the security group to add the EC2 instance to.
20 | # - AWS_SUBNET_ID The id of the network subnet to connect the EC2 instance to.
21 |
22 | name: Arm Virtual Hardware basic example - two tier
23 | on:
24 | workflow_run:
25 | workflows:
26 | - Caller Arm Virtual Hardware basic example
27 | types:
28 | - completed
29 | workflow_dispatch:
30 |
31 | env:
32 | # Enable the next three lines if you are using IAM User and you added them in the repo's secret.
33 | # AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
34 | # AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
35 | # AWS_DEFAULT_REGION: ${{ secrets.AWS_DEFAULT_REGION }}
36 | AWS_S3_BUCKET_NAME: ${{ secrets.AWS_S3_BUCKET_NAME }}
37 | AWS_IAM_PROFILE: ${{ secrets.AWS_IAM_PROFILE }}
38 | AWS_SECURITY_GROUP_ID: ${{ secrets.AWS_SECURITY_GROUP_ID }}
39 | AWS_SUBNET_ID: ${{ secrets.AWS_SUBNET_ID }}
40 | jobs:
41 | set_pending_status_to_pr:
42 | runs-on: ubuntu-latest
43 | if: ${{ github.event.workflow_run.event == 'pull_request' }}
44 | steps:
45 | - name: Set a pending status to the PR
46 | env:
47 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
48 | run: |
49 | curl --request POST \
50 | --url https://api.github.com/repos/${{ github.repository }}/statuses/${{ github.event.workflow_run.head_commit.id }} \
51 | --header "authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \
52 | --header 'content-type: application/json' \
53 | --data '{
54 | "state": "pending",
55 | "context": "Arm Virtual Hardware basic example",
56 | "target_url": "https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}"
57 | }' \
58 | --fail
59 |
60 | ci_test:
61 | runs-on: ubuntu-latest
62 | permissions:
63 | id-token: write
64 | contents: read
65 | outputs:
66 | avhresult: ${{ steps.avh.conclusion }}
67 | testbadge: ${{ steps.avh.outputs.badge }}
68 | steps:
69 | - name: Read github.event
70 | run: echo "${{ github.event.workflow_run.event }}"
71 | - name: Check out repository code
72 | if: ${{ github.event.workflow_run.event != 'pull_request' }}
73 | uses: actions/checkout@v3
74 |
75 | - name: Download workflow artifact
76 | if: ${{ github.event.workflow_run.event == 'pull_request' }}
77 | uses: dawidd6/action-download-artifact@v2
78 | with:
79 | github_token: ${{ secrets.GITHUB_TOKEN }}
80 | workflow: caller_virtual_hardware.yml
81 | run_id: ${{ github.event.workflow_run.id }}
82 |
83 | - name: Read the pr_num file
84 | if: ${{ github.event.workflow_run.event == 'pull_request' }}
85 | id: pr_num_reader
86 | uses: juliangruber/read-file-action@v1.1.6
87 | with:
88 | path: ./pr_number/pr_number
89 | trim: true
90 |
91 | - name: Clone this repo
92 | if: ${{ github.event.workflow_run.event == 'pull_request' }}
93 | uses: actions/checkout@v3
94 | with:
95 | fetch-depth: 0
96 |
97 | - name: Checkout PR
98 | if: ${{ github.event.workflow_run.event == 'pull_request' }}
99 | env:
100 | GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
101 | run: |
102 | gh pr checkout ${{ steps.pr_num_reader.outputs.content }}
103 |
104 | - name: Set up Python 3.10
105 | uses: actions/setup-python@v4
106 | with:
107 | python-version: '3.10'
108 |
109 | - name: Install AVH Client for Python
110 | run: |
111 | pip install git+https://github.com/ARM-software/avhclient.git@v0.1
112 |
113 | - uses: ammaraskar/gcc-problem-matcher@master
114 |
115 | - name: Configure AWS Credentials
116 | uses: aws-actions/configure-aws-credentials@v1
117 | with:
118 | role-to-assume: arn:aws:iam::720528183931:role/Proj-vht-assume-role
119 | aws-region: eu-west-1
120 |
121 | - name: Run tests
122 | id: avh
123 | run: |
124 | avhclient -b aws execute --specfile basic/avh.yml
125 |
126 | - name: Archive results
127 | uses: actions/upload-artifact@v3
128 | with:
129 | name: results
130 | path: |
131 | basic/basic-*.zip
132 | basic/basic-*.xunit
133 | retention-days: 1
134 | if-no-files-found: error
135 | if: always()
136 |
137 | - name: Publish test results
138 | uses: mikepenz/action-junit-report@v3
139 | with:
140 | check_name: "Test results"
141 | report_paths: basic/basic-*.xunit
142 | if: always()
143 |
144 | badge:
145 | if: always() && github.event_name == 'push'
146 | runs-on: ubuntu-latest
147 | needs: ci_test
148 | steps:
149 | - name: Check out repository code
150 | uses: actions/checkout@v3
151 | with:
152 | ref: badges
153 |
154 | - name: Update badge
155 | run: |
156 | mkdir -p .github/badges
157 | cd .github/badges
158 | rm -f basic.yml.*.svg
159 | if [[ "${{ needs.ci_test.outputs.avhresult }}" == "success" ]]; then
160 | cp vht-completed.svg basic.yml.vht.svg
161 | else
162 | cp vht-failed.svg basic.yml.vht.svg
163 | fi
164 | curl -o basic.yml.unittest.svg https://img.shields.io/badge/${{ needs.ci_test.outputs.testbadge }}
165 | git config user.name github-actions
166 | git config user.email github-actions@github.com
167 | git add basic.yml.*.svg
168 | if git commit -m "Update badges for workflow basic.yml"; then
169 | git push
170 | fi
171 |
172 | set_success_status_to_pr:
173 | runs-on: ubuntu-latest
174 | needs: ci_test
175 | if: ${{ failure() && github.event.workflow_run.event == 'pull_request' }}
176 | steps:
177 | - name: Set success status to the PR
178 | env:
179 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
180 | run: |
181 | curl --request POST \
182 | --url https://api.github.com/repos/${{ github.repository }}/statuses/${{ github.event.workflow_run.head_commit.id }} \
183 | --header "authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \
184 | --header 'content-type: application/json' \
185 | --data '{
186 | "state": "success",
187 | "context": "Arm Virtual Hardware basic example",
188 | "target_url": "https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}"
189 | }' \
190 | --fail
191 |
192 | set_failure_status_to_pr:
193 | runs-on: ubuntu-latest
194 | needs: ci_test
195 | if: ${{ failure() && github.event.workflow_run.event == 'pull_request' }}
196 | steps:
197 | - name: Set failure status to the PR
198 | env:
199 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
200 | run: |
201 | curl --request POST \
202 | --url https://api.github.com/repos/${{ github.repository }}/statuses/${{ github.event.workflow_run.head_commit.id }} \
203 | --header "authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \
204 | --header 'content-type: application/json' \
205 | --data '{
206 | "state": "failure",
207 | "context": "Arm Virtual Hardware basic example",
208 | "target_url": "https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}"
209 | }' \
210 | --fail
211 |
--------------------------------------------------------------------------------
/.github/workflows/basic.yml:
--------------------------------------------------------------------------------
1 | # ===================================================================================================
2 | # Please use this workflow if your github repo is private or public without external contributions.
3 | # ===================================================================================================
4 |
5 | # This is a basic workflow to help you get started with Actions on CMSIS projects
6 | # See also https://community.arm.com/developer/tools-software/tools/b/tools-software-ides-blog/posts/infrastructure-for-continuous-integration-tests
7 | #
8 | # The repository needs to provide the following secrets
9 | # - AWS_ACCESS_KEY_ID The id of the access key.
10 | # - AWS_SECRET_ACCESS_KEY The access key secret.
11 | # - AWS_DEFAULT_REGION The data center region to be used.
12 | # - AWS_S3_BUCKET_NAME The name of the S3 storage bucket to be used for data exchange.
13 | # - AWS_IAM_PROFILE The IAM profile to be used.
14 | # - AWS_SECURITY_GROUP_ID The id of the security group to add the EC2 instance to.
15 | # - AWS_SUBNET_ID The id of the network subnet to connect the EC2 instance to.
16 |
17 | name: Arm Virtual Hardware basic example
18 | on:
19 | push:
20 | branches: [ main ]
21 | pull_request:
22 | paths:
23 | - .github/workflows/basic.yml
24 | - basic/**/*
25 | workflow_dispatch:
26 |
27 | env:
28 | # Enable the next three lines if you are using IAM User and you added them in the repo's secret.
29 | # AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
30 | # AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
31 | # AWS_DEFAULT_REGION: ${{ secrets.AWS_DEFAULT_REGION }}
32 | AWS_S3_BUCKET_NAME: ${{ secrets.AWS_S3_BUCKET_NAME }}
33 | AWS_IAM_PROFILE: ${{ secrets.AWS_IAM_PROFILE }}
34 | AWS_SECURITY_GROUP_ID: ${{ secrets.AWS_SECURITY_GROUP_ID }}
35 | AWS_SUBNET_ID: ${{ secrets.AWS_SUBNET_ID }}
36 | jobs:
37 | ci_test:
38 | runs-on: ubuntu-latest
39 | permissions:
40 | id-token: write
41 | contents: read
42 | outputs:
43 | avhresult: ${{ steps.avh.conclusion }}
44 | testbadge: ${{ steps.avh.outputs.badge }}
45 | steps:
46 | - name: Check out repository code
47 | uses: actions/checkout@v3
48 |
49 | - name: Set up Python 3.10
50 | uses: actions/setup-python@v4
51 | with:
52 | python-version: '3.10'
53 |
54 | - name: Install AVH Client for Python
55 | run: |
56 | pip install git+https://github.com/ARM-software/avhclient.git@v0.1
57 |
58 | - uses: ammaraskar/gcc-problem-matcher@master
59 |
60 | - name: Configure AWS Credentials
61 | uses: aws-actions/configure-aws-credentials@v1
62 | with:
63 | role-to-assume: arn:aws:iam::720528183931:role/Proj-vht-assume-role
64 | aws-region: eu-west-1
65 |
66 | - name: Run tests
67 | id: avh
68 | run: |
69 | avhclient -b aws execute --specfile basic/avh.yml
70 |
71 | - name: Archive results
72 | uses: actions/upload-artifact@v3
73 | with:
74 | name: results
75 | path: |
76 | basic/basic-*.zip
77 | basic/basic-*.xunit
78 | retention-days: 1
79 | if-no-files-found: error
80 | if: always()
81 |
82 | - name: Publish test results
83 | uses: mikepenz/action-junit-report@v3
84 | with:
85 | check_name: "Test results"
86 | report_paths: basic/basic-*.xunit
87 | if: always()
88 |
89 |
90 | badge:
91 | if: always() && github.event_name == 'push'
92 | runs-on: ubuntu-latest
93 | needs: ci_test
94 | steps:
95 | - name: Check out repository code
96 | uses: actions/checkout@v3
97 | with:
98 | ref: badges
99 |
100 | - name: Update badge
101 | run: |
102 | mkdir -p .github/badges
103 | cd .github/badges
104 | rm -f basic.yml.*.svg
105 | if [[ "${{ needs.ci_test.outputs.avhresult }}" == "success" ]]; then
106 | cp vht-completed.svg basic.yml.vht.svg
107 | else
108 | cp vht-failed.svg basic.yml.vht.svg
109 | fi
110 | curl -o basic.yml.unittest.svg https://img.shields.io/badge/${{ needs.ci_test.outputs.testbadge }}
111 | git config user.name github-actions
112 | git config user.email github-actions@github.com
113 | git add basic.yml.*.svg
114 | if git commit -m "Update badges for workflow basic.yml"; then
115 | git push
116 | fi
--------------------------------------------------------------------------------
/.github/workflows/caller-basic-two-tier.yml:
--------------------------------------------------------------------------------
1 | # ===================================================================================================
2 | # This is just a caller for basic-two-tier.yml workflow. See details there.
3 | # ===================================================================================================
4 |
5 | name: Caller Arm Virtual Hardware basic example
6 | on:
7 | push:
8 | branches: [ main ]
9 | pull_request:
10 | paths:
11 | - .github/workflows/basic-two-tier.yml
12 | - basic/**/*
13 | jobs:
14 | upload_pr_number:
15 | if: ${{ github.event_name == 'pull_request' }}
16 | runs-on: ubuntu-latest
17 | steps:
18 | - name: Save PR number
19 | env:
20 | PR_NUMBER: ${{ github.event.number }}
21 | run: |
22 | mkdir -p ./pr
23 | echo -n $PR_NUMBER > ./pr/pr_number
24 | - uses: actions/upload-artifact@v3
25 | with:
26 | name: pr_number
27 | path: pr/
28 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | **/*.log
2 | **/*.xunit
3 | **/*.pack
4 | **/*.tar
5 | **/Objects
6 | **/RTE/_**
7 |
--------------------------------------------------------------------------------
/.jenkins/AVH-as-Jenkins-Node/configuration-as-code/snippets.yaml:
--------------------------------------------------------------------------------
1 | # ** ${variable} should be replaced for your need **
2 | jenkins:
3 | clouds:
4 | - amazonEC2:
5 | cloudName: "AVH"
6 | credentialsId: "${AWS_AMI_JENKINS_CRED_ID}"
7 | region: "${AWS_REGION}"
8 | sshKeysCredentialsId: "${AWS_EC2_JENKINS_PK_CREDENTIAL}"
9 | templates:
10 | # maybe outdated, please double check it
11 | - ami: "ami-0c5eeabe11f3a2685"
12 | amiType:
13 | unixData:
14 | sshPort: "22"
15 | associatePublicIp: false
16 | connectBySSHProcess: false
17 | connectionStrategy: PRIVATE_IP
18 | deleteRootOnTermination: true
19 | description: "AVH"
20 | ebsEncryptRootVolume: DEFAULT
21 | ebsOptimized: false
22 | hostKeyVerificationStrategy: CHECK_NEW_HARD
23 | idleTerminationMinutes: "30"
24 | instanceCapStr: "1"
25 | initScript: |
26 | #!/bin/bash
27 |
28 | sudo apt update
29 | sleep 5
30 | sudo apt-get install openjdk-11-jdk-headless awscli -y
31 | labelString: "AVH"
32 | maxTotalUses: -1
33 | minimumNumberOfInstances: 0
34 | minimumNumberOfSpareInstances: 0
35 | mode: EXCLUSIVE
36 | monitoring: false
37 | numExecutors: 1
38 | remoteAdmin: "ubuntu"
39 | remoteFS: "/home/ubuntu"
40 | securityGroups: "${ubuntu_jenkins_nodes}"
41 | stopOnTerminate: false
42 | subnetId: "${AWS_PRIVATE_SUBNET_IDS}"
43 | t2Unlimited: false
44 | tags:
45 | - name: "AVH"
46 | value: "true"
47 | tenancy: Default
48 | type: T2Medium
49 | useEphemeralDevices: true
50 | useInstanceProfileForCredentials: false
51 |
--------------------------------------------------------------------------------
/.jenkins/AVH-as-Jenkins-Node/jobDSL/jobDSL.groovy:
--------------------------------------------------------------------------------
1 | // Developed and tested using jobDSL plugin v1.77
2 | // https://plugins.jenkins.io/job-dsl/
3 | //
4 | // This is just a example, change it for your need
5 | /* ************************************************************************* */
6 | println("Adding folder...")
7 | def AVHFolder = folder('AVH') {
8 | displayName('AVH')
9 | description('')
10 | }
11 |
12 | / ************************************************************************** */
13 | println("Creating AVH jobs ...")
14 | pipelineJob("${AVHFolder.name}/AVH-as-Jenkins-Node") {
15 | displayName('AVH')
16 | description('AVH as Jenkins Node')
17 | logRotator {
18 | daysToKeep(14)
19 | }
20 | disabled(false)
21 | definition {
22 | cpsScm {
23 | lightweight(true)
24 | // Path for your pipeline. Change it for your need.
25 | scriptPath('.jenkins/AVH-as-Jenkins-Node/pipeline/Jenkinsfile')
26 | scm {
27 | git {
28 | remote {
29 | url('https://github.com/ARM-software/AVH-GetStarted.git')
30 | }
31 | branches('main')
32 | extensions {
33 | wipeWorkspace()
34 | cloneOptions {
35 | honorRefspec(true)
36 | noTags(true)
37 | shallow(true)
38 | depth(1)
39 | }
40 | }
41 | }
42 | }
43 | }
44 | }
45 | }
46 |
--------------------------------------------------------------------------------
/.jenkins/AVH-as-Jenkins-Node/pipeline/Jenkinsfile:
--------------------------------------------------------------------------------
1 | pipeline {
2 | // Agent label matching the Amazon EC2 node configuration
3 | agent { label 'AVH' }
4 | // Optional -- enables timestamp on output
5 | options {
6 | timestamps()
7 | }
8 | stages {
9 | stage('Checking out SCM') {
10 | steps {
11 | // Checkout AVH-GetStarted Repo.
12 | checkout([
13 | $class: 'GitSCM',
14 | branches: [[name: 'main']],
15 | extensions: [
16 | [$class: 'CheckoutOption', timeout: 5],
17 | [$class: 'CloneOption', depth: 1, honorRefspec: true, noTags: true, reference: '', shallow: true, timeout: 5]
18 | ],
19 | userRemoteConfigs: [[url: 'https://github.com/ARM-software/AVH-GetStarted.git']]
20 | ])
21 | }
22 | }
23 | stage('Install Get-Start Dependencies') {
24 | steps {
25 | sh('pip install -r requirements.txt')
26 | }
27 | }
28 | stage('Running Get-Started Example') {
29 | steps {
30 | dir('basic') {
31 | // extracting env vars from .bashrc and store them in a `vars` file.
32 | sh("/bin/bash -c 'cat ~/.bashrc | grep export > vars'")
33 | sh("/bin/bash -c 'source vars; ./build.py --verbose -t debug cbuild'")
34 | sh("/bin/bash -c 'source vars; ./build.py --verbose -t debug AVH'")
35 | }
36 | }
37 | }
38 | }
39 | // Remove it if you running in a short-live container.
40 | post {
41 | always { cleanWs() }
42 | }
43 | }
44 |
--------------------------------------------------------------------------------
/.jenkins/README.md:
--------------------------------------------------------------------------------
1 | # Jenkins
2 | There are two examples provided: `Using-AVH-Module` which uses AVH Python module and `AVH-as-Jenkins-Node` which creates a Jenkins node from AVH AMI.
3 |
4 | ## Using AVH-Module
5 | In this approach, it is used AVH Python module, which is build on top of AWS SDK, to drive the AVH process. The Jenkins node is just a caller for it. The actual work is done by an EC2 instance created by the AVH Python module. In other words, the Jenkins pipeline is just a light-weight front end having enough code to run the AVH Python module.
6 |
7 | ### Content of Using-AVH-Module
8 | * jobDSL: Jenkins configuration as code to create the AVH Jenkins Job.
9 | * pipeline: Example of running AVH using AVH Python Module.
10 |
11 | ### Dependencies
12 | #### AWS Account
13 | * AWS IAM User is needed to be created in your AWS Account. [See item 1 and 2](https://arm-software.github.io/AVH/main/infrastructure/html/run_ami_github.html#github_hosted1).
14 | * A S3 Bucket is needed to store temporary files. No special requirement is needed.
15 | * Security Group with Ingress SSH port allowed.
16 | * IAM Instance Profile to be associated with the AVH EC2 instances. [See item 3](https://arm-software.github.io/AVH/main/infrastructure/html/run_ami_github.html#github_hosted1)
17 | * `Optional` SSH Key is needed if you would like to debug on EC2.
18 | * Subnet Id needs to be informed with EC2 instance.
19 |
20 | **It is provided a Cloudformation (AWS Infrastructure as Code) yaml file which can create the required AWS Resources for AVH, please go to ./infrastructure/cloudformation folder**
21 |
22 | #### Jenkins plugins
23 | * [CloudBees AWS Credentials](https://plugins.jenkins.io/aws-credentials/) - Tested on v1.29
24 | * [Pyenv-pipeline](https://plugins.jenkins.io/pyenv-pipeline/) - Tested on v2.1.2
25 | * [JobDSL - needed if the JobDSL code is used](https://plugins.jenkins.io/job-dsl/) - Tested on v1.77
26 |
27 | #### Jenkins Credentials
28 | * AWS Credential for IAM User (`AWS_ACCESS_KEY_ID` and `AWS_SECRET_ACCESS_KEY`)
29 | * AWS SSH Private Key to be associated with the EC2 instance.
30 |
31 | ## AVH-as-Jenkins-Node
32 | In this example, it is created a Jenkins node from the AVH AMI. Jenkins node is connected by SSH in Jenkins Controller and the commands are executed directly to the EC2 instance (as a Jenkins Node in this case).
33 |
34 | ### Content of Using-AVH-Module
35 | * configuration-as-code: Example of Amazon EC2 plugin code.
36 | * jobDSL: Jenkins configuration as code to create the AVH as Jenkins Node job.
37 | * pipeline: Example of running AVH as Jenkins Node.
38 |
39 | ### Dependencies
40 | #### AWS Account
41 | * AWS IAM User is needed to be created in your AWS Account. [See item 1 and 2](https://arm-software.github.io/AVH/main/infrastructure/html/run_ami_github.html#github_hosted1).
42 | * Security Group with Ingress SSH port allowed.
43 | * SSH Keys are needed to communicate with EC2 instance as Jenkins Nodes.
44 | * Subnet Id needs to be informed with EC2 instance.
45 |
46 | **It is provided a Cloudformation (AWS Infrastructure as Code) yaml file which can create the required AWS Resources for AVH, please go to ./infrastructure/cloudformation folder**
47 |
48 | #### Jenkins plugins
49 | * [Amazon EC2](https://plugins.jenkins.io/ec2/) - Tested on v1.57
50 | * [JobDSL - needed if the JobDSL code is used](https://plugins.jenkins.io/job-dsl/) - Tested on v1.77
51 |
52 | #### Jenkins Credentials
53 | * AWS Credential for IAM User (`AWS_ACCESS_KEY_ID` and `AWS_SECRET_ACCESS_KEY`)
54 | * AWS SSH Private Key to be associated with the EC2 instance.
55 |
--------------------------------------------------------------------------------
/.jenkins/Using-AVH-Module/jobDSL/jobDSL.groovy:
--------------------------------------------------------------------------------
1 | // Developed and tested using jobDSL plugin v1.77
2 | // https://plugins.jenkins.io/job-dsl/
3 | //
4 | // This is just a example, change it for your need
5 |
6 |
7 | /* ************************************************************************* */
8 | println("Adding folder...")
9 | def avhFolder = folder('AVH') {
10 | displayName('AVH')
11 | description('')
12 | }
13 |
14 | / * ************************************************************************* */
15 | println("Creating AVH job ...")
16 | pipelineJob("${avhFolder.name}/AVH_GetStarted") {
17 | displayName('AVH GetStarted Example')
18 | description('AVH Example Pipeline')
19 | logRotator {
20 | daysToKeep(14)
21 | }
22 | disabled(false)
23 | parameters {
24 | stringParam {
25 | name('AWS_DEFAULT_REGION')
26 | defaultValue('eu-west-1')
27 | description('')
28 | trim(true)
29 | }
30 | stringParam {
31 | name('AWS_S3_BUCKET_NAME')
32 | defaultValue('gh-orta-vht')
33 | description('Your S3 Bucket Name e.g. gh-orta-vht in this example. You must change it')
34 | trim(true)
35 | }
36 | stringParam {
37 | name('AWS_IAM_PROFILE')
38 | defaultValue('VHTRole')
39 | description('This is the name proposed on the Cloudformation example')
40 | trim(true)
41 | }
42 | stringParam {
43 | name('AWS_SECURITY_GROUP_ID')
44 | defaultValue('sg-04022e04e91197ce3')
45 | description('Your Security Group ID e.g. sg-04022e04e91197ce3 in this example. You must change it.')
46 | trim(true)
47 | }
48 | stringParam {
49 | name('AWS_SUBNET_ID')
50 | defaultValue('subnet-00455495b268076f0')
51 | description('Your Subnet ID e.g. subnet-00455495b268076f0 in this example. You must change it.')
52 | trim(true)
53 | }
54 | }
55 | definition {
56 | cpsScm {
57 | lightweight(true)
58 | // Path for your pipeline. Change it for your need.
59 | scriptPath('.jenkins/Using-AVH-Module/pipeline/Jenkinsfile')
60 | scm {
61 | git {
62 | remote {
63 | url('https://github.com/ARM-software/AVH-GetStarted.git')
64 | }
65 | branches('main')
66 | extensions {
67 | wipeWorkspace()
68 | cloneOptions {
69 | honorRefspec(true)
70 | noTags(true)
71 | shallow(true)
72 | depth(1)
73 | }
74 | }
75 | }
76 | }
77 | }
78 | }
79 | }
80 |
--------------------------------------------------------------------------------
/.jenkins/Using-AVH-Module/pipeline/Jenkinsfile:
--------------------------------------------------------------------------------
1 | // Pipeline expects Jobs parameters and those automatically added as Env Vars:
2 | // - AWS_DEFAULT_REGION The data center region to be used.
3 | // - AWS_S3_BUCKET_NAME The name of the S3 storage bucket to be used for data exchange.
4 | // - AWS_IAM_PROFILE The IAM profile to be used.
5 | // - AWS_SECURITY_GROUP_ID The id of the security group to add the EC2 instance to.
6 | // - AWS_SUBNET_ID The id of the network subnet to connect the EC2 instance to.
7 |
8 | pipeline {
9 | // any Unix-like agent (including macOS)
10 | // The node needs:
11 | // - python3
12 | // - tar
13 | // Please change the agent block for your needs (if maybe it is K8S or Docker node)
14 | agent { any }
15 | // Optional -- enables timestamp on output
16 | options {
17 | timestamps()
18 | }
19 | // Mandatory: Set desired AWS_DEFAULT_REGION
20 | // IMPORTANT: If Job parameters are not automatically added as Env Vars, please add them here.
21 | environment {
22 | AWS_DEFAULT_REGION = "${params.AWS_DEFAULT_REGION}"
23 | AWS_S3_BUCKET_NAME = "${params.AWS_S3_BUCKET_NAME}"
24 | AWS_IAM_PROFILE = "${params.AWS_IAM_PROFILE}"
25 | AWS_SECURITY_GROUP_ID = "${params.AWS_SECURITY_GROUP_ID}"
26 | AWS_SUBNET_ID = "${params.AWS_SUBNET_ID}"
27 | }
28 | stages {
29 | // Run AVH Client for Python
30 | stage('Run AVH') {
31 | steps {
32 | // Please install Jenkins plugin: https://plugins.jenkins.io/aws-credentials/
33 | // Then, create a AWS Credential in order to inject in the block below.
34 | // In this example, we have created a AWS credential called `VHT_IAM_User`.
35 | withCredentials([aws(accessKeyVariable: 'AWS_ACCESS_KEY_ID', credentialsId: 'VHT_IAM_User', secretKeyVariable: 'AWS_SECRET_ACCESS_KEY')]) {
36 | // Please install Jenkins plugin: https://plugins.jenkins.io/pyenv-pipeline/
37 | // On Debian/Ubuntu systems, you need to install the python3-venv
38 | withPythonEnv('python3') {
39 | sh 'pip install git+https://github.com/ARM-software/avhclient.git@v0.1.1'
40 | sh 'avhclient -b aws execute --specfile basic/avh.yml'
41 | }
42 | }
43 | }
44 | }
45 | // Archive results
46 | stage('Results') {
47 | steps {
48 | archiveArtifacts artifacts: 'basic/basic-*.zip', followSymlinks: false
49 | junit 'basic/basic-*.xunit'
50 | }
51 | }
52 | }
53 | }
54 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # DEPRECATED
2 |
3 | Use [Arm-Examples/AVH_CI_Template](https://github.com/Arm-Examples/AVH_CI_Template) instead.
4 |
5 | -------
6 |
7 |
8 |
9 | # Getting started with Arm Virtual Hardware
10 |
11 | 
12 |
13 | [**Arm Virtual Hardware**](https://www.arm.com/virtual-hardware) provides simulation models, software tooling, and infrastructure that can be integrated into CI/CD and MLOps development flows. The simulation models (Fixed Virtual Platforms (FVPs)) are an implementation of a Cortex-M device sub-systems and are designed for complex software verification and testing. This allows simulation-based test automation of various software workloads, including unit tests, integration tests, and fault injection. Refer to the [Arm Virtual Hardware documentation](https://arm-software.github.io/AVH/main/overview/html/index.html) for more information.
14 |
15 | **Note:**
16 | - This is a template repository that can be used as starting point for own validation projects that utilize Arm Virtual Hardware.
17 |
18 | ## Repository structure
19 |
20 | | Directory | Contents | Documentation |
21 | |-------------------------------|----------|---------------|
22 | | .github/workflow | Workflow YML file that gets you started with GitHUb actions for CMSIS projects |
23 | | .jenkins | Two Jenkins examples (one using a AVH Python module, the other creating a Jenkins node from AVH AMI | [README.md](./.jenkins/README.md) |
24 | | basic | An example project that shows unit testing | [README.md](./basic/README.md) |
25 | | infrastructure/cloudformation | AWS Cloudformation template helps with the setup of the AWS infrastructure | [README.md](./infrastructure/cloudformation/README.md) |
26 |
27 | ## Usage instructions
28 |
29 | You can use this repository as a template for your own validation projects that use with Arm Virtual Hardware. Read the [documentation](https://arm-software.github.io/AVH/main/examples/html/GetStarted.html) to learn how to use it and understand which steps are required to make it work for you.
30 |
31 | ## Get started with GitHub Actions
32 |
33 | [](https://armkeil.blob.core.windows.net/developer/Files/videos/KeilMDK/GetStartedGitHubActions_AVH.mp4)
34 |
35 | ## Further reading
36 |
37 | The links below provide access to additional developer resources:
38 |
39 | | Resource | Description |
40 | |--------------------|---------------------------------------------------------------------------------------------|
41 | | [Documentation](https://arm-software.github.io/AVH/main/overview/html/index.html) | Is a comprehensive documentation about Arm Virtual Hardware. |
42 | | [Support Forum](https://community.arm.com/support-forums/f/arm-virtual-hardware-targets-forum) | Arm Virtual Hardware is supported via a forum. Your feedback will influence future roadmap. |
43 | | [TFL Micro Speech](https://github.com/arm-software/AVH-TFLmicrospeech) | This example project shows the Virtual Streaming Interface with Audio input. |
44 | | [Marketing Overview](https://www.arm.com/virtual-hardware) | Gives you a top-level marketing message. |
45 |
--------------------------------------------------------------------------------
/basic/README.md:
--------------------------------------------------------------------------------
1 | [](https://github.com/ARM-software/AVH-GetStarted/actions/workflows/basic.yml)
2 | 
3 |
4 | # Arm Virtual Hardware - Basic Example
5 |
6 | This project demonstrates how to setup a development workflow with cloud-based
7 | Continuous Integration (CI) for testing an embedded application.
8 |
9 | The embedded program implements a set of simple unit tests for execution on
10 | a Arm Fixed Virtual Platform (FVP) models. Code development and debug can be done
11 | locally, for example with [CMSIS-Build](https://arm-software.github.io/CMSIS_5/develop/Build/html/index.html) and [Keil MDK](https://developer.arm.com/tools-and-software/embedded/keil-mdk) tools.
12 |
13 | Automated test execution is managed with GitHub Actions and gets triggered on
14 | every code change in the repository. The program gets built and run on [Arm
15 | Virtual Hardware](https://www.arm.com/products/development-tools/simulation/virtual-hardware) cloud infrastructure in AWS and the test results can
16 | be then observed in repository's [GitHub Actions](https://github.com/ARM-software/AVH-GetStarted/actions).
17 |
18 | ## Example Structure
19 |
20 | Folder or Files in the example | Description
21 | :--------------------------------|:--------------------
22 | `./` | Folder with the Basic embedded application example
23 | `./RTE/Device/SSE-300-MPS3/` | Folder with target-specific configurable files provided by software components used in the project. Includes system startup files, linker scatter file, CMSIS-Driver configurations and others. See [Components in Project](https://www.keil.com/support/man/docs/uv4/uv4_ca_compinproj.htm) in µVision documentation.
24 | `./main.c`
`./basic/retarget_stdio.c` | Application code files
25 | `./basic.debug.cprj` | Project file in [.cprj format](https://arm-software.github.io/CMSIS_5/Build/html/cprjFormat_pg.html)
26 | `./fvp_config.txt` | Configuration file for running the Virtual Hardware model from command line
27 | `./mdk_config.txt` | Configuration file for running the Virtual Hardware model model from within MDK
28 | `./build.py` | Python script for project build, execution and analysis of test results
29 | `./avh.yml` | File with instructions for [AVH Client for Python](https://github.com/ARM-software/avhclient)
30 | `./requirements.txt` | File with the list of Python packages required for execution of `./build.py`
31 |
32 | ## Prerequisites
33 |
34 | The sections below list the installation and configuration requirements for
35 | both supported use cases:
36 |
37 | - execute the tests manually on a local machine
38 | - run tests automatically in the AWS cloud
39 |
40 | ### Local environment setup
41 |
42 | For building, running and debugging on the local machine one needs to install
43 | the following tools.
44 |
45 | #### Embedded Toolchain
46 |
47 | - IDE for local build and debug (Windows only):
48 | - [Keil MDK](https://developer.arm.com/tools-and-software/embedded/keil-mdk), Professional Edition
49 | - alternatively, for command-line build without debug (Linux, Windows):
50 | - [Arm Compiler 6 for Embedded](https://developer.arm.com/tools-and-software/embedded/arm-compiler)
51 | (also available with [Keil MDK](https://developer.arm.com/tools-and-software/embedded/keil-mdk)
52 | (Windows) or [Arm DS](https://developer.arm.com/tools-and-software/embedded/arm-development-studio)
53 | (Linux, Windows))
54 | - [CMSIS-Build](https://github.com/ARM-software/CMSIS_5/releases/download/5.8.0/cbuild_install.0.10.3.sh)
55 | command-line building tools provided with the [CMSIS_5 release](https://github.com/ARM-software/CMSIS_5/releases).
56 | Additionally requires for its operation:
57 | - [Bash](https://en.wikipedia.org/wiki/Bash_(Unix_shell)) environment.
58 | - [CMake](https://arm-software.github.io/CMSIS_5/Build/html/cmake.html)
59 | 3.15 or above, and support for its build system (default is Ninja).
60 | - [Python 3.9](https://www.python.org/downloads/) (*optional*, needed only when using `build.py`)
61 | - with packages defined in `./requirements.txt`, that shall be installed with:\
62 | `pip install -r requirements.txt`
63 |
64 | #### Target Models
65 |
66 | - Arm Virtual Hardware (AVH) model of Arm Corstone-300 sub-system.
67 |
68 | Note that CMSIS software packs used in the project will be requested and
69 | installed automatically when using Keil MDK or CMSIS-Build.
70 |
71 | ### Cloud environment setup
72 |
73 | Following setup is required for building and running the example program in the cloud as part of a
74 | CI workflow.
75 |
76 | - **Amazon Web Service (AWS) account** with:
77 | - Amazon EC2 (elastic cloud) access
78 | - Amazon S3 (storage) access
79 | - Registration to access AVH Amazon Machine Image [AVH AMI](https://aws.amazon.com/marketplace/search/results?searchTerms=Arm+Virtual+Hardware)
80 | - AWS Authentication (either way):
81 | - AMI User setup for scripted API access ***OR***
82 | - Use Assume Role with Web Identity (Please see [Configuring OpenID Connect in Amazon Web Services](https://docs.github.com/en/actions/deployment/security-hardening-your-deployments/configuring-openid-connect-in-amazon-web-services#adding-the-identity-provider-to-aws))
83 | - **GitHub**:
84 | - Fork of this repository with at least _Write_ access rights
85 | - If you are using Assume Role with WebIdentify, please change the GitHub Action task `Configure AWS Credentials` to use your role (e.g. `arn:aws:iam::720528183931:role/Proj-vht-assume-role`).
86 | - Following AWS configuration values stored as
87 | [GitHub Secrets](https://docs.github.com/en/actions/security-guides/encrypted-secrets)
88 | of the forked repository
89 | Secret Name | Description
90 | :----------------------------------------------|:--------------------
91 | `AWS_ACCESS_KEY_ID`
`AWS_SECRET_ACCESS_KEY` | [Access key pair](https://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_access-keys.html) for the AWS account (as IAM user) that shall be used by the CI workflow for AWS access.
***PLEASE NOTE: NOT NEEDED IF YOU ARE ASSUMING ROLE WITH WEB IDENTITY***
92 | `AWS_IAM_PROFILE` | The [IAM Role](https://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_use.html) to be used for AWS access.
93 | `AWS_S3_BUCKET_NAME` | The name of the S3 storage bucket to be used for data exchange between GitHub and AWS AMI.
94 | `AWS_DEFAULT_REGION` | The data center region the AVH AMI will be run on. For example `eu-west-1`.
95 | `AWS_EC2_SECURITY_GROUP_ID` | The id of the [VPC security group](https://docs.aws.amazon.com/vpc/latest/userguide/VPC_SecurityGroups.html) to add the EC2 instance to. Shall have format `sg-xxxxxxxx`.
96 | `AWS_SUBNET_ID` | The id of the [VPC subnet](https://docs.aws.amazon.com/vpc/latest/userguide/working-with-vpcs.html#view-subnet) to connect the EC2 instance to. Shall have format `subnet-xxxxxxxx`.
97 |
98 | ## Local build and debug
99 |
100 | For developing the tests on the local machine one needs to clone this
101 | repository into a local workspace.
102 |
103 | ### Building on command line
104 |
105 | Open a command prompt in the local workspace. The following instructions assume
106 | Python is installed. If one doesn't want to go the Python way one can issue the
107 | individual command, manually. The CMSIS-Build command `cbuild` and the FVP executable `VHT_Corstone_SSE-300_Ethos-U55` are expected in the
108 | system `PATH`.
109 |
110 | In order to use the `build.py` script to conveniently execute the required commands,
111 | one need to install some Python requirements listed in `requirements.txt`:
112 |
113 | ```text
114 | ~/AVH-GetStarted/basic $ pip install -r requirements.txt
115 | ```
116 |
117 | Once the required Python packages are installed one can run the script to
118 | build the example:
119 |
120 | ```text
121 | ~/AVH-GetStarted/basic $ ./build.py -t debug build
122 | [debug](build:run_cbuild) bash -c cbuild.sh --quiet basic.debug.cprj
123 | [debug](build:run_cbuild) bash succeeded with exit code 0
124 |
125 | Matrix Summary
126 | ==============
127 |
128 | target build run
129 | -------- ------- -----
130 | debug success (skip)
131 |
132 | ~/AVH-GetStarted/basic $ ls -lah Objects/basic.axf
133 |
134 | -rw-r--r-- 1 **** 4096 64K Nov 25 10:59 Objects/basic.axf
135 | ```
136 |
137 | The `build.py` script automatically creates a timestamped archive of the build results
138 | in a file `basic-.zip`. One can extract this into another workspace at a
139 | later point in time to inspect the result, e.g. run the tests in a debugger.
140 |
141 | ### Execute on command line
142 |
143 | Open a command prompt in the local workspace. The following instructions assume
144 | Python is installed. If one don't want to go the Python way one can issue the
145 | individual command, manually.
146 |
147 | ```text
148 | ~/AVH-GetStarted/basic $ ./build.py -t debug run
149 | [debug](run:run_fvp) VHT_Corstone_SSE-300_Ethos-U55.EXE -q --stat --simlimit 1 -f fvp_config.txt Objects/basic.axf
150 | [debug](run:run_fvp) VHT_Corstone_SSE-300_Ethos-U55.EXE succeeded with exit code 0
151 | ::set-output name=badge::Unittest-3%20of%204%20passed-yellow
152 |
153 | Matrix Summary
154 | ==============
155 |
156 | target build run
157 | -------- ------- -----
158 | debug (skip) 3/4
159 | ```
160 |
161 | The summary lists out the number of test cases passed and totally executed.
162 | This example intentionally has one failing test case. Inspect the xunit result
163 | file to see the details:
164 |
165 | ```text
166 | ~/AVH-GetStarted/basic $ cat basic-.xunit
167 |
168 |
169 |
170 |
171 |
172 |
173 |
174 |
175 |
176 |
177 |
178 | ```
179 |
180 | This reveals that the test assertion in `main.c` line 48 failed.
181 |
182 | ### Understanding the `build.py` script
183 |
184 | The `build.py` script is written using the `python-matrix-runner` Python
185 | package. Find more detailed documentation for this Python package on its
186 | [PyPI page](https://pypi.org/project/python-matrix-runner/).
187 |
188 | This section puts some parts of the build script into the spotlight.
189 |
190 | #### Test report converter `class UnityReport`
191 |
192 | The `class UnityReport` is implemented as a `ReportFilter` so that it can
193 | later be used in a test report chain (see section about commands below).
194 |
195 | The relevant part here is `stream` property that receives a data stream
196 | (standard output of the model) and translates it into JUnit format. This
197 | is done by pattern matching (using regular expression) on the expected
198 | Unity framework output. Each found test case with its result is converted
199 | into a `junit_xml.TestCase` taken from the Python package `junit-xml`.
200 |
201 | #### Configuration axes `@matrix_axis`
202 |
203 | The `python-matrix-runner` has built-in support for matrix build configurations.
204 | In case of this trivial GetStarted example only a single configuration `debug`
205 | is used. This is done by specifying a project specific `Enum` per degree of
206 | freedom listing the configuration values. This example only has one axis
207 | (`target`) with one value (`debug`). More elaborated use-cases may add further
208 | axes for support of different compilers, optimization levels or target devices.
209 |
210 | #### Build actions `@matrix_action`
211 |
212 | The build script can offer different top-level actions the user can trigger
213 | from the command line. In this example these are only `build` and `run`. Each
214 | action is defined by the according method.
215 |
216 | An action method must at least `yield` one shell command to be executed.
217 | Complex actions can be composed from multiple shell commands interleaved
218 | with additional Python code. In this basic example additional Python code
219 | is used for some post-processing of the shell command results such as
220 | creating an zip archive with the build output.
221 |
222 | #### Build commands `@matrix_command`
223 |
224 | Each shell command (required to compose the actions) is defined by a method
225 | returning an array with the command line parts, see
226 | [subprocess.run](https://docs.python.org/3.8/library/subprocess.html#subprocess.run)
227 | for details.
228 |
229 | A command can be further customized, for instance by attaching a `test_report`.
230 | The `test_report` is created by applying a chain of `ReportFiler`'s to the
231 | output of the command. In the basic example the output of the FVP
232 | model is captured (`ConsoleReport`), the Unity output between
233 | the known text markers is cropped (`CropReport`), and the remaining data
234 | is converted into JUnit format (`UnityReport`).
235 |
236 |
237 | ### Build and debug in MDK
238 |
239 | [Run with MDK-Professional](https://arm-software.github.io/AVH/main/infrastructure/html/run_mdk_pro.html)
240 | explains in details the tool setup and project configuration for running an
241 | MDK project on Arm Virtual Hardware.
242 |
243 | For this example, import the `basic.debug.cprj` in MDK. Before launching the debug session one needs to
244 | verify the debugger configuration:
245 |
246 | - Bring up the _Options for target..._ dialog from the tool bar.
247 | - Navigate to the _Debug_ pane and select _Use: Models ARMv8-M Debugger_.
248 | - Next, click on the _Settings_ button to bring up the _Models ARMv8-M Target Driver Setup_ dialog.
249 | - Select in the as the _Command_ field the model executable for Corstone SSE-300
250 | with Ethos-U55 (filename is: `VHT_Corstone_SSE-300_Ethos-U55.exe`
251 | in the location where Virtual Hardware models are installed).
252 | - Set `cpu0` as the _Target_.
253 | - Browse for the _Configuration File_ and select `mdk_config.txt`.
254 |
255 | Now, start the debug session and the model executable should pop up. By default,
256 | MDK stops execution when reaching `main`. Set a breakpoint to line 37 and
257 | continue execution. Hitting the breakpoint one can single step the code under
258 | test to figure out the issue. In this case the issue is obvious:
259 | `1 + (-1) != 2`.
260 |
261 | ## Running tests in GitHub Actions CI
262 |
263 | The repository defines a workflow to build and run the tests using
264 | GitHub Actions on every change i.e., *push* and *pull_request* triggers.
265 |
266 | To make this work the repository needs to be configured, see Prerequisites
267 | above.
268 |
269 | On every change, the workflow is kicked off executing the following steps.
270 |
271 | - Execute build and test inside an EC2 instance\
272 | The [AVH Client for Python](https://github.com/ARM-software/avhclient) is used to
273 | - create new EC2 instance
274 | - upload the workspace to the EC2 instance using a S3 storage bucket;
275 | - run the command line build;
276 | - execute the test image using the AVH model
277 | - download the output into the workspace.
278 | - terminate the EC2 instance
279 | - Extract and post-process test output, including
280 | - conversion of the log file into XUnit format.
281 | - Archive build/test output\
282 | The image, log file and XUnit report are attached as a build artifact for
283 | later analysis.
284 | - Publish test results
285 |
--------------------------------------------------------------------------------
/basic/RTE/Device/SSE-300-MPS3/RTE_Device.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2019-2021 Arm Limited. All rights reserved.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | #ifndef __RTE_DEVICE_H
18 | #define __RTE_DEVICE_H
19 |
20 | // USART (Universal synchronous - asynchronous receiver transmitter) [Driver_USART0]
21 | // Configuration settings for Driver_USART0 in component ::Drivers:USART
22 | #define RTE_USART0 1
23 | // USART (Universal synchronous - asynchronous receiver transmitter) [Driver_USART0]
24 |
25 | // USART (Universal synchronous - asynchronous receiver transmitter) [Driver_USART1]
26 | // Configuration settings for Driver_USART1 in component ::Drivers:USART
27 | #define RTE_USART1 1
28 | // USART (Universal synchronous - asynchronous receiver transmitter) [Driver_USART1]
29 |
30 | // MPC (Memory Protection Controller) [Driver_ISRAM0_MPC]
31 | // Configuration settings for Driver_ISRAM0_MPC in component ::Drivers:MPC
32 | #define RTE_ISRAM0_MPC 1
33 | // MPC (Memory Protection Controller) [Driver_ISRAM0_MPC]
34 |
35 | // MPC (Memory Protection Controller) [Driver_ISRAM1_MPC]
36 | // Configuration settings for Driver_ISRAM1_MPC in component ::Drivers:MPC
37 | #define RTE_ISRAM1_MPC 1
38 | // MPC (Memory Protection Controller) [Driver_ISRAM1_MPC]
39 |
40 | // MPC (Memory Protection Controller) [Driver_SRAM_MPC]
41 | // Configuration settings for Driver_SRAM_MPC in component ::Drivers:MPC
42 | #define RTE_SRAM_MPC 1
43 | // MPC (Memory Protection Controller) [Driver_SRAM_MPC]
44 |
45 | // MPC (Memory Protection Controller) [Driver_QSPI_MPC]
46 | // Configuration settings for Driver_QSPI_MPC in component ::Drivers:MPC
47 | #define RTE_QSPI_MPC 1
48 | // MPC (Memory Protection Controller) [Driver_QSPI_MPC]
49 |
50 | // PPC (Peripheral Protection Controller) [PPC_SSE300_MAIN0]
51 | // Configuration settings for Driver_PPC_SSE300_MAIN0 in component ::Drivers:PPC
52 | #define RTE_PPC_SSE300_MAIN0 1
53 | // PPC (Peripheral Protection Controller) [Driver_PPC_SSE300_MAIN0]
54 |
55 | // PPC (Peripheral Protection Controller) [PPC_SSE300_MAIN_EXP0]
56 | // Configuration settings for Driver_PPC_SSE300_MAIN_EXP0 in component ::Drivers:PPC
57 | #define RTE_PPC_SSE300_MAIN_EXP0 1
58 | // PPC (Peripheral Protection Controller) [Driver_PPC_SSE300_MAIN_EXP0]
59 |
60 | // PPC (Peripheral Protection Controller) [PPC_SSE300_MAIN_EXP1]
61 | // Configuration settings for Driver_PPC_SSE300_MAIN_EXP1 in component ::Drivers:PPC
62 | #define RTE_PPC_SSE300_MAIN_EXP1 1
63 | // PPC (Peripheral Protection Controller) [Driver_PPC_SSE300_MAIN_EXP1]
64 |
65 | // PPC (Peripheral Protection Controller) [PPC_SSE300_PERIPH0]
66 | // Configuration settings for Driver_PPC_SSE300_PERIPH0 in component ::Drivers:PPC
67 | #define RTE_PPC_SSE300_PERIPH0 1
68 | // PPC (Peripheral Protection Controller) [Driver_PPC_SSE300_PERIPH0]
69 |
70 | // PPC (Peripheral Protection Controller) [PPC_SSE300_PERIPH1]
71 | // Configuration settings for Driver_PPC_SSE300_PERIPH1 in component ::Drivers:PPC
72 | #define RTE_PPC_SSE300_PERIPH1 1
73 | // PPC (Peripheral Protection Controller) [Driver_PPC_SSE300_PERIPH1]
74 |
75 | // PPC (Peripheral Protection Controller) [PPC_SSE300_PERIPH_EXP0]
76 | // Configuration settings for Driver_PPC_SSE300_PERIPH_EXP0 in component ::Drivers:PPC
77 | #define RTE_PPC_SSE300_PERIPH_EXP0 1
78 | // PPC (Peripheral Protection Controller) [Driver_PPC_SSE300_PERIPH_EXP0]
79 |
80 | // PPC (Peripheral Protection Controller) [PPC_SSE300_PERIPH_EXP1]
81 | // Configuration settings for Driver_PPC_SSE300_PERIPH_EXP1 in component ::Drivers:PPC
82 | #define RTE_PPC_SSE300_PERIPH_EXP1 1
83 | // PPC (Peripheral Protection Controller) [Driver_PPC_SSE300_PERIPH_EXP1]
84 |
85 | // PPC (Peripheral Protection Controller) [PPC_SSE300_PERIPH_EXP2]
86 | // Configuration settings for Driver_PPC_SSE300_PERIPH_EXP2 in component ::Drivers:PPC
87 | #define RTE_PPC_SSE300_PERIPH_EXP2 1
88 | // PPC (Peripheral Protection Controller) [Driver_PPC_SSE300_PERIPH_EXP2]
89 |
90 | // Flash device emulated by SRAM [Driver_Flash0]
91 | // Configuration settings for Driver_Flash0 in component ::Drivers:Flash
92 | #define RTE_FLASH0 1
93 | // Flash device emulated by SRAM [Driver_Flash0]
94 |
95 | // I2C SBCon [Driver_I2C0]
96 | // Configuration settings for Driver_I2C0 in component ::Drivers:I2C
97 | #define RTE_I2C0 1
98 | // I2C SBCon [Driver_I2C0]
99 |
100 | #endif /* __RTE_DEVICE_H */
101 |
--------------------------------------------------------------------------------
/basic/RTE/Device/SSE-300-MPS3/cmsis_driver_config.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2019-2020 Arm Limited. All rights reserved.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | #ifndef __CMSIS_DRIVER_CONFIG_H__
18 | #define __CMSIS_DRIVER_CONFIG_H__
19 |
20 | #include "system_core_init.h"
21 | #include "device_cfg.h"
22 | #include "device_definition.h"
23 | #include "platform_base_address.h"
24 |
25 | #endif /* __CMSIS_DRIVER_CONFIG_H__ */
26 |
--------------------------------------------------------------------------------
/basic/RTE/Device/SSE-300-MPS3/device_cfg.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2020-2021 Arm Limited. All rights reserved.
3 | *
4 | * Licensed under the Apache License Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing software
11 | * distributed under the License is distributed on an "AS IS" BASIS
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | #ifndef __DEVICE_CFG_H__
18 | #define __DEVICE_CFG_H__
19 |
20 | /**
21 | * \file device_cfg.h
22 | * \brief Configuration file native driver re-targeting
23 | *
24 | * \details This file can be used to add native driver specific macro
25 | * definitions to select which peripherals are available in the build.
26 | *
27 | * This is a default device configuration file with all peripherals enabled.
28 | */
29 |
30 | /* Secure only peripheral configuration */
31 |
32 | /* ARM MPS3 IO SCC */
33 | #define MPS3_IO_S
34 | #define MPS3_IO_DEV MPS3_IO_DEV_S
35 |
36 | /* ARM UART Controller PL011 */
37 | #define UART0_CMSDK_S
38 | #define UART0_CMSDK_DEV UART0_CMSDK_DEV_S
39 | #define UART1_CMSDK_S
40 | #define UART1_CMSDK_DEV UART1_CMSDK_DEV_S
41 |
42 | #define DEFAULT_UART_BAUDRATE 115200U
43 |
44 | /* To be used as CODE and DATA sram */
45 | #define MPC_ISRAM0_S
46 | #define MPC_ISRAM0_DEV MPC_ISRAM0_DEV_S
47 |
48 | #define MPC_ISRAM1_S
49 | #define MPC_ISRAM1_DEV MPC_ISRAM0_DEV_S
50 |
51 | #define MPC_SRAM_S
52 | #define MPC_SRAM_DEV MPC_SRAM_DEV_S
53 |
54 | #define MPC_QSPI_S
55 | #define MPC_QSPI_DEV MPC_QSPI_DEV_S
56 |
57 | /** System Counter Armv8-M */
58 | #define SYSCOUNTER_CNTRL_ARMV8_M_S
59 | #define SYSCOUNTER_CNTRL_ARMV8_M_DEV SYSCOUNTER_CNTRL_ARMV8_M_DEV_S
60 |
61 | #define SYSCOUNTER_READ_ARMV8_M_S
62 | #define SYSCOUNTER_READ_ARMV8_M_DEV SYSCOUNTER_READ_ARMV8_M_DEV_S
63 | /**
64 | * Arbitrary scaling values for test purposes
65 | */
66 | #define SYSCOUNTER_ARMV8_M_DEFAULT_SCALE0_INT 1u
67 | #define SYSCOUNTER_ARMV8_M_DEFAULT_SCALE0_FRACT 0u
68 | #define SYSCOUNTER_ARMV8_M_DEFAULT_SCALE1_INT 1u
69 | #define SYSCOUNTER_ARMV8_M_DEFAULT_SCALE1_FRACT 0u
70 |
71 | /* System timer */
72 | #define SYSTIMER0_ARMV8_M_S
73 | #define SYSTIMER0_ARMV8_M_DEV SYSTIMER0_ARMV8_M_DEV_S
74 | #define SYSTIMER1_ARMV8_M_S
75 | #define SYSTIMER1_ARMV8_M_DEV SYSTIMER1_ARMV8_M_DEV_S
76 | #define SYSTIMER2_ARMV8_M_S
77 | #define SYSTIMER2_ARMV8_M_DEV SYSTIMER2_ARMV8_M_DEV_S
78 | #define SYSTIMER3_ARMV8_M_S
79 | #define SYSTIMER3_ARMV8_M_DEV SYSTIMER3_ARMV8_M_DEV_S
80 |
81 | #define SYSTIMER0_ARMV8M_DEFAULT_FREQ_HZ (25000000ul)
82 | #define SYSTIMER1_ARMV8M_DEFAULT_FREQ_HZ (25000000ul)
83 | #define SYSTIMER2_ARMV8M_DEFAULT_FREQ_HZ (25000000ul)
84 | #define SYSTIMER3_ARMV8M_DEFAULT_FREQ_HZ (25000000ul)
85 |
86 | /* CMSDK GPIO driver structures */
87 | #define GPIO0_CMSDK_S
88 | #define GPIO0_CMSDK_DEV GPIO0_CMSDK_DEV_S
89 | #define GPIO1_CMSDK_S
90 | #define GPIO1_CMSDK_DEV GPIO1_CMSDK_DEV_S
91 | #define GPIO2_CMSDK_S
92 | #define GPIO2_CMSDK_DEV GPIO2_CMSDK_DEV_S
93 | #define GPIO3_CMSDK_S
94 | #define GPIO3_CMSDK_DEV GPIO3_CMSDK_DEV_S
95 |
96 | /* ARM MPS3 IO FPGAIO driver structures */
97 | #define ARM_MPS3_IO_FPGAIO_S
98 | #define ARM_MPS3_IO_FPGAIO_DEV ARM_MPS3_IO_FPGAIO_DEV_S
99 |
100 | /* System Watchdogs */
101 | #define SYSWDOG_ARMV8_M_S
102 | #define SYSWDOG_ARMV8_M_DEV SYSWDOG_ARMV8_M_DEV_S
103 |
104 | /* ARM MPC SIE 300 driver structures */
105 | #define MPC_VM0_S
106 | #define MPC_VM0_DEV MPC_VM0_DEV_S
107 | #define MPC_VM1_S
108 | #define MPC_VM1_DEV MPC_VM1_DEV_S
109 | #define MPC_SSRAM2_S
110 | #define MPC_SSRAM2_DEV MPC_SSRAM2_DEV_S
111 | #define MPC_SSRAM3_S
112 | #define MPC_SSRAM3_DEV MPC_SSRAM3_DEV_S
113 |
114 | /* ARM PPC driver structures */
115 | #define PPC_SSE300_MAIN0_S
116 | #define PPC_SSE300_MAIN0_DEV PPC_SSE300_MAIN0_DEV_S
117 | #define PPC_SSE300_MAIN_EXP0_S
118 | #define PPC_SSE300_MAIN_EXP0_DEV PPC_SSE300_MAIN_EXP0_DEV_S
119 | #define PPC_SSE300_MAIN_EXP1_S
120 | #define PPC_SSE300_MAIN_EXP1_DEV PPC_SSE300_MAIN_EXP1_DEV_S
121 | #define PPC_SSE300_MAIN_EXP2_S
122 | #define PPC_SSE300_MAIN_EXP2_DEV PPC_SSE300_MAIN_EXP2_DEV_S
123 | #define PPC_SSE300_MAIN_EXP3_S
124 | #define PPC_SSE300_MAIN_EXP3_DEV PPC_SSE300_MAIN_EXP3_DEV_S
125 | #define PPC_SSE300_PERIPH0_S
126 | #define PPC_SSE300_PERIPH0_DEV PPC_SSE300_PERIPH0_DEV_S
127 | #define PPC_SSE300_PERIPH1_S
128 | #define PPC_SSE300_PERIPH1_DEV PPC_SSE300_PERIPH1_DEV_S
129 | #define PPC_SSE300_PERIPH_EXP0_S
130 | #define PPC_SSE300_PERIPH_EXP0_DEV PPC_SSE300_PERIPH_EXP0_DEV_S
131 | #define PPC_SSE300_PERIPH_EXP1_S
132 | #define PPC_SSE300_PERIPH_EXP1_DEV PPC_SSE300_PERIPH_EXP1_DEV_S
133 | #define PPC_SSE300_PERIPH_EXP2_S
134 | #define PPC_SSE300_PERIPH_EXP2_DEV PPC_SSE300_PERIPH_EXP2_DEV_S
135 | #define PPC_SSE300_PERIPH_EXP3_S
136 | #define PPC_SSE300_PERIPH_EXP3_DEV PPC_SSE300_PERIPH_EXP3_DEV_S
137 |
138 | /* ARM SPI PL022 */
139 | /* Invalid device stubs are not defined */
140 | #define DEFAULT_SPI_SPEED_HZ 4000000U /* 4MHz */
141 | #define SPI1_PL022_S
142 | #define SPI1_PL022_DEV SPI1_PL022_DEV_S
143 |
144 |
145 | #endif /* __DEVICE_CFG_H__ */
146 |
--------------------------------------------------------------------------------
/basic/RTE/Device/SSE-300-MPS3/fvp_sse300_mps3_s.sct:
--------------------------------------------------------------------------------
1 | #! armclang --target=arm-arm-none-eabi -march=armv8.1-m.main -E -xc
2 |
3 | ;/*
4 | ; * Copyright (c) 2018-2021 Arm Limited. All rights reserved.
5 | ; *
6 | ; * Licensed under the Apache License, Version 2.0 (the "License");
7 | ; * you may not use this file except in compliance with the License.
8 | ; * You may obtain a copy of the License at
9 | ; *
10 | ; * http://www.apache.org/licenses/LICENSE-2.0
11 | ; *
12 | ; * Unless required by applicable law or agreed to in writing, software
13 | ; * distributed under the License is distributed on an "AS IS" BASIS,
14 | ; * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | ; * See the License for the specific language governing permissions and
16 | ; * limitations under the License.
17 | ; *
18 | ; */
19 |
20 | #include "region_defs.h"
21 |
22 | LR_CODE S_CODE_START {
23 | ER_CODE S_CODE_START {
24 | *.o (RESET +First)
25 | .ANY (+RO)
26 | }
27 |
28 | /*
29 | * Place the CMSE Veneers (containing the SG instruction) after the code, in
30 | * a separate 32 bytes aligned region so that the SAU can programmed to just
31 | * set this region as Non-Secure Callable. The maximum size of this
32 | * executable region makes it only used the space left over by the ER_CODE
33 | * region so that you can rely on code+veneer size combined will not exceed
34 | * the S_CODE_SIZE value. We also substract from the available space the
35 | * area used to align this section on 32 bytes boundary (for SAU conf).
36 | */
37 | ER_CODE_CMSE_VENEER +0 ALIGN 32 {
38 | *(Veneer$$CMSE)
39 | }
40 | /*
41 | * This dummy region ensures that the next one will be aligned on a 32 bytes
42 | * boundary, so that the following region will not be mistakenly configured
43 | * as Non-Secure Callable by the SAU.
44 | */
45 | ER_CODE_CMSE_VENEER_DUMMY +0 ALIGN 32 EMPTY 0 {}
46 |
47 | /* This empty, zero long execution region is here to mark the limit address
48 | * of the last execution region that is allocated in SRAM.
49 | */
50 | CODE_WATERMARK +0 EMPTY 0x0 {
51 | }
52 | /* Make sure that the sections allocated in the SRAM does not exceed the
53 | * size of the SRAM available.
54 | */
55 | ScatterAssert(ImageLimit(CODE_WATERMARK) <= S_CODE_START + S_CODE_SIZE)
56 |
57 | ER_DATA S_DATA_START {
58 | .ANY (+ZI +RW)
59 | }
60 |
61 | #if HEAP_SIZE > 0
62 | ARM_LIB_HEAP +0 ALIGN 8 EMPTY HEAP_SIZE { ; Reserve empty region for heap
63 | }
64 | #endif
65 |
66 | ARM_LIB_STACK +0 ALIGN 32 EMPTY STACK_SIZE { ; Reserve empty region for stack
67 | }
68 |
69 | /* This empty, zero long execution region is here to mark the limit address
70 | * of the last execution region that is allocated in SRAM.
71 | */
72 | SRAM_WATERMARK +0 EMPTY 0x0 {
73 | }
74 | /* Make sure that the sections allocated in the SRAM does not exceed the
75 | * size of the SRAM available.
76 | */
77 | ScatterAssert(ImageLimit(SRAM_WATERMARK) <= S_DATA_START + S_DATA_SIZE)
78 | }
79 |
--------------------------------------------------------------------------------
/basic/RTE/Device/SSE-300-MPS3/platform_base_address.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2019-2021 Arm Limited
3 | *
4 | * Licensed under the Apache License Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing software
11 | * distributed under the License is distributed on an "AS IS" BASIS
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | /**
18 | * \file platform_base_address.h
19 | * \brief This file defines all the peripheral base addresses for MPS3 SSE-300 +
20 | * Ethos-U55 AN547 platform.
21 | */
22 |
23 | #ifndef __PLATFORM_BASE_ADDRESS_H__
24 | #define __PLATFORM_BASE_ADDRESS_H__
25 |
26 | /* ======= Defines peripherals memory map addresses ======= */
27 | /* Non-secure memory map addresses */
28 | #define ITCM_BASE_NS 0x00000000 /* Instruction TCM Non-Secure base address */
29 | #define SRAM_BASE_NS 0x01000000 /* CODE SRAM Non-Secure base address */
30 | #define DTCM0_BASE_NS 0x20000000 /* Data TCM block 0 Non-Secure base address */
31 | #define DTCM1_BASE_NS 0x20020000 /* Data TCM block 1 Non-Secure base address */
32 | #define DTCM2_BASE_NS 0x20040000 /* Data TCM block 2 Non-Secure base address */
33 | #define DTCM3_BASE_NS 0x20060000 /* Data TCM block 3 Non-Secure base address */
34 | #define ISRAM0_BASE_NS 0x21000000 /* Internal SRAM Area Non-Secure base address */
35 | #define ISRAM1_BASE_NS 0x21200000 /* Internal SRAM Area Non-Secure base address */
36 | #define QSPI_SRAM_BASE_NS 0x28000000 /* QSPI SRAM Non-Secure base address */
37 | /* Non-Secure Subsystem peripheral region */
38 | #define CPU0_PWRCTRL_BASE_NS 0x40012000 /* CPU 0 Power Control Block Non-Secure base address */
39 | #define CPU0_IDENTITY_BASE_NS 0x4001F000 /* CPU 0 Identity Block Non-Secure base address */
40 | #define SSE300_NSACFG_BASE_NS 0x40080000 /* SSE-300 Non-Secure Access Configuration Register Block Non-Secure base address */
41 | /* Non-Secure MSTEXPPILL Peripheral region */
42 | #define GPIO0_CMSDK_BASE_NS 0x41100000 /* GPIO 0 Non-Secure base address */
43 | #define GPIO1_CMSDK_BASE_NS 0x41101000 /* GPIO 1 Non-Secure base address */
44 | #define GPIO2_CMSDK_BASE_NS 0x41102000 /* GPIO 2 Non-Secure base address */
45 | #define GPIO3_CMSDK_BASE_NS 0x41103000 /* GPIO 3 Non-Secure base address */
46 | #define AHB_USER_0_BASE_NS 0x41104000 /* AHB USER 0 Non-Secure base address */
47 | #define AHB_USER_1_BASE_NS 0x41105000 /* AHB USER 1 Non-Secure base address */
48 | #define AHB_USER_2_BASE_NS 0x41106000 /* AHB USER 2 Non-Secure base address */
49 | #define AHB_USER_3_BASE_NS 0x41107000 /* AHB USER 3 Non-Secure base address */
50 | #define DMA_0_BASE_NS 0x41200000 /* DMA 0 Non-Secure base address */
51 | #define DMA_1_BASE_NS 0x41201000 /* DMA 1 Non-Secure base address */
52 | #define DMA_2_BASE_NS 0x41202000 /* DMA 2 Non-Secure base address */
53 | #define DMA_3_BASE_NS 0x41203000 /* DMA 3 Non-Secure base address */
54 | #define ETHERNET_BASE_NS 0x41400000 /* Ethernet Non-Secure base address */
55 | #define USB_BASE_NS 0x41500000 /* USB Non-Secure base address */
56 | #define USER_APB0_BASE_NS 0x41700000 /* User APB 0 Non-Secure base address */
57 | #define USER_APB1_BASE_NS 0x41701000 /* User APB 1 Non-Secure base address */
58 | #define USER_APB2_BASE_NS 0x41702000 /* User APB 2 Non-Secure base address */
59 | #define USER_APB3_BASE_NS 0x41703000 /* User APB 3 Non-Secure base address */
60 | #define QSPI_CONFIG_BASE_NS 0x41800000 /* QSPI Config Non-Secure base address */
61 | #define QSPI_WRITE_BASE_NS 0x41801000 /* QSPI Write Non-Secure base address */
62 | /* Non-Secure Subsystem peripheral region */
63 | #define SYSTIMER0_ARMV8_M_BASE_NS 0x48000000 /* System Timer 0 Non-Secure base address */
64 | #define SYSTIMER1_ARMV8_M_BASE_NS 0x48001000 /* System Timer 1 Non-Secure base address */
65 | #define SYSTIMER2_ARMV8_M_BASE_NS 0x48002000 /* System Timer 2 Non-Secure base address */
66 | #define SYSTIMER3_ARMV8_M_BASE_NS 0x48003000 /* System Timer 3 Non-Secure base address */
67 | #define SSE300_SYSINFO_BASE_NS 0x48020000 /* SSE-300 System info Block Non-Secure base address */
68 | #define SLOWCLK_TIMER_CMSDK_BASE_NS 0x4802F000 /* CMSDK based SLOWCLK Timer Non-Secure base address */
69 | #define SYSWDOG_ARMV8_M_CNTRL_BASE_NS 0x48040000 /* Non-Secure Watchdog Timer control frame Non-Secure base address */
70 | #define SYSWDOG_ARMV8_M_REFRESH_BASE_NS 0x48041000 /* Non-Secure Watchdog Timer refresh frame Non-Secure base address */
71 | #define SYSCNTR_READ_BASE_NS 0x48101000 /* System Counter Read Secure base address */
72 | /* Non-Secure MSTEXPPIHL Peripheral region */
73 | #define ETHOS_U55_APB_BASE_NS 0x48102000 /* Ethos-U55 APB Non-Secure base address */
74 | #define U55_TIMING_ADAPTER_BASE_NS 0x48103000 /* Ethos-U55 Timing Adapter registers Non-Secure base address */
75 | #define FPGA_SBCon_I2C_TOUCH_BASE_NS 0x49200000 /* FPGA - SBCon I2C (Touch) Non-Secure base address */
76 | #define FPGA_SBCon_I2C_AUDIO_BASE_NS 0x49201000 /* FPGA - SBCon I2C (Audio Conf) Non-Secure base address */
77 | #define FPGA_SPI_ADC_BASE_NS 0x49202000 /* FPGA - PL022 (SPI ADC) Non-Secure base address */
78 | #define FPGA_SPI_SHIELD0_BASE_NS 0x49203000 /* FPGA - PL022 (SPI Shield0) Non-Secure base address */
79 | #define FPGA_SPI_SHIELD1_BASE_NS 0x49204000 /* FPGA - PL022 (SPI Shield1) Non-Secure base address */
80 | #define SBCon_I2C_SHIELD0_BASE_NS 0x49205000 /* SBCon (I2C - Shield0) Non-Secure base address */
81 | #define SBCon_I2C_SHIELD1_BASE_NS 0x49206000 /* SBCon (I2C – Shield1) Non-Secure base address */
82 | #define USER_APB_BASE_NS 0x49207000 /* USER APB Non-Secure base address */
83 | #define FPGA_DDR4_EEPROM_BASE_NS 0x49208000 /* FPGA - SBCon I2C (DDR4 EEPROM) Non-Secure base address */
84 | #define FPGA_SCC_BASE_NS 0x49300000 /* FPGA - SCC registers Non-Secure base address */
85 | #define FPGA_I2S_BASE_NS 0x49301000 /* FPGA - I2S (Audio) Non-Secure base address */
86 | #define FPGA_IO_BASE_NS 0x49302000 /* FPGA - IO (System Ctrl + I/O) Non-Secure base address */
87 | #define UART0_BASE_NS 0x49303000 /* UART 0 Non-Secure base address */
88 | #define UART1_BASE_NS 0x49304000 /* UART 1 Non-Secure base address */
89 | #define UART2_BASE_NS 0x49305000 /* UART 2 Non-Secure base address */
90 | #define UART3_BASE_NS 0x49306000 /* UART 3 Non-Secure base address */
91 | #define UART4_BASE_NS 0x49307000 /* UART 4 Non-Secure base address */
92 | #define UART5_BASE_NS 0x49308000 /* UART 5 Non-Secure base address */
93 | #define CLCD_Config_Reg_BASE_NS 0x4930A000 /* CLCD Config Reg Non-Secure base address */
94 | #define RTC_BASE_NS 0x4930B000 /* RTC Non-Secure base address */
95 | #define DDR4_BLK0_BASE_NS 0x60000000 /* DDR4 block 0 Non-Secure base address */
96 | #define DDR4_BLK2_BASE_NS 0x80000000 /* DDR4 block 2 Non-Secure base address */
97 | #define DDR4_BLK4_BASE_NS 0xA0000000 /* DDR4 block 4 Non-Secure base address */
98 | #define DDR4_BLK6_BASE_NS 0xC0000000 /* DDR4 block 6 Non-Secure base address */
99 |
100 | /* Secure memory map addresses */
101 | #define ITCM_BASE_S 0x10000000 /* Instruction TCM Secure base address */
102 | #define SRAM_BASE_S 0x11000000 /* CODE SRAM Secure base address */
103 | #define DTCM0_BASE_S 0x30000000 /* Data TCM block 0 Secure base address */
104 | #define DTCM1_BASE_S 0x30020000 /* Data TCM block 1 Secure base address */
105 | #define DTCM2_BASE_S 0x30040000 /* Data TCM block 2 Secure base address */
106 | #define DTCM3_BASE_S 0x30060000 /* Data TCM block 3 Secure base address */
107 | #define ISRAM0_BASE_S 0x31000000 /* Internal SRAM Area Secure base address */
108 | #define ISRAM1_BASE_S 0x31200000 /* Internal SRAM Area Secure base address */
109 | #define QSPI_SRAM_BASE_S 0x38000000 /* QSPI SRAM Secure base address */
110 | /* Secure Subsystem peripheral region */
111 | #define CPU0_SECCTRL_BASE_S 0x50011000 /* CPU 0 Local Security Control Block Secure base address */
112 | #define CPU0_PWRCTRL_BASE_S 0x50012000 /* CPU 0 Power Control Block Secure base address */
113 | #define CPU0_IDENTITY_BASE_S 0x5001F000 /* CPU 0 Identity Block Secure base address */
114 | #define SSE300_SACFG_BASE_S 0x50080000 /* SSE-300 Secure Access Configuration Register Secure base address */
115 | #define MPC_ISRAM0_BASE_S 0x50083000 /* Internal SRAM0 Memory Protection Controller Secure base address */
116 | #define MPC_ISRAM1_BASE_S 0x50084000 /* Internal SRAM1 Memory Protection Controller Secure base address */
117 | /* Secure MSTEXPPILL Peripheral region */
118 | #define GPIO0_CMSDK_BASE_S 0x51100000 /* GPIO 0 Secure base address */
119 | #define GPIO1_CMSDK_BASE_S 0x51101000 /* GPIO 1 Secure base address */
120 | #define GPIO2_CMSDK_BASE_S 0x51102000 /* GPIO 2 Secure base address */
121 | #define GPIO3_CMSDK_BASE_S 0x51103000 /* GPIO 3 Secure base address */
122 | #define AHB_USER_0_BASE_S 0x51104000 /* AHB USER 0 Secure base address */
123 | #define AHB_USER_1_BASE_S 0x51105000 /* AHB USER 1 Secure base address */
124 | #define AHB_USER_2_BASE_S 0x51106000 /* AHB USER 2 Secure base address */
125 | #define AHB_USER_3_BASE_S 0x51107000 /* AHB USER 3 Secure base address */
126 | #define DMA_0_BASE_S 0x51200000 /* DMA 0 Secure base address */
127 | #define DMA_1_BASE_S 0x51201000 /* DMA 1 Secure base address */
128 | #define DMA_2_BASE_S 0x51202000 /* DMA 2 Secure base address */
129 | #define DMA_3_BASE_S 0x51203000 /* DMA 3 Secure base address */
130 | #define ETHERNET_BASE_S 0x51400000 /* Ethernet Secure base address */
131 | #define USB_BASE_S 0x51500000 /* USB Secure base address */
132 | #define USER_APB0_BASE_S 0x51700000 /* User APB 0 Secure base address */
133 | #define USER_APB1_BASE_S 0x51701000 /* User APB 1 Secure base address */
134 | #define USER_APB2_BASE_S 0x51702000 /* User APB 2 Secure base address */
135 | #define USER_APB3_BASE_S 0x51703000 /* User APB 3 Secure base address */
136 | #define QSPI_CONFIG_BASE_S 0x51800000 /* QSPI Config Secure base address */
137 | #define QSPI_WRITE_BASE_S 0x51801000 /* QSPI Write Secure base address */
138 | #define MPC_SRAM_BASE_S 0x57000000 /* SRAM Memory Protection Controller Secure base address */
139 | #define MPC_QSPI_BASE_S 0x57001000 /* QSPI Memory Protection Controller Secure base address */
140 | #define MPC_DDR4_BASE_S 0x57002000 /* DDR4 Memory Protection Controller Secure base address */
141 | /* Secure Subsystem peripheral region */
142 | #define SYSTIMER0_ARMV8_M_BASE_S 0x58000000 /* System Timer 0 Secure base address */
143 | #define SYSTIMER1_ARMV8_M_BASE_S 0x58001000 /* System Timer 1 Secure base address */
144 | #define SYSTIMER2_ARMV8_M_BASE_S 0x58002000 /* System Timer 0 Secure base address */
145 | #define SYSTIMER3_ARMV8_M_BASE_S 0x58003000 /* System Timer 1 Secure base address */
146 | #define SSE300_SYSINFO_BASE_S 0x58020000 /* SSE-300 System info Block Secure base address */
147 | #define SSE300_SYSCTRL_BASE_S 0x58021000 /* SSE-300 System control Block Secure base address */
148 | #define SSE300_SYSPPU_BASE_S 0x58022000 /* SSE-300 System Power Policy Unit Secure base address */
149 | #define SSE300_CPU0PPU_BASE_S 0x58023000 /* SSE-300 CPU 0 Power Policy Unit Secure base address */
150 | #define SSE300_MGMTPPU_BASE_S 0x58028000 /* SSE-300 Management Power Policy Unit Secure base address */
151 | #define SSE300_DBGPPU_BASE_S 0x58029000 /* SSE-300 Debug Power Policy Unit Secure base address */
152 | #define SLOWCLK_WDOG_CMSDK_BASE_S 0x5802E000 /* CMSDK based SLOWCLK Watchdog Secure base address */
153 | #define SLOWCLK_TIMER_CMSDK_BASE_S 0x5802F000 /* CMSDK based SLOWCLK Timer Secure base address */
154 | #define SYSWDOG_ARMV8_M_CNTRL_BASE_S 0x58040000 /* Secure Watchdog Timer control frame Secure base address */
155 | #define SYSWDOG_ARMV8_M_REFRESH_BASE_S 0x58041000 /* Secure Watchdog Timer refresh frame Secure base address */
156 | #define SYSCNTR_CNTRL_BASE_S 0x58100000 /* System Counter Control Secure base address */
157 | #define SYSCNTR_READ_BASE_S 0x58101000 /* System Counter Read Secure base address */
158 | /* Secure MSTEXPPIHL Peripheral region */
159 | #define ETHOS_U55_APB_BASE_S 0x58102000 /* Ethos-U55 APB Secure base address */
160 | #define U55_TIMING_ADAPTER_BASE_S 0x58103000 /* Ethos-U55 Timing Adapter registers Secure base address */
161 | #define FPGA_SBCon_I2C_TOUCH_BASE_S 0x59200000 /* FPGA - SBCon I2C (Touch) Secure base address */
162 | #define FPGA_SBCon_I2C_AUDIO_BASE_S 0x59201000 /* FPGA - SBCon I2C (Audio Conf) Secure base address */
163 | #define FPGA_SPI_ADC_BASE_S 0x59202000 /* FPGA - PL022 (SPI ADC) Secure base address */
164 | #define FPGA_SPI_SHIELD0_BASE_S 0x59203000 /* FPGA - PL022 (SPI Shield0) Secure base address */
165 | #define FPGA_SPI_SHIELD1_BASE_S 0x59204000 /* FPGA - PL022 (SPI Shield1) Secure base address */
166 | #define SBCon_I2C_SHIELD0_BASE_S 0x59205000 /* SBCon (I2C - Shield0) Secure base address */
167 | #define SBCon_I2C_SHIELD1_BASE_S 0x59206000 /* SBCon (I2C – Shield1) Secure base address */
168 | #define USER_APB_BASE_S 0x59207000 /* USER APB Secure base address */
169 | #define FPGA_DDR4_EEPROM_BASE_S 0x59208000 /* FPGA - SBCon I2C (DDR4 EEPROM) Secure base address */
170 | #define FPGA_SCC_BASE_S 0x59300000 /* FPGA - SCC registers Secure base address */
171 | #define FPGA_I2S_BASE_S 0x59301000 /* FPGA - I2S (Audio) Secure base address */
172 | #define FPGA_IO_BASE_S 0x59302000 /* FPGA - IO (System Ctrl + I/O) Secure base address */
173 | #define UART0_BASE_S 0x59303000 /* UART 0 Secure base address */
174 | #define UART1_BASE_S 0x59304000 /* UART 1 Secure base address */
175 | #define UART2_BASE_S 0x59305000 /* UART 2 Secure base address */
176 | #define UART3_BASE_S 0x59306000 /* UART 3 Secure base address */
177 | #define UART4_BASE_S 0x59307000 /* UART 4 Secure base address */
178 | #define UART5_BASE_S 0x59308000 /* UART 5 Secure base address */
179 | #define CLCD_Config_Reg_BASE_S 0x5930A000 /* CLCD Config Reg Secure base address */
180 | #define RTC_BASE_S 0x5930B000 /* RTC Secure base address */
181 | #define DDR4_BLK1_BASE_S 0x70000000 /* DDR4 block 1 Secure base address */
182 | #define DDR4_BLK3_BASE_S 0x90000000 /* DDR4 block 3 Secure base address */
183 | #define DDR4_BLK5_BASE_S 0xB0000000 /* DDR4 block 5 Secure base address */
184 | #define DDR4_BLK7_BASE_S 0xD0000000 /* DDR4 block 7 Secure base address */
185 |
186 | /* Memory map addresses exempt from memory attribution by both the SAU and IDAU */
187 | #define SSE300_EWIC_BASE 0xE0047000 /* External Wakeup Interrupt Controller
188 | * Access from Non-secure software is only allowed
189 | * if AIRCR.BFHFNMINS is set to 1 */
190 |
191 | /* Memory size definitions */
192 | #define ITCM_SIZE (0x00080000) /* 512 kB */
193 | #define DTCM_BLK_SIZE (0x00020000) /* 128 kB */
194 | #define DTCM_BLK_NUM (0x4) /* Number of DTCM blocks */
195 | #define SRAM_SIZE (0x00200000) /* 2 MB */
196 | #define ISRAM0_SIZE (0x00200000) /* 2 MB */
197 | #define ISRAM1_SIZE (0x00200000) /* 2 MB */
198 | #define QSPI_SRAM_SIZE (0x00800000) /* 8 MB */
199 | #define DDR4_BLK_SIZE (0x10000000) /* 256 MB */
200 | #define DDR4_BLK_NUM (0x8) /* Number of DDR4 blocks */
201 |
202 | /* Defines for Driver MPC's */
203 | /* SRAM -- 2 MB */
204 | #define MPC_SRAM_RANGE_BASE_NS (SRAM_BASE_NS)
205 | #define MPC_SRAM_RANGE_LIMIT_NS (SRAM_BASE_NS + SRAM_SIZE-1)
206 | #define MPC_SRAM_RANGE_OFFSET_NS (0x0)
207 | #define MPC_SRAM_RANGE_BASE_S (SRAM_BASE_S)
208 | #define MPC_SRAM_RANGE_LIMIT_S (SRAM_BASE_S + SRAM_SIZE-1)
209 | #define MPC_SRAM_RANGE_OFFSET_S (0x0)
210 |
211 | /* QSPI -- 8 MB*/
212 | #define MPC_QSPI_RANGE_BASE_NS (QSPI_SRAM_BASE_NS)
213 | #define MPC_QSPI_RANGE_LIMIT_NS (QSPI_SRAM_BASE_NS + QSPI_SRAM_SIZE-1)
214 | #define MPC_QSPI_RANGE_OFFSET_NS (0x0)
215 | #define MPC_QSPI_RANGE_BASE_S (QSPI_SRAM_BASE_S)
216 | #define MPC_QSPI_RANGE_LIMIT_S (QSPI_SRAM_BASE_S + QSPI_SRAM_SIZE-1)
217 | #define MPC_QSPI_RANGE_OFFSET_S (0x0)
218 |
219 | /* ISRAM0 -- 2 MB*/
220 | #define MPC_ISRAM0_RANGE_BASE_NS (ISRAM0_BASE_NS)
221 | #define MPC_ISRAM0_RANGE_LIMIT_NS (ISRAM0_BASE_NS + ISRAM0_SIZE-1)
222 | #define MPC_ISRAM0_RANGE_OFFSET_NS (0x0)
223 | #define MPC_ISRAM0_RANGE_BASE_S (ISRAM0_BASE_S)
224 | #define MPC_ISRAM0_RANGE_LIMIT_S (ISRAM0_BASE_S + ISRAM0_SIZE-1)
225 | #define MPC_ISRAM0_RANGE_OFFSET_S (0x0)
226 |
227 | /* ISRAM1 -- 2 MB*/
228 | #define MPC_ISRAM1_RANGE_BASE_NS (ISRAM1_BASE_NS)
229 | #define MPC_ISRAM1_RANGE_LIMIT_NS (ISRAM1_BASE_NS + ISRAM1_SIZE-1)
230 | #define MPC_ISRAM1_RANGE_OFFSET_NS (0x0)
231 | #define MPC_ISRAM1_RANGE_BASE_S (ISRAM1_BASE_S)
232 | #define MPC_ISRAM1_RANGE_LIMIT_S (ISRAM1_BASE_S + ISRAM1_SIZE-1)
233 | #define MPC_ISRAM1_RANGE_OFFSET_S (0x0)
234 |
235 | /* DDR4 -- 2GB (8 * 256 MB) */
236 | #define MPC_DDR4_BLK0_RANGE_BASE_NS (DDR4_BLK0_BASE_NS)
237 | #define MPC_DDR4_BLK0_RANGE_LIMIT_NS (DDR4_BLK0_BASE_NS + ((DDR4_BLK_SIZE)-1))
238 | #define MPC_DDR4_BLK0_RANGE_OFFSET_NS (0x0)
239 | #define MPC_DDR4_BLK1_RANGE_BASE_S (DDR4_BLK1_BASE_S)
240 | #define MPC_DDR4_BLK1_RANGE_LIMIT_S (DDR4_BLK1_BASE_S + ((DDR4_BLK_SIZE)-1))
241 | #define MPC_DDR4_BLK1_RANGE_OFFSET_S (DDR4_BLK1_BASE_S - DDR4_BLK0_BASE_NS)
242 | #define MPC_DDR4_BLK2_RANGE_BASE_NS (DDR4_BLK2_BASE_NS)
243 | #define MPC_DDR4_BLK2_RANGE_LIMIT_NS (DDR4_BLK2_BASE_NS + ((DDR4_BLK_SIZE)-1))
244 | #define MPC_DDR4_BLK2_RANGE_OFFSET_NS (DDR4_BLK2_BASE_NS - DDR4_BLK0_BASE_NS)
245 | #define MPC_DDR4_BLK3_RANGE_BASE_S (DDR4_BLK3_BASE_S)
246 | #define MPC_DDR4_BLK3_RANGE_LIMIT_S (DDR4_BLK3_BASE_S + ((DDR4_BLK_SIZE)-1))
247 | #define MPC_DDR4_BLK3_RANGE_OFFSET_S (DDR4_BLK3_BASE_S - DDR4_BLK0_BASE_NS)
248 | #define MPC_DDR4_BLK4_RANGE_BASE_NS (DDR4_BLK4_BASE_NS)
249 | #define MPC_DDR4_BLK4_RANGE_LIMIT_NS (DDR4_BLK4_BASE_NS + ((DDR4_BLK_SIZE)-1))
250 | #define MPC_DDR4_BLK4_RANGE_OFFSET_NS (DDR4_BLK4_BASE_NS - DDR4_BLK0_BASE_NS)
251 | #define MPC_DDR4_BLK5_RANGE_BASE_S (DDR4_BLK5_BASE_S)
252 | #define MPC_DDR4_BLK5_RANGE_LIMIT_S (DDR4_BLK5_BASE_S + ((DDR4_BLK_SIZE)-1))
253 | #define MPC_DDR4_BLK5_RANGE_OFFSET_S (DDR4_BLK5_BASE_S - DDR4_BLK0_BASE_NS)
254 | #define MPC_DDR4_BLK6_RANGE_BASE_NS (DDR4_BLK6_BASE_NS)
255 | #define MPC_DDR4_BLK6_RANGE_LIMIT_NS (DDR4_BLK6_BASE_NS + ((DDR4_BLK_SIZE)-1))
256 | #define MPC_DDR4_BLK6_RANGE_OFFSET_NS (DDR4_BLK6_BASE_NS - DDR4_BLK0_BASE_NS)
257 | #define MPC_DDR4_BLK7_RANGE_BASE_S (DDR4_BLK7_BASE_S)
258 | #define MPC_DDR4_BLK7_RANGE_LIMIT_S (DDR4_BLK7_BASE_S + ((DDR4_BLK_SIZE)-1))
259 | #define MPC_DDR4_BLK7_RANGE_OFFSET_S (DDR4_BLK7_BASE_S - DDR4_BLK0_BASE_NS)
260 |
261 | #endif /* __PLATFORM_BASE_ADDRESS_H__ */
262 |
--------------------------------------------------------------------------------
/basic/RTE/Device/SSE-300-MPS3/region_defs.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2016-2021 Arm Limited
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | #ifndef __REGION_DEFS_H__
18 | #define __REGION_DEFS_H__
19 |
20 | #include "region_limits.h"
21 |
22 | /* **************************************************************
23 | * WARNING: this file is parsed both by the C/C++ compiler
24 | * and the linker. As a result the syntax must be valid not only
25 | * for C/C++ but for the linker scripts too.
26 | * Beware of the following limitations:
27 | * - LD (GCC linker) requires white space around operators.
28 | * - UL postfix for macros is not suported by the linker script
29 | ****************************************************************/
30 |
31 | /* Secure regions */
32 | #define S_CODE_START ( S_ROM_ALIAS )
33 | #define S_CODE_SIZE ( TOTAL_S_ROM_SIZE )
34 | #define S_CODE_LIMIT ( S_CODE_START + S_CODE_SIZE )
35 |
36 | #define S_DATA_START ( S_RAM_ALIAS )
37 | #define S_DATA_SIZE ( TOTAL_S_RAM_SIZE )
38 | #define S_DATA_LIMIT ( S_DATA_START + S_DATA_SIZE )
39 |
40 | /* Non-Secure regions */
41 | #define NS_CODE_START ( NS_ROM_ALIAS )
42 | #define NS_CODE_SIZE ( TOTAL_NS_ROM_SIZE )
43 | #define NS_CODE_LIMIT ( NS_CODE_START + NS_CODE_SIZE )
44 |
45 | #define NS_DATA_START ( NS_RAM_ALIAS )
46 | #define NS_DATA_SIZE ( TOTAL_NS_RAM_SIZE )
47 | #define NS_DATA_LIMIT ( NS_DATA_START + NS_DATA_SIZE )
48 |
49 | #endif /* __REGION_DEFS_H__ */
50 |
--------------------------------------------------------------------------------
/basic/RTE/Device/SSE-300-MPS3/region_limits.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2018-2021 Arm Limited
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | #ifndef __REGION_LIMITS_H__
18 | #define __REGION_LIMITS_H__
19 |
20 | /* **************************************************************
21 | * WARNING: this file is parsed both by the C/C++ compiler
22 | * and the linker. As a result the syntax must be valid not only
23 | * for C/C++ but for the linker scripts too.
24 | * Beware of the following limitations:
25 | * - LD (GCC linker) requires white space around operators.
26 | * - UL postfix for macros is not suported by the linker script
27 | ****************************************************************/
28 |
29 | /* Secure Code */
30 | #define S_ROM_ALIAS (0x10000000) /* ITCM_BASE_S */
31 | #define TOTAL_S_ROM_SIZE (0x00040000) /* 256 kB */
32 |
33 | /* Secure Data */
34 | #define S_RAM_ALIAS (0x30000000) /* DTCM_BASE_S */
35 | #define TOTAL_S_RAM_SIZE (0x00040000) /* 256 kB */
36 |
37 |
38 | /* Non-Secure Code */
39 | #define NS_ROM_ALIAS (0x01000000) /* SRAM_BASE_NS */
40 | #define TOTAL_NS_ROM_SIZE (0x00040000) /* 256 kB */
41 |
42 | /* Non-Secure Data */
43 | #define NS_RAM_ALIAS (0x21000000) /* ISRAM0_BASE_NS */
44 | #define TOTAL_NS_RAM_SIZE (0x00040000) /* 256 kB */
45 |
46 |
47 | /* Heap and Stack sizes for secure and nonsecure applications */
48 | #define HEAP_SIZE (0x00000400) /* 1 KiB */
49 | #define STACK_SIZE (0x00000400) /* 1 KiB */
50 |
51 | #endif /* __REGION_LIMITS_H__ */
52 |
--------------------------------------------------------------------------------
/basic/RTE/Device/SSE-300-MPS3/startup_fvp_sse300_mps3.c:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2009-2020 Arm Limited. All rights reserved.
3 | *
4 | * SPDX-License-Identifier: Apache-2.0
5 | *
6 | * Licensed under the Apache License, Version 2.0 (the License); you may
7 | * not use this file except in compliance with the License.
8 | * You may obtain a copy of the License at
9 | *
10 | * www.apache.org/licenses/LICENSE-2.0
11 | *
12 | * Unless required by applicable law or agreed to in writing, software
13 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT
14 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | * See the License for the specific language governing permissions and
16 | * limitations under the License.
17 | */
18 |
19 | /*
20 | * This file is derivative of CMSIS V5.6.0 startup_ARMv81MML.c
21 | * Git SHA: b5f0603d6a584d1724d952fd8b0737458b90d62b
22 | */
23 |
24 | #include
25 | #include
26 |
27 | #include "cmsis.h"
28 |
29 | /*----------------------------------------------------------------------------
30 | Exception / Interrupt Handler Function Prototype
31 | *----------------------------------------------------------------------------*/
32 | typedef void( *pFunc )( void );
33 |
34 | /*----------------------------------------------------------------------------
35 | External References
36 | *----------------------------------------------------------------------------*/
37 | extern uint32_t __INITIAL_SP;
38 | extern uint32_t __STACK_LIMIT;
39 |
40 | extern void __PROGRAM_START(void) __NO_RETURN;
41 |
42 | /*----------------------------------------------------------------------------
43 | Internal References
44 | *----------------------------------------------------------------------------*/
45 | void Reset_Handler (void) __NO_RETURN;
46 |
47 | /*----------------------------------------------------------------------------
48 | Exception / Interrupt Handler
49 | *----------------------------------------------------------------------------*/
50 | // Call exit() in not returing (fault) handlers
51 | // to force the model to quit with error code.
52 | #define DEFAULT_IRQ_HANDLER(handler_name) \
53 | void __WEAK __NO_RETURN handler_name(void); \
54 | void handler_name(void) { \
55 | exit(-1); \
56 | while(1); \
57 | }
58 |
59 | /* Exceptions */
60 | DEFAULT_IRQ_HANDLER(NMI_Handler)
61 | DEFAULT_IRQ_HANDLER(HardFault_Handler)
62 | DEFAULT_IRQ_HANDLER(MemManage_Handler)
63 | DEFAULT_IRQ_HANDLER(BusFault_Handler)
64 | DEFAULT_IRQ_HANDLER(UsageFault_Handler)
65 | DEFAULT_IRQ_HANDLER(SecureFault_Handler)
66 | DEFAULT_IRQ_HANDLER(SVC_Handler)
67 | DEFAULT_IRQ_HANDLER(DebugMon_Handler)
68 | DEFAULT_IRQ_HANDLER(PendSV_Handler)
69 | DEFAULT_IRQ_HANDLER(SysTick_Handler)
70 |
71 | DEFAULT_IRQ_HANDLER(NONSEC_WATCHDOG_RESET_Handler)
72 | DEFAULT_IRQ_HANDLER(NONSEC_WATCHDOG_Handler)
73 | DEFAULT_IRQ_HANDLER(SLOWCLK_Timer_Handler)
74 | DEFAULT_IRQ_HANDLER(TIMER0_Handler)
75 | DEFAULT_IRQ_HANDLER(TIMER1_Handler)
76 | DEFAULT_IRQ_HANDLER(TIMER2_Handler)
77 | DEFAULT_IRQ_HANDLER(MPC_Handler)
78 | DEFAULT_IRQ_HANDLER(PPC_Handler)
79 | DEFAULT_IRQ_HANDLER(MSC_Handler)
80 | DEFAULT_IRQ_HANDLER(BRIDGE_ERROR_Handler)
81 | DEFAULT_IRQ_HANDLER(MGMT_PPU_Handler)
82 | DEFAULT_IRQ_HANDLER(SYS_PPU_Handler)
83 | DEFAULT_IRQ_HANDLER(CPU0_PPU_Handler)
84 | DEFAULT_IRQ_HANDLER(DEBUG_PPU_Handler)
85 | DEFAULT_IRQ_HANDLER(TIMER3_Handler)
86 | DEFAULT_IRQ_HANDLER(CTI_REQ0_IRQHandler)
87 | DEFAULT_IRQ_HANDLER(CTI_REQ1_IRQHandler)
88 |
89 | DEFAULT_IRQ_HANDLER(System_Timestamp_Counter_Handler)
90 | DEFAULT_IRQ_HANDLER(UARTRX0_Handler)
91 | DEFAULT_IRQ_HANDLER(UARTTX0_Handler)
92 | DEFAULT_IRQ_HANDLER(UARTRX1_Handler)
93 | DEFAULT_IRQ_HANDLER(UARTTX1_Handler)
94 | DEFAULT_IRQ_HANDLER(UARTRX2_Handler)
95 | DEFAULT_IRQ_HANDLER(UARTTX2_Handler)
96 | DEFAULT_IRQ_HANDLER(UARTRX3_Handler)
97 | DEFAULT_IRQ_HANDLER(UARTTX3_Handler)
98 | DEFAULT_IRQ_HANDLER(UARTRX4_Handler)
99 | DEFAULT_IRQ_HANDLER(UARTTX4_Handler)
100 | DEFAULT_IRQ_HANDLER(UART0_Combined_Handler)
101 | DEFAULT_IRQ_HANDLER(UART1_Combined_Handler)
102 | DEFAULT_IRQ_HANDLER(UART2_Combined_Handler)
103 | DEFAULT_IRQ_HANDLER(UART3_Combined_Handler)
104 | DEFAULT_IRQ_HANDLER(UART4_Combined_Handler)
105 | DEFAULT_IRQ_HANDLER(UARTOVF_Handler)
106 | DEFAULT_IRQ_HANDLER(ETHERNET_Handler)
107 | DEFAULT_IRQ_HANDLER(I2S_Handler)
108 | DEFAULT_IRQ_HANDLER(TOUCH_SCREEN_Handler)
109 | DEFAULT_IRQ_HANDLER(USB_Handler)
110 | DEFAULT_IRQ_HANDLER(SPI_ADC_Handler)
111 | DEFAULT_IRQ_HANDLER(SPI_SHIELD0_Handler)
112 | DEFAULT_IRQ_HANDLER(SPI_SHIELD1_Handler)
113 | DEFAULT_IRQ_HANDLER(ETHOS_U55_Handler)
114 | DEFAULT_IRQ_HANDLER(GPIO0_Combined_Handler)
115 | DEFAULT_IRQ_HANDLER(GPIO1_Combined_Handler)
116 | DEFAULT_IRQ_HANDLER(GPIO2_Combined_Handler)
117 | DEFAULT_IRQ_HANDLER(GPIO3_Combined_Handler)
118 | DEFAULT_IRQ_HANDLER(GPIO0_0_Handler)
119 | DEFAULT_IRQ_HANDLER(GPIO0_1_Handler)
120 | DEFAULT_IRQ_HANDLER(GPIO0_2_Handler)
121 | DEFAULT_IRQ_HANDLER(GPIO0_3_Handler)
122 | DEFAULT_IRQ_HANDLER(GPIO0_4_Handler)
123 | DEFAULT_IRQ_HANDLER(GPIO0_5_Handler)
124 | DEFAULT_IRQ_HANDLER(GPIO0_6_Handler)
125 | DEFAULT_IRQ_HANDLER(GPIO0_7_Handler)
126 | DEFAULT_IRQ_HANDLER(GPIO0_8_Handler)
127 | DEFAULT_IRQ_HANDLER(GPIO0_9_Handler)
128 | DEFAULT_IRQ_HANDLER(GPIO0_10_Handler)
129 | DEFAULT_IRQ_HANDLER(GPIO0_11_Handler)
130 | DEFAULT_IRQ_HANDLER(GPIO0_12_Handler)
131 | DEFAULT_IRQ_HANDLER(GPIO0_13_Handler)
132 | DEFAULT_IRQ_HANDLER(GPIO0_14_Handler)
133 | DEFAULT_IRQ_HANDLER(GPIO0_15_Handler)
134 | DEFAULT_IRQ_HANDLER(GPIO1_0_Handler)
135 | DEFAULT_IRQ_HANDLER(GPIO1_1_Handler)
136 | DEFAULT_IRQ_HANDLER(GPIO1_2_Handler)
137 | DEFAULT_IRQ_HANDLER(GPIO1_3_Handler)
138 | DEFAULT_IRQ_HANDLER(GPIO1_4_Handler)
139 | DEFAULT_IRQ_HANDLER(GPIO1_5_Handler)
140 | DEFAULT_IRQ_HANDLER(GPIO1_6_Handler)
141 | DEFAULT_IRQ_HANDLER(GPIO1_7_Handler)
142 | DEFAULT_IRQ_HANDLER(GPIO1_8_Handler)
143 | DEFAULT_IRQ_HANDLER(GPIO1_9_Handler)
144 | DEFAULT_IRQ_HANDLER(GPIO1_10_Handler)
145 | DEFAULT_IRQ_HANDLER(GPIO1_11_Handler)
146 | DEFAULT_IRQ_HANDLER(GPIO1_12_Handler)
147 | DEFAULT_IRQ_HANDLER(GPIO1_13_Handler)
148 | DEFAULT_IRQ_HANDLER(GPIO1_14_Handler)
149 | DEFAULT_IRQ_HANDLER(GPIO1_15_Handler)
150 | DEFAULT_IRQ_HANDLER(GPIO2_0_Handler)
151 | DEFAULT_IRQ_HANDLER(GPIO2_1_Handler)
152 | DEFAULT_IRQ_HANDLER(GPIO2_2_Handler)
153 | DEFAULT_IRQ_HANDLER(GPIO2_3_Handler)
154 | DEFAULT_IRQ_HANDLER(GPIO2_4_Handler)
155 | DEFAULT_IRQ_HANDLER(GPIO2_5_Handler)
156 | DEFAULT_IRQ_HANDLER(GPIO2_6_Handler)
157 | DEFAULT_IRQ_HANDLER(GPIO2_7_Handler)
158 | DEFAULT_IRQ_HANDLER(GPIO2_8_Handler)
159 | DEFAULT_IRQ_HANDLER(GPIO2_9_Handler)
160 | DEFAULT_IRQ_HANDLER(GPIO2_10_Handler)
161 | DEFAULT_IRQ_HANDLER(GPIO2_11_Handler)
162 | DEFAULT_IRQ_HANDLER(GPIO2_12_Handler)
163 | DEFAULT_IRQ_HANDLER(GPIO2_13_Handler)
164 | DEFAULT_IRQ_HANDLER(GPIO2_14_Handler)
165 | DEFAULT_IRQ_HANDLER(GPIO2_15_Handler)
166 | DEFAULT_IRQ_HANDLER(GPIO3_0_Handler)
167 | DEFAULT_IRQ_HANDLER(GPIO3_1_Handler)
168 | DEFAULT_IRQ_HANDLER(GPIO3_2_Handler)
169 | DEFAULT_IRQ_HANDLER(GPIO3_3_Handler)
170 | DEFAULT_IRQ_HANDLER(UARTRX5_Handler)
171 | DEFAULT_IRQ_HANDLER(UARTTX5_Handler)
172 | DEFAULT_IRQ_HANDLER(UART5_Handler)
173 |
174 | /*----------------------------------------------------------------------------
175 | Exception / Interrupt Vector table
176 | *----------------------------------------------------------------------------*/
177 |
178 | #if defined ( __GNUC__ )
179 | #pragma GCC diagnostic push
180 | #pragma GCC diagnostic ignored "-Wpedantic"
181 | #endif
182 |
183 | extern const pFunc __VECTOR_TABLE[496];
184 | const pFunc __VECTOR_TABLE[496] __VECTOR_TABLE_ATTRIBUTE = {
185 | (pFunc)(&__INITIAL_SP), /* Initial Stack Pointer */
186 | Reset_Handler, /* Reset Handler */
187 | NMI_Handler, /* -14: NMI Handler */
188 | HardFault_Handler, /* -13: Hard Fault Handler */
189 | MemManage_Handler, /* -12: MPU Fault Handler */
190 | BusFault_Handler, /* -11: Bus Fault Handler */
191 | UsageFault_Handler, /* -10: Usage Fault Handler */
192 | SecureFault_Handler, /* -9: Secure Fault Handler */
193 | 0, /* Reserved */
194 | 0, /* Reserved */
195 | 0, /* Reserved */
196 | SVC_Handler, /* -5: SVCall Handler */
197 | DebugMon_Handler, /* -4: Debug Monitor Handler */
198 | 0, /* Reserved */
199 | PendSV_Handler, /* -2: PendSV Handler */
200 | SysTick_Handler, /* -1: SysTick Handler */
201 |
202 | NONSEC_WATCHDOG_RESET_Handler, /* 0: Non-Secure Watchdog Reset Handler */
203 | NONSEC_WATCHDOG_Handler, /* 1: Non-Secure Watchdog Handler */
204 | SLOWCLK_Timer_Handler, /* 2: SLOWCLK Timer Handler */
205 | TIMER0_Handler, /* 3: TIMER 0 Handler */
206 | TIMER1_Handler, /* 4: TIMER 1 Handler */
207 | TIMER2_Handler, /* 5: TIMER 2 Handler */
208 | 0, /* 6: Reserved */
209 | 0, /* 7: Reserved */
210 | 0, /* 8: Reserved */
211 | MPC_Handler, /* 9: MPC Combined (Secure) Handler */
212 | PPC_Handler, /* 10: PPC Combined (Secure) Handler */
213 | MSC_Handler, /* 11: MSC Combined (Secure) Handler */
214 | BRIDGE_ERROR_Handler, /* 12: Bridge Error (Secure) Handler */
215 | 0, /* 13: Reserved */
216 | MGMT_PPU_Handler, /* 14: MGMT PPU Handler */
217 | SYS_PPU_Handler, /* 15: SYS PPU Handler */
218 | CPU0_PPU_Handler, /* 16: CPU0 PPU Handler */
219 | 0, /* 17: Reserved */
220 | 0, /* 18: Reserved */
221 | 0, /* 19: Reserved */
222 | 0, /* 20: Reserved */
223 | 0, /* 21: Reserved */
224 | 0, /* 22: Reserved */
225 | 0, /* 23: Reserved */
226 | 0, /* 24: Reserved */
227 | 0, /* 25: Reserved */
228 | DEBUG_PPU_Handler, /* 26: DEBUG PPU Handler */
229 | TIMER3_Handler, /* 27: TIMER 3 Handler */
230 | CTI_REQ0_IRQHandler, /* 28: CTI request 0 IRQ Handler */
231 | CTI_REQ1_IRQHandler, /* 29: CTI request 1 IRQ Handler */
232 | 0, /* 30: Reserved */
233 | 0, /* 31: Reserved */
234 |
235 | /* External interrupts */
236 | System_Timestamp_Counter_Handler, /* 32: System timestamp counter Handler */
237 | UARTRX0_Handler, /* 33: UART 0 RX Handler */
238 | UARTTX0_Handler, /* 34: UART 0 TX Handler */
239 | UARTRX1_Handler, /* 35: UART 1 RX Handler */
240 | UARTTX1_Handler, /* 36: UART 1 TX Handler */
241 | UARTRX2_Handler, /* 37: UART 2 RX Handler */
242 | UARTTX2_Handler, /* 38: UART 2 TX Handler */
243 | UARTRX3_Handler, /* 39: UART 3 RX Handler */
244 | UARTTX3_Handler, /* 40: UART 3 TX Handler */
245 | UARTRX4_Handler, /* 41: UART 4 RX Handler */
246 | UARTTX4_Handler, /* 42: UART 4 TX Handler */
247 | UART0_Combined_Handler, /* 43: UART 0 Combined Handler */
248 | UART1_Combined_Handler, /* 44: UART 1 Combined Handler */
249 | UART2_Combined_Handler, /* 45: UART 2 Combined Handler */
250 | UART3_Combined_Handler, /* 46: UART 3 Combined Handler */
251 | UART4_Combined_Handler, /* 47: UART 4 Combined Handler */
252 | UARTOVF_Handler, /* 48: UART 0, 1, 2, 3, 4 & 5 Overflow Handler */
253 | ETHERNET_Handler, /* 49: Ethernet Handler */
254 | I2S_Handler, /* 50: Audio I2S Handler */
255 | TOUCH_SCREEN_Handler, /* 51: Touch Screen Handler */
256 | USB_Handler, /* 52: USB Handler */
257 | SPI_ADC_Handler, /* 53: SPI ADC Handler */
258 | SPI_SHIELD0_Handler, /* 54: SPI (Shield 0) Handler */
259 | SPI_SHIELD1_Handler, /* 55: SPI (Shield 0) Handler */
260 | ETHOS_U55_Handler, /* 56: Ethos-U55 Handler */
261 | 0, /* 57: Reserved */
262 | 0, /* 58: Reserved */
263 | 0, /* 59: Reserved */
264 | 0, /* 60: Reserved */
265 | 0, /* 61: Reserved */
266 | 0, /* 62: Reserved */
267 | 0, /* 63: Reserved */
268 | 0, /* 64: Reserved */
269 | 0, /* 65: Reserved */
270 | 0, /* 66: Reserved */
271 | 0, /* 67: Reserved */
272 | 0, /* 68: Reserved */
273 | GPIO0_Combined_Handler, /* 69: GPIO 0 Combined Handler */
274 | GPIO1_Combined_Handler, /* 70: GPIO 1 Combined Handler */
275 | GPIO2_Combined_Handler, /* 71: GPIO 2 Combined Handler */
276 | GPIO3_Combined_Handler, /* 72: GPIO 3 Combined Handler */
277 | GPIO0_0_Handler, /* 73: GPIO0 Pin 0 Handler */
278 | GPIO0_1_Handler, /* 74: GPIO0 Pin 1 Handler */
279 | GPIO0_2_Handler, /* 75: GPIO0 Pin 2 Handler */
280 | GPIO0_3_Handler, /* 76: GPIO0 Pin 3 Handler */
281 | GPIO0_4_Handler, /* 77: GPIO0 Pin 4 Handler */
282 | GPIO0_5_Handler, /* 78: GPIO0 Pin 5 Handler */
283 | GPIO0_6_Handler, /* 79: GPIO0 Pin 6 Handler */
284 | GPIO0_7_Handler, /* 80: GPIO0 Pin 7 Handler */
285 | GPIO0_8_Handler, /* 81: GPIO0 Pin 8 Handler */
286 | GPIO0_9_Handler, /* 82: GPIO0 Pin 9 Handler */
287 | GPIO0_10_Handler, /* 83: GPIO0 Pin 10 Handler */
288 | GPIO0_11_Handler, /* 84: GPIO0 Pin 11 Handler */
289 | GPIO0_12_Handler, /* 85: GPIO0 Pin 12 Handler */
290 | GPIO0_13_Handler, /* 86: GPIO0 Pin 13 Handler */
291 | GPIO0_14_Handler, /* 87: GPIO0 Pin 14 Handler */
292 | GPIO0_15_Handler, /* 88: GPIO0 Pin 15 Handler */
293 | GPIO1_0_Handler, /* 89: GPIO1 Pin 0 Handler */
294 | GPIO1_1_Handler, /* 90: GPIO1 Pin 1 Handler */
295 | GPIO1_2_Handler, /* 91: GPIO1 Pin 2 Handler */
296 | GPIO1_3_Handler, /* 92: GPIO1 Pin 3 Handler */
297 | GPIO1_4_Handler, /* 93: GPIO1 Pin 4 Handler */
298 | GPIO1_5_Handler, /* 94: GPIO1 Pin 5 Handler */
299 | GPIO1_6_Handler, /* 95: GPIO1 Pin 6 Handler */
300 | GPIO1_7_Handler, /* 96: GPIO1 Pin 7 Handler */
301 | GPIO1_8_Handler, /* 97: GPIO1 Pin 8 Handler */
302 | GPIO1_9_Handler, /* 98: GPIO1 Pin 9 Handler */
303 | GPIO1_10_Handler, /* 99: GPIO1 Pin 10 Handler */
304 | GPIO1_11_Handler, /* 100: GPIO1 Pin 11 Handler */
305 | GPIO1_12_Handler, /* 101: GPIO1 Pin 12 Handler */
306 | GPIO1_13_Handler, /* 102: GPIO1 Pin 13 Handler */
307 | GPIO1_14_Handler, /* 103: GPIO1 Pin 14 Handler */
308 | GPIO1_15_Handler, /* 104: GPIO1 Pin 15 Handler */
309 | GPIO2_0_Handler, /* 105: GPIO2 Pin 0 Handler */
310 | GPIO2_1_Handler, /* 106: GPIO2 Pin 1 Handler */
311 | GPIO2_2_Handler, /* 107: GPIO2 Pin 2 Handler */
312 | GPIO2_3_Handler, /* 108: GPIO2 Pin 3 Handler */
313 | GPIO2_4_Handler, /* 109: GPIO2 Pin 4 Handler */
314 | GPIO2_5_Handler, /* 110: GPIO2 Pin 5 Handler */
315 | GPIO2_6_Handler, /* 111: GPIO2 Pin 6 Handler */
316 | GPIO2_7_Handler, /* 112: GPIO2 Pin 7 Handler */
317 | GPIO2_8_Handler, /* 113: GPIO2 Pin 8 Handler */
318 | GPIO2_9_Handler, /* 114: GPIO2 Pin 9 Handler */
319 | GPIO2_10_Handler, /* 115: GPIO2 Pin 10 Handler */
320 | GPIO2_11_Handler, /* 116: GPIO2 Pin 11 Handler */
321 | GPIO2_12_Handler, /* 117: GPIO2 Pin 12 Handler */
322 | GPIO2_13_Handler, /* 118: GPIO2 Pin 13 Handler */
323 | GPIO2_14_Handler, /* 119: GPIO2 Pin 14 Handler */
324 | GPIO2_15_Handler, /* 120: GPIO2 Pin 15 Handler */
325 | GPIO3_0_Handler, /* 121: GPIO3 Pin 0 Handler */
326 | GPIO3_1_Handler, /* 122: GPIO3 Pin 1 Handler */
327 | GPIO3_2_Handler, /* 123: GPIO3 Pin 2 Handler */
328 | GPIO3_3_Handler, /* 124: GPIO3 Pin 3 Handler */
329 | UARTRX5_Handler, /* 125: UART 5 RX Interrupt */
330 | UARTTX5_Handler, /* 126: UART 5 TX Interrupt */
331 | UART5_Handler, /* 127: UART 5 combined Interrupt */
332 | 0, /* 128: Reserved */
333 | 0, /* 129: Reserved */
334 | 0, /* 130: Reserved */
335 | };
336 |
337 | #if defined ( __GNUC__ )
338 | #pragma GCC diagnostic pop
339 | #endif
340 |
341 | /*----------------------------------------------------------------------------
342 | Reset Handler called on controller reset
343 | *----------------------------------------------------------------------------*/
344 | void Reset_Handler(void)
345 | {
346 | __set_MSPLIM((uint32_t)(&__STACK_LIMIT));
347 |
348 | SystemInit(); /* CMSIS System Initialization */
349 | __PROGRAM_START(); /* Enter PreMain (C library entry point) */
350 | }
351 |
--------------------------------------------------------------------------------
/basic/RTE/Device/SSE-300-MPS3/system_SSE300MPS3.c:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2009-2021 Arm Limited. All rights reserved.
3 | *
4 | * SPDX-License-Identifier: Apache-2.0
5 | *
6 | * Licensed under the Apache License, Version 2.0 (the License); you may
7 | * not use this file except in compliance with the License.
8 | * You may obtain a copy of the License at
9 | *
10 | * www.apache.org/licenses/LICENSE-2.0
11 | *
12 | * Unless required by applicable law or agreed to in writing, software
13 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT
14 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | * See the License for the specific language governing permissions and
16 | * limitations under the License.
17 | */
18 |
19 | /*
20 | * This file is derivative of CMSIS V5.6.0 system_ARMv81MML.c
21 | * Git SHA: b5f0603d6a584d1724d952fd8b0737458b90d62b
22 | */
23 |
24 | #include "SSE300MPS3.h"
25 |
26 | /*----------------------------------------------------------------------------
27 | Define clocks
28 | *----------------------------------------------------------------------------*/
29 | #define XTAL (32000000UL)
30 | #define SYSTEM_CLOCK (XTAL)
31 | #define PERIPHERAL_CLOCK (25000000UL)
32 |
33 | /*----------------------------------------------------------------------------
34 | Externals
35 | *----------------------------------------------------------------------------*/
36 | #if defined (__VTOR_PRESENT) && (__VTOR_PRESENT == 1U)
37 | extern uint32_t __VECTOR_TABLE;
38 | #endif
39 |
40 | /*----------------------------------------------------------------------------
41 | System Core Clock Variable
42 | *----------------------------------------------------------------------------*/
43 | uint32_t SystemCoreClock = SYSTEM_CLOCK;
44 | uint32_t PeripheralClock = PERIPHERAL_CLOCK;
45 |
46 | /*----------------------------------------------------------------------------
47 | System Core Clock update function
48 | *----------------------------------------------------------------------------*/
49 | void SystemCoreClockUpdate (void)
50 | {
51 | SystemCoreClock = SYSTEM_CLOCK;
52 | PeripheralClock = PERIPHERAL_CLOCK;
53 | }
54 |
55 | /*----------------------------------------------------------------------------
56 | System initialization function
57 | *----------------------------------------------------------------------------*/
58 | void SystemInit (void)
59 | {
60 |
61 | #if defined (__VTOR_PRESENT) && (__VTOR_PRESENT == 1U)
62 | SCB->VTOR = (uint32_t)(&__VECTOR_TABLE);
63 | #endif
64 |
65 | /* CMSIS System Initialization */
66 | #if (defined (__FPU_USED) && (__FPU_USED == 1U)) || \
67 | (defined (__ARM_FEATURE_MVE) && (__ARM_FEATURE_MVE > 0U))
68 | SCB->CPACR |= ((3U << 10U*2U) | /* enable CP10 Full Access */
69 | (3U << 11U*2U) ); /* enable CP11 Full Access */
70 | #endif
71 |
72 | #ifdef UNALIGNED_SUPPORT_DISABLE
73 | SCB->CCR |= SCB_CCR_UNALIGN_TRP_Msk;
74 | #endif
75 |
76 | /* Enable Loop and branch info cache */
77 | SCB->CCR |= SCB_CCR_LOB_Msk;
78 | __ISB();
79 |
80 | /* Set CPDLPSTATE.CLPSTATE to 0, so PDCORE will not enter low-power state. Set
81 | CPDLPSTATE.ELPSTATE to 0, to stop the processor from trying to switch the EPU
82 | into retention state */
83 | #define CPDLPSTATE_ADDR (0xE001E300UL)
84 | #define CPDLPSTATE *(volatile unsigned int *) CPDLPSTATE_ADDR
85 | CPDLPSTATE &= 0xFFFFFF00UL;
86 | }
87 |
--------------------------------------------------------------------------------
/basic/avh.yml:
--------------------------------------------------------------------------------
1 | name: "AVH GetStarted Example"
2 | workdir: ./
3 | backend:
4 | aws:
5 | ami-version: ~=1.1
6 | instance-type: t2.micro
7 | upload:
8 | - RTE/**/*
9 | - -:RTE/**/RTE_Components.h
10 | - basic.debug.cprj
11 | - build.py
12 | - main.c
13 | - requirements.txt
14 | - retarget_stdio.c
15 | - fvp_config.txt
16 | - README.md
17 | steps:
18 | - run: |
19 | pip install -r requirements.txt
20 | python build.py --verbose build run
21 | download:
22 | - RTE/**/RTE_Components.h
23 | - Objects/basic.axf
24 | - Objects/basic.axf.map
25 | - basic-*.xunit
26 | - basic-*.zip
27 |
--------------------------------------------------------------------------------
/basic/basic.debug.cprj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | Cloud CI basic demo
8 | Very basic unit test demo running tests in the cloud on Arm Virtual Hardware.
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
--------------------------------------------------------------------------------
/basic/build.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/python3
2 |
3 | import logging
4 | import re
5 | import shutil
6 |
7 | from datetime import datetime
8 | from enum import Enum
9 | from glob import iglob, glob
10 | from io import StringIO
11 | from zipfile import ZipFile
12 |
13 | from junit_xml import TestSuite, TestCase, to_xml_report_string
14 | from os import environ
15 | from pathlib import Path
16 | from typing import Tuple
17 |
18 | from matrix_runner import main, matrix_axis, matrix_action, matrix_command, ConsoleReport, CropReport, ReportFilter
19 |
20 | # Colors for the Unittest result badge
21 | UNITTEST_BADGE_COLOR = {
22 | True: 'green', # stable: all tests passing
23 | False: 'yellow', # unstable: not all tests passing
24 | None: 'red' # error: no test results generated
25 | }
26 |
27 |
28 | class UnityReport(ReportFilter):
29 | class Result(ReportFilter.Result, ReportFilter.Summary):
30 | @staticmethod
31 | def common_fix(s1, s2):
32 | steps = range(min(len(s1), len(s2)) - 1, -1, -1)
33 | return next((s2[:n] for n in steps if s1[-n:] == s2[:n]), '')
34 |
35 | @property
36 | def stream(self) -> StringIO:
37 | if not self._stream:
38 | try:
39 | self._stream = StringIO()
40 | input = self._other.stream
41 | input.seek(0)
42 | tcs = []
43 | cwd = Path.cwd()
44 | for line in input:
45 | m = re.match('(.*):(\d+):(\w+):(PASS|FAIL)(:(.*))?', line)
46 | if m:
47 | file = Path(m.group(1))
48 | try:
49 | file = file.relative_to(cwd)
50 | except ValueError as e:
51 | if "is not in the subpath" in e.args[0]:
52 | logging.info(e)
53 | lookup = glob(str(Path.cwd().joinpath("**").joinpath(file.name)), recursive=True)
54 | if len(lookup) != 1:
55 | raise e
56 | logging.info("Found similar named file at '%s'.", str(lookup[0]))
57 | file = Path(lookup[0]).relative_to(Path.cwd())
58 | if m.group(1).endswith(str(file)):
59 | cwd = Path(m.group(1)[0:-len(str(file))])
60 | logging.info("Deduced working directory is '%s'.", str(cwd))
61 |
62 | tc = TestCase(m.group(3), file=file, line=m.group(2))
63 | if m.group(4) == "FAIL":
64 | tc.add_failure_info(message=m.group(6).strip())
65 | tcs += [tc]
66 | self.ts = TestSuite("Cloud-CI basic tests", tcs)
67 | self._stream.write(to_xml_report_string([self.ts]))
68 | except Exception as e:
69 | self._stream = e
70 | if isinstance(self._stream, Exception):
71 | raise RuntimeError from self._stream
72 | else:
73 | return self._stream
74 |
75 | @property
76 | def summary(self) -> Tuple[int, int]:
77 | passed = len([tc for tc in self.ts.test_cases if not (tc.is_failure() or tc.is_error() or tc.is_skipped())])
78 | executed = len(self.ts.test_cases)
79 | return passed, executed
80 |
81 | def __init__(self, *args):
82 | super(UnityReport, self).__init__()
83 | self.args = args
84 |
85 |
86 | def timestamp(t: datetime = datetime.now()):
87 | return t.strftime("%Y%m%d%H%M%S")
88 |
89 |
90 | @matrix_axis("target", "t", "The project target(s) to build")
91 | class TargetAxis(Enum):
92 | debug = ('debug')
93 |
94 |
95 | @matrix_action
96 | def build(config, results):
97 | """Build the config(s) with CMSIS-Build"""
98 | yield run_cbuild(config)
99 | if not results[0].success:
100 | return
101 |
102 | file = f"basic-{timestamp()}.zip"
103 | logging.info(f"Archiving build output to {file}...")
104 | with ZipFile(file, "w") as archive:
105 | archive.write(f"Objects/basic.axf")
106 | archive.write(f"Objects/basic.axf.map")
107 | archive.write(f"Objects/basic.{config.target}.clog")
108 |
109 |
110 | @matrix_action
111 | def run(config, results):
112 | """Run the config(s) with fast model"""
113 | yield run_fvp(config)
114 | ts = timestamp()
115 | if not results[0].success:
116 | print(f"::set-output name=badge::Unittest-failed-{UNITTEST_BADGE_COLOR[None]}")
117 | else:
118 | results[0].test_report.write(f"basic-{ts}.xunit")
119 | passed, executed = results[0].test_report.summary
120 | print(f"::set-output name=badge::Unittest-{passed}%20of%20{executed}%20passed-{UNITTEST_BADGE_COLOR[passed == executed]}")
121 |
122 |
123 | @matrix_command(needs_shell=False)
124 | def run_cbuild(config):
125 | return ["bash", "-c", f"cbuild.sh --quiet --packs basic.{config.target}.cprj"]
126 |
127 |
128 | @matrix_command(test_report=ConsoleReport()|CropReport("---\[ UNITY BEGIN \]---", '---\[ UNITY END \]---')|UnityReport())
129 | def run_fvp(config):
130 | return ["VHT_Corstone_SSE-300_Ethos-U55", "-q", "--stat", "--simlimit", "1", "-f", "fvp_config.txt", "Objects/basic.axf"]
131 |
132 |
133 | if __name__ == "__main__":
134 | main()
135 |
--------------------------------------------------------------------------------
/basic/fvp_config.txt:
--------------------------------------------------------------------------------
1 | # Parameters:
2 | # instance.parameter=value #(type, mode) default = 'def value' : description : [min..max]
3 | #------------------------------------------------------------------------------
4 | cpu_core.core_clk.mul=100000000 # (int , init-time) default = '0x17d7840' : Clock Rate Multiplier. This parameter is not exposed via CADI and can only be set in LISA
5 | cpu_core.mps3_board.visualisation.disable-visualisation=1 # (bool , init-time) default = '0' : Enable/disable visualisation
6 | cpu_core.mps3_board.DISABLE_GATING=1 # (bool , init-time) default = '0' : Disable Memory gating logic
7 | cpu_core.mps3_board.telnetterminal0.start_port=5000 # (int , init-time) default = '0x1388' : Telnet TCP Port Number
8 | cpu_core.mps3_board.telnetterminal0.start_telnet=0 # (bool , init-time) default = '1' : Start telnet if nothing connected
9 | cpu_core.mps3_board.uart0.out_file=- # (string, init-time) default = '' : Output file to hold data written by the UART (use '-' to send all output to stdout)
10 |
11 | cpu_core.cpu0.semihosting-enable=1 # (bool , init-time) default = '1' : Enable semihosting SVC traps. Applications that do not use semihosting must set this parameter to false.
12 | cpu_core.cpu0.semihosting-Thumb_SVC=0xAB # (int , init-time) default = '0xAB' : T32 SVC number for semihosting : [0x0..0xFF]
13 | cpu_core.cpu0.semihosting-cmd_line="" # (string, init-time) default = '' : Command line available to semihosting SVC calls
14 | cpu_core.cpu0.semihosting-heap_base=0x0 # (int , init-time) default = '0x0' : Virtual address of heap base : [0x0..0xFFFFFFFF]
15 | cpu_core.cpu0.semihosting-heap_limit=0x0 # (int , init-time) default = '0x10700000' : Virtual address of top of heap : [0x0..0xFFFFFFFF]
16 | cpu_core.cpu0.semihosting-stack_base=0x0 # (int , init-time) default = '0x10700000' : Virtual address of base of descending stack : [0x0..0xFFFFFFFF]
17 | cpu_core.cpu0.semihosting-stack_limit=0x0 # (int , init-time) default = '0x10800000' : Virtual address of stack limit : [0x0..0xFFFFFFFF]
18 | cpu_core.cpu0.semihosting-cwd="" # (string, init-time) default = '' : Base directory for semihosting file access.
19 |
--------------------------------------------------------------------------------
/basic/main.c:
--------------------------------------------------------------------------------
1 | /*----------------------------------------------------------------------------
2 | * Name: main.c
3 | *----------------------------------------------------------------------------*/
4 |
5 | #include "unity.h"
6 | #include
7 |
8 | extern void stdio_init (void);
9 |
10 | /* Application function to test */
11 | static int my_sum(int a, int b) {
12 | return a + b;
13 | }
14 |
15 | /*============= UNIT TESTS ============== */
16 |
17 | /* Called in RUN_TEST before executing test function */
18 | void setUp(void) {
19 | // set stuff up here
20 | }
21 |
22 | /* Called in RUN_TEST after executing test function */
23 | void tearDown(void) {
24 | // clean stuff up here
25 | }
26 |
27 | /* Testing summation of positive integers */
28 | static void test_my_sum_pos(void) {
29 | const int sum = my_sum(1, 1);
30 | TEST_ASSERT_EQUAL_INT(2, sum);
31 | }
32 |
33 | /* Testing summation of negative integers */
34 | static void test_my_sum_neg(void) {
35 | const int sum = my_sum(-1, -1);
36 | TEST_ASSERT_EQUAL_INT(-2, sum);
37 | }
38 |
39 | /* Testing summation of zeros */
40 | static void test_my_sum_zero(void) {
41 | const int sum = my_sum(0, 0);
42 | TEST_ASSERT_EQUAL_INT(0, sum);
43 | }
44 |
45 | /* Failing test with incorrect summation value */
46 | static void test_my_sum_fail(void) {
47 | const int sum = my_sum(1, -1);
48 | TEST_ASSERT_EQUAL_INT(2, sum);
49 | }
50 |
51 | /* Main: Run tests */
52 | int main(void) {
53 | stdio_init();
54 |
55 | printf("---[ UNITY BEGIN ]---\n");
56 | UNITY_BEGIN();
57 | RUN_TEST(test_my_sum_pos);
58 | RUN_TEST(test_my_sum_neg);
59 | RUN_TEST(test_my_sum_fail);
60 | RUN_TEST(test_my_sum_zero);
61 | const int result = UNITY_END();
62 | printf("---[ UNITY END ]---\n");
63 | return result;
64 | }
65 |
--------------------------------------------------------------------------------
/basic/mdk_config.txt:
--------------------------------------------------------------------------------
1 | # Parameters:
2 | # instance.parameter=value #(type, mode) default = 'def value' : description : [min..max]
3 | #------------------------------------------------------------------------------
4 | cpu_core.core_clk.mul=100000000 # (int , init-time) default = '0x17d7840' : Clock Rate Multiplier. This parameter is not exposed via CADI and can only be set in LISA
5 | cpu_core.mps3_board.visualisation.disable-visualisation=1 # (bool , init-time) default = '0' : Enable/disable visualisation
6 | cpu_core.mps3_board.DISABLE_GATING=1 # (bool , init-time) default = '0' : Disable Memory gating logic
7 | cpu_core.mps3_board.telnetterminal0.start_port=5000 # (int , init-time) default = '0x1388' : Telnet TCP Port Number
8 | cpu_core.mps3_board.telnetterminal0.start_telnet=1 # (bool , init-time) default = '1' : Start telnet if nothing connected
9 | cpu_core.mps3_board.uart0.out_file= # (string, init-time) default = '' : Output file to hold data written by the UART (use '-' to send all output to stdout)
10 |
11 | cpu_core.cpu0.semihosting-enable=1 # (bool , init-time) default = '1' : Enable semihosting SVC traps. Applications that do not use semihosting must set this parameter to false.
12 | cpu_core.cpu0.semihosting-Thumb_SVC=0xAB # (int , init-time) default = '0xAB' : T32 SVC number for semihosting : [0x0..0xFF]
13 | cpu_core.cpu0.semihosting-cmd_line="" # (string, init-time) default = '' : Command line available to semihosting SVC calls
14 | cpu_core.cpu0.semihosting-heap_base=0x0 # (int , init-time) default = '0x0' : Virtual address of heap base : [0x0..0xFFFFFFFF]
15 | cpu_core.cpu0.semihosting-heap_limit=0x0 # (int , init-time) default = '0x10700000' : Virtual address of top of heap : [0x0..0xFFFFFFFF]
16 | cpu_core.cpu0.semihosting-stack_base=0x0 # (int , init-time) default = '0x10700000' : Virtual address of base of descending stack : [0x0..0xFFFFFFFF]
17 | cpu_core.cpu0.semihosting-stack_limit=0x0 # (int , init-time) default = '0x10800000' : Virtual address of stack limit : [0x0..0xFFFFFFFF]
18 | cpu_core.cpu0.semihosting-cwd=""
19 |
--------------------------------------------------------------------------------
/basic/requirements.txt:
--------------------------------------------------------------------------------
1 | # -*- coding: utf-8 -*-
2 | #
3 | # Python requirements for build.py script
4 | #
5 | python-matrix-runner~=1.0
6 | junit-xml~=1.9
7 |
--------------------------------------------------------------------------------
/basic/retarget_stdio.c:
--------------------------------------------------------------------------------
1 | /* -----------------------------------------------------------------------------
2 | * Copyright (c) 2020 Arm Limited (or its affiliates). All rights reserved.
3 | *
4 | * SPDX-License-Identifier: Apache-2.0
5 | *
6 | * Licensed under the Apache License, Version 2.0 (the License); you may
7 | * not use this file except in compliance with the License.
8 | * You may obtain a copy of the License at
9 | *
10 | * www.apache.org/licenses/LICENSE-2.0
11 | *
12 | * Unless required by applicable law or agreed to in writing, software
13 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT
14 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | * See the License for the specific language governing permissions and
16 | * limitations under the License.
17 | * -------------------------------------------------------------------------- */
18 |
19 | #include
20 | #include
21 | #include "device_cfg.h"
22 | #include "Driver_USART.h"
23 |
24 | extern ARM_DRIVER_USART Driver_USART0;
25 |
26 | void stdio_init (void) {
27 | Driver_USART0.Initialize(NULL);
28 | Driver_USART0.Control(ARM_USART_MODE_ASYNCHRONOUS, 115200U);
29 | }
30 |
31 | /**
32 | Put a character to the stdout
33 |
34 | \param[in] ch Character to output
35 | \return The character written, or -1 on write error.
36 | */
37 | int stdout_putchar (int ch) {
38 | int32_t ret;
39 |
40 | #ifdef __UVISION_VERSION
41 | // Windows Telnet expects CR-LF line endings
42 | // add carriage return before each line feed
43 | if (ch=='\n') {
44 | int cr = '\r';
45 | Driver_USART0.Send(&cr, 1U);
46 | }
47 | #endif
48 |
49 | if (Driver_USART0.Send(&ch, 1U) == ARM_DRIVER_OK) {
50 | return ch;
51 | }
52 | return EOF;
53 | }
54 |
--------------------------------------------------------------------------------
/create_debug_test.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ARM-software/AVH-GetStarted/28940d6cc8721edc00ddef054275825b952e8c12/create_debug_test.png
--------------------------------------------------------------------------------
/infrastructure/cloudformation/.images/vht_cloudformation_ack.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ARM-software/AVH-GetStarted/28940d6cc8721edc00ddef054275825b952e8c12/infrastructure/cloudformation/.images/vht_cloudformation_ack.png
--------------------------------------------------------------------------------
/infrastructure/cloudformation/.images/vht_cloudformation_create_progress.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ARM-software/AVH-GetStarted/28940d6cc8721edc00ddef054275825b952e8c12/infrastructure/cloudformation/.images/vht_cloudformation_create_progress.png
--------------------------------------------------------------------------------
/infrastructure/cloudformation/.images/vht_cloudformation_create_stack.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ARM-software/AVH-GetStarted/28940d6cc8721edc00ddef054275825b952e8c12/infrastructure/cloudformation/.images/vht_cloudformation_create_stack.png
--------------------------------------------------------------------------------
/infrastructure/cloudformation/.images/vht_cloudformation_main.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ARM-software/AVH-GetStarted/28940d6cc8721edc00ddef054275825b952e8c12/infrastructure/cloudformation/.images/vht_cloudformation_main.png
--------------------------------------------------------------------------------
/infrastructure/cloudformation/.images/vht_cloudformation_output.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ARM-software/AVH-GetStarted/28940d6cc8721edc00ddef054275825b952e8c12/infrastructure/cloudformation/.images/vht_cloudformation_output.png
--------------------------------------------------------------------------------
/infrastructure/cloudformation/.images/vht_cloudformation_stack_completed.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ARM-software/AVH-GetStarted/28940d6cc8721edc00ddef054275825b952e8c12/infrastructure/cloudformation/.images/vht_cloudformation_stack_completed.png
--------------------------------------------------------------------------------
/infrastructure/cloudformation/.images/vht_cloudformation_stack_details.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ARM-software/AVH-GetStarted/28940d6cc8721edc00ddef054275825b952e8c12/infrastructure/cloudformation/.images/vht_cloudformation_stack_details.png
--------------------------------------------------------------------------------
/infrastructure/cloudformation/.images/vht_cloudformation_stack_resources.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ARM-software/AVH-GetStarted/28940d6cc8721edc00ddef054275825b952e8c12/infrastructure/cloudformation/.images/vht_cloudformation_stack_resources.png
--------------------------------------------------------------------------------
/infrastructure/cloudformation/Arm-AVH-CloudFormation-Template.yaml:
--------------------------------------------------------------------------------
1 | ############################################################
2 | # This is a TEMPLATE code, please change it for your need
3 | # See comments in the code
4 | ############################################################
5 |
6 | AWSTemplateFormatVersion: 2010-09-09
7 | Parameters:
8 | S3BucketName:
9 | Type: String
10 | Description: AVH S3 Bucket. Name must be unique.
11 | VpcId:
12 | Type: AWS::EC2::VPC::Id
13 | Description: VPC ID to be associated with the AVH Security Group (e.g. vpc-0dc320e47b6a8077f)
14 | Resources:
15 | AVHS3Bucket:
16 | Type: 'AWS::S3::Bucket'
17 | Properties:
18 | AccessControl: Private
19 | BucketName:
20 | Ref: S3BucketName
21 | Tags:
22 | - Key: AVH
23 | Value: true
24 | AVHEC2SecurityGroup:
25 | Type: AWS::EC2::SecurityGroup
26 | Properties:
27 | GroupDescription: Allow ssh communication and outbound traffic
28 | GroupName: AVHEC2SecurityGroup
29 | VpcId:
30 | Ref: VpcId
31 | SecurityGroupIngress:
32 | - IpProtocol: tcp
33 | FromPort: 22
34 | ToPort: 22
35 | CidrIp: 0.0.0.0/0
36 | AVHIAMProfile:
37 | Type: "AWS::IAM::InstanceProfile"
38 | Properties:
39 | InstanceProfileName: Proj-AVHInstanceRole
40 | Path: "/"
41 | Roles:
42 | - Ref: "AVHInstanceRole"
43 | DependsOn:
44 | - AVHInstanceRole
45 | AVHInstanceRole:
46 | Type: AWS::IAM::Role
47 | Properties:
48 | AssumeRolePolicyDocument: |
49 | {
50 | "Version": "2012-10-17",
51 | "Statement": [
52 | {
53 | "Effect": "Allow",
54 | "Principal": {
55 | "Service": "ec2.amazonaws.com"
56 | },
57 | "Action": "sts:AssumeRole"
58 | }
59 | ]
60 | }
61 | Description: Allows EC2 instances to call AWS services on AVH behalf.
62 | Policies:
63 | - PolicyName: Proj-AVHIAMProfileS3Policy
64 | PolicyDocument:
65 | Version: "2012-10-17"
66 | Statement:
67 | - Effect: Allow
68 | Action:
69 | - 's3:PutObject'
70 | - 's3:GetObject'
71 | - 's3:DeleteObject'
72 | Resource: !Join
73 | - ''
74 | - - 'arn:aws:s3:::'
75 | - !Ref S3BucketName
76 | - '/*'
77 | ManagedPolicyArns:
78 | - arn:aws:iam::aws:policy/AmazonSSMManagedInstanceCore
79 | RoleName: Proj-AVHInstanceRole
80 | # Uncomment this line if you need to setup ARM LZ-based AWS Account
81 | # PermissionsBoundary: !Sub 'arn:aws:iam::${AWS::AccountId}:policy/ProjAdminsPermBoundaryv2'
82 | Tags:
83 | - Key: AVH
84 | Value: true
85 | AVHRole:
86 | Type: AWS::IAM::Role
87 | Properties:
88 | AssumeRolePolicyDocument:
89 | Version: '2012-10-17'
90 | Statement:
91 | - Effect: Allow
92 | Principal:
93 | Federated: !Sub 'arn:aws:iam::${AWS::AccountId}:oidc-provider/token.actions.githubusercontent.com'
94 | Action: sts:AssumeRoleWithWebIdentity
95 | Condition:
96 | ForAnyValue:StringLike:
97 | token.actions.githubusercontent.com:sub:
98 | # PLEASE ADD YOUR GITHUB_ORGS AND GITHUB_REPOS
99 | - repo:YOUR_GITHUB_ORG/YOUR_GITHUB_REPO:*
100 | Description: Allow GitHub Runners to execute AVH.
101 | ManagedPolicyArns:
102 | - arn:aws:iam::aws:policy/AmazonEC2FullAccess
103 | - arn:aws:iam::aws:policy/AmazonS3FullAccess
104 | - arn:aws:iam::aws:policy/AmazonSSMFullAccess
105 | Policies:
106 | - PolicyName: Proj-PassRoleToAVHInstance
107 | PolicyDocument:
108 | Version: "2012-10-17"
109 | Statement:
110 | - Effect: Allow
111 | Action:
112 | - iam:PassRole
113 | Resource: !GetAtt AVHInstanceRole.Arn
114 | RoleName: Proj-AVHRole
115 | # Uncomment this line if you need to setup ARM LZ-based AWS Account
116 | # PermissionsBoundary: !Sub 'arn:aws:iam::${AWS::AccountId}:policy/ProjAdminsPermBoundaryv2'
117 | Tags:
118 | - Key: AVH
119 | Value: true
120 | DependsOn:
121 | - AVHGitHubOIDC
122 | - AVHInstanceRole
123 | AVHGitHubOIDC:
124 | Type: AWS::IAM::OIDCProvider
125 | Properties:
126 | ClientIdList:
127 | - sts.amazonaws.com
128 | Tags:
129 | - Key: AVH
130 | Value: true
131 | ThumbprintList:
132 | - 6938fd4d98bab03faadb97b34396831e3780aea1
133 | Url: https://token.actions.githubusercontent.com
134 | Outputs:
135 | AVHIAMProfile:
136 | Value:
137 | !GetAtt AVHIAMProfile.Arn
138 | Description:
139 | IAM Instance Profile ARN created in the stack
140 | AVHS3BucketName:
141 | Value:
142 | !Ref S3BucketName
143 | Description:
144 | S3 Bucket created in the stack
145 | AVHEC2SecurityGroupId:
146 | Value:
147 | !GetAtt AVHEC2SecurityGroup.GroupId
148 | Description:
149 | EC2 Security Group created in the stack
150 | AVHGitHubOIDC:
151 | Value:
152 | !Ref AVHGitHubOIDC
153 | Description:
154 | AVHGitHubOIDC ARN
155 | AVHRole:
156 | Value:
157 | !GetAtt AVHRole.Arn
158 | Description:
159 | AVH Role ARN
160 |
--------------------------------------------------------------------------------
/infrastructure/cloudformation/Arm-AVH-EFS-Setup.yaml:
--------------------------------------------------------------------------------
1 | AWSTemplateFormatVersion: '2010-09-09'
2 | Description: This template creates an Amazon EFS file system and mount target for AVH Projects.
3 | Parameters:
4 | SubnetId:
5 | Description: Subnet ID to create a EFS mount point (e.g. subnet-09117668ea05e295d)
6 | Type: "AWS::EC2::Subnet::Id"
7 | VpcId:
8 | Description: VPC ID to be associated with the EFS Mount Point Security Group (e.g. vpc-0dc320e47b6a8077f)
9 | Type: "AWS::EC2::VPC::Id"
10 | Resources:
11 | MountTargetSecurityGroup:
12 | Type: AWS::EC2::SecurityGroup
13 | Properties:
14 | GroupDescription: Security group for mount target
15 | GroupName: AVHEFSSecurityGroup
16 | VpcId:
17 | Ref: VpcId
18 | SecurityGroupIngress:
19 | - IpProtocol: tcp
20 | FromPort: 2049
21 | ToPort: 2049
22 | CidrIp: 0.0.0.0/0
23 | FileSystem:
24 | Type: AWS::EFS::FileSystem
25 | Properties:
26 | PerformanceMode: generalPurpose
27 | Encrypted: True
28 | FileSystemTags:
29 | - Key: Name
30 | Value: AVHEFSCloudformation
31 | MountTarget:
32 | Type: AWS::EFS::MountTarget
33 | Properties:
34 | FileSystemId:
35 | Ref: FileSystem
36 | SubnetId:
37 | Ref: SubnetId
38 | SecurityGroups:
39 | - Ref: MountTargetSecurityGroup
40 | Outputs:
41 | MountTargetID:
42 | Description: Mount target ID
43 | Value:
44 | Ref: MountTarget
45 | FileSystemID:
46 | Description: File system ID
47 | Value:
48 | Ref: FileSystem
49 | MountTargetSecurityGroupID:
50 | Description: Mount Target Security Group ID
51 | Value:
52 | Ref: MountTargetSecurityGroup
53 |
--------------------------------------------------------------------------------
/infrastructure/cloudformation/README.md:
--------------------------------------------------------------------------------
1 | # Arm Virtual Hardware AWS-CloudFormation
2 |
3 | The following section describes how to setup the AWS infrastructure for using the [Arm Virtual Hardware Amazon Machine Image (AMI)](https://arm-software.github.io/AVH/main/infrastructure/html/index.html#AWS).
4 | Using a template file creates the setup that is for example required to run **Arm Virtual Hardware** with a [**GitHub-hosted Runner**](https://arm-software.github.io/AVH/main/infrastructure/html/run_ami_github.html#GitHub_hosted).
5 |
6 | ## Prerequisites
7 | * Use your [**AWS account**](https://aws.amazon.com/premiumsupport/knowledge-center/create-and-activate-aws-account/)
8 | * Subscribe [**Arm Virtual Hardware**](https://arm-software.github.io/AVH/main/infrastructure/html/index.html#Subscribe)
9 |
10 | ## What is Created
11 | The `Arm-AVH-CloudFormation-Template.yaml` is an [AWS CloudFormation](https://docs.aws.amazon.com/cloudformation/index.html) template that creates the following AWS infrastructure items:
12 | * One S3 Bucket (to store temporary files)
13 | * One EC2 Security Group (to be associated with the EC2 instances)
14 | * One IAM User and Access Keys (to limit access rights in the AWS)
15 | * One IAM Role (to be associated with the EC2 Instances)
16 |
17 | ### Required User Input
18 | * _S3BucketName_ that identifies the S3 Bucket.
19 | * _VpcId_ to be associated with the EC2 Security Group.
20 |
21 | ### Provided Output
22 | Resources to be used with Arm AVH AMI (see below in step 12).
23 |
24 | ## How to run it for the first time
25 | 1. Download the file [`Arm-AVH-CloudFormation-Template.yaml`](./Arm-AVH-CloudFormation-Template.yaml) to your computer.
26 |
27 | 2. Sign in with your AWS account on [aws.amazon.com](https://aws.amazon.com/) to open the AWS Management Console page.
28 |
29 | 3. Type `Cloudformation` in the search and proceed to the corresponding AWS service page.
30 |
31 | 4. Click the _Create stack_ button.
32 |
33 |
34 |
35 | 5. Select _Template is ready_ option, and then _Upload a template file_.
36 |
37 | 6. With the _Choose file_ button select the file `Arm-AVH-CloudFormation-Template.yaml` downloaded in step 1.
38 |
39 | 7. Click _Next_.
40 |
41 |
42 |
43 | 8. Specify stack details as follows:
44 | - _Stack name_: use any name, for example `Arm-AVH-Stack`.
45 | - _S3BucketName_: shall have only small letters and numbers and be unique across AWS, as otherwise stack creation will fail later.
46 | - _Vpcid_: provide VPC ID for your target region. This can be found in VPC AWS service.
47 |
48 |
49 |
50 | 9. On _Configure stack options_ page keep default values and press _Next_.
51 |
52 | 10. On _Review_ page:
53 | - Acknowledge that a new AWS IAM User and AWS IAM AccessKey will be created.
54 | - Press _Create stack_.
55 |
56 |
57 |
58 | 11. The infrastructure described in the template file will be provisioned. In _Events_ tab you can follow the creation process. Use _refresh_ button if the page does not get updated automatically. After a few minutes, the stack creation should be successfully completed.
59 |
60 |
61 |
62 | 12. Go to the created stack and in the _Output_ tab, find the values for the parameters needed for using an Arm Virtual Hardware AMI:
63 | - `AVHEC2SecurityGroupId`: the name of created EC2 security group.
64 | - `AVHS3BucketName`: the name of created S3 bucket. It has the same value as provided in step 8.
65 | - `AVHIAMProfile`: the name of created IAM Instance Profile.
66 | - `AVHAccessKeyId`: the access key id for the IAM User created in the stack.
67 | - `AVHSecretAccessKey`: the secret access key value for the `AVHAccessKeyId`. See [access key pair](https://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_access-keys.html) for details.
68 |
69 |
70 |
71 | Note that when the cloud stack is not needed anymore CloudFormation service can be also used to easily delete the stack including all the provisioned resources. In this case, it needs to be ensured that the EC2 instance associated with the created EC2 Security Group is terminated before stack delete is started.
72 |
73 | # ARM AVH EFS setup
74 |
75 | The Cloudformation file `Arm-AVH-EFS-Setup.yaml` creates a NFS-like EFS Share. It can be mounted to AVH Instances to share content (e.g. Packs).
76 |
77 | ## Prerequisites
78 | * Use your [**AWS account**](https://aws.amazon.com/premiumsupport/knowledge-center/create-and-activate-aws-account/)
79 | * Subscribe [**Arm Virtual Hardware**](https://arm-software.github.io/AVH/main/infrastructure/html/index.html#Subscribe)
80 |
81 | ## Prerequisites
82 |
83 | It requires:
84 | * VpcId
85 | * SubnetId
86 |
87 | ### Required User Input
88 | * _VpcId_ to be associated with the EFS MountPoint
89 | * _SubnetId_ to be associated with the EFS MountPoint
90 |
91 | ## What is Created
92 |
93 | * FileSystem
94 | * MountPoint for each VpcId and SubnetId (single for this template)
95 | * MountTargetSecurityGroup to allow NFS inbound communication
96 |
97 | ## After running Cloudformation
98 |
99 | When a new EFS is created and packs need to be stored, then runs a helper script to setup a user pack folder into.
100 | See misc/efs folder (mainly `setup_avh_efs_for_packs.sh` file).
101 |
102 | ## Observations
103 |
104 | The Cloudformation code assumes a single MountTarget SubnetId associated with the EFS. If more than one Subnet mount points is necessary:
105 | * Add more SubnetId inputs as Parameters
106 | * Add more MountPoints as Resources
107 |
108 | Or ideally, use Parameter Lists. See [Parameters doc](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/parameters-section-structure.html)
109 |
110 | # ARM AVH EFS Manual Packs Installation
111 |
112 | In case of problem installing packs on-demand, there is an option to install packs manually into the EFS packs share.
113 |
114 | ## Assumptions
115 |
116 | * It is assumed that you have the pack file(s) locally in your workspace
117 | * AWS CLI is installed
118 | * You have configured a key pair in AWS and you have the private key locally for SSH/SCP connection
119 | * The AWS Keys are exposed (exported) in your local environment
120 |
121 | ## Installing manually packs
122 |
123 | You can use the helper file on `misc/efs` folder called `install_manual_packs_into_efs.sh`. This is just a template, so it needs some information.
124 | You would need to change some variables before running it, please see the code.
125 |
126 | This script basically:
127 | * Creates a new AVH EC2 Instance with the proper EFS configuration (Security Groups, EFS mount, SSH and etc)
128 | * Deletes any local Pack folder
129 | * Mounts EFS packs folder into `~/packs`
130 | * Copies your local pack file into EC2's `/tmp`
131 | * Installs your local pack into EFS packs by using `cpackget`
132 | * Terminates the instance
133 |
134 | You can use part of the script just to create a new EC2 instance and then copy and install manually the packs by using SSH and SCP.
135 | Feel free to use as it pleases you.
136 |
--------------------------------------------------------------------------------
/infrastructure/cloudformation/misc/efs/install_manual_packs_into_efs.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash -e
2 | set -e
3 |
4 | ################################
5 | # PLEASE MODIFY THE VARS BELOW #
6 | ################################
7 | # You can use any AVH AMI
8 | avh_image_id="ami-07b00fa9adbbd2af5"
9 | instance_type="t2.micro"
10 | # Use the Mount Point Subnet
11 | subnet_id="subnet-025b7baebd743a68b"
12 | # Use the AVH EFS Security Group & some SSH inbound SG
13 | security_group_ids="sg-0a9aa42b4737b3f86 sg-03afe5ec007b4bcb0"
14 | key_name="common"
15 |
16 | # private key absolute path associated with the key_name field
17 | private_key_location="/c/Users/sampel01/OneDrive - Arm/.ssh/mcu_open_common.pem"
18 |
19 | # EFS-related info
20 | efs_dns_name=fs-014b24a7f24f3d529.efs.eu-west-1.amazonaws.com
21 | file_system_id=fs-014b24a7f24f3d529
22 | mount_point=/mnt/efs/fs1
23 | packs_folder=packs
24 | user_data="file://user_data.txt"
25 |
26 | # Local path location (in this case expected in the same folder)
27 | pack_name=Active-Semi.PAC52XX.2.1.0.pack
28 |
29 | echo "Creating an AVH EC2 instance..."
30 | instance_id=$(aws --output text ec2 run-instances \
31 | --image-id ${avh_image_id} \
32 | --instance-type ${instance_type} \
33 | --subnet-id ${subnet_id} \
34 | --security-group-ids ${security_group_ids} \
35 | --key-name ${key_name} \
36 | --associate-public-ip-address \
37 | --user-data ${user_data} | awk '/INSTANCES/{print $9}')
38 |
39 | echo "Waiting instance ${instance_id} to be running..."
40 | aws ec2 wait instance-running \
41 | --instance-ids ${instance_id}
42 |
43 | echo "Waiting instance ${instance_id} to be status OK..."
44 | aws ec2 wait instance-status-ok \
45 | --instance-ids ${instance_id}
46 |
47 | echo "Getting EC2 Public DNS for SSH & SCP"
48 | public_dns=$(aws --output text ec2 describe-instances \
49 | --instance-ids ${instance_id} | awk '/INSTANCES/{print $15}')
50 | echo "EC2 Public DNS is $public_dns"
51 |
52 | echo "Waiting for EFS mount point to be present..."
53 | until ssh -i "${private_key_location}" -oStrictHostKeyChecking=no ubuntu@${public_dns} "df -h | grep ${file_system_id}"
54 | do
55 | sleep 5
56 | done
57 |
58 | echo "Mount the EFS Pack folder to the /home/ubuntu/packs"
59 | ssh -i "${private_key_location}" ubuntu@${public_dns} "rm -rf ~/packs && mkdir ~/packs"
60 | ssh -i "${private_key_location}" ubuntu@${public_dns} "sudo mount -t nfs -o nfsvers=4.1,rsize=1048576,wsize=1048576,hard,timeo=600,retrans=2,noresvport ${efs_dns_name}:/${packs_folder} /home/ubuntu/${packs_folder}"
61 |
62 | # list of PACK files you want to copy to the AVH EC2 instance (e.g. Active-Semi.PAC52XX.2.1.0)
63 | scp -i "${private_key_location}" ${pack_name} ubuntu@${public_dns}:/tmp/.
64 |
65 | # Install the local pack files into EFS packs folder
66 | ssh -i "${private_key_location}" ubuntu@${public_dns} "CMSIS_PACK_ROOT=~/${packs_folder} /opt/ctools/bin/cpackget pack add /tmp/${pack_name}"
67 |
68 | echo "Terminating instance ${instance_id}..."
69 | aws ec2 terminate-instances \
70 | --instance-ids ${instance_id}
71 |
72 | echo "Waiting for instance ${instance_id} to be terminated"
73 | aws ec2 wait instance-terminated \
74 | --instance-ids ${instance_id}
75 |
--------------------------------------------------------------------------------
/infrastructure/cloudformation/misc/efs/setup_avh_efs_for_packs.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | # This script aims to setup a pack folder into a new
4 | # EFS. Run it just once.
5 |
6 | # Please change the user_data.txt variables according
7 | # to your info. E.g:
8 | # - efs_mount_point_1=/mnt/efs/fs1
9 | # - file_system_id_1=fs-066cf410af2428e2f
10 | # - efs_dns_name=fs-066cf410af2428e2f.efs.eu-west-1.amazonaws.com
11 | # - pack_folder=packs
12 |
13 | ################################
14 | # PLEASE MODIFY THE VARS BELOW #
15 | ################################
16 | # You can use any Ubuntu image
17 | image_id="ami-0520f21724d333fa7"
18 | instance_type="t2.micro"
19 | # Use the Mount Point Subnet
20 | subnet_id="subnet-025b7baebd743a68b"
21 | # Use the AVH EFS Security Group
22 | security_group_ids="sg-0a9aa42b4737b3f86 sg-03afe5ec007b4bcb0"
23 | key_name="common"
24 | user_data="file://user_data.txt"
25 |
26 | echo "Creating an AVH EC2 instance that setup a new EFS..."
27 | instance_id=$(aws --output text ec2 run-instances \
28 | --image-id ${image_id} \
29 | --instance-type ${instance_type} \
30 | --subnet-id ${subnet_id} \
31 | --security-group-ids ${security_group_ids} \
32 | --key-name ${key_name} \
33 | --associate-public-ip-address \
34 | --user-data ${user_data} | awk '/INSTANCES/{print $9}')
35 |
36 | echo "Waiting instance ${instance_id} to be running..."
37 | aws ec2 wait instance-running \
38 | --instance-ids ${instance_id}
39 |
40 | echo "Waiting instance ${instance_id} to be status OK..."
41 | aws ec2 wait instance-status-ok \
42 | --instance-ids ${instance_id}
43 |
44 | echo "Sleeping for 180s to be sure cloud init was executed"
45 | sleep 180
46 |
47 | echo "Terminating instance ${instance_id}..."
48 | aws ec2 terminate-instances \
49 | --instance-ids ${instance_id}
50 |
51 | echo "Waiting for instance ${instance_id} to be terminated"
52 | aws ec2 wait instance-terminated \
53 | --instance-ids ${instance_id}
54 |
--------------------------------------------------------------------------------
/infrastructure/cloudformation/misc/efs/user_data.txt:
--------------------------------------------------------------------------------
1 | #cloud-config
2 | package_update: false
3 | package_upgrade: false
4 | runcmd:
5 | - efs_mount_point_1=/mnt/efs/fs1
6 | - file_system_id_1=fs-014b24a7f24f3d529
7 | - efs_dns_name=fs-014b24a7f24f3d529.efs.eu-west-1.amazonaws.com
8 | - pack_folder=packs
9 | - yum install -y amazon-efs-utils
10 | - apt-get -y install amazon-efs-utils
11 | - yum install -y nfs-utils
12 | - apt-get -y install nfs-common
13 | - mkdir -p "${efs_mount_point_1}"
14 | - test -f "/sbin/mount.efs" && printf "\n${file_system_id_1}:/ ${efs_mount_point_1} efs tls,_netdev\n" >> /etc/fstab || printf "\n${efs_dns_name}:/ ${efs_mount_point_1} nfs4 nfsvers=4.1,rsize=1048576,wsize=1048576,hard,timeo=600,retrans=2,noresvport,_netdev 0 0\n" >> /etc/fstab
15 | - test -f "/sbin/mount.efs" && grep -ozP 'client-info]\nsource' '/etc/amazon/efs/efs-utils.conf'; if [[ $? == 1 ]]; then printf "\n[client-info]\nsource=liw\n" >> /etc/amazon/efs/efs-utils.conf; fi;
16 | - retryCnt=15; waitTime=30; while true; do mount -a -t efs,nfs4 defaults; if [ $? = 0 ] || [ $retryCnt -lt 1 ]; then echo File system mounted successfully; break; fi; echo File system not available, retrying to mount.; ((retryCnt--)); sleep $waitTime; done;
17 | - mkdir -p "${efs_mount_point_1}/${pack_folder}"
18 | - /opt/ctools/bin/cpackget init ${efs_mount_point_1}/${pack_folder}
19 | - chown -R ubuntu:ubuntu "${efs_mount_point_1}/${pack_folder}"
20 |
--------------------------------------------------------------------------------