Skip to main content
supercoolman
Associate II
February 13, 2010
Question

linker script for compilation and OpenOCD script for STM3210E-EVAL + Olimex ARM-USB-TINY

  • February 13, 2010
  • 5 replies
  • 1253 views
Posted on February 13, 2010 at 18:53

linker script for compilation and OpenOCD script for STM3210E-EVAL + Olimex ARM-USB-TINY

#stm32
    This topic has been closed for replies.

    5 replies

    Nickname12657_O
    Associate III
    May 17, 2011
    Posted on May 17, 2011 at 13:40

    Hi,

    You  have to enable the GPIO-F first with  this code :

    RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOF, ENABLE);

    Hope this helps you.

    Cheers,

    STOne-32.

    supercoolman
    Associate II
    May 17, 2011
    Posted on May 17, 2011 at 13:40

    I think I found the problem...

    the linker and startup script for gcc from the lib 3.1.2 is useless. compilable, but does nothing. I keep everything the same, but use another linker and startup not from STM32, then everything works just fine. all the interrupt, LED ... etc are working as expected

    supercoolman
    Associate II
    May 17, 2011
    Posted on May 17, 2011 at 13:40

    Thank you  for your reply STOne-32

    I'm sorry that I didn't post complete main by mistake because I put all of the config content in a separate file and just call them from main.c. below is the full main.c which turns on LED. my main.c currently calls config for Clock, GPIO and interrupt. interrupt for DMA1CH1 getting value from ADC1 is enable now but I'm only clearing the IT flags in interrupt functions void ADC1_2_IRQHandler(void). I don't think that interrupt are a problem here, so I just exclude them to prevent distraction, but  I'll post them all if you think it's necessary.

    #include ''stm32f10x.h''

    #include ''stm32f10x_gpio.h''

    int main(void){

       RCC_Configuration();

       __disable_irq();

       GPIO_InitStructure.GPIO_Pin = GPIO_Pin_6 | GPIO_Pin_7 | GPIO_Pin_8 | GPIO_Pin_9;

       GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;

       GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_PP;

       GPIO_Init(GPIOF, &GPIO_InitStructure);

       GPIO_SetBits(GPIOF, GPIO_Pin_6 | GPIO_Pin_7 | GPIO_Pin_8 | GPIO_Pin_9);

       NVIC_Configuration();

       DMA1_Configuration();

       __enable_irq();

    while(1);

    }

    void RCC_Configuration(void){

       /* RCC system reset(for debug purpose) */

       RCC_DeInit();

       /* Enable HSE */

       RCC_HSEConfig(RCC_HSE_ON);

       /* Wait till HSE is ready */

       HSEStartUpStatus = RCC_WaitForHSEStartUp();

       if(HSEStartUpStatus == SUCCESS)  {

          /* Enable Prefetch Buffer */

          FLASH_PrefetchBufferCmd(FLASH_PrefetchBuffer_Enable);

          /* Flash 2 wait state */

          /* FLASH_Latency_0 SYSCLK <= 24 MHz

           * FLASH_Latency_1 SYSCLK <= 48 MHz

           * FLASH_Latency_2 SYSCLK <= 72 MHz

           */

          FLASH_SetLatency(FLASH_Latency_2);

          /* HCLK = SYSCLK */

          RCC_HCLKConfig(RCC_SYSCLK_Div1);

          /* PCLK2 = HCLK/1 = 72 MHz */

          // UART1, SPI1, Timer1, ADC1, ADC2, GPIOA-GPIOE

          RCC_PCLK2Config(RCC_HCLK_Div1);

          /* PCLK1 = HCLK/2 = 36 MHz */

          // CAN, USB, I2C1, I2C2, UART2, UART3, SPI2, Timer2, Timer3, Timer4

          RCC_PCLK1Config(RCC_HCLK_Div2);

          /* ADCCLK = PCLK2/4 = 14 MHz */

          RCC_ADCCLKConfig(RCC_PCLK2_Div4);

         /* Configure PLLs *********************************************************/

          /* PLL2 configuration: PLL2CLK = (HSE / 5) * 8 = 40 MHz */

          RCC_PREDIV2Config(RCC_PREDIV2_Div5);

          RCC_PLL2Config(RCC_PLL2Mul_8);

          /* Enable PLL2 */

          RCC_PLL2Cmd(ENABLE);

          /* Wait till PLL2 is ready */

          while (RCC_GetFlagStatus(RCC_FLAG_PLL2RDY) == RESET);

          /* PLL configuration: PLLCLK = (PLL2 / 5) * 9 = 72 MHz */

          RCC_PREDIV1Config(RCC_PREDIV1_Source_PLL2, RCC_PREDIV1_Div5);

          RCC_PLLConfig(RCC_PLLSource_PREDIV1, RCC_PLLMul_9);

          /* PPL3 configuration: PLL3CLK = (HSE / 5) * 11 = PLL3_VCO = 110 MHz */

          RCC_PLL3Config(RCC_PLL3Mul_11);

          /* Enable PLL3 */

          RCC_PLL3Cmd(ENABLE);

          /* Wait till PLL3 is ready */

          while (RCC_GetFlagStatus(RCC_FLAG_PLL3RDY) == RESET);

          /* Configure I2S clock source: On Connectivity-Line Devices, the I2S can be clocked by PLL3 VCO instead of SYS_CLK in order to guarantee higher precision */

          RCC_I2S3CLKConfig(RCC_I2S3CLKSource_PLL3_VCO);

          /* Enable PLL */

          RCC_PLLCmd(ENABLE);

          /* Wait till PLL is ready */

          while(RCC_GetFlagStatus(RCC_FLAG_PLLRDY) == RESET);

          /* Select PLL as system clock source */

          RCC_SYSCLKConfig(RCC_SYSCLKSource_PLLCLK);

          /* Wait till PLL is used as system clock source */

          while(RCC_GetSYSCLKSource() != 0x08);

       } // end if

       // Enables the Clock Security System.

       RCC_ClockSecuritySystemCmd(ENABLE);

       /* Enable peripheral clocks --------------------------------------------------*/

       /* Enable DMA clock */

       //RCC_AHBPeriphClockCmd(RCC_AHBPeriph_DMA1 | RCC_AHBPeriph_DMA2, ENABLE);

       /* Enable ADC1, ADC3, TIM1 clock */

       //RCC_APB2PeriphClockCmd(RCC_APB2Periph_ADC1 | RCC_APB2Periph_ADC2 | RCC_APB2Periph_ADC3 | RCC_APB2Periph_TIM1, ENABLE);

       /* Enable GPIOA, GPIOB, GPIOC, GPIOG, GPIOF clock */

       RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOA | RCC_APB2Periph_GPIOB | RCC_APB2Periph_GPIOC | RCC_APB2Periph_GPIOG | RCC_APB2Periph_GPIOF, ENABLE);

    }

    tobias23
    Associate II
    May 17, 2011
    Posted on May 17, 2011 at 13:40

    Same here! Would be nice to have a working GCC linkerscript.

    boss
    Visitor II
    May 17, 2011
    Posted on May 17, 2011 at 13:40

    I have the same problem. Which linker and startup are you using?