How to transition from MCU to MPU, Mil's bare metal development application notes based on STM32MP135 development board
[Copy link]
Previously, microprocessors (MPUs) and microcontrollers (MCUs) were two distinct devices, with MPUs supporting rich software systems such as Linux and related software stacks, while MCUs would typically focus on bare metal and RTOS. In recent years, as MCUs have become increasingly powerful, the distinction between MCUs and MPUs has become increasingly blurred.
STM32MP135 is an entry-level, cost-effective MPU, suitable for scenarios where MCU performance does not meet the requirements or Linux needs to be run. Mir's STM32MP135 development board provides bare metal bare metal development software based on STM32Cube, which can further enhance real-time performance support to meet users' needs for hard real-time applications. This is especially friendly to users who are accustomed to using MCU development, allowing developers to get a similar MCU development experience while using the powerful performance of MPU. Mir provides a bare metal development environment. Next, let us introduce how to perform bare metal development on Mir's STM32MP135 development board.
1. Environment Construction
1.1. Get the source code
Download the 04_Sources/STM32CubeMP13-1.0.0 source code package provided by Mir, and use STM32CubeIDE to import the STM32Cube_FW_MP13_V1.0.0ProjectsSTM32MP135C-DKExamplesDDRDDR_Init file, and click File->Import->Existing Projects into Workspace.
1.2. Compile source code
After successfully importing the project, compile it. Click to compile. When 0 errors and 0 warnings appear below, it means the compilation is successful.
1.3. Development board wiring
After the project source code is compiled, the development board needs to be connected to ST-Link for debugging, and the dip switch is set to engineering mode 1-4: 1000. The interface used is J7. Since the pins are not soldered at the factory, users need to solder them by themselves. The wiring method is as shown below:
1.4. Debugging project
2. Application loading
2.1. Application environment configuration
After initializing ddr, the next step is to let the application run on ddr. Here we choose the engineering application under the path of MYD-YF13X-20230601STM32CubeMP13-1.0.0ProjectsSTM32MP135C-DKTemplatesBSP_BasicTemplates:
-
Delete the comment of REGION_ALIAS("RAM", DDR_BASE);, and then comment out REGION_ALIAS("RAM", SYSRAM_BASE), save and select:
2.2. Debugging Applications
After completing the above environment configuration, you also need to configure it during the application debugging stage. Open the debugging settings interface of the project, click startup, delete monitor reset, save and debug:
Connect the development board to the serial port and run at full speed. The serial port will print Hello World - USE_STM32MP135 BOARD, and the application is debugged successfully.
3. Create an application
3.1. Hardware Adaptation
Taking the heartbeat light on the Mir MYD-YF13x development board as an example, we must first determine the GPIO port used by the heartbeat light. Looking at the hardware schematic, we can see that the heartbeat light is connected to SPI5_MOSI:
By checking the Pin List of Mir, we know that the pin corresponding to SPI5_MOSI is PH12, so the next step is to create a project to configure the flashing of the heartbeat light.
3.2. Project creation
The project created by Mir is located in the path STM32CubeMP13-1.0.0ProjectsSTM32MP135C-DKExamplesGPIOGPIO_EXTI. Import the project according to the method in 1.1 as follows:
Start configuring the heartbeat light and modify the heartbeat light pin configuration in stm32mp13xx_disco.h:
After the modification, return to the main.c file and add the heartbeat light code in the while function:
After compiling and debugging, let the program run at full speed, and you can see the blue light on the development board flashing:
The project created so far has been debugged successfully.
product description
Mir STM32MP135 development board, based on STM32MP13 series processor, single-core Cortex-A7 design, running frequency up to 1GHz, designed for entry-level Linux, bare metal or RTOS systems. The development board adopts 12V/2A DC power supply, equipped with 2 Gigabit Ethernet interfaces, 1 4G module interface of USB2.0 protocol MINI PCIE socket, 1 RGB display interface, 1 audio input and output interface, 2 USB HOST Type A, 1 USB OTG Type-C interface, 1 Micro SD interface, etc. The development board has rich interfaces and is suitable for energy and power, industrial control, industrial gateway, industrial HMI and other scenarios.
|