About the compilation problem of "RT-Thread" real-time system

Hello everyone. I used “STM32CubeMx” yesterday to generate the project with the “RT-Thread” code, then I put it into “PlatFormio” to compile, but there was always a problem. I didn’t solve the problem yesterday.

I don’t know if you have used this “RT-Thread” real-time system. Can you help me solve it?

STM32CubeMx generated project source code

PlatFormIO project source code

RT-Thread real-time system engineering source code

  • this is a weird OS which tries to redefine C library definitions from GCC/newlibc…
  • in the rtconfig.h add the lines

below #include "RTE_Components.h".

  • in src/stm32f1xx_it.c, remove the function definitions of the Hardfault, Pend… and Systick handler, they are defined by the OS already

  • should result in

DATA:    [          ]   2.4% (used 496 bytes from 20480 bytes)
PROGRAM: [=         ]   8.0% (used 5244 bytes from 65536 bytes)
 [SUCCESS] Took 2.49 seconds 
1 Like

Thank you for your answer, you solved a big problem for me.You are really amazing::+1::+1:,I wasted a day because of this problem.

I used your method to compile my STM32F429 project, but it still went wrong. The type of error is very strange

stm32F429_PlatFormIO source code

stm32F429_CubeMx source code

Uhm it’s very weird you have two rtconfig.h files

$ find . -name "rtconfig.h"

You edited the wrong one. I edited include/rtconfig.h.

You have to figure out which file you need and watch for other duplicated files.

Here’s my compilable version of the project: https://drive.google.com/open?id=1FS3YDL0PptkbjtYr31W9Is2Y_K-Mwqj8

:rofl:all right

I deleted “rtconfig.h” in “bsp” and changed “rtconfig.h” in “include”,But my stm32F429 project now has this problem. I suspect that GCC does not support certain instructions.

Does my provided project not build? I encountered the same problem trying to fixup your example. Could you try my google drive build first.

I have no problem compiling the “fixed_stm32f103_rt” project you uploaded.

Delete this line and compile it, the program is fine. I do not know whyW93I0V%7D(FBG~8%40_%60PV(0K%24D

Hm seems to have need a different float ABI. Does it work now?

If not maybe use only the original bsp/rtconfig.h with added RT_USING_NEWLIB etc. The STM32Cube generated configuration may be in that file not in include/rtconfig.h.

I want to verify tomorrow. Now China’s time has arrived at 00:30 in the morning.:rofl::rofl:

Hello, good evening. I want to ask if your “fixed_stm32f103_rt” can be uploaded to the stm32f103MCU normally.

Why do I get an error when uploading to the MCU?


What’s your exact board? A Bluepill board? And you connected the ST-Linkv2 to the SWD, SWDIO, VCC and GND pins correctly? Maybe also try to connect the NRST signal of the ST-Link to the MCU?

I can use “keil” to upload successfully.

This project is a test project I created with “stm32cubemx”

This is my board


Is a different programm accessing the device? (close all unrelated programs.) Does pressing RESET on the board before or during upload help? Does holding down the BOOT0 button and then reset button press help?

I will get an error when I press “reset” during upload

I use the “STM32CubeProgrammer” to read the MCU memory. This problem occurs.


Can you try and go into this file C:\Users\<user>\.platformio\packages\tool-openocd\scripts\target\stm32f1x.cfg and exchange the line

reset_config srst_nogate


reset_config srst_only

If that does not work try

reset_config trst_only

I think the program was uploaded successfully, but there was a problem during the reset process.WJN%60OE~42Y%5DKMF%25JO)KINS1