[Deprecated: old core]Introducing the new delivery for STM

The official STMicroelectronics Arduino core
nikosx
Posts: 25
Joined: Sun May 07, 2017 4:33 pm

Re: [Deprecated: old core]Introducing the new delivery for STM

Post by nikosx » Tue Nov 07, 2017 9:57 am

@fpiSTM : What's the correct way to reference TIM3_IRQHandler in the code and not get an error ?

fpiSTM
Posts: 270
Joined: Fri Sep 16, 2016 12:33 pm
Location: Le Mans, France

Re: [Deprecated: old core]Introducing the new delivery for STM

Post by fpiSTM » Tue Nov 07, 2017 10:46 am

Hum, currently none as it is defined in the timer.c of the core.

As a workaround, you can comment this one in the core:
https://github.com/stm32duino/Arduino_C ... er.c#L1077

then it should be ok.
As said it will be extended and more user friendly.

nikosx
Posts: 25
Joined: Sun May 07, 2017 4:33 pm

Re: [Deprecated: old core]Introducing the new delivery for STM

Post by nikosx » Tue Nov 07, 2017 12:09 pm

Thanks again !!!

there should be something, else why the compiler is complaining ??? :)

i'll give it a try...

nikosx
Posts: 25
Joined: Sun May 07, 2017 4:33 pm

Re: [Deprecated: old core]Introducing the new delivery for STM

Post by nikosx » Tue Nov 07, 2017 12:20 pm

line 1077, timer.c :


void TIM3_IRQHandler(void)
{
if(timer_handles[2] != NULL) {
HAL_TIM_IRQHandler(timer_handles[2]);
}
}

nikosx
Posts: 25
Joined: Sun May 07, 2017 4:33 pm

Re: [Deprecated: old core]Introducing the new delivery for STM

Post by nikosx » Tue Nov 07, 2017 12:27 pm

Found 2 time.c, put code in comment, same error....

where this file should be ?

fpiSTM
Posts: 270
Joined: Fri Sep 16, 2016 12:33 pm
Location: Le Mans, France

Re: [Deprecated: old core]Introducing the new delivery for STM

Post by fpiSTM » Tue Nov 07, 2017 3:41 pm

could you provide the sketch you used.
In fact the error is that the TIM3_IRQHandler(void) is already defined in the core.
As it is a weak one, you should be able to comment it.

nikosx
Posts: 25
Joined: Sun May 07, 2017 4:33 pm

Re: [Deprecated: old core]Introducing the new delivery for STM

Post by nikosx » Tue Nov 07, 2017 4:16 pm

Ok.... Does NOT compile for VS 10 + VS Arduino but it did compile and run OK for ARDUINO IDE...
it also workd OK
code below

// for ARDUINO to compile
// timer.c in
// C:\Users\Nick\AppData\Local\Arduino15\packages\STM32\hardware\stm32\2017.8.31\cores\arduino\stm32
// commend TIM3_IRQHandler


static TIM_HandleTypeDef s_TimerInstance =
{
.Instance = TIM3
};


extern "C" void TIM3_IRQHandler(void)
{
static boolean flag = false;
static int32_t index = 0;

if (__HAL_TIM_GET_FLAG(&s_TimerInstance, TIM_IT_UPDATE) != RESET)
{
__HAL_TIM_CLEAR_IT(&s_TimerInstance, TIM_IT_UPDATE);
if (flag)
{
digitalWrite(LED_BUILTIN, HIGH);
flag=0;
}
else
{
digitalWrite(LED_BUILTIN, LOW);
flag=1;
}
}
}

void setup()
{
pinMode(LED_BUILTIN, OUTPUT);

HAL_NVIC_SetPriority( TIM3_IRQn, 0, 0 );
HAL_NVIC_EnableIRQ ( TIM3_IRQn );

s_TimerInstance.Init.Prescaler = 48000; //APB1 TIM3 has 48Mhz

s_TimerInstance.Init.CounterMode = TIM_COUNTERMODE_UP;
s_TimerInstance.Init.Period = 100-1; // prescaler gives 2khz time base
s_TimerInstance.Init.ClockDivision = TIM_CLOCKDIVISION_DIV1;
s_TimerInstance.Init.RepetitionCounter = 0;

__HAL_RCC_TIM3_CLK_ENABLE();

HAL_TIM_Base_Init ( &s_TimerInstance );
HAL_TIM_Base_Start_IT ( &s_TimerInstance );
}

void loop()
{

}

nikosx
Posts: 25
Joined: Sun May 07, 2017 4:33 pm

Re: [Deprecated: old core]Introducing the new delivery for STM

Post by nikosx » Tue Nov 07, 2017 4:19 pm

it became very close to code i've tried before in VS arduino and got the same error as today

TestF030.ino:31:17: error: conflicting declaration of 'void TIM3_IRQHandler()' with 'C' linkage
TestF030.ino:previous declaration with 'C++' linkage
Error compiling

Thing is VS is so much better / faster than Arduino IDE and (apart from this timer issue) works OK with ST nucleo boards....
still could not find the file that uses to change as did with arduino....

nikosx
Posts: 25
Joined: Sun May 07, 2017 4:33 pm

Re: [Deprecated: old core]Introducing the new delivery for STM

Post by nikosx » Tue Nov 07, 2017 6:59 pm

The only way to compile in VS is to make it

extern "C++" void TIM3_IRQHandler(void)

but in this case, code does NOT run !!!!!

User avatar
Rick Kimball
Posts: 1066
Joined: Tue Apr 28, 2015 1:26 am
Location: Eastern NC, US
Contact:

Re: [Deprecated: old core]Introducing the new delivery for STM

Post by Rick Kimball » Tue Nov 07, 2017 7:08 pm

It would be nice if you split this conversation over to a new thread nikosx. Your issues have little to do with the STM core and all to do with your choice of development tools along with misunderstanding of C vs C++ name mangling and linking.
-rick

Post Reply