Announcement

Collapse
No announcement yet.

Stm32f103c4

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Stm32f103c4

    /************************************************** **********************************
    * File: main.cpp
    * Purpose: Cortex-M4 main file.
    * Replace with your code.
    * Date: 05 July 2013
    * Info: If __NO_SYSTEM_INIT is defined in the Build options,
    * the startup code will not branch to SystemInit()
    * and the function can be removed
    ************************************************** **********************************/
    #include <C:\iccv9cortex\include\include_bis\ST\STM32F10x\s tm32f10x_adc.h>
    #include <C:\iccv9cortex\include\include_bis\ST\STM32F10x\s tm32f10x_rcc.h>
    //#include <cstdlib>
    #include <C:\iccv9cortex\GnuARM\arm-none-eabi\include\malloc.h>
    #include <C:\iccv9cortex\GnuARM\arm-none-eabi\include\stdlib.h>

    //#include <malloc.h>


    #ifndef __NO_SYSTEM_INIT
    void SystemInit()
    {}
    #endif


    /************************************************** *******************
    *
    * main()
    *
    ************************************************** *******************/
    int main()

    {
    /************************************************** ****************
    *
    * Place your code here.
    ************************************************** ****************/
    ADC_InitTypeDef* res;


    /* Reset ADC init structure parameters values */
    /* Initialize the ADC_Mode member*/

    /*Allocation mémoire dynamique du pointeur */

    res= (ADC_InitTypeDef *)malloc(sizeof(ADC_InitTypeDef));

    res->ADC_NbrOfChannel = 1;

    res->ADC_Mode = ADC_Mode_Independent;
    /* initialize the ADC_ScanConvMode member */
    res->ADC_ScanConvMode = DISABLE;
    /* Initialize the ADC_ContinuousConvMode member */
    res->ADC_ContinuousConvMode = DISABLE;
    /* Initialize the ADC_ExternalTrigConv member */
    res->ADC_ExternalTrigConv = ADC_ExternalTrigConv_T1_CC1;
    /* Initialize the ADC_DataAlign member */
    res->ADC_DataAlign = ADC_DataAlign_Right;
    /* Initialize the ADC_NbrOfChannel member */
    //C_Inits->ADC_NbrOfChannel = 1;
    ADC_StructInit(res);

    ADC_Init(ADC1,res);
    ADC_RegularChannelConfig(ADC1,ADC_Channel_0,0x04,A DC_SampleTime_1Cycles5);
    free(res);
    return 0;
    }

    When I compile the source above, I get a problem
    cause I get two main errors which are following:


    \libnosys.a(sbrk.o): In function `_sbrk':
    sbrk.c.text._sbrk+0x18): undefined reference to `end'
    collect2.exe: error: ld returned 1 exit status
    Process terminated with status 1 (0 minute(s), 0 second(s))
    Build Failed: ExitCode(1) 2 error(s), 0 warning(s) (0 minute(s), 0 second(s))

    So, thank you for your reading of this post message.

    All the best,

    Arist_104

  • #2
    The "end" symbol definition is missing in the flash.ld linker file. Fix sent to user and will be incorporated in upcoming 9.04.03 release.

    Comment

    Working...
    X