Topic : Debugger jump

Forum : ARM

Original Post
Post Information Post
June 21, 2011 - 11:42am
Guest

Hello, I use an Olimex H103 board with STM32.
For the moment, the program is just a led blink.
The program works good when in "stand alone" mode, but when I debug it using Rlink, there are random PC jumps after seconds, sometimes out of the allowed memory for a basic Rlink edition.
ITs are off. The main code is the following (sample from Ride)


/* Includes ------------------------------------------------------------------*/
#include "stm32f10x.h"

/* board defines ------------------------------------------------------------*/

/* example defines ------------------------------------------------------------*/

/* example function prototypes -----------------------------------------------*/

void RCC_Configuration( void );
void NVIC_Configuration( void );
void Delay( vu32 nCount );

/* example global variables --------------------------------------------------*/

/*these variables could (and should, maybe) be defined as local to the main
function, but declaring them as global and volatile helps for debugging.
*/
GPIO_InitTypeDef GPIO_InitStructure;
volatile int delayvar = 0xFFFF;
volatile unsigned char toggle = 0;



/* example functions ---------------------------------------------------------*/
/*******************************************************************************
* Function Name  : main
* Description    : Main program.
* Input          : None
* Output         : None
* Return         : None
*******************************************************************************/
int main( void )
{

#ifdef DEBUG
    debug();
#endif

    // System Clocks Configuration
    RCC_Configuration();

    // NVIC Configuration
    NVIC_Configuration();

    // Enable LEDs GPIO clock
    RCC_APB2PeriphClockCmd( RCC_APB2Periph_GPIOC, ENABLE );

    // Configure PC.12 as output
    GPIO_InitStructure.GPIO_Pin = GPIO_Pin_12;
    GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_PP;
    GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
    GPIO_Init( GPIOC, &GPIO_InitStructure );

    while ( 1 )
    {
        //toggle=1-toggle;
        Delay( 0x7FFF );
        GPIO_WriteBit(GPIOC,GPIO_Pin_12,Bit_RESET);
        Delay( 0x7FFF );
        GPIO_WriteBit(GPIOC,GPIO_Pin_12,Bit_SET);

    }
}
void RCC_Configuration( void )
{
    // RCC system reset(for debug purpose)
    RCC_DeInit();

    // Enable HSE
    RCC_HSEConfig( RCC_HSE_ON );

    // Wait till HSE is ready
    while ( RCC_GetFlagStatus( RCC_FLAG_HSERDY ) == RESET )
        {;}

    // Enable Prefetch Buffer
    FLASH_PrefetchBufferCmd( FLASH_PrefetchBuffer_Enable );

    // Flash 2 wait state
    FLASH_SetLatency( FLASH_Latency_2 );

    // HCLK = SYSCLK
    RCC_HCLKConfig( RCC_SYSCLK_Div1 );

    // PCLK2 = HCLK
    RCC_PCLK2Config( RCC_HCLK_Div1 );

    // PCLK1 = HCLK
    RCC_PCLK1Config( RCC_HCLK_Div1 );

    // Select HSE as system clock source
    RCC_SYSCLKConfig( RCC_SYSCLKSource_HSE );

    // Wait till HSE is used as system clock source
    while ( RCC_GetSYSCLKSource() != 0x04 )
        {;}
}
void NVIC_Configuration( void )
{
#ifdef  VECT_TAB_RAM
    // Set the Vector Table base location at 0x20000000
    NVIC_SetVectorTable( NVIC_VectTab_RAM, 0x0 );
#else  // VECT_TAB_FLASH  
    // Set the Vector Table base location at 0x08000000
    NVIC_SetVectorTable( NVIC_VectTab_FLASH, 0x0 );
#endif
}

void assert_failed( u8* file, u32 line )
{
    while ( 1 )
    {
    }
}


/*******************************************************************************
* Function Name  : Delay
* Description    : Inserts a delay time.
* Input          : nCount: specifies the delay time length.
* Output         : None
* Return         : None
*******************************************************************************/
void Delay( vu32 nCount )
{
    for ( ; nCount != 0; nCount-- );
}
Replies
Post Information Post
+1
0
-1
June 21, 2011 - 12:40pm
Guest

I can't use JTAG interface with RLink (in the configuration window). I can only use SWD, maybe a first step for the solution...

+1
0
-1
June 21, 2011 - 2:39pm
Raisonance Support Team

Hi,

These problems sound like known situations...

For the debug jumps, please see this:
http://forum.raisonance.com/viewtopic.php?id=2694

For the JTAG/SWD thing, please read this:
http://forum.raisonance.com/viewtopic.php?id=3394

If these do not allow you to understand and solve the issue, we will need more information for helping you. Please then fill this form and send the answers to :
http://forum.raisonance.com/viewtopic.php?id=2231

Best Regards,

Vincent

+1
0
-1
June 21, 2011 - 4:00pm
Guest

It's ok for the JTAG/SWD thing. I just had to switch power OFF and ON with the good option checked.

Debugging in JTAG instead of SWD doesn't change the PC jump.

+1
0
-1
June 21, 2011 - 6:36pm
Guest

I now use the new 3.5 ST firmware library. It's ok now. I guess there's a compatibility problem between all versions installed with Rkit ARM (2.03, 3.40 and now 3.5 by me).
I also use the template by ST to create the project.