Porting RT-Thread to ModusToolbox
The background of this KBA is that some customers need to run RT-Thread OS on PSoC6 with ModusToolbox. They use ModusToolbox to develop PSoC6 application instead of RT-Thread Studio IDE. Currently RT-Thread has ported PSoC6 code into RT-Thread Studio IDE, but ModusToolbox does not support RT-Thread OS. Thus, we port RT-Thread code into ModusToolbox.
The software environment is ModusToolbox3.0. The RT-Thread source code is rt-thread-master from GitHub https://github.com/RT-Thread/rt-thread. The hardware is PSoC6 2M CY8CPROTO-062-4343W because customer uses CY8C624ABZI-S2D44.
Below is RT-Thread startup flow. The entry code is entry() in GCC.
Figure 1 RT-Thread Startup Flow
We need to modify startup_psoc6_02_cm4.S like Figure 2.
Figure 2 PSoC6 Startup file
Also need to modify linkscript file linker.ld to add some section by RT-Thread define like Figure 3.Figure 3 PSoC6 Linkscript file
The RT-Thread source code folder in ModusToolbox is as below.
Figure 4 RT-Thread code folder in ModusToolbox3.0
The rtconfig.h should be modified to open peripheral driver of PSoC6 by Figure 5.
Figure 5 rtconfig.h
Below is the FinSH shell start run after ModusToolbox project compiled and programmed.
Figure 6 FinSH shell