diff options
Diffstat (limited to 'demos/ARMCM3-STM32F103')
| -rw-r--r-- | demos/ARMCM3-STM32F103/ch.ld | 69 | ||||
| -rw-r--r-- | demos/ARMCM3-STM32F103/chconf.h | 47 | ||||
| -rw-r--r-- | demos/ARMCM3-STM32F103/halconf.h | 70 | ||||
| -rw-r--r-- | demos/ARMCM3-STM32F103/iar/ch.ewp | 2 | ||||
| -rw-r--r-- | demos/ARMCM3-STM32F103/keil/ch.uvproj | 17 | ||||
| -rw-r--r-- | demos/ARMCM3-STM32F103/main.c | 9 | ||||
| -rw-r--r-- | demos/ARMCM3-STM32F103/mcuconf.h | 58 | ||||
| -rw-r--r-- | demos/ARMCM3-STM32F103/readme.txt | 6 | 
8 files changed, 205 insertions, 73 deletions
diff --git a/demos/ARMCM3-STM32F103/ch.ld b/demos/ARMCM3-STM32F103/ch.ld index 44f494121..4d97e7682 100644 --- a/demos/ARMCM3-STM32F103/ch.ld +++ b/demos/ARMCM3-STM32F103/ch.ld @@ -1,5 +1,6 @@  /*
 -    ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010 Giovanni Di Sirio.
 +    ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010,
 +                 2011 Giovanni Di Sirio.
      This file is part of ChibiOS/RT.
 @@ -37,11 +38,32 @@ __ram_end__             = __ram_start__ + __ram_size__;  SECTIONS
  {
      . = 0;
 +    _text = .;
 -    .text : ALIGN(16) SUBALIGN(16)
 +    startup : ALIGN(16) SUBALIGN(16)
      {
 -        _text = .;
          KEEP(*(vectors))
 +    } > flash
 +
 +    constructors : ALIGN(4) SUBALIGN(4)
 +    {
 +        PROVIDE(__init_array_start = .);
 +        KEEP(*(SORT(.init_array.*)))
 +        KEEP(*(.init_array))
 +        PROVIDE(__init_array_end = .);
 +    } > flash
 +
 +    destructors : ALIGN(4) SUBALIGN(4)
 +    {
 +        PROVIDE(__fini_array_start = .);
 +        KEEP(*(.fini_array))
 +        KEEP(*(SORT(.fini_array.*)))
 +        PROVIDE(__fini_array_end = .);
 +    } > flash
 +
 +    .text : ALIGN(16) SUBALIGN(16)
 +    {
 +        *(.text.startup.*)
          *(.text)
          *(.text.*)
          *(.rodata)
 @@ -51,31 +73,26 @@ SECTIONS          *(.gcc*)
      } > flash
 -    .ctors :
 +    .ARM.extab :
      {
 -        PROVIDE(_ctors_start_ = .);
 -        KEEP(*(SORT(.ctors.*)))
 -        KEEP(*(.ctors))
 -        PROVIDE(_ctors_end_ = .);
 +        *(.ARM.extab* .gnu.linkonce.armextab.*)
      } > flash
 -    .dtors :
 +    .ARM.exidx : {
 +        PROVIDE(__exidx_start = .);
 +        *(.ARM.exidx* .gnu.linkonce.armexidx.*)
 +        PROVIDE(__exidx_end = .);
 +     } > flash
 +
 +    .eh_frame_hdr :
      {
 -        PROVIDE(_dtors_start_ = .);
 -        KEEP(*(SORT(.dtors.*)))
 -        KEEP(*(.dtors))
 -        PROVIDE(_dtors_end_ = .);
 +        *(.eh_frame_hdr)
      } > flash
 -    .ARM.extab : {*(.ARM.extab* .gnu.linkonce.armextab.*)}
 -
 -    __exidx_start = .;
 -    .ARM.exidx : {*(.ARM.exidx* .gnu.linkonce.armexidx.*)} > flash
 -    __exidx_end = .;
 -
 -    .eh_frame_hdr : {*(.eh_frame_hdr)}
 -
 -    .eh_frame : ONLY_IF_RO {*(.eh_frame)}
 +    .eh_frame : ONLY_IF_RO
 +    {
 +        *(.eh_frame)
 +    } > flash
      . = ALIGN(4);
      _etext = .;
 @@ -83,26 +100,26 @@ SECTIONS      .data :
      {
 -        _data = .;
 +        PROVIDE(_data = .);
          *(.data)
          . = ALIGN(4);
          *(.data.*)
          . = ALIGN(4);
          *(.ramtext)
          . = ALIGN(4);
 -        _edata = .;
 +        PROVIDE(_edata = .);
      } > ram AT > flash
      .bss :
      {
 -        _bss_start = .;
 +        PROVIDE(_bss_start = .);
          *(.bss)
          . = ALIGN(4);
          *(.bss.*)
          . = ALIGN(4);
          *(COMMON)
          . = ALIGN(4);
 -        _bss_end = .;
 +        PROVIDE(_bss_end = .);
      } > ram    
  }
 diff --git a/demos/ARMCM3-STM32F103/chconf.h b/demos/ARMCM3-STM32F103/chconf.h index 3353391ca..c9c4c286a 100644 --- a/demos/ARMCM3-STM32F103/chconf.h +++ b/demos/ARMCM3-STM32F103/chconf.h @@ -1,5 +1,6 @@  /*
 -    ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010 Giovanni Di Sirio.
 +    ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010,
 +                 2011 Giovanni Di Sirio.
      This file is part of ChibiOS/RT.
 @@ -83,12 +84,29 @@   *
   * @note    In order to let the OS manage the whole RAM the linker script must
   *          provide the @p __heap_base__ and @p __heap_end__ symbols.
 - * @note    Requires @p CH_USE_COREMEM.
 + * @note    Requires @p CH_USE_MEMCORE.
   */
  #if !defined(CH_MEMCORE_SIZE) || defined(__DOXYGEN__)
  #define CH_MEMCORE_SIZE                 0
  #endif
 +/**
 + * @brief   Idle thread automatic spawn suppression.
 + * @details When this option is activated the function @p chSysInit()
 + *          does not spawn the idle thread automatically. The application has
 + *          then the responsibility to do one of the following:
 + *          - Spawn a custom idle thread at priority @p IDLEPRIO.
 + *          - Change the main() thread priority to @p IDLEPRIO then enter
 + *            an endless loop. In this scenario the @p main() thread acts as
 + *            the idle thread.
 + *          .
 + * @note    Unless an idle thread is spawned the @p main() thread must not
 + *          enter a sleep state.
 + */
 +#if !defined(CH_NO_IDLE_THREAD) || defined(__DOXYGEN__)
 +#define CH_NO_IDLE_THREAD               FALSE
 +#endif
 +
  /*===========================================================================*/
  /* Performance options.                                                      */
  /*===========================================================================*/
 @@ -105,26 +123,6 @@  #define CH_OPTIMIZE_SPEED               TRUE
  #endif
 -/**
 - * @brief   Exotic optimization.
 - * @details If defined then a CPU register is used as storage for the global
 - *          @p currp variable. Caching this variable in a register greatly
 - *          improves both space and time OS efficiency. A side effect is that
 - *          one less register has to be saved during the context switch
 - *          resulting in lower RAM usage and faster context switch.
 - *
 - * @note    This option is only usable with the GCC compiler and is only useful
 - *          on processors with many registers like ARM cores.
 - * @note    If this option is enabled then ALL the libraries linked to the
 - *          ChibiOS/RT code <b>must</b> be recompiled with the GCC option @p
 - *          -ffixed-@<reg@>.
 - * @note    This option must be enabled in the Makefile, it is listed here for
 - *          documentation only.
 - */
 -#if defined(__DOXYGEN__)
 -#define CH_CURRP_REGISTER_CACHE         "reg"
 -#endif
 -
  /*===========================================================================*/
  /* Subsystem options.                                                        */
  /*===========================================================================*/
 @@ -280,7 +278,6 @@   * @details If enabled then the I/O queues APIs are included in the kernel.
   *
   * @note    The default is @p TRUE.
 - * @note    Requires @p CH_USE_SEMAPHORES.
   */
  #if !defined(CH_USE_QUEUES) || defined(__DOXYGEN__)
  #define CH_USE_QUEUES                   TRUE
 @@ -303,7 +300,7 @@   *          in the kernel.
   *
   * @note    The default is @p TRUE.
 - * @note    Requires @p CH_USE_COREMEM and either @p CH_USE_MUTEXES or
 + * @note    Requires @p CH_USE_MEMCORE and either @p CH_USE_MUTEXES or
   *          @p CH_USE_SEMAPHORES.
   * @note    Mutexes are recommended.
   */
 @@ -318,7 +315,7 @@   *
   * @note    The default is @p FALSE.
   * @note    Requires @p CH_USE_HEAP.
 - * @note    The C-runtime may or may not require @p CH_USE_COREMEM, see the
 + * @note    The C-runtime may or may not require @p CH_USE_MEMCORE, see the
   *          appropriate documentation.
   */
  #if !defined(CH_USE_MALLOC_HEAP) || defined(__DOXYGEN__)
 diff --git a/demos/ARMCM3-STM32F103/halconf.h b/demos/ARMCM3-STM32F103/halconf.h index 890f3896b..d784e5233 100644 --- a/demos/ARMCM3-STM32F103/halconf.h +++ b/demos/ARMCM3-STM32F103/halconf.h @@ -1,5 +1,6 @@  /*
 -    ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010 Giovanni Di Sirio.
 +    ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010,
 +                 2011 Giovanni Di Sirio.
      This file is part of ChibiOS/RT.
 @@ -55,6 +56,13 @@  #endif
  /**
 + * @brief   Enables the GPT subsystem.
 + */
 +#if !defined(HAL_USE_GPT) || defined(__DOXYGEN__)
 +#define HAL_USE_GPT                 FALSE
 +#endif
 +
 +/**
   * @brief   Enables the I2C subsystem.
   */
  #if !defined(HAL_USE_I2C) || defined(__DOXYGEN__)
 @@ -62,6 +70,13 @@  #endif
  /**
 + * @brief   Enables the ICU subsystem.
 + */
 +#if !defined(HAL_USE_ICU) || defined(__DOXYGEN__)
 +#define HAL_USE_ICU                 FALSE
 +#endif
 +
 +/**
   * @brief   Enables the MAC subsystem.
   */
  #if !defined(HAL_USE_MAC) || defined(__DOXYGEN__)
 @@ -83,6 +98,13 @@  #endif
  /**
 + * @brief   Enables the SDC subsystem.
 + */
 +#if !defined(HAL_USE_SDC) || defined(__DOXYGEN__)
 +#define HAL_USE_SDC                 FALSE
 +#endif
 +
 +/**
   * @brief   Enables the SERIAL subsystem.
   */
  #if !defined(HAL_USE_SERIAL) || defined(__DOXYGEN__)
 @@ -90,6 +112,13 @@  #endif
  /**
 + * @brief   Enables the SERIAL over USB subsystem.
 + */
 +#if !defined(HAL_USE_SERIAL_USB) || defined(__DOXYGEN__)
 +#define HAL_USE_SERIAL_USB          FALSE
 +#endif
 +
 +/**
   * @brief   Enables the SPI subsystem.
   */
  #if !defined(HAL_USE_SPI) || defined(__DOXYGEN__)
 @@ -100,7 +129,14 @@   * @brief   Enables the UART subsystem.
   */
  #if !defined(HAL_USE_UART) || defined(__DOXYGEN__)
 -#define HAL_USE_UART                FALSE
 +#define HAL_USE_UART                TRUE
 +#endif
 +
 +/**
 + * @brief   Enables the USB subsystem.
 + */
 +#if !defined(HAL_USE_USB) || defined(__DOXYGEN__)
 +#define HAL_USE_USB                 FALSE
  #endif
  /*===========================================================================*/
 @@ -207,6 +243,36 @@  /*===========================================================================*/
  /*===========================================================================*/
 +/* SDC driver related settings.                                              */
 +/*===========================================================================*/
 +/**
 + * @brief   Number of initialization attempts before rejecting the card.
 + * @note    Attempts are performed at 10mS intevals.
 + */
 +#if !defined(SDC_INIT_RETRY) || defined(__DOXYGEN__)
 +#define SDC_INIT_RETRY              100
 +#endif
 +
 +/**
 + * @brief   Include support for MMC cards.
 + * @note    MMC support is not yet implemented so this option must be kept
 + *          at @p FALSE.
 + */
 +#if !defined(SDC_MMC_SUPPORT) || defined(__DOXYGEN__)
 +#define SDC_MMC_SUPPORT             FALSE
 +#endif
 +
 +/**
 + * @brief   Delays insertions.
 + * @details If enabled this options inserts delays into the MMC waiting
 + *          routines releasing some extra CPU time for the threads with
 + *          lower priority, this may slow down the driver a bit however.
 + */
 +#if !defined(SDC_NICE_WAITING) || defined(__DOXYGEN__)
 +#define SDC_NICE_WAITING            TRUE
 +#endif
 +
 +/*===========================================================================*/
  /* SERIAL driver related settings.                                           */
  /*===========================================================================*/
 diff --git a/demos/ARMCM3-STM32F103/iar/ch.ewp b/demos/ARMCM3-STM32F103/iar/ch.ewp index b5733a58c..085175d5f 100644 --- a/demos/ARMCM3-STM32F103/iar/ch.ewp +++ b/demos/ARMCM3-STM32F103/iar/ch.ewp @@ -523,6 +523,7 @@          </option>
          <option>
            <name>AUserIncludes</name>
 +          <state>$PROJ_DIR$\..\</state>
            <state>$PROJ_DIR$\..\..\..\os\ports\IAR\ARMCMx\STM32</state>
            <state>$PROJ_DIR$\..\..\..\boards\OLIMEX_STM32_P103</state>
          </option>
 @@ -1387,6 +1388,7 @@          </option>
          <option>
            <name>AUserIncludes</name>
 +          <state>$PROJ_DIR$\..\</state>
            <state>$PROJ_DIR$\..\..\..\os\ports\IAR\ARMCMx\STM32</state>
            <state>$PROJ_DIR$\..\..\..\boards\OLIMEX_STM32_P103</state>
          </option>
 diff --git a/demos/ARMCM3-STM32F103/keil/ch.uvproj b/demos/ARMCM3-STM32F103/keil/ch.uvproj index 88c373dcc..3f8ff22bd 100644 --- a/demos/ARMCM3-STM32F103/keil/ch.uvproj +++ b/demos/ARMCM3-STM32F103/keil/ch.uvproj @@ -361,7 +361,7 @@                <MiscControls>--cpreproc</MiscControls>                <Define></Define>                <Undefine></Undefine> -              <IncludePath>..\..\..\boards\OLIMEX_STM32_P103;..\..\..\os\ports\RVCT\ARMCMx\STM32</IncludePath> +              <IncludePath>..\;..\..\..\boards\OLIMEX_STM32_P103;..\..\..\os\ports\RVCT\ARMCMx\STM32</IncludePath>              </VariousControls>            </Aads>            <LDads> @@ -1031,6 +1031,21 @@                <FileType>1</FileType>                <FilePath>..\main.c</FilePath>              </File> +            <File> +              <FileName>chconf.h</FileName> +              <FileType>5</FileType> +              <FilePath>..\chconf.h</FilePath> +            </File> +            <File> +              <FileName>halconf.h</FileName> +              <FileType>5</FileType> +              <FilePath>..\halconf.h</FilePath> +            </File> +            <File> +              <FileName>mcuconf.h</FileName> +              <FileType>5</FileType> +              <FilePath>..\mcuconf.h</FilePath> +            </File>            </Files>          </Group>        </Groups> diff --git a/demos/ARMCM3-STM32F103/main.c b/demos/ARMCM3-STM32F103/main.c index 671124a42..d16bea6ab 100644 --- a/demos/ARMCM3-STM32F103/main.c +++ b/demos/ARMCM3-STM32F103/main.c @@ -1,5 +1,6 @@  /*
 -    ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010 Giovanni Di Sirio.
 +    ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010,
 +                 2011 Giovanni Di Sirio.
      This file is part of ChibiOS/RT.
 @@ -29,9 +30,9 @@ static msg_t Thread1(void *arg) {    (void)arg;
    while (TRUE) {
 -    palClearPad(IOPORT3, GPIOC_LED);
 +    palClearPad(GPIOC, GPIOC_LED);
      chThdSleepMilliseconds(500);
 -    palSetPad(IOPORT3, GPIOC_LED);
 +    palSetPad(GPIOC, GPIOC_LED);
      chThdSleepMilliseconds(500);
    }
  }
 @@ -66,7 +67,7 @@ int main(void) {     * sleeping in a loop and check the button state.
     */
    while (TRUE) {
 -    if (palReadPad(IOPORT1, GPIOA_BUTTON))
 +    if (palReadPad(GPIOA, GPIOA_BUTTON))
        TestThread(&SD2);
      chThdSleepMilliseconds(500);
    }
 diff --git a/demos/ARMCM3-STM32F103/mcuconf.h b/demos/ARMCM3-STM32F103/mcuconf.h index 4e640b93f..8f6199e69 100644 --- a/demos/ARMCM3-STM32F103/mcuconf.h +++ b/demos/ARMCM3-STM32F103/mcuconf.h @@ -1,5 +1,6 @@  /*
 -    ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010 Giovanni Di Sirio.
 +    ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010,
 +                 2011 Giovanni Di Sirio.
      This file is part of ChibiOS/RT.
 @@ -49,9 +50,9 @@   * ADC driver system settings.
   */
  #define STM32_ADC_USE_ADC1                  TRUE
 -#define STM32_ADC_ADC1_DMA_PRIORITY         3
 +#define STM32_ADC_ADC1_DMA_PRIORITY         2
  #define STM32_ADC_ADC1_IRQ_PRIORITY         5
 -#define STM32_ADC_ADC1_DMA_ERROR_HOOK()     chSysHalt()
 +#define STM32_ADC_DMA_ERROR_HOOK(adcp)      chSysHalt()
  /*
   * CAN driver system settings.
 @@ -60,8 +61,37 @@  #define STM32_CAN_CAN1_IRQ_PRIORITY         11
  /*
 + * GPT driver system settings.
 + */
 +#define STM32_GPT_USE_TIM1                  FALSE
 +#define STM32_GPT_USE_TIM2                  FALSE
 +#define STM32_GPT_USE_TIM3                  FALSE
 +#define STM32_GPT_USE_TIM4                  FALSE
 +#define STM32_GPT_USE_TIM5                  FALSE
 +#define STM32_GPT_TIM1_IRQ_PRIORITY         7
 +#define STM32_GPT_TIM2_IRQ_PRIORITY         7
 +#define STM32_GPT_TIM3_IRQ_PRIORITY         7
 +#define STM32_GPT_TIM4_IRQ_PRIORITY         7
 +#define STM32_GPT_TIM5_IRQ_PRIORITY         7
 +
 +/*
 + * ICU driver system settings.
 + */
 +#define STM32_ICU_USE_TIM1                  FALSE
 +#define STM32_ICU_USE_TIM2                  FALSE
 +#define STM32_ICU_USE_TIM3                  FALSE
 +#define STM32_ICU_USE_TIM4                  TRUE
 +#define STM32_ICU_USE_TIM5                  FALSE
 +#define STM32_ICU_TIM1_IRQ_PRIORITY         7
 +#define STM32_ICU_TIM2_IRQ_PRIORITY         7
 +#define STM32_ICU_TIM3_IRQ_PRIORITY         7
 +#define STM32_ICU_TIM4_IRQ_PRIORITY         7
 +#define STM32_ICU_TIM5_IRQ_PRIORITY         7
 +
 +/*
   * PWM driver system settings.
   */
 +#define STM32_PWM_USE_ADVANCED              TRUE
  #define STM32_PWM_USE_TIM1                  TRUE
  #define STM32_PWM_USE_TIM2                  FALSE
  #define STM32_PWM_USE_TIM3                  FALSE
 @@ -93,15 +123,13 @@  #define STM32_SPI_USE_SPI1                  TRUE
  #define STM32_SPI_USE_SPI2                  TRUE
  #define STM32_SPI_USE_SPI3                  FALSE
 -#define STM32_SPI_SPI1_DMA_PRIORITY         2
 -#define STM32_SPI_SPI2_DMA_PRIORITY         2
 -#define STM32_SPI_SPI3_DMA_PRIORITY         2
 +#define STM32_SPI_SPI1_DMA_PRIORITY         1
 +#define STM32_SPI_SPI2_DMA_PRIORITY         1
 +#define STM32_SPI_SPI3_DMA_PRIORITY         1
  #define STM32_SPI_SPI1_IRQ_PRIORITY         10
  #define STM32_SPI_SPI2_IRQ_PRIORITY         10
  #define STM32_SPI_SPI3_IRQ_PRIORITY         10
 -#define STM32_SPI_SPI1_DMA_ERROR_HOOK()     chSysHalt()
 -#define STM32_SPI_SPI2_DMA_ERROR_HOOK()     chSysHalt()
 -#define STM32_SPI_SPI3_DMA_ERROR_HOOK()     chSysHalt()
 +#define STM32_SPI_DMA_ERROR_HOOK(spip)      chSysHalt()
  /*
   * UART driver system settings.
 @@ -115,6 +143,12 @@  #define STM32_UART_USART1_DMA_PRIORITY      0
  #define STM32_UART_USART2_DMA_PRIORITY      0
  #define STM32_UART_USART3_DMA_PRIORITY      0
 -#define STM32_UART_USART1_DMA_ERROR_HOOK()  chSysHalt()
 -#define STM32_UART_USART2_DMA_ERROR_HOOK()  chSysHalt()
 -#define STM32_UART_USART3_DMA_ERROR_HOOK()  chSysHalt()
 +#define STM32_UART_DMA_ERROR_HOOK(uartp)    chSysHalt()
 +
 +/*
 + * USB driver system settings.
 + */
 +#define STM32_USB_USE_USB1                  TRUE
 +#define STM32_USB_LOW_POWER_ON_SUSPEND      FALSE
 +#define STM32_USB_USB1_HP_IRQ_PRIORITY      6
 +#define STM32_USB_USB1_LP_IRQ_PRIORITY      14
 diff --git a/demos/ARMCM3-STM32F103/readme.txt b/demos/ARMCM3-STM32F103/readme.txt index 5329bfb35..e14bc600f 100644 --- a/demos/ARMCM3-STM32F103/readme.txt +++ b/demos/ARMCM3-STM32F103/readme.txt @@ -10,12 +10,12 @@ The demo runs on an Olimex STM32-P103 board.  The demo flashes the board LED using a thread, by pressing the button located
  on the board the test procedure is activated with output on the serial port
 -COM2 (USART2).
 +SD2 (USART2).
  ** Build Procedure **
 -The demo has been tested by using the free Codesourcery GCC-based toolchain,
 -YAGARTO and an experimental WinARM build including GCC 4.3.0.
 +The demo has been tested by using the free Codesourcery GCC-based toolchain
 +and YAGARTO.
  Just modify the TRGT line in the makefile in order to use different GCC ports.
  ** Notes **
  | 
