Skip to main content
loder
Associate II
June 22, 2016
Question

IAR STM32F103C8 Project Setup

  • June 22, 2016
  • 7 replies
  • 2748 views
Posted on June 22, 2016 at 10:47

Hello forum,

i didn't find a tutorial on the web how to setup an IAR-project to send code to a STM32F103C8-Board with ST-LINK so i am asking here to find more information about it. First i am struggeling with the correct header file? I took a look in the ''arm\inc\ST\'' folder but there is no file for the STM32F103C8. There are only the these files:

''iostm32f10xx4.h''

''iostm32f10xxB.h''

''iostm32f10xxE.h''

''iostm32f10xxG.h''

No matter which file i include i always get the error while compiling:

''Fatal Error: cannot open source file''

''Error while runing C/C++ compiler''

Please help me!

#iar-workbenc #!stm32
This topic has been closed for replies.

7 replies

Nesrine M_O
Associate
June 22, 2016
Posted on June 22, 2016 at 13:43

Hi gustamko.master,

I suggest you to start from the template project under the STM32F1 cube firmware package: STM32Cube_FW_F1_V1.4.0\Projects\STM32F103RB-Nucleo\Templates

These projects provide a reference template that can be used to build any firmware application.

-Syrine-

Tesla DeLorean
Guru
June 22, 2016
Posted on June 22, 2016 at 14:23

It is a little unclear what you are doing, but usually one doesn't ADD include files to a project, their inclusion inferred by the source. What you need to do is add a list of include directory paths.

I would suggest you also look at the examples/templates in the Standard Peripheral Library (SPL), and the files, command line defines, and include paths.

Tips, Buy me a coffee, or three.. PayPal VenmoUp vote any posts that you find helpful, it shows what's working..
AvaTar
Senior III
June 22, 2016
Posted on June 22, 2016 at 14:57

> I would suggest you also look at the examples/templates in the Standard Peripheral Library (SPL), and the files, command line defines, and include paths.

 

I'd like to second clive1's point here - the SPL comes with IAR workspaces/projects (beside MDK and TrueStudio), so you can directly open them.

Perhaps some conversions for newer EWARM versions are required - the IDE will tell you.

loder
loderAuthor
Associate II
June 28, 2016
Posted on June 28, 2016 at 11:08

I don't have a Nucleo folder in my IAR program directory :(

loder
loderAuthor
Associate II
June 28, 2016
Posted on June 28, 2016 at 11:14

Okay i downloaded the STDPeripheral files from here:

https://my.st.com/content/my_st_com/en/products/embedded-software/mcus-embedded-software/stm32-embedded-software/stm32-standard-peripheral-libraries/stsw-stm32license%3d1467108656html I took a look in the ''3ADCs_DMA'' example and i saw that a ''stm32f10x.h'' is included but this specific file is not part of the standard peripheral library! For the beginning i just want to set an output high, this is my attempt:

#include ''stm32f10x.h''
int main()
{
GPIOB->ODR |= (1<<
3
);
GPIOB->CRH |= (1<<3);
return 0;
}

It looks like, IAR is also not familiar with the header file because i get an ''cannot open source file'' - error, even though there must be some header file which tells the compiler which register is at which address etc.?
loder
loderAuthor
Associate II
July 13, 2016
Posted on July 13, 2016 at 10:42

Please guys, help me!

Tesla DeLorean
Guru
July 13, 2016
Posted on July 13, 2016 at 13:31

I'm not an IAR user

Isn't the file here?

STM32F10x_StdPeriph_Lib_V3.5.0\Libraries\CMSIS\CM3\DeviceSupport\ST\STM32F10x\stm32f10x.h

You need to pay attention to the Include Paths that the project pulls files from, and the Defines it passes into the compiler. You will need to add the library source files to the project.

Please review the template project for EWARM (IAR), to get an idea of how to use your tool-chain.

STM32F10x_StdPeriph_Lib_V3.5.0\Project\STM32F10x_StdPeriph_Template\EWARM\Project.ewp

Also don't return from main(), only bad things can happen.

Tips, Buy me a coffee, or three.. PayPal VenmoUp vote any posts that you find helpful, it shows what's working..