Loading...
 

Zephyr project on STM32

   Zephyr Workbench, a VSCode extension to manage Zephyr on STM32.
It enables users to easily create, develop, and debug Zephyr applications.
Main features:
  • Install host dependencies.
  • Import toolchain and SDK.
  • Create, configure, build and manage apps.
  • Debug STM32.
You can directly download it from the VSCode marketplace
For more details, visit the Zephyr Workbench

System Workbench for STM32


NOT TRUE! - Eclipse Complaints: undefined reference to `TIM_TimeBaseInit'

Hi All,

SW4STM32 complaints about undefined references but it’s not true. Everything is there for the compiler to find via #include “stm32f10x.h”. I added #include “stm32f10x_tim.h” but that’s not even necessary because in #include “stm32f10x.h” other declarations lead to the appropriate peripheral library headers files. I have checked this thoroughly with stm32f10x_stdperiph_lib_um.chm reference manual. Screenshot of SW4STM32 view attached.


void InitializeLEDs(void)
{
RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOC, ENABLE);

GPIO_InitTypeDef gpioStructure;
gpioStructure.GPIO_Pin = GPIO_Pin_12 | GPIO_Pin_13;
gpioStructure.GPIO_Mode = GPIO_Mode_Out_PP;
gpioStructure.GPIO_Speed = GPIO_Speed_50MHz;
GPIO_Init(GPIOD, &gpioStructure);

GPIO_WriteBit(GPIOD, GPIO_Pin_12 | GPIO_Pin_13, Bit_RESET);
}

void InitializeTimer(void)
{
RCC_APB1PeriphClockCmd(RCC_APB1Periph_TIM2, ENABLE);

TIM_TimeBaseInitTypeDef TIM_TimeBaseStructure;
TIM_TimeBaseStructure.TIM_Prescaler = 40000;
TIM_TimeBaseStructure.TIM_CounterMode = TIM_CounterMode_Up;
TIM_TimeBaseStructure.TIM_Period = 500;
TIM_TimeBaseStructure.TIM_ClockDivision = TIM_CKD_DIV1;
TIM_TimeBaseStructure.TIM_RepetitionCounter = 0;
TIM_TimeBaseInit(TIM2, &TIM_TimeBaseStructure);
TIM_Cmd(TIM2, ENABLE);
}

int main()
{
InitializeLEDs();
InitializeTimer();

for (;;)
{
int timerValue = TIM_GetCounter(TIM2);
if (timerValue == 400)
GPIO_WriteBit(GPIOD, GPIO_Pin_12, Bit_SET);
else if (timerValue == 500)
GPIO_WriteBit(GPIOD, GPIO_Pin_12, Bit_RESET);
}
}

TIM_Cmd, TIM_TimeBaseInit and TIM_GetCounter are ALL defined in stm32f10x_tim.h so I don’t know what eclipse is complaining about. Maybe again one of those those eclipse oddities? See screenshot.

TIM_Cmd, TIM_TimeBaseInit and TIM_GetCounter are ALL defined in stm32f10x_tim.h so I don’t know what eclipse is complaining about. Maybe again one of those eclipse oddities? See screenshot attached.


Same here. I brought up the issue (without explicit examples) a couple of days ago. Compiler here builds ok anyways. But the red flags remain and the ctrl-space shows not resolved on code entry / edit.
Annoying.



Hi,

This a very know issue :-(

I solve using

Project >> C/C++ Index >> Freshen all files

best regards
Eng.Mazen Aljeddani


Hi,

For the compiling Error I think you should check
“stm32f110x_hal_conf.h”

And make sure

  1. define HAL_TIM_MODULE_ENABLED


is defined since it will include the header for the Timer moudle as

  1. ifdef HAL_TIM_MODULE_ENABLED

#include “stm32f7xx_hal_tim.h”

  1. endif /* HAL_TIM_MODULE_ENABLED */


best regards
Eng.Mazen Aljeddani

Bosnia and Herzegovina

Thanks, Mazen,
For me, your suggestion solved a problem - after I enable one timer error disappeared.

Ratko


 

Newest Forum Posts

  1. SPI on Nucleo_STMH533RE by royjamil, 2025-05-04 20:13
  2. SPI on Nucleo_STMH533RE by higginsa1, 2025-03-25 07:37
  3. SPI on Nucleo_STMH533RE by royjamil, 2025-03-23 11:31
  4. SPI on Nucleo_STMH533RE by higginsa1, 2025-03-23 09:33
  5. Configuring DMA for ADC in SW? by sam.hodgson, 2025-03-04 12:58
  6. Build a project in "release" mode by info@creosrl.it, 2025-02-20 18:12
  7. Build a project in "release" mode by info@creosrl.it, 2025-02-20 17:05
  8. Build a project in "release" mode by tang, 2025-02-20 10:36
  9. Build a project in "release" mode by info@creosrl.it, 2025-02-19 17:35
  10. Fail to debug in Win 11 C/C++ by mortenlund, 2024-12-26 20:27

Last-Modified Blogs