Page 1 of 2

STM32F3 Discovery - IAR

Posted: Sun Oct 13, 2013 3:58 pm
by midihenry
Hello,
I've just downloaded the 2.6.1 version of ChibiOS and I am trying to work on the STM32F3 Discovery board. Could someone please tell me how to use it on IAR Embedded Workbench as I couldn't find an iar project folder for the board as for the F4 board.
Thanks in advance.

Re: STM32F3 Discovery - IAR

Posted: Sun Oct 13, 2013 5:04 pm
by Giovanni
Hi,

An IAR project is not provided in all demos because it is a pain to update all the project files when a path changes. You should copy the IAR directory from the F4 demo into the F3 demo and adjust the few paths that refers the F4 platform.

Giovanni

Re: STM32F3 Discovery - IAR

Posted: Sun Oct 13, 2013 5:25 pm
by midihenry
Thank you for the response, I'm a beginner but I'll try to do that :)

Re: STM32F3 Discovery - IAR

Posted: Sun Oct 13, 2013 10:53 pm
by midihenry
I tried to make the changes on the F4 iar project but still get those errors..
Fatal Error[Pe035]: #error directive: "Using a wrong mcuconf.h file, STM32F2xx_MCUCONF not defined"
Fatal Error[Pe1696]: cannot open source file "stm32f4xx.h" C:\Users\toshiba\Desktop\Robotique\ChibiOS_2.6.1\os\hal\platforms\STM32\stm32.h 65
Fatal Error[Pe035]: #error directive: "Using a wrong mcuconf.h file, STM32F2xx_MCUCONF not defined"
Error[Pe020]: identifier "SPIDriver" is undefined C:\Users\toshiba\Desktop\Robotique\ChibiOS_2.6.1\os\various\devices_lib\accel\lis302dl.h 85
Error[Pe020]: identifier "SPIDriver" is undefined C:\Users\toshiba\Desktop\Robotique\ChibiOS_2.6.1\os\various\devices_lib\accel\lis302dl.h 86
Error[Pe020]: identifier "SPIDriver" is undefined C:\Users\toshiba\Desktop\Robotique\ChibiOS_2.6.1\os\various\devices_lib\accel\lis302dl.c 60
Warning[Pe223]: function "spiSelect" declared implicitly C:\Users\toshiba\Desktop\Robotique\ChibiOS_2.6.1\os\various\devices_lib\accel\lis302dl.c 62
Warning[Pe223]: function "spiExchange" declared implicitly C:\Users\toshiba\Desktop\Robotique\ChibiOS_2.6.1\os\various\devices_lib\accel\lis302dl.c 65
Warning[Pe223]: function "spiUnselect" declared implicitly C:\Users\toshiba\Desktop\Robotique\ChibiOS_2.6.1\os\various\devices_lib\accel\lis302dl.c 66
Error[Pe020]: identifier "SPIDriver" is undefined C:\Users\toshiba\Desktop\Robotique\ChibiOS_2.6.1\os\various\devices_lib\accel\lis302dl.c 78
Warning[Pe223]: function "spiSelect" declared implicitly C:\Users\toshiba\Desktop\Robotique\ChibiOS_2.6.1\os\various\devices_lib\accel\lis302dl.c 111
Warning[Pe223]: function "spiSend" declared implicitly C:\Users\toshiba\Desktop\Robotique\ChibiOS_2.6.1\os\various\devices_lib\accel\lis302dl.c 114
Warning[Pe223]: function "spiUnselect" declared implicitly C:\Users\toshiba\Desktop\Robotique\ChibiOS_2.6.1\os\various\devices_lib\accel\lis302dl.c 115
Error[Pe136]: struct "<unnamed>" has no field "SR" C:\Users\toshiba\Desktop\Robotique\ChibiOS_2.6.1\os\hal\platforms\STM32\USARTv1\serial_lld.c 111
Error[Pe136]: struct "<unnamed>" has no field "SR" C:\Users\toshiba\Desktop\Robotique\ChibiOS_2.6.1\os\hal\platforms\STM32\USARTv1\serial_lld.c 112
Error[Pe136]: struct "<unnamed>" has no field "DR" C:\Users\toshiba\Desktop\Robotique\ChibiOS_2.6.1\os\hal\platforms\STM32\USARTv1\serial_lld.c 113
Error[Pe020]: identifier "USART_SR_ORE" is undefined C:\Users\toshiba\Desktop\Robotique\ChibiOS_2.6.1\os\hal\platforms\STM32\USARTv1\serial_lld.c 138
Error[Pe020]: identifier "USART_SR_PE" is undefined C:\Users\toshiba\Desktop\Robotique\ChibiOS_2.6.1\os\hal\platforms\STM32\USARTv1\serial_lld.c 140
Error[Pe020]: identifier "USART_SR_FE" is undefined C:\Users\toshiba\Desktop\Robotique\ChibiOS_2.6.1\os\hal\platforms\STM32\USARTv1\serial_lld.c 142
Error[Pe020]: identifier "USART_SR_NE" is undefined C:\Users\toshiba\Desktop\Robotique\ChibiOS_2.6.1\os\hal\platforms\STM32\USARTv1\serial_lld.c 144
Error[Pe136]: struct "<unnamed>" has no field "SR" C:\Users\toshiba\Desktop\Robotique\ChibiOS_2.6.1\os\hal\platforms\STM32\USARTv1\serial_lld.c 159
Error[Pe136]: struct "<unnamed>" has no field "DR" C:\Users\toshiba\Desktop\Robotique\ChibiOS_2.6.1\os\hal\platforms\STM32\USARTv1\serial_lld.c 160
Error[Pe020]: identifier "USART_SR_ORE" is undefined C:\Users\toshiba\Desktop\Robotique\ChibiOS_2.6.1\os\hal\platforms\STM32\USARTv1\serial_lld.c 163
Error[Pe020]: identifier "USART_SR_NE" is undefined C:\Users\toshiba\Desktop\Robotique\ChibiOS_2.6.1\os\hal\platforms\STM32\USARTv1\serial_lld.c 163
Error[Pe020]: identifier "USART_SR_FE" is undefined C:\Users\toshiba\Desktop\Robotique\ChibiOS_2.6.1\os\hal\platforms\STM32\USARTv1\serial_lld.c 163
Error[Pe020]: identifier "USART_SR_PE" is undefined C:\Users\toshiba\Desktop\Robotique\ChibiOS_2.6.1\os\hal\platforms\STM32\USARTv1\serial_lld.c 163
Error[Pe020]: identifier "USART_SR_LBD" is undefined C:\Users\toshiba\Desktop\Robotique\ChibiOS_2.6.1\os\hal\platforms\STM32\USARTv1\serial_lld.c 166
Error[Pe136]: struct "<unnamed>" has no field "SR" C:\Users\toshiba\Desktop\Robotique\ChibiOS_2.6.1\os\hal\platforms\STM32\USARTv1\serial_lld.c 170
Error[Pe020]: identifier "USART_SR_RXNE" is undefined C:\Users\toshiba\Desktop\Robotique\ChibiOS_2.6.1\os\hal\platforms\STM32\USARTv1\serial_lld.c 173
Error[Pe020]: identifier "USART_SR_TXE" is undefined C:\Users\toshiba\Desktop\Robotique\ChibiOS_2.6.1\os\hal\platforms\STM32\USARTv1\serial_lld.c 179
Error[Pe136]: struct "<unnamed>" has no field "DR" C:\Users\toshiba\Desktop\Robotique\ChibiOS_2.6.1\os\hal\platforms\STM32\USARTv1\serial_lld.c 188
Error[Pe020]: identifier "USART_SR_TC" is undefined C:\Users\toshiba\Desktop\Robotique\ChibiOS_2.6.1\os\hal\platforms\STM32\USARTv1\serial_lld.c 192
Error[Pe136]: struct "<unnamed>" has no field "SR" C:\Users\toshiba\Desktop\Robotique\ChibiOS_2.6.1\os\hal\platforms\STM32\USARTv1\serial_lld.c 197
Fatal Error[Pe035]: #error directive: "Using a wrong mcuconf.h file, STM32F2xx_MCUCONF not defined"

Re: STM32F3 Discovery - IAR

Posted: Mon Oct 14, 2013 8:39 am
by Giovanni
You are using the wrong platform files, it expects STM32F2xx_MCUCON defined in mcuconf.h.

You have to switch all paths to the F3 directories.

Giovanni

Re: STM32F3 Discovery - IAR

Posted: Mon Oct 14, 2013 4:17 pm
by midihenry
Thank you :) Well there is stil only a problem apparently with the spi_lld.h file eventhough I included it :/
lis302dl.c
Error[Pe020]: identifier "SPIDriver" is undefined C:\Users\toshiba\Desktop\Robotique\ChibiOS_2.6.1\os\various\devices_lib\accel\lis302dl.h 85
Error[Pe020]: identifier "SPIDriver" is undefined C:\Users\toshiba\Desktop\Robotique\ChibiOS_2.6.1\os\various\devices_lib\accel\lis302dl.h 86
Error[Pe020]: identifier "SPIDriver" is undefined C:\Users\toshiba\Desktop\Robotique\ChibiOS_2.6.1\os\various\devices_lib\accel\lis302dl.c 60
Warning[Pe223]: function "spiSelect" declared implicitly C:\Users\toshiba\Desktop\Robotique\ChibiOS_2.6.1\os\various\devices_lib\accel\lis302dl.c 62
Warning[Pe223]: function "spiExchange" declared implicitly C:\Users\toshiba\Desktop\Robotique\ChibiOS_2.6.1\os\various\devices_lib\accel\lis302dl.c 65
Warning[Pe223]: function "spiUnselect" declared implicitly C:\Users\toshiba\Desktop\Robotique\ChibiOS_2.6.1\os\various\devices_lib\accel\lis302dl.c 66
Error[Pe020]: identifier "SPIDriver" is undefined C:\Users\toshiba\Desktop\Robotique\ChibiOS_2.6.1\os\various\devices_lib\accel\lis302dl.c 78
Warning[Pe223]: function "spiSelect" declared implicitly C:\Users\toshiba\Desktop\Robotique\ChibiOS_2.6.1\os\various\devices_lib\accel\lis302dl.c 111
Warning[Pe223]: function "spiSend" declared implicitly C:\Users\toshiba\Desktop\Robotique\ChibiOS_2.6.1\os\various\devices_lib\accel\lis302dl.c 114
Warning[Pe223]: function "spiUnselect" declared implicitly C:\Users\toshiba\Desktop\Robotique\ChibiOS_2.6.1\os\various\devices_lib\accel\lis302dl.c 115

Re: STM32F3 Discovery - IAR

Posted: Mon Oct 14, 2013 5:42 pm
by Giovanni
Hi,

Is the SPI driver enabled in halconf.h? (it should in the existing demo)

Giovanni

Re: STM32F3 Discovery - IAR

Posted: Tue Oct 15, 2013 1:29 am
by midihenry
I tried to enable it but I got this error
Fatal Error[Pe035]: #error directive: "SPI driver activated but no SPI peripheral assigned" C:\Users\toshiba\Desktop\Robotique\ChibiOS_2.6.1\os\hal\platforms\STM32\SPIv1\spi_lld.h 208


Well anyway here is the original halconf.h file

Code: Select all

#ifndef _HALCONF_H_
#define _HALCONF_H_

#include "mcuconf.h"

/**
 * @brief   Enables the TM subsystem.
 */
#if !defined(HAL_USE_TM) || defined(__DOXYGEN__)
#define HAL_USE_TM                  FALSE
#endif

/**
 * @brief   Enables the PAL subsystem.
 */
#if !defined(HAL_USE_PAL) || defined(__DOXYGEN__)
#define HAL_USE_PAL                 TRUE
#endif

/**
 * @brief   Enables the ADC subsystem.
 */
#if !defined(HAL_USE_ADC) || defined(__DOXYGEN__)
#define HAL_USE_ADC                 FALSE
#endif

/**
 * @brief   Enables the CAN subsystem.
 */
#if !defined(HAL_USE_CAN) || defined(__DOXYGEN__)
#define HAL_USE_CAN                 FALSE
#endif

/**
 * @brief   Enables the EXT subsystem.
 */
#if !defined(HAL_USE_EXT) || defined(__DOXYGEN__)
#define HAL_USE_EXT                 FALSE
#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__)
#define HAL_USE_I2C                 FALSE
#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__)
#define HAL_USE_MAC                 FALSE
#endif

/**
 * @brief   Enables the MMC_SPI subsystem.
 */
#if !defined(HAL_USE_MMC_SPI) || defined(__DOXYGEN__)
#define HAL_USE_MMC_SPI             FALSE
#endif

/**
 * @brief   Enables the PWM subsystem.
 */
#if !defined(HAL_USE_PWM) || defined(__DOXYGEN__)
#define HAL_USE_PWM                 FALSE
#endif

/**
 * @brief   Enables the RTC subsystem.
 */
#if !defined(HAL_USE_RTC) || defined(__DOXYGEN__)
#define HAL_USE_RTC                 FALSE
#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__)
#define HAL_USE_SERIAL              TRUE
#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__)
#define HAL_USE_SPI                 FALSE
#endif

/**
 * @brief   Enables the UART subsystem.
 */
#if !defined(HAL_USE_UART) || defined(__DOXYGEN__)
#define HAL_USE_UART                FALSE
#endif

/**
 * @brief   Enables the USB subsystem.
 */
#if !defined(HAL_USE_USB) || defined(__DOXYGEN__)
#define HAL_USE_USB                 FALSE
#endif

/*===========================================================================*/
/* ADC driver related settings.                                              */
/*===========================================================================*/

/**
 * @brief   Enables synchronous APIs.
 * @note    Disabling this option saves both code and data space.
 */
#if !defined(ADC_USE_WAIT) || defined(__DOXYGEN__)
#define ADC_USE_WAIT                TRUE
#endif

/**
 * @brief   Enables the @p adcAcquireBus() and @p adcReleaseBus() APIs.
 * @note    Disabling this option saves both code and data space.
 */
#if !defined(ADC_USE_MUTUAL_EXCLUSION) || defined(__DOXYGEN__)
#define ADC_USE_MUTUAL_EXCLUSION    TRUE
#endif

/*===========================================================================*/
/* CAN driver related settings.                                              */
/*===========================================================================*/

/**
 * @brief   Sleep mode related APIs inclusion switch.
 */
#if !defined(CAN_USE_SLEEP_MODE) || defined(__DOXYGEN__)
#define CAN_USE_SLEEP_MODE          TRUE
#endif

/*===========================================================================*/
/* I2C driver related settings.                                              */
/*===========================================================================*/

/**
 * @brief   Enables the mutual exclusion APIs on the I2C bus.
 */
#if !defined(I2C_USE_MUTUAL_EXCLUSION) || defined(__DOXYGEN__)
#define I2C_USE_MUTUAL_EXCLUSION    TRUE
#endif

/*===========================================================================*/
/* MAC driver related settings.                                              */
/*===========================================================================*/

/**
 * @brief   Enables an event sources for incoming packets.
 */
#if !defined(MAC_USE_ZERO_COPY) || defined(__DOXYGEN__)
#define MAC_USE_ZERO_COPY           FALSE
#endif

/**
 * @brief   Enables an event sources for incoming packets.
 */
#if !defined(MAC_USE_EVENTS) || defined(__DOXYGEN__)
#define MAC_USE_EVENTS              TRUE
#endif

/*===========================================================================*/
/* MMC_SPI driver related settings.                                          */
/*===========================================================================*/

/**
 * @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.
 *          This option is recommended also if the SPI driver does not
 *          use a DMA channel and heavily loads the CPU.
 */
#if !defined(MMC_NICE_WAITING) || defined(__DOXYGEN__)
#define MMC_NICE_WAITING            TRUE
#endif

/*===========================================================================*/
/* SDC driver related settings.                                              */
/*===========================================================================*/

/**
 * @brief   Number of initialization attempts before rejecting the card.
 * @note    Attempts are performed at 10mS intervals.
 */
#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.                                           */
/*===========================================================================*/

/**
 * @brief   Default bit rate.
 * @details Configuration parameter, this is the baud rate selected for the
 *          default configuration.
 */
#if !defined(SERIAL_DEFAULT_BITRATE) || defined(__DOXYGEN__)
#define SERIAL_DEFAULT_BITRATE      38400
#endif

/**
 * @brief   Serial buffers size.
 * @details Configuration parameter, you can change the depth of the queue
 *          buffers depending on the requirements of your application.
 * @note    The default is 64 bytes for both the transmission and receive
 *          buffers.
 */
#if !defined(SERIAL_BUFFERS_SIZE) || defined(__DOXYGEN__)
#define SERIAL_BUFFERS_SIZE         16
#endif

/*===========================================================================*/
/* SPI driver related settings.                                              */
/*===========================================================================*/

/**
 * @brief   Enables synchronous APIs.
 * @note    Disabling this option saves both code and data space.
 */
#if !defined(SPI_USE_WAIT) || defined(__DOXYGEN__)
#define SPI_USE_WAIT                TRUE
#endif

/**
 * @brief   Enables the @p spiAcquireBus() and @p spiReleaseBus() APIs.
 * @note    Disabling this option saves both code and data space.
 */
#if !defined(SPI_USE_MUTUAL_EXCLUSION) || defined(__DOXYGEN__)
#define SPI_USE_MUTUAL_EXCLUSION    TRUE
#endif

#endif /* _HALCONF_H_ */


Thanks again :)

Re: STM32F3 Discovery - IAR

Posted: Tue Oct 15, 2013 8:19 am
by Giovanni
In halconf.h you enable the SPI driver, in mcuconf.h you assign the spysical SPI units to the SPI driver. You just need to select which SPI you want to use.

Giovanni

Re: STM32F3 Discovery - IAR

Posted: Wed Oct 16, 2013 7:25 pm
by midihenry
Thank you :D
But I still only have this error..
Error[Pe020]: identifier "SPI_CR1_DFF" is undefined C:\Users\toshiba\Desktop\Robotique\ChibiOS_2.6.1\os\hal\platforms\STM32\SPIv1\spi_lld.c 272


I really appreciate your help