gcccortex-mgcc-warningkeilarmcc

stm32f4 - discovery - Using the armcc compiler and setting include paths


So, im trying to build my self a program that will compile all my code and stuff in windows with gcc. (to use it with visual studio).

it have gone pretty good until now, when i have a include. the problem is that it cant finde the .H file since it´s in another directory. but even if i add the -Idir[PATH1,PATH2,PATH3] it still dosent find it.

this is my program im trying to compile

#include <stm32f10x.h>                      /* STM32F103 definitions         */

/*----------------------------------------------------------------------------
  wait function
 *----------------------------------------------------------------------------*/
void wait (void)  {
  int  d;

  for (d = 0; d < 2000000; d++);             /* only to delay for LED flashes */
}


/*----------------------------------------------------------------------------
  Main Program
 *----------------------------------------------------------------------------*/
int main (void) {
  unsigned int i;                            /* LED variable                  */

  RCC->APB2ENR |= (1UL << 3);                /* Enable GPIOB clock            */

  GPIOB->CRH    =  0x33333333;               /* PB.8..16 defined as Outputs   */

  while (1)  {                               /* Loop forever                  */
    for (i = 1<<8; i < 1<<15; i <<= 1) {     /* Blink LED 0,1,2,3,4,5,6       */
      GPIOB->BSRR = i;                       /* Turn LED on                   */
      wait ();                               /* call wait function            */
      GPIOB->BRR = i;                        /* Turn LED off                  */
    }
    for (i = 1<<15; i > 1<<8; i >>=1 ) {     /* Blink LED 7,6,5,4,3,2,1       */
      GPIOB->BSRR = i;                       /* Turn LED on                   */
      wait ();                               /* call wait function            */
      GPIOB->BRR = i;                        /* Turn LED off                  */
    }
  }
}

and this is my armcc compiler options. -

C:/Keil/ARM/ARMCC/bin/armcc.exe -c --dwarf2 --MD -O0 --cpu=cortex-m4 -Idir[,C:/Keil/ARM/INC/,C:/Keil/ARM/CMSIS/Include/,C:/Keil/ARM/INC/ST/STM32F10x/] -Jdir[,C:/Keil/ARM/INC/,C:/Keil/ARM/CMSIS/Include/,C:/Keil/ARM/INC/ST/STM32F10x/] Blinky.c

and the error i get is : Error 5: Cannot open source input file "stm32f10x.h" No such file or directory #include /* STM32F103 definitions */

Why do i get this error even if i include the paths? Have i actualy included my pahts correctly? any points, info or anything is more than welcome!


Solution

  • According to my reading of the Keil documentation for the -I option, your command line should look something like this:

     C:/Keil/ARM/ARMCC/bin/armcc.exe -c --dwarf2 --MD -O0 --cpu=cortex-m4 -IC:/Keil/ARM/INC/,C:/Keil/ARM/CMSIS/Include/,C:/Keil/ARM/INC/ST/STM32F10x/ -JC:/Keil/ARM/INC/,C:/Keil/ARM/CMSIS/Include/,C:/Keil/ARM/INC/ST/STM32F10x/ Blinky.c