STM32F103C8Tx - MPU

Nitroblue 1·2025년 8월 25일

the STM32 family includes a Memory Protection Unit (MPU) that can be present on some STM32 microcontrollers (MCUs), but it is not a guaranteed component in all devices and its presence depends on the specific microcontroller. The MPU is an optional feature, primarily found on higher-end Cortex-M-based STM32 microcontrollers, like those in the Cortex-M4 and M7 series, to enhance system security and reliability by preventing unauthorized memory access.


  • what is the MPU?
    The MPU (Memory Protection Unit) is an optional component within the ARM Cortex-M cores found in some STM32 microcontrollers.
    Its purpose is to define access permissions for different memory regions, making the system more robust and secure.

  • Where is it Found?
    The MPU is an optional component and is not present on all STM32 products.
    It is included in many STM32 MCUs that feature Cortex-M4 and Cortex-M7 cores.
    To confirm if a specific STM32 microcontroller has an MPU, you must check its datasheet.

  • How it Works and Why it's Used

  1. Memory Access Control:
    The MPU allows you to configure different regions of memory, defining what types of access (read, write, execute) are permitted within those regions.
  2. Enhanced Reliability:
    By preventing user applications from corrupting critical data, such as operating system kernels, the MPU makes embedded systems more stable.
  3. Improved Security:
    It can be used to make memory regions non-executable (XN), which helps to prevent code injection attacks.

Configuration:
The MPU needs to be programmed and enabled before it can be used. Tools like STM32CubeMX can be used to configure the MPU.


결론) 내 보드엔 MPU가 없다.

혹시 모르니 진짜로 MPU가 없는지 확인해보는 방법

좋은 질문이에요 👍
안타깝지만 Ubuntu bash(Wsl)에서 그냥 명령어 하나로 “이 보드에 MPU가 있다/없다”를 바로 알 수는 없습니다.
왜냐하면 MPU는 CPU 코어 안의 하드웨어 기능 비트이고, 이건 리눅스 쉘에서 읽어낼 수 있는 게 아니라 실제 칩 위에서 코드가 돌아가야 확인되거든요.

방법 1. 데이터시트/레퍼런스 매뉴얼 확인

STM32F103C8T6 (Cortex-M3, ST F1 시리즈)는 공식 문서에 **“MPU not present”**라고 되어 있습니다.
따라서 실험해보지 않아도 없다는 결론이에요.

방법 2. 직접 코드 실행해서 확인

만약 실제로 확인하고 싶으면, 간단한 펌웨어를 올려서 MPU->TYPE 레지스터를 읽어보면 됩니다.

#include "stm32f10x.h"
#include <stdio.h>
int main(void) {
    // MPU->TYPE: bits[15:8] = DREGION (number of supported regions)
    uint32_t type = MPU->TYPE;
    uint32_t regions = (type >> 8) & 0xFF;
if (regions == 0) {
        printf("No MPU present\n");
    } else {
        printf("MPU present, regions = %lu\n", regions);
    }
    while (1);
}

STM32F103에서는 regions == 0이 나올 겁니다.

방법 3. gdb/openocd로 레지스터 읽기

보드를 PC에 연결한 뒤, arm-none-eabi-gdb + OpenOCD / ST-Link 유틸로 붙어서 **MPU TYPE 레지스터 주소(0xE000ED90)**를 읽을 수도 있어요.

(gdb) monitor mdw 0xE000ED90 1
  • 값이 0x00000000 → MPU 없음
  • 값이 0x0080xxxx 처럼 나오면 → MPU 있음 (region 수 확인 가능)

✅ 결론:
Ubuntu bash 단독 명령어로는 불가능 → 칩에 직접 코드나 디버거를 붙여야 확인 가능.
하지만 STM32F103C8T6은 문서상 확정적으로 MPU 없음이에요.

??? 허허...

0개의 댓글