stm32 cubemx 添加 rt-thread 操作系统 context_gcc.S 编译报错

stm32 cubemx 添加 rt-thread 操作系统 context_gcc.S 编译报错

解决方法(eclipse+CDT 或 cubeide)

右键点击项目名称->Properties->C/C++ Build->Setting->Tool Settings->MCU GCC Assembler->Miscellaneous->Other flags->Add…

在弹出框中输入:

-Wa,-mimplicit-it=thumb

OK->Apply and Close

然后重新编译项目,问题解决。


若编译后仍然报错:

删除 stm32f4xx_it.c 中 的 HardFault_HandlerSysTick_HandlerPendSV_Handler 三个函数。


若编译成功、下载成功后,deBug不进入main函数,程序无法正常运行。

打开 Startup目录下的 startup_stm32fxxxxxxx.s ,找到第 113 行。

  bl  main

修改为

  bl  entry

右键项目名称 Clean Project

重新编译,下载即可。


如果还想使用HAL库中的 HAL_GetTick 函数,则将 board.c 中的 SysTick_Handler 函数修改为

void SysTick_Handler(void)
{
    /* enter interrupt */
    rt_interrupt_enter();

    HAL_IncTick();
    rt_tick_increase();

    /* leave interrupt */
    rt_interrupt_leave();
}

猜你喜欢

转载自blog.csdn.net/gyzw_mx/article/details/106641448