/* Keep D3/SRD in run mode */ MODIFY_REG (PWR->CPUCR, PWR_CPUCR_RUN_D3, D3State); }
/******************** Bit definition for PWR_CPUCR register *****************/ #define PWR_CPUCR_RUN_D3_Pos (11U) #define PWR_CPUCR_RUN_D3_Msk (0x1UL << PWR_CPUCR_RUN_D3_Pos) /*!< 0x00000800 */ #define PWR_CPUCR_RUN_D3 PWR_CPUCR_RUN_D3_Msk /*!< Keep system D3 domain in RUN mode regardless of the CPU sub-systems modes */
/******************** Bit definition for PWR_CPU2CR register ****************/ #define PWR_CPU2CR_RUN_D3_Pos (11U) #define PWR_CPU2CR_RUN_D3_Msk (0x1UL << PWR_CPU2CR_RUN_D3_Pos) /*!< 0x00000800 */ #define PWR_CPU2CR_RUN_D3 PWR_CPU2CR_RUN_D3_Msk /*!< Keep system D3 domain in RUN mode regardless of the CPU sub-systems modes */
7.6.1 Operating modes Several system operating modes are available to tune the system according to the performance required, i.e. when the CPU(s) do not need to execute code and are waiting for an external event. It is up to the user to select the operating mode that gives the best compromise between low power consumption, short startup time and available wakeup sources. The operating modes allow controlling the clock distribution to the different system blocks and powering them. The system operating mode is driven by CPU1 subsystem, CPU2 subsystem and system D3 autonomous wakeup. A CPU subsystem can include multiple domains depending on its peripheral allocation (see Section 9.5.11: Peripheral clock gating control). The following operating modes are available for the different system blocks (see Table 34): • CPU subsystem modes: – CRun CPU and CPU subsystem peripheral allocated via RCC PERxEN bits are clocked. – CSleep: The CPU clocks is stalled and the CPU subsystem allocated peripheral(s) clock operate according to RCC PERxLPEN. – CStop: CPU and CPU subsystem peripheral clocks are stalled. • D1 domain and D2 domain modes: – DRun The domain bus matrix is clocked: - The domain CPU subsystem(a) is in CRun or CSleep mode, or - the other domain CPU subsystem(a) having an allocated peripheral in the domain is in CRun or CSleep mode. – DStop The domain bus matrix clock is stalled: - The domain CPU subsystem is in CStop mode and - The other domain CPU subsystem has no peripheral allocated in the domain. or the other domain CPU subsystem having an allocated peripheral in the domain is also in CStop mode and - At least one PDDS_Dn(b) bit for the domain select DStop. – DStandby The domain is powered down: - The domain CPU subsystem is in CStop mode and - The other domain CPU subsystem has no peripheral allocated in the domain or the other domain CPU subsystem having an allocated peripheral in the domain is also in CStop mode and - All PDDS_Dn(b) bits for the domain select DStandby mode. • System /D3 domain modes – Run/Run* The system clock and D3 domain bus matrix clock are running: - A CPU subsystem is in CRun or CSleep mode or - A wakeup signal is active. (i.e. System D3 autonomous mode) The Run* mode is entered after a POR reset and a wakeup from Standby. In Run* mode, the performance is limited and the system supply configuration shall be programmed in PWR control register 3 (PWR_CR3). The system enters Run mode only when the ACTVOSRDY bit in PWR control status register 1 (PWR_CSR1) is set to 1. – Stop The system clock and D3 domain bus matrix clock is stalled: - both CPU subsystems are in CStop mode. and - all wakeup signals are inactive. and - At least one PDDS_Dn(b) bit for any domain select Stop mode. – Standby The system is powered down: - both CPU subsystems are in CStop mode and - all wakeup signals are inactive. and - All PDDS_Dn(b) bits for all domains select Standby mode. In Run mode, power consumption can be reduced by one of the following means: •Lowering the system performance by slowing down the system clocks and reducing the VCORE supply level through VOS voltage scaling bits. •Gating the clocks to the APBx and AHBx peripherals when they are not used, through PERxEN bits.
a. The domain CPU subsystem, for example CPU1 subsystem for D1 domain. a. The other domain CPU subsystem, for example CPU1 subsystem for D2 domain.
9 Reset and Clock Control (RCC) The RCC block manages the clock and reset generation for the whole microcontroller, which embeds two CPUs: an Arm® Cortex®-M7 and an Arm® Cortex®-M4, called CPU1 and CPU2, respectively. The RCC block is located in the D3 domain (refer to Section 7: Power control (PWR) for a detailed description). The operating modes this section refers to are defined in Section 7.6.1: Operating modes of the PWR block.
This application note describes how to manage the memory protection unit (MPU) in the STM32 products The MPU is an optional component for the memory protection. Including the MPU in the STM32 microcontrollers (MCUs) makes them more robust and reliable. The MPU must be programmed and enabled before using it. If the MPU is not enabled, there is no change in the memory system behavior. This application note concerns all the STM32 products listed in Table 1 that include the Cortex®-M0+/M3/M4 and M7 design that
supports the MPU. For more details about the MPU, refer to the following documents available on http://www.st.com • Programming manual STM32F7 series and STM32H7 series Cortex®-M7 processor (PM0253) • Programming manual STM32F10xxx/20xxx/21xxx/L1xxxx Cortex®-M3 (PM0056) • Programming manual STM32 Cortex®-M0+ MCUs programming manual (PM0223) • Programming manual STM32 Cortex®-M4 MCUs and MPUs (PM0214) • Programming manual STM32 Cortex®-M33 MCUs (PM0264) Table 1. Applicable products
Type Product series Microcontrollers • STM32C0 series • STM32F1 series, STM32F2 series, STM32F3 series, STM32F4 series, STM32F7 series • STM32G0 series, STM32G4 series • STM32H5 series, STM32H7 series • STM32L0 series, STM32L1 series, STM32L4 series, STM32L4+ series, STM32L5 series • STM32U0 series, STM32U5 series • STM32WB series, STM32WB0 series
3.2 Memory protection unit (MPU) The devices feature two memory protection units. Each MPU manages the CPU access rights and the attributes of the system resources. It has to be programmed and enabled before use. Its main purposes are to prevent an untrusted user program to accidentally corrupt data used by the OS and/or by a privileged task, but also to protect data processes or read-protect memory regions. The MPU defines access rules for privileged accesses and user program accesses. It allows defining up to 16 protected regions that can in turn be divided into up to 8 independent subregions, where region address, size, and attributes can be configured. The protection area ranges from 32 bytes to 4 Gbytes of addressable memory. When an unauthorized access is performed, a memory management exception is generated.
리눅스 버전 받으면 zip으로 받아지고, 압축풀면 아래와 같이 exe와 linux 파일이 생기는데
linux는 900kb 정도로 용량이 작아서 쉘 스크립트 치곤 크네.. 하고 봤더니 ELF 실행파일.
그냥 ./SetupSTM32CubeProgrammer-2.17.0.linux 로 실행하면 된다.
$ file * SetupSTM32CubeProgrammer-2.17.0.exe: PE32 executable (GUI) Intel 80386 (stripped to external PDB), for MS Windows SetupSTM32CubeProgrammer-2.17.0.linux: ELF 64-bit LSB executable, x86-64, version 1 (GNU/Linux), statically linked, for GNU/Linux 3.2.0, BuildID[sha1]=bcc7be207b463b7b004b10f7078d9d2be84d3902, with debug_info, not stripped jre: directory
Dual core • 32-bit Arm® Cortex®-M7 core with doubleprecision FPU and L1 cache: 16 Kbytes of data and 16 Kbytes of instruction cache; frequency up to 480 MHz, MPU, 1027 DMIPS/ 2.14 DMIPS/MHz (Dhrystone 2.1), and DSP instructions • 32-bit Arm® 32-bit Cortex®-M4 core with FPU, Adaptive real-time accelerator (ART Accelerator) for internal flash memory and external memories, frequency up to 240 MHz, MPU, 300 DMIPS/1.25 DMIPS /MHz (Dhrystone 2.1), and DSP instructions
ART 가속에 대해서는 머라머라 써있는데 이해를 못하겠고..
대충 온칩 메모리(SRAM)과 플래시에 대해서 대기없는 접근이 가능하다 정도로 이해..
그런데 Cortex-M4 에만 달려서 테시등을 확인하는걸 보면.. M4 쪽이 slave 구성인가 싶기도 하다
The acceleration is achieved by loading selected code into an embedded cache and making it instantly available to the Cortex-M4 core, thus avoiding latency due to memory wait states.
ART™ accelerator features: • 32-bit AHB slave port to interface with the D2 domain • 32-bit AHB master port for non-cacheable memory accesses • 64-bit AXI master port to load the code from memory to cache • 64 cache lines of 256 bits • Fully-associative cache • Programmable cacheable page • Cache content consistency checker
D1 domain 에는 cortex-M7이 있는 것 같고. M7 에만 TCM(tightly coupled memory)가 달려있다.
D2 domain 에는 Cortex-M4가 있고 플래시가 없다? D1 domain으로 접근해서 Flash에서 펌웨어를 불러오게 되는 구조 같다.
D3 domain 에는 DBMA / SDRAM 64k / Backup SRAM 4k 가 있는데 얘는 절전모드 용인가?
AHB는 1<->2<->3 그리고 1<->3 간에 존재하여 어느쪽이던 많이 돌지 않고 접근이 가능하다.
부팅은 BOOT0 핀과 BOOT_ADDx 옵션 바이트에 의해서 결정되는데
BOOT0 핀이 0이면
CM7은 플래시의 0x0800_000을 사용하고
CM4는 플래시의 0x0810_000을 사용한다.
BCM4/7은 SYSCFG_UR1 레지스터에 존재하는 녀석인데 얜 어느 시점에 누가 설정하지?
3.2 Dual-core boot At startup, the boot memory space is selected by the BOOT pin and BOOT_ADDx option bytes, allowing to program any boot memory address from 0x0000 0000 to 0x3FFF FFFF which includes all Flash address space, all RAM address space (ITCM, DTCM RAMs and SRAMs) and the System memory bootloader. The boot address is provided by option byte and default programmed value to allow: • CM7 Boots from Flash memory at 0x0800 0000 when Boot0=0 • CM4 Boots from Flash memory at 0x0810 0000 when Boot0=0 • Boot respectively from System memory or SRAM1 when Boot0=1 The values on the BOOT pin are latched on the 4th rising edge of SYSCLK after reset release. It is up to the user to set the BOOT pin after reset as shown in the figure below.
If the programmed boot memory address is out of the memory mapped area or a reserved area, the default boot fetch address is: • BCM7_ADD0: FLASH at 0x0800 0000 • BCM4_ADD0: FLASH at 0x0810 0000 • BCM7_ADD1: System Memory at 0x1FF0 0000 • BCM4_ADD1: SRAM1 at 0x1000 0000 When Flash level 2 protection is enabled, only boot from Flash or system is available. If boot address is out of the memory range or RAM address, then the default fetch is forced from Flash at address 0x0800 0000 for Cortex®‑M7 and Flash at address 0x0810 0000 for Cortex®-M4. In the STM32H7 dual‑core, to maximize energy efficiency, each core operates in its own power domain and can be turned off individually when not needed. The two cores can boot alone or in the same time according to the option bytes as shown in Table 4.
circuit python 에서 import machine 하면 모듈이 없다고 해서 찾아보니
micropython 에서 제공하는 녀석이라고 한다.
machine is a built-in module in MicroPython which means it's part of MicroPython itself. CircuitPython and MicroPython similar but not exactly the same. One difference is that CircuitPython has no built-in module called machine.