Free Review | Infineon XMC7200 Series MCU Porting Experience on RT-Thread Revealed!
XMC7200 is a development board for a 32-bit dual-core CPU subsystem (ARM Cortex-M7 and ARM Cortex-M0) launched by Infineon. Designed for industrial applications, the XMC7200D is a true programmable embedded system-on-chip that integrates up to two 350MHz Arm® Cortex-M7® as the main application processor and a 100MHz Arm® Cortex-M0®+.
RT-Thread already supports Infineon XMC7200 series. This article will introduce the transplantation experience of RT-Thread based on the development board xmc7200-kit_xmc7200_evk :
Preliminary preparation
Transplantation preparation
2.1 Understand the RT-Thread directory structure
In most BSPs, the following files are included:
After understanding the directory, we can complete the BSP step by step according to the required files.
2.2 Generate a sample project using ModusToolBox
2.2.1 Generate Project
Next, we use the official IDE to generate a sample project to obtain its driver library, startup file, link script, etc.
In the pop-up window, select the chip type we are using this time and click Next.
Then select the 'Hello World' project and choose the save location to create it.
2.2.2 Generate files
2.2.2.1 mtb_shared file
When our project is created, we will use these two files:
In mtb_shared are stored:
We will use the following files:
2.2.2.2 Project files
In the generated sample project, the bsps directory will contain the relevant link scripts for the corresponding development board, files containing onboard initialization, and startup files, which we will also use later.
File Migration
We create a new folder under the same series.
3.1 applications file
In this folder we store user code, usually there is only one main.c and one Sconscript at the beginning. You can copy an applications folder from other series.
3.2 Board Files
This file contains some compiler linker scripts and files used for onboard initialization.
3.2.1 Linker Script
We can find the link script in the example project:
After changing its name, put it in the linker_scripts folder under the board.
3.2.2 board.c/.h files
In the board.c/.h file, there are usually some functions used in the onboard initialization stage. In this porting, the cybsp_init() function needs to be added. This function can help us configure the system clock, power management, resource management, etc. You can copy and paste it from the same series.
Next, we need to modify the SRAM size and starting address in board.h. This requires checking the chip data sheet.
3.2.3 Scons&&KConfig
There are also Scons and KConfig files, which are mainly related to compilation and configuration. Some modifications need to be made after copying them.
First, you need to specify different compilers to implement the underlying system library functions. The source file is in the mtb_shared directory.
Then there are various macros involved in compilation. This requires using ModusToolbox to compile the sample project, and then looking for parameters starting with -D in the generated compile_commands.json. These are all macros involved in compilation. Then add these macros to Sconscript.
Then there is Kconfig, where we configure the peripheral options we need to use. This port only needs to use the serial port and GPIO, so there are only two configurations in the onboard peripheral configuration. Just add, delete, and modify the copied files. In the hardware driver configuration, we can modify it in the same way as other series. At the same time, we also need to modify Konfig under libraries (mentioned later).
3.3 lib files
We need to copy the TARGET_APP_KIT_XMC72_EVK file in the bsps directory generated in the example project just now, and also write a Sconscript, where we need to use the configuration and startup files in it.
3.4 MDK Project
First copy the MDK-related project files from other projects.
Then modify the chip type in the template project. If it is not displayed, you need to download the Pack first.
It can be downloaded through Keil's built-in downloader or through a link path.
Download path: Click to download
3.5 rtconfig.h/.py、Konfig、.config
These files are responsible for hardware configuration. After copying them, we can directly modify the settings in .config according to the needs, and then use ENV to enter menuconfig to save and update rtconfig.h. For example, here we need to set the console serial port to serial port 3.
You can also use ENV to enter menuconfig to modify it:
3.6 SConscript、SConsturct
This type of file is mainly related to compilation. After being copied from other BSPs, SConscript files generally do not need to be modified, but SConstruct files need to modify the file path according to their own needs.
If the driver library is made into a software package here, you need to re-specify the path and modify it according to your needs.
3.7 Libraries Modification
3.7.1 Modify Kconfig
In Kconfig under the libraries directory, we need to add our board information, just like other series.
3.7.2 Modify the HAL_Drivers file
In the driver library, there are some places that we still need to adjust.
In uart_config.h, modify the serial port pin.
Different from the adapted Infineon PSoC™ 6 series, the interrupt configuration will be different and needs to be modified here. If it is the same series with the same configuration, no operation is required.
Make a software package
After the transplantation work was completed, since the driver library was quite large, I integrated it and made it into a software package. At the same time, other series were also modified to depend on the software package. When using it, remember to enter ENV and use the pkgs --update command to download the software package. If it is other series, you can refer to other articles to put the generated driver library in the appropriate location.
use
The adaptation is completed here, and the next step is to compile and download.
5.1 Generate MDK project
After the software package is installed, enter the SCons --target==MDK5 command in the ENV environment, and ENV will automatically generate the MDK5 project.
Then enter MDK to compile
As you can see, the compiled macro just written will be displayed here
Remember to check the box to generate a HEX file for later burning.
5.2 Burning
Open the official burning software Cypress and select the corresponding board.
Select the .hex file you just compiled and click Connect.
Click the Program button to download.
Looking for more applications or product information ?
Want to contact us to buy a product ?
Welcome to scan the QR code and fill in the form.
We will follow up later.