embeded/Cortex-M7 STM2024. 7. 22. 14:57

MMU 처럼 메모리 관리하는건 아니고, 메모리 접근을 관리하는 녀석인듯.

 

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

[링크 : https://www.st.com/resource/en/application_note/an4838-introduction-to-memory-protection-unit-management-on-stm32-mcus-stmicroelectronics.pdf]

 

MPU는 2개 있고, 각각의 CPU에 대해서 메모리 접근을 확인한다고.

꽤 중요한 녀석인데 데이터시트에 고작 아래의 내용이 전부냐?!

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.

[링크 : https://www.st.com/resource/en/datasheet/stm32h757ai.pdf]

'embeded > Cortex-M7 STM' 카테고리의 다른 글

STM32H7 디버깅 설정(cubeIDE)  (0) 2024.07.22
STM32H750 operation mode  (0) 2024.07.22
STM32 HSEM (Hardware SEMaphore)  (0) 2024.07.22
STM32H757 User configuration  (0) 2024.07.22
STM32CubeProgrammer  (0) 2024.07.22
Posted by 구차니
embeded/Cortex-M7 STM2024. 7. 22. 14:45

multi CPU를 위한 하드웨어 세마포어 인듯.

그러니까.. 싱글 코어이거나, 이기종 CPU가 아니라면 달려있는 이유가 없는 모듈

 

[링크 : https://www.st.com/resource/en/product_training/STM32WB-System-Hardware-Semaphore-HSEM.pdf]

'embeded > Cortex-M7 STM' 카테고리의 다른 글

STM32H750 operation mode  (0) 2024.07.22
STM32 MPU(Memory Protection Unit)  (2) 2024.07.22
STM32H757 User configuration  (0) 2024.07.22
STM32CubeProgrammer  (0) 2024.07.22
stm32h757xi / stm32h757i-eval  (0) 2024.07.19
Posted by 구차니
embeded/Cortex-M7 STM2024. 7. 22. 14:00

이전에 메뉴얼 뒤지다 발견한 BCM7/BCM4는 어디서 접근이 가능한지, 설정이 가능한지 찾질 못했는데

프로그램 하나 설치하니 해피하게 해결.. -_-

[링크 : https://www.st.com/resource/en/application_note/an5557-stm32h745755-and-stm32h747757-lines-dualcore-architecture-stmicroelectronics.pdf]

 

왼쪽 세번째 아이콘 OB가 Option Bytes 인데

거기서 User Configuration 항목에 BCM4 / BCM7을 발견할 수 있다.

[링크 : https://blog.naver.com/chandong83/221652968153]

[링크 : https://www.st.com/en/development-tools/stm32cubeprog.html]

[링크 : https://blog.naver.com/chcbaram/221597488638]

 

+

  HAL_FLASH_Unlock();
  HAL_FLASH_OB_Unlock();
  HAL_FLASHEx_OBGetConfig(&OBInit);

  OBInit.OptionType = OPTIONBYTE_CM7_BOOTADD;
  OBInit.BootAddr0 = 0x08010000;
  OBInit.BootConfig = OB_BOOT_ADD0;
  HAL_FLASHEx_OBProgram(&OBInit);
  HAL_FLASH_OB_Launch()

[링크 : https://community.st.com/t5/stm32-mcus-products/stm32h745-set-cm7-boot-addr0-from-cm4/td-p/654791]

 

+

void HAL_FLASHEx_OBGetConfig(FLASH_OBProgramInitTypeDef *pOBInit)
{
  pOBInit->OptionType = OPTIONBYTE_WRP | OPTIONBYTE_RDP | OPTIONBYTE_USER | OPTIONBYTE_BOR;

  /*Get WRP*/
  pOBInit->WRPSector = FLASH_OB_GetWRP();

  /*Get RDP Level*/
  pOBInit->RDPLevel = FLASH_OB_GetRDP();

  /*Get USER*/
  pOBInit->USERConfig = FLASH_OB_GetUser();

  /*Get BOR Level*/
  pOBInit->BORLevel = FLASH_OB_GetBOR();
}

[링크 : https://github.com/fboris/STM32Cube_FW_F4/blob/master/Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_flash_ex.c#L341]

 

typedef struct
{
  uint32_t OptionType;   /*!< Option byte to be configured.
                              This parameter can be a value of @ref FLASHEx_Option_Type */

  uint32_t WRPState;     /*!< Write protection activation or deactivation.
                              This parameter can be a value of @ref FLASHEx_WRP_State */

  uint32_t WRPSector;         /*!< Specifies the sector(s) to be write protected.
                              The value of this parameter depend on device used within the same series */

  uint32_t Banks;        /*!< Select banks for WRP activation/deactivation of all sectors.
                              This parameter must be a value of @ref FLASHEx_Banks */        

  uint32_t RDPLevel;     /*!< Set the read protection level.
                              This parameter can be a value of @ref FLASHEx_Option_Bytes_Read_Protection */

  uint32_t BORLevel;     /*!< Set the BOR Level.
                              This parameter can be a value of @ref FLASHEx_BOR_Reset_Level */

  uint8_t  USERConfig;   /*!< Program the FLASH User Option Byte: IWDG_SW / RST_STOP / RST_STDBY. */

} FLASH_OBProgramInitTypeDef;

[링크 : https://github.com/fboris/STM32Cube_FW_F4/blob/master/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_flash_ex.h#L106]

'embeded > Cortex-M7 STM' 카테고리의 다른 글

STM32 MPU(Memory Protection Unit)  (2) 2024.07.22
STM32 HSEM (Hardware SEMaphore)  (0) 2024.07.22
STM32CubeProgrammer  (0) 2024.07.22
stm32h757xi / stm32h757i-eval  (0) 2024.07.19
FT5336 - 정전식 터치 i2c  (0) 2021.07.06
Posted by 구차니
embeded/Cortex-M7 STM2024. 7. 22. 12:45

별도의 독립 프로그램이다... -_-

리눅스 버전 받으면 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

 

UI 색상 왜이래.. 다크모드라 그런가?

[링크 : https://www.st.com/en/development-tools/stm32cubeprog.html]

[링크 : https://blog.naver.com/chcbaram/221597488638]

 

귀찮아서 기본값으로 설치했는데.. 프로그램 등록이 되지 않아 수동으로 실행해야 한다.

GUI는 아래의 명령어로 실행하면 된다.

~/STMicroelectronics/STM32Cube/STM32CubeProgrammer/bin$ ./STM32CubeProgrammer

 

 

'embeded > Cortex-M7 STM' 카테고리의 다른 글

STM32 HSEM (Hardware SEMaphore)  (0) 2024.07.22
STM32H757 User configuration  (0) 2024.07.22
stm32h757xi / stm32h757i-eval  (0) 2024.07.19
FT5336 - 정전식 터치 i2c  (0) 2021.07.06
stm32f4 otg update bin file  (0) 2021.07.02
Posted by 구차니
embeded/Cortex-M7 STM2024. 7. 19. 11:12

480MHz의 Coretx-M7 / Cortex-M4가 달려있는 듀얼 코어 cpu이다.

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

[링크 : https://www.st.com/content/ccc/resource/training/technical/product_training/group0/7d/83/8c/1f/3a/1c/43/1e/STM32H7-System-Adaptive_Real-Time_Accelerator_ART/files/STM32H7-System-Adaptive_Real-Time_Accelerator_ART.pdf/_jcr_content/translations/en.STM32H7-System-Adaptive_Real-Time_Accelerator_ART.pdf]

 

 

stm32h747xi 와 stm32h757xi 로 eval 보드가 있는데

두 칩 간 주요 차이점은 757은 암호화 모듈이 내장되어 있다는 것  정도?

 

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.

[링크 : https://www.st.com/resource/en/application_note/an5557-stm32h745755-and-stm32h747757-lines-dualcore-architecture-stmicroelectronics.pdf]

 

아니 최소한 하나의 문서에 어디라고 표기는 해달라고 -_ㅠ

477p - BOOT_C1 / BOOT_C2

 

601p - BCM7 / BCM4 reset value가 x면 도대체 머라고 해석해야 하지?

[링크 : https://www.st.com/resource/en/reference_manual/rm0399-stm32h745755-and-stm32h747757-advanced-armbased-32bit-mcus-stmicroelectronics.pdf]

 

'embeded > Cortex-M7 STM' 카테고리의 다른 글

STM32H757 User configuration  (0) 2024.07.22
STM32CubeProgrammer  (0) 2024.07.22
FT5336 - 정전식 터치 i2c  (0) 2021.07.06
stm32f4 otg update bin file  (0) 2021.07.02
stm32cubeide generate bin  (0) 2021.07.02
Posted by 구차니
embeded/Cortex-M7 STM2021. 7. 6. 17:45

STM32F746G-DISCO 보드의 I2C 터치 센서가 문득 궁금해져서

(freertos나 touchGFX 쓰지 않고 raw data가 궁금해서) 데이터 시트 찾는 중

 

해당 discovery 보드 데이터로는 못 찾고 한다리 건너 발견

[링크 : https://www.newhavendisplay.com/appnotes/datasheets/touchpanel/FT5336.pdf]

    [링크 : https://blog.naver.com/75rudals/221034561748]

 

INT는 안쓰고 I2C로만 받을 데이터가 있는지 확인하는 구조인 듯?

[링크 : https://noel-embedded.tistory.com/619]

 

+

FT로 시작해서 FTDI 사의 제품인줄 알았는데, focaltech라는 업체의 제품

'embeded > Cortex-M7 STM' 카테고리의 다른 글

STM32CubeProgrammer  (0) 2024.07.22
stm32h757xi / stm32h757i-eval  (0) 2024.07.19
stm32f4 otg update bin file  (0) 2021.07.02
stm32cubeide generate bin  (0) 2021.07.02
stm32cubeide gdb external flash  (0) 2021.07.02
Posted by 구차니
embeded/Cortex-M7 STM2021. 7. 2. 19:37

'embeded > Cortex-M7 STM' 카테고리의 다른 글

stm32h757xi / stm32h757i-eval  (0) 2024.07.19
FT5336 - 정전식 터치 i2c  (0) 2021.07.06
stm32cubeide generate bin  (0) 2021.07.02
stm32cubeide gdb external flash  (0) 2021.07.02
TouchGFX on STM32F746G-DISCO  (4) 2021.07.02
Posted by 구차니
embeded/Cortex-M7 STM2021. 7. 2. 19:34

cubeide로 빌드하는데 hex와 elf는 나오는데 bin은 안나와서 검색!

겁나~ 구성탱이에 있네 -_-

Convert to binary file (-O binary)를 체크해주면 된다. 기본값은 꺼져 있는 듯?

 

[링크 : https://blog.naver.com/chandong83/221751192307]

'embeded > Cortex-M7 STM' 카테고리의 다른 글

FT5336 - 정전식 터치 i2c  (0) 2021.07.06
stm32f4 otg update bin file  (0) 2021.07.02
stm32cubeide gdb external flash  (0) 2021.07.02
TouchGFX on STM32F746G-DISCO  (4) 2021.07.02
st-link stm32 option bytes  (0) 2021.07.02
Posted by 구차니
embeded/Cortex-M7 STM2021. 7. 2. 16:47

 

1.1 GDB server start-up options
--ext-memory-loaders
Provides the list of the available external memory loaders.

-el <file_path>, --extload <file_path>
Selects a custom external memory-loader.

--external-init
Runs Init() from external memory loader after reset to make external memory accessible without need for
application software to set up the access to memory-mapped external memory.
[This option requires that option -el <file_path>, --extload <file_path> is used also.]


2.3.1 Loading program to external memory
When a program must be loaded to an external memory, the option --extload <file_path> must be used.
External memory loader files are delivered for most available STM32 Evaluation and Discovery boards containing
external memory. To list the available loader files, use the --ext-memory-loaders option.
The STM32CubeProgrammer software description user manual (UM2237) contains detailed information on how
to use external Flash loader programs and develop customized loaders for external memory. The user manual is
available from the STM32CubeProg webpage on www.st.com.

2.3.2 Memory read/write to external memory
To make external memory accessible for read and write by the debugger, use the --external-init option
together with external memory loader --extload <file_path> option. When --external-init is used the
Init() function in the external memory loader is run by the ST-LINK GDB server after reset. This makes
external memory accessible without any need for application software to set up the device for external memory
access. The external memory must be memory mapped and directly accessed because normal memory read/
write is used by gdb.
Note: When using the --external-init option with the ST-LINK GDB server, the stack required by the Init()
function is limited to 1024 bytes of stack instead of 400 bytes in ST-LINK GDB server v5.4.0.

[링크 : https://www.st.com/resource/en/user_manual/dm00613038-stm32cubeide-stlink-gdb-server-stmicroelectronics.pdf]

'embeded > Cortex-M7 STM' 카테고리의 다른 글

stm32f4 otg update bin file  (0) 2021.07.02
stm32cubeide generate bin  (0) 2021.07.02
TouchGFX on STM32F746G-DISCO  (4) 2021.07.02
st-link stm32 option bytes  (0) 2021.07.02
st-link util external module?  (0) 2021.07.02
Posted by 구차니
embeded/Cortex-M7 STM2021. 7. 2. 16:31

STM32F746NGHx_FLASH.ld

/* Specify the memory areas */
MEMORY
{
FLASH (rx)      : ORIGIN = 0x08000000, LENGTH = 1024K
RAM (xrw)      : ORIGIN = 0x20000000, LENGTH = 320K
ITCMRAM (xrw)      : ORIGIN = 0x00000000, LENGTH = 16K
QSPI (rx)         : ORIGIN = 0x90000000, LENGTH = 16M
}

  .ARM.attributes 0 : { *(.ARM.attributes) }
  ExtFlashSection : { *(ExtFlashSection) } >QSPI
}

 

#include <touchgfx/hal/Config.hpp>

LOCATION_EXTFLASH_PRAGMA
KEEP extern const unsigned char _control_center_button_pressed[] LOCATION_EXTFLASH_ATTRIBUTE = { // 191x191 RGB565 pixels.
// ...
};

 

#elif defined(__ARMCC_VERSION)
#define LOCATION_EXTFLASH_PRAGMA
#define LOCATION_EXTFLASH_ATTRIBUTE __attribute__ ((section ("ExtFlashSection"))) __attribute__ ((aligned(4)))

#elif defined __ICCARM__
#define LOCATION_EXTFLASH_PRAGMA _Pragma("location=\"ExtFlashSection\"")

 

내장 플래시

 

외부 QSPI 플래시

'embeded > Cortex-M7 STM' 카테고리의 다른 글

stm32cubeide generate bin  (0) 2021.07.02
stm32cubeide gdb external flash  (0) 2021.07.02
st-link stm32 option bytes  (0) 2021.07.02
st-link util external module?  (0) 2021.07.02
cortex-M7 우와.. -_-  (0) 2021.07.02
Posted by 구차니