boards/arm/v2m_musca_b1/doc/index.html · boards/arm/v2m_musca_b1/doc/index.rst 공식 원문 ↗

Zephyr 3.7.0 · Arm Musca B1 · Cortex-M33

Arm V2M Musca B1

Cortex-M33와 SSE-200을 기반으로 Secure/Non-Secure firmware를 검증하는 Musca B1 test-chip board입니다.

Official pathboards/arm/v2m_musca_b1/doc/index.html
Source fileboards/arm/v2m_musca_b1/doc/index.rst
Source versionZephyr 3.7.0
TranslationFull · reviewed

본문 기준: Zephyr 3.7.0 LTS3 · 이후 유지보수 패치는 별도입니다.

Part 1

요약·해설

Musca B1은 Cortex-M33, on-chip eFlash 4 MB, QSPI 8 MB와 DAPLink를 제공합니다. 기본 boot는 eFlash이며 Zephyr console은 UART1입니다.

Arm V2M Musca B1
Arm V2M Musca B1. 이미지 출처: Arm, Zephyr 3.7.0.
CPU

Arm Cortex-M33

Memory

512 KB SRAM · 4 MB eFlash · 8 MB QSPI

Clock

CPU0 40 MHz · CPU1 up to 160 MHz

Part 2

접을 수 있는 영어 원문 전체

영어 원문 전체 펼치기
원문 SHA-256 C435338401DF861E36CF81422A26B47FF308D7181F99F7EFBE02EB01CF1CFBFC
.. _v2m_musca_b1_board:

ARM V2M Musca B1
################

Overview
********

The v2m_musca_b1 board configuration is used by Zephyr applications that run
on the V2M Musca B1 board. It provides support for the Musca B1 ARM Cortex-M33
CPU and the following devices:

- Nested Vectored Interrupt Controller (NVIC)
- System Tick System Clock (SYSTICK)
- Cortex-M System Design Kit GPIO
- Cortex-M System Design Kit UART

.. image:: ../../../../../../../boards/arm/v2m_musca_b1/doc/img/v2m_musca_b1.jpg
     :align: center
     :alt: ARM V2M Musca B1

More information about the board can be found at the `V2M Musca B1 Website`_.

Hardware
********

ARM V2M MUSCA B1 provides the following hardware components:



- ARM Cortex-M33
- ARM IoT Subsystem for Cortex-M33
- Memory

  - 512KB on-chip system memory SRAM.
  - 8MB of external QSPI flash.
  - 4MB on-chip boot eFlash.

- Debug

  - JTAG, SWD & 4 bit TRACE.
  - DAPLink with a virtual UART port.

- Arduino interface

  - 16 3V3 GPIO.
  - UART.
  - SPI.
  - I2C.
  - I2S.
  - 3-channel PWM.
  - 6-channel analog interface.

- On-board Peripherals

  - User RGB LED.
  - Gyro sensor.
  - Combined ADC/DAC/temperature sensor.
  - Secure Digital I/O (SDIO) microSD card.


User push buttons
=================

The v2m_musca_b1 board provides the following user push buttons:

- PBON power on/off.
- nSRST: Cortex-M33 system reset and CoreSight debug reset.
- ISP: Updates DAPLink firmware.


Supported Features
===================

The v2m_musca_b1 board configuration supports the following hardware features:

+-----------+------------+-------------------------------------+
| Interface | Controller | Driver/Component                    |
+===========+============+=====================================+
| NVIC      | on-chip    | nested vector interrupt controller  |
+-----------+------------+-------------------------------------+
| SYSTICK   | on-chip    | systick                             |
+-----------+------------+-------------------------------------+
| UART      | on-chip    | serial port-polling;                |
|           |            | serial port-interrupt               |
+-----------+------------+-------------------------------------+
| PINMUX    | on-chip    | pinmux                              |
+-----------+------------+-------------------------------------+
| GPIO      | on-chip    | gpio                                |
+-----------+------------+-------------------------------------+
| WATCHDOG  | on-chip    | watchdog                            |
+-----------+------------+-------------------------------------+
| TIMER     | on-chip    | timer                               |
+-----------+------------+-------------------------------------+

Other hardware features are not currently supported by the port.
See the `V2M Musca B1 Website`_ for a complete list of V2M Musca board hardware
features.

The default configuration can be found in the defconfig file:
:zephyr_file:`boards/arm/v2m_musca_b1/v2m_musca_b1_defconfig`.

Interrupt Controller
====================

Musca B1 is a Cortex-M33 based SoC and has 15 fixed exceptions and 77 IRQs.

A Cortex-M33-based board uses vectored exceptions. This means each exception
calls a handler directly from the vector table.

Zephyr provides handlers for exceptions 1-7, 11, 12, 14, and 15, as listed
in the following table:

+------+------------+----------------+--------------------------+
| Exc# | Name       | Remarks        | Used by Zephyr Kernel    |
+======+============+================+==========================+
|  1   | Reset      |                | system initialization    |
+------+------------+----------------+--------------------------+
|  2   | NMI        |                | system fatal error       |
+------+------------+----------------+--------------------------+
|  3   | Hard fault |                | system fatal error       |
+------+------------+----------------+--------------------------+
|  4   | MemManage  | MPU fault      | system fatal error       |
+------+------------+----------------+--------------------------+
|  5   | Bus        |                | system fatal error       |
+------+------------+----------------+--------------------------+
|  6   | Usage      | Undefined      | system fatal error       |
|      | fault      | instruction,   |                          |
|      |            | or switch      |                          |
|      |            | attempt to ARM |                          |
|      |            | mode           |                          |
+------+------------+----------------+--------------------------+
|  7   | SecureFault| Unauthorized   | system fatal error       |
|      |            | access to      |                          |
|      |            | secure region  |                          |
|      |            | from ns space  |                          |
+------+------------+----------------+--------------------------+
|  8   | Reserved   |                | not handled              |
+------+------------+----------------+--------------------------+
|  9   | Reserved   |                | not handled              |
+------+------------+----------------+--------------------------+
| 10   | Reserved   |                | not handled              |
+------+------------+----------------+--------------------------+
| 11   | SVC        |                | system calls, kernel     |
|      |            |                | run-time exceptions,     |
|      |            |                | and IRQ offloading       |
+------+------------+----------------+--------------------------+
| 12   | Debug      |                | system fatal error       |
|      | monitor    |                |                          |
+------+------------+----------------+--------------------------+
| 13   | Reserved   |                | not handled              |
+------+------------+----------------+--------------------------+
| 14   | PendSV     |                | context switch           |
+------+------------+----------------+--------------------------+
| 15   | SYSTICK    |                | system clock             |
+------+------------+----------------+--------------------------+
| 16   | Reserved   |                | not handled              |
+------+------------+----------------+--------------------------+
| 17   | Reserved   |                | not handled              |
+------+------------+----------------+--------------------------+
| 18   | Reserved   |                | not handled              |
+------+------------+----------------+--------------------------+

Pin Mapping
===========

The ARM V2M Musca B1 Board has 4 GPIO controllers. These controllers are
responsible for pin-muxing, input/output, pull-up, etc.

All GPIO controller pins are exposed via the following sequence of pin numbers:

- Pins 0 - 15 are for GPIO

Mapping from the ARM V2M Musca B1 Board pins to GPIO controllers:

.. rst-class:: rst-columns

   - D0 : P0_0
   - D1 : P0_1
   - D2 : P0_2
   - D3 : P0_3
   - D4 : P0_4
   - D5 : P0_5
   - D6 : P0_6
   - D7 : P0_7
   - D8 : P0_8
   - D9 : P0_9
   - D10 : P0_10
   - D11 : P0_11
   - D12 : P0_12
   - D13 : P0_13
   - D14 : P0_14
   - D15 : P0_15

Peripheral Mapping:

.. rst-class:: rst-columns

   - UART_0_RX : D0
   - UART_0_TX : D1
   - SPI_0_CS : D10
   - SPI_0_MOSI : D11
   - SPI_0_MISO : D12
   - SPI_0_SCLK : D13
   - I2C_0_SDA : D14
   - I2C_0_SCL : D15

For more details please refer to `Musca B1 Technical Reference Manual (TRM)`_.


RGB LED
============

Musca B1 has a built-in RGB LED connected to GPIO[4:2] pins.

- Red LED connected at GPIO[2] pin,with optional PWM0.
- Green LED connected at GPIO[3] pin,with optional PWM1.
- Blue LED connected at GPIO[4] pin,with optional PWM2.

.. note:: The SCC registers select the functions of pins GPIO[4:2].

System Clock
============

V2M Musca B1 has a 32.768kHz crystal clock. The clock goes to a PLL and is
multiplied to drive the Cortex-M33 processors and SSE-200 subsystem. The
default is 40MHz but can be increased to 160MHz maximum for the secondary
processor (CPU1) via software configuration. The maximum clock frequency
for the primary processor (CPU0) is 40MHz.

Serial Port
===========

The ARM Musca B1 processor has two UARTs. Both the UARTs have only two wires
for RX/TX and no flow control (CTS/RTS) or FIFO. The Zephyr console output,
by default, uses UART1.

Security components
===================

- Implementation Defined Attribution Unit (`IDAU`_). The IDAU is used to define
  secure and non-secure memory maps. By default, all of the memory space is
  defined to be secure accessible only.
- Secure and Non-secure peripherals via the Peripheral Protection Controller
  (PPC). Peripherals can be assigned as secure or non-secure accessible.
- Secure boot.
- Secure `AMBA®`_ interconnect.

Serial Configuration Controller (SCC)
=====================================

The ARM Musca B1 test chip implements a Serial Configuration Control (SCC)
register. The purpose of this register is to allow individual control of
clocks, reset-signals and interrupts to peripherals, and pin-muxing.

Boot memory
================
Normal Musca-B1 test chip boot operation is from 4MB eFlash by default, and
it offers the fastest boot method.
Musca-B1 test chip also support to boot from 8MB QSPI. You can update the
DAPLink firmware for either QSPI or eFlash for booting.

Programming and Debugging
*************************

Musca B1 supports the v8m security extension, and by default boots to the
secure state.

When building a secure/non-secure application, the secure application will
have to set the idau/sau and mpc configuration to permit access from the
non-secure application before jumping.

The following system components are required to be properly configured during the
secure firmware:

- AHB5 TrustZone Memory Protection Controller (MPC).
- AHB5 TrustZone Peripheral Protection Controller (PPC).
- Implementation-Defined Attribution Unit (IDAU).

For more details please refer to `Corelink SSE-200 Subsystem`_.

Flashing
========

DAPLink
---------

V2M Musca B1 provides:

- A USB connection to the host computer, which exposes a Mass Storage and an
  USB Serial Port.
- A Serial Flash device, which implements the USB flash disk file storage.
- A physical UART connection which is relayed over interface USB Serial port.

This interfaces are exposed via DAPLink which provides:

- Serial Wire Debug (SWD).
- USB Mass Storage Device (USBMSD).
- UART.
- Remote reset.

For more details please refer
to the `DAPLink Website`_.


Building a secure only application
----------------------------------


You can build applications in the usual way. Here is an example for
the :ref:`hello_world` application.

.. zephyr-app-commands::
   :zephyr-app: samples/hello_world
   :board: v2m_musca_b1
   :goals: build

Open a serial terminal (minicom, putty, etc.) with the following settings:

- Speed: 115200
- Data: 8 bits
- Parity: None
- Stop bits: 1

Reset the board, and you should see the following message on the corresponding
serial port:

.. code-block:: console

   Hello World! musca_b1

Building a secure/non-secure with Trusted Firmware
--------------------------------------------------

The process requires five steps:

1. Build Trusted Firmware (tfm).
2. Import it as a library to the Zephyr source folder.
3. Build Zephyr with a non-secure configuration.
4. Merge the two binaries together and sign them.
5. Concatenate the bootloader with the signed image blob.

In order to build tfm please refer to `Trusted Firmware M Guide`_.
Follow the build steps for AN521 target while replacing the platform with
``-DTARGET_PLATFORM=MUSCA_B1`` and compiler (if required) with ``-DCOMPILER=GNUARM``

Copy over tfm as a library to the Zephyr project source and create a shortcut
for the secure veneers and necessary header files. All files are in the install
folder after TF-M built.

Uploading an application to V2M Musca B1
----------------------------------------

Applications must be converted to Intel's hex format before being flashed to a
V2M Musca B1. An optional bootloader can be prepended to the image.
The QSPI flash base address alias is 0x0, and the eFlash base address alias is
0xA000000.
The image offset is calculated by adding the flash offset to the
bootloader partition size.

A third-party tool (srecord) is used to generate the Intel formatted hex image.
For more information refer to the `Srecord Manual`_.

.. code-block:: bash

   srec_cat $BIN_BOOTLOADER -Binary -offset $FLASH_OFFSET $BIN_SNS -Binary -offset $IMAGE_OFFSET -o $HEX_FLASHABLE -Intel

   # For a 128K bootloader IMAGE_OFFSET = $FLASH_OFFSET + 0x20000
   srec_cat $BIN_BOOTLOADER -Binary -offset 0xA000000 $BIN_SNS -Binary -offset 0xA020000 -o $HEX_FLASHABLE -Intel

Connect the V2M Musca B1 to your host computer using the USB port. You should
see a USB connection exposing a Mass Storage (MUSCA_B) and a USB Serial Port.
Copy the generated ``zephyr.hex`` in the MUSCA_B drive.

Reset the board, and you should see the following message on the corresponding
serial port:

.. code-block:: console

   Hello World! musca_b1


.. _V2M Musca B1 Website:
   https://developer.arm.com/Tools%20and%20Software/Musca-B1%20Test%20Chip%20Board

.. _Musca B1 Technical Reference Manual (TRM):
   https://developer.arm.com/documentation/101312/latest/

.. _DAPLink Website:
   https://github.com/ARMmbed/DAPLink

.. _Cortex M33 Generic User Guide:
   https://developer.arm.com/documentation/100235/latest/

.. _Trusted Firmware M Guide:
   https://tf-m-user-guide.trustedfirmware.org/building/tfm_build_instruction.html

.. _Corelink SSE-200 Subsystem:
   https://developer.arm.com/documentation/dto0051/latest/subsystem-overview/about-the-sse-200

.. _Srecord Manual:
   https://srecord.sourceforge.net/man/man1/srec_cat.1.html

.. _IDAU:
   https://developer.arm.com/documentation/100690/latest/Attribution-units--SAU-and-IDAU-

.. _AMBA®:
   https://developer.arm.com/products/architecture/system-architectures/amba

Part 3

한국어 전문 번역

개요

v2m_musca_b1 보드 구성은 Musca B1에서 실행하는 Zephyr application용입니다. Arm Cortex-M33, NVIC, SYSTICK, CMSDK GPIO·UART를 지원합니다.

Arm V2M Musca B1 board
Arm V2M Musca B1 보드.

하드웨어

  • Arm Cortex-M33와 Cortex-M33용 Arm IoT Subsystem
  • memory: on-chip system SRAM 512 KB, external QSPI flash 8 MB, on-chip boot eFlash 4 MB
  • debug: JTAG, SWD, 4-bit TRACE, virtual UART가 있는 DAPLink
  • Arduino interface: 3.3 V GPIO 16개, UART, SPI, I2C, I2S, 3-channel PWM, 6-channel analog
  • on-board: user RGB LED, gyro sensor, ADC/DAC/temperature 복합 sensor, SDIO microSD card

User push button

  • PBON: power on/off
  • nSRST: Cortex-M33 system reset와 CoreSight debug reset
  • ISP: DAPLink firmware update

지원 기능

InterfaceControllerDriver/Component
NVICon-chipnested vector interrupt controller
SYSTICKon-chipsystick
UARTon-chipserial port-polling; serial port-interrupt
PINMUXon-chippinmux
GPIOon-chipgpio
WATCHDOGon-chipwatchdog
TIMERon-chiptimer

그 밖의 hardware는 현재 port에서 지원하지 않습니다. 기본 구성은 boards/arm/v2m_musca_b1/v2m_musca_b1_defconfig입니다.

Interrupt controller

Musca B1은 Cortex-M33 기반 SoC로 15개의 fixed exception과 77개의 IRQ가 있습니다. vectored exception을 사용하므로 각 exception이 vector table의 handler를 직접 호출합니다. Zephyr는 exception 1~7, 11, 12, 14, 15에 handler를 제공합니다.

Exc#NameRemarksZephyr kernel 용도
1Resetsystem initialization
2NMIsystem fatal error
3Hard faultsystem fatal error
4MemManageMPU faultsystem fatal error
5Bussystem fatal error
6Usage faultundefined instruction 또는 ARM mode 전환 시도system fatal error
7SecureFaultnon-secure space에서 secure region 무단 접근system fatal error
8Reservednot handled
9Reservednot handled
10Reservednot handled
11SVCsystem calls, kernel run-time exceptions, IRQ offloading
12Debug monitorsystem fatal error
13Reservednot handled
14PendSVcontext switch
15SYSTICKsystem clock
16Reservednot handled
17Reservednot handled
18Reservednot handled

Pin mapping

원문은 GPIO controller 4개가 pin muxing, input/output, pull-up 등을 담당하며 GPIO pin 0~15가 노출됩니다.

Board pinGPIO pin
D0P0_0
D1P0_1
D2P0_2
D3P0_3
D4P0_4
D5P0_5
D6P0_6
D7P0_7
D8P0_8
D9P0_9
D10P0_10
D11P0_11
D12P0_12
D13P0_13
D14P0_14
D15P0_15

Peripheral mapping

Peripheral signalDigital pin
UART_0_RXD0
UART_0_TXD1
SPI_0_CSD10
SPI_0_MOSID11
SPI_0_MISOD12
SPI_0_SCLKD13
I2C_0_SDAD14
I2C_0_SCLD15

자세한 내용은 Musca B1 Technical Reference Manual(TRM)을 참고합니다.

RGB LED

Musca B1의 built-in RGB LED는 GPIO[4:2]에 연결됩니다.

  • Red: GPIO[2], optional PWM0
  • Green: GPIO[3], optional PWM1
  • Blue: GPIO[4], optional PWM2

SCC register가 GPIO[4:2] pin function을 선택합니다.

System clock

32.768 kHz crystal clock을 PLL에서 배수해 Cortex-M33 processor와 SSE-200 subsystem을 구동합니다. 기본은 40 MHz이며 secondary processor CPU1은 software 설정으로 최대 160 MHz, primary processor CPU0은 최대 40 MHz입니다.

Serial port

UART는 2개입니다. RX/TX 두 선만 사용하고 CTS/RTS flow control과 FIFO는 없습니다. 기본 Zephyr console은 UART1입니다.

Security component

  • IDAU가 secure/non-secure memory map을 정의합니다. 기본적으로 전체 memory space는 secure-only입니다.
  • PPC로 peripheral을 secure 또는 non-secure access로 배정합니다.
  • Secure boot와 Secure AMBA interconnect를 제공합니다.

Serial Configuration Controller

Musca B1 test chip의 SCC register는 peripheral clock, reset signal, interrupt와 pin muxing을 개별 제어합니다.

Boot memory

기본 boot는 가장 빠른 4 MB eFlash에서 수행합니다. 8 MB QSPI에서도 boot할 수 있으며 QSPI 또는 eFlash boot용 DAPLink firmware로 갱신할 수 있습니다.

프로그래밍과 디버깅

Musca B1은 Armv8-M Security Extension을 지원하며 기본적으로 Secure state로 boot합니다. Secure/Non-Secure application에서는 Secure application이 jump하기 전에 Non-Secure access를 허용하도록 IDAU/SAU와 MPC를 설정해야 합니다. Secure firmware에서 AHB5 TrustZone MPC, AHB5 TrustZone PPC, IDAU를 올바르게 구성해야 합니다.

Flashing

DAPLink

USB 연결은 host에 Mass Storage와 USB Serial Port를 노출합니다. Serial Flash가 USB flash disk storage를 구현하며 physical UART는 USB Serial Port로 relay됩니다. DAPLink는 다음 interface를 제공합니다.

  • Serial Wire Debug(SWD)
  • USB Mass Storage Device(USBMSD)
  • UART
  • remote reset

Secure-only application build

west build -b v2m_musca_b1 samples/hello_world

terminal은 115200 baud, 8 data bit, parity none, 1 stop bit로 열고 reset 후 다음 출력을 확인합니다.

Hello World! musca_b1

Trusted Firmware로 Secure/Non-Secure build

과정은 다섯 단계입니다.

  1. Trusted Firmware-M(TF-M)을 build합니다.
  2. Zephyr source folder에 library로 import합니다.
  3. Non-Secure configuration으로 Zephyr를 build합니다.
  4. 두 binary를 병합하고 sign합니다.
  5. bootloader와 signed image blob을 concatenate합니다.

TF-M Guide의 AN521 절차에서 platform은 -DTARGET_PLATFORM=MUSCA_B1, 필요 시 compiler는 -DCOMPILER=GNUARM으로 바꿉니다. TF-M install folder의 secure veneer와 header file을 Zephyr project에 연결합니다.

Application upload

flash 전에 Intel HEX 형식으로 변환해야 하며 optional bootloader를 image 앞에 붙일 수 있습니다. QSPI flash base alias는 0x0, eFlash base alias는 0xA000000입니다. image offset은 flash offset에 bootloader partition size를 더해 계산합니다. Srecord 예시는 다음과 같습니다.

srec_cat $BIN_BOOTLOADER -Binary -offset $FLASH_OFFSET $BIN_SNS -Binary -offset $IMAGE_OFFSET -o $HEX_FLASHABLE -Intel

# 128K bootloader: IMAGE_OFFSET = $FLASH_OFFSET + 0x20000
srec_cat $BIN_BOOTLOADER -Binary -offset 0xA000000 $BIN_SNS -Binary -offset 0xA020000 -o $HEX_FLASHABLE -Intel

USB로 연결하면 MUSCA_B Mass Storage와 USB Serial Port가 나타납니다. 생성된 zephyr.hex를 MUSCA_B drive에 복사하고 reset한 뒤 Hello World! musca_b1을 확인합니다.

참고 자료

Source

출처

영어 원문에는 문단, 문서 지시문, 표, 코드, 코드 심벌, 경로를 그대로 보존했습니다.