Topic : extern declarated Function will not be executed

Forum : ARM

Original Post
Post Information Post
August 4, 2010 - 11:52pm
Guest

Problem:
A function which is located in main.c will not be executed by a call from interrupt stm32f10x_it.c
It is declared as extern and Code optimization is only activated for certain librarys not for main and not for this file.
Otherwise i get a flash error (flash full). Anybody any idea why this problem happens and how to solve??

void USART1_IRQHandler(void)
{
int del;
if(USART_GetITStatus(USART1, USART_IT_RXNE) != RESET)
{
/* Read one byte from the receive data register */
RxBuffer[RxCounter++] = (USART_ReceiveData(USART1) & 0x7F);
if(RxBuffer[3]==0x0d || RxCounter >10)
{
RxCounter=0;
extern Command(); <<<<

Replies
Post Information Post
+1
0
-1
August 6, 2010 - 9:09pm
Guest

I'm going to state my understanding of the situation to make sure I've interpreted your post correctly. If you build the code with "extern Command();" as shown below, the code builds fine and Command will not be called. If you build the code with "Command();" (extern removed), then you get a flash-full error.

Have you checked the .map file to make sure that the code for Command exists with the extern? Have you checked the .map file for other clues about flash use?

Is Command called from any other location?

+1
0
-1
August 7, 2010 - 4:24pm
Guest

isionous wrote:
I'm going to state my understanding of the situation to make sure I've interpreted your post correctly. If you build the code with "extern Command();" as shown below, the code builds fine and Command will not be called. If you build the code with "Command();" (extern removed), then you get a flash-full error.

Have you checked the .map file to make sure that the code for Command exists with the extern? Have you checked the .map file for other clues about flash use?

Is Command called from any other location?

"If you build the code with "extern Command();" as shown below, the code builds fine and Command will not be called."
Yes.

"If you build the code with "Command();" (extern removed), then you get a flash-full error."
No, i mean if i setup the project to "no optimize in proprties window, then i get a flash full error.

The initial problem was that function command was compiled without any errors but it was not executed during debugging steps. In an previous topic, i read that some problems during debugging while optimization is activ could still happen.
The problem is now solved in an different way, i copied the interrupt function to main program and everything works fine for now.
But it should also work under using the external file.

+1
0
-1
August 12, 2010 - 11:38pm
Guest

joachim wrote:
extern Command(); <<<<
That's because the 'extern' keyword indicates just a declaration of the symbol - this is not a call to the function!