Part 1
요약·해설
MPU region, world별 우선순위, EM Starter Kit·nSIM SEM의 debugger 실행 절차를 설명합니다.
ARC SecureShield
Secure 1/2 · Normal 1/2
Bootloader · GDB
Part 2
접을 수 있는 영어 원문 전체
영어 원문 전체 펼치기
2E0C83E7B4C4BA960FA4D89781D287CECFC898D4A7EE4835A1A9B32475F8FD32
.. _arc_secure_service:
ARC Secure Service
##################
Overview
********
This sample implements a simple secure service based on ARC SecureShield to
demonstrate how a secure zephyr application runs together with a normal
Zephyr application.
In this sample:
* Secure application will be in the secure memory space defined in
``arc_mpu_regions.c``. Half of RAM and ROM is allocated to secure world,
the other half is allocated to normal world.
* Memory not allocated to the secure application is allocated to
the normal application.
* By default, all the peripheral space is normal mode accessible, i.e.,
the peripherals are shared between normal mode and secure mode. If some
peripherals are required by secure world, it can be done by adding static
mpu entry in ``arc_mpu_regions.c``.
* The interrupts of two internal timers are configure as normal interrupts,
so the normal zephyr's kernel tick can work correctly.
* Secure interrupts priority > secure threads priority > normal interrupts
priority > normal threads priority.
Requirements
************
To use this sample, ARC processor should be equipped with ARC SecureShield. In
Zephyr, the following board configurations are supported:
* em_starterkit_em7d
* secure application: em_starterkit_em7d_secure
* normal application: em_starterkit_em7d_normal
* nsim_sem
* secure application: nsim_sem
* normal application: nsim_sem_normal
Building and Running
********************
Building
========
Secure application
^^^^^^^^^^^^^^^^^^
First, you should build the secure application.
.. zephyr-app-commands::
:zephyr-app: samples/boards/arc_secure_services
:board: em_starterkit_em7d_secure nsim_sem
:goals: build
:compact:
Normal application
^^^^^^^^^^^^^^^^^^
Currently, in normal application, MPU is not accessible, so no user space and
mpu-based stack checking. Please copy the specific dts file and def_config
file to the specific board dir to build normal application.
Here,take :ref:'dining-philosophers-sample' as an example for normal
application.
.. zephyr-app-commands::
:zephyr-app: samples/philosophers
:board: em_starterkit_em7d_normal nsim_sem_normal
:goals: build
:compact:
Running
=======
* Run using the bootloader
The bootloader should load the secure and normal application into the correct place,
then jump to the entry of the secure application. The entry of normal application
is hardcoded in secure application. Secure application will boot normal application.
* Run using the debugger (recommended)
Use the gdb debugger to load and run the two applications.
For em starter kit, run the following commands
.. code-block:: console
# load secure application first
$ cd samples/boards/arc_secure_services/build
$ west debug
# load normal application
$ monitor load_image ../../../philosophers/build/zephyr/zephyr.elf
$ c
For nsim sem, you need two consoles: one for application output, and one for
debugger.
In the console for output:
.. code-block:: console
# open debug server
$ cd samples/boards/arc_secure_services/build
$ west debugserver
In the console for debugger:
.. code-block:: console
# open debug server
$ cd samples/boards/arc_secure_services/build
$ arc-elf32-gdb zephyr/zephyr.elf
$ target remote :3333
# load normal application
$ load ../../../philosophers/build/zephyr/zephyr.elf
# load secure application
$ load
$ c
Part 3
한국어 전문 번역
개요
이 sample은 ARC SecureShield 기반의 간단한 secure service를 구현해 secure Zephyr application과 normal Zephyr application이 함께 실행되는 방식을 보여줍니다.
이 sample의 구성은 다음과 같습니다.
- Secure application은
arc_mpu_regions.c에 정의된 secure memory space에 배치됩니다. RAM과 ROM의 절반은 secure world에, 나머지 절반은 normal world에 할당됩니다. - Secure application에 할당되지 않은 memory는 normal application에 할당됩니다.
- 기본적으로 모든 peripheral space는 normal mode에서 접근할 수 있으므로 peripheral을 normal mode와 secure mode가 공유합니다. Secure world 전용 peripheral이 필요하면
arc_mpu_regions.c에 static MPU entry를 추가할 수 있습니다. - 두 internal timer의 interrupt는 normal interrupt로 설정되므로 normal Zephyr의 kernel tick이 올바르게 동작할 수 있습니다.
- 우선순위는 secure interrupt, secure thread, normal interrupt, normal thread 순입니다.
요구사항
이 sample을 사용하려면 ARC processor에 ARC SecureShield가 탑재되어 있어야 합니다. Zephyr는 다음 board configuration을 지원합니다.
em_starterkit_em7d- Secure application:
em_starterkit_em7d_secure - Normal application:
em_starterkit_em7d_normal
- Secure application:
nsim_sem- Secure application:
nsim_sem - Normal application:
nsim_sem_normal
- Secure application:
Build와 실행
Build
Secure application
먼저 secure application을 build해야 합니다.
west build -b em_starterkit_em7d_secure nsim_sem samples/boards/arc_secure_services
Normal application
현재 normal application에서는 MPU에 접근할 수 없으므로 user space와 MPU 기반 stack checking을 사용할 수 없습니다. Normal application을 build하려면 해당 DTS file과 def_config file을 대상 board directory에 복사하십시오.
여기서는 normal application의 예로 Dining Philosophers sample을 사용합니다.
west build -b em_starterkit_em7d_normal nsim_sem_normal samples/philosophers
실행
- Bootloader 사용: Bootloader가 secure application과 normal application을 올바른 위치에 적재한 뒤 secure application entry로 이동해야 합니다. Normal application entry는 secure application에 hardcode되어 있으며, secure application이 normal application을 boot합니다.
- Debugger 사용(권장): GDB debugger로 두 application을 적재하고 실행합니다.
EM Starter Kit에서는 다음 명령을 실행합니다.
# load secure application first
$ cd samples/boards/arc_secure_services/build
$ west debug
# load normal application
$ monitor load_image ../../../philosophers/build/zephyr/zephyr.elf
$ c
nSIM SEM에서는 application 출력용 console과 debugger용 console 두 개가 필요합니다.
출력용 console에서 다음과 같이 debug server를 엽니다.
# open debug server
$ cd samples/boards/arc_secure_services/build
$ west debugserver
Debugger용 console에서는 다음 명령을 실행합니다.
# open debug server
$ cd samples/boards/arc_secure_services/build
$ arc-elf32-gdb zephyr/zephyr.elf
$ target remote :3333
# load normal application
$ load ../../../philosophers/build/zephyr/zephyr.elf
# load secure application
$ load
$ c
Source
출처
영어 원문에는 문단, 문서 지시문, 표, 코드, 코드 심벌, 경로를 그대로 보존했습니다.