MikroC pro for ARM compiler problems

General discussion on mikroC PRO for ARM.
Post Reply
Author
Message
p77
Posts: 10
Joined: 03 Nov 2016 16:33

MikroC pro for ARM compiler problems

#1 Post by p77 » 10 Apr 2023 10:00

Hello guys,

I have bought a bunch of Mikroe development equipment a couple of days ago and the smile :D on my face ended the moment I started using the tools :shock: .
Mikro C pro for ARM:
Selecting libraries from the Library manager and using "Rebuild libraries" button gives one list of compiler errors such as:
13 393 '_MIKROBUS_ERR_PIN' Identifier redefined __mm_stm32_m4_gpio.c
15 393 '_GPIO_OUTPUT' Identifier redefined __mm_stm32_m4_gpio.c
16 393 '_GPIO_INPUT' Identifier redefined __mm_stm32_m4_gpio.c
18 393 '_MIKROBUS_AN_PIN' Identifier redefined __mm_stm32_m4_gpio.c
etc.
WHILE in the exact same situation clicking "Rebuild all sources" returns:
File 'easymx_v7_STM32F407VG.c' not found
Can't open include file "__t_stm32.h" #include "__t_STM32.h" 1 error in preprocessor.
These are just a few errors keeping me from doing any actual work.
No matter what I do, or what addresses I include in search paths there is always something missing or not working.
Here is the code I am working on (It's a demo code for Clicker2 for STM32)

Code: Select all

/*
 * Project name:
     clicker 2 for STM32 (Simple 'Hello World' project)
 * Copyright:
     (c) Mikroelektronika, 2014.
 * Revision History:
     20140924:
       - initial release (FJ);
 * Description:
     This is a simple 'Hello World' project. It turns on/off LEDs connected to
     PE12 and PE15 pins depending on pressed buttons. Left button T1 changes mode
     of blinking and right button changes frequency of blinking.
 * Test configuration:
     MCU:             STM32F407VG
                      http://www.st.com/st-web-ui/static/active/en/resource/technical/document/datasheet/DM00037051.pdf
     Dev.Board:       clicker 2 for STM32 - ac:clicker_2_STM32
                      http://www.mikroe.com/stm32/clicker-2/
     Oscillator:      HSI-PLL, 120.000MHz
     Ext. Modules:    None.
     SW:              mikroC PRO for ARM
                      http://www.mikroe.com/mikroc/arm/
 */
#include "__t_STM32.h" // LITERALLY THE ONLY CHANGE IN THE DEMO CODE, HAVENT GOTTEN ANY FURTHER THAN THIS

// pin definitions
sbit LD1 at ODR12_GPIOE_ODR_bit;
sbit LD2 at ODR15_GPIOE_ODR_bit;

// globals
char oldstate1 = 0, oldstate2 = 0;
char Example_State = 0;
char count;

//Timer2 Prescaler :959; Preload = 62499; Actual Interrupt Time = 500 ms
void InitTimer2(){
  RCC_APB1ENR.TIM2EN = 1;
  TIM2_CR1.CEN = 0;
  TIM2_PSC = 959;
  TIM2_ARR = 62499;
  NVIC_IntEnable(IVT_INT_TIM2);
  TIM2_DIER.UIE = 1;
  TIM2_CR1.CEN = 1;
}

// ISR
void Timer2_interrupt() iv IVT_INT_TIM2 {
char temp;
  TIM2_SR.UIF = 0;
  // check T1 button state
  switch (Example_State & 0x0F){
    case 0 : LD1 = 0;                     // Both LEDs are OFF
             LD2 = 0;
             break;
    case 1 : LD1 ^= 1;                    // Only LD1 blinks
             LD2 = 0;
             break;
    case 2 : LD1 = 0;                     // Only LD2 blinks
             LD2 ^= 1;
             break;
    case 3 : LD1 ^= 1;                    // Both LEDs blinks alternately
             LD2  = !LD1;
             break;
    case 4 : LD1 ^= 1;                    // Both LEDs blink simultaneously
             LD2  = LD1;
             break;
    default : Example_State &= 0xF0;      // reset T1 state to zero
              break;
  }
  // check T2 button state
  switch (Example_State & 0xF0){
    case 0x00 : TIM2_PSC = 959;           // Set Timer2 Interrupt time to 500ms
                TIM2_ARR = 62499;
                break;
    case 0x10 : TIM2_PSC = 749;           // Set Timer2 Interrupt time to 400ms
                TIM2_ARR = 63999;         
                break;
    case 0x20 : TIM2_PSC = 575;           // Set Timer2 Interrupt time to 300ms
                TIM2_ARR = 62499;
                break;
    case 0x30 : TIM2_PSC = 374;           // Set Timer2 Interrupt time to 200ms
                TIM2_ARR = 63999;
                break;
    case 0x40 : TIM2_PSC = 191;           // Set Timer2 Interrupt time to 100ms
                TIM2_ARR = 62499;
                break;
    default :   TIM2_PSC = 959;           // Set Timer2 Interrupt time to 500ms
                TIM2_ARR = 62499;
                Example_State &= 0x0F;    // reset T1 state to zero
                break;
  }
}

// main function
void main() {
  // Set GPIO_PORTE pin 0 as digital input
  GPIO_Digital_Input(&GPIOE_BASE, _GPIO_PINMASK_0);

  // Set GPIO_PORTA pin 10 as digital input
  GPIO_Digital_Input(&GPIOA_BASE, _GPIO_PINMASK_10);

  // Set GPIO_PORTE pins 12 and 15 as digital output
  GPIO_Digital_Output(&GPIOE_BASE, _GPIO_PINMASK_12 | _GPIO_PINMASK_15);

  LD1 = 0;                  // turn off LEDs
  LD2 = 0;
  
  Example_State = 0;        // set default Example state

  InitTimer2();             // initialize Timer2

  while(1){                 // Endless loop
    // check T1 button
    if (Button(&GPIOE_IDR, 0, 2, 0)) {            // Detect logical zero
      oldstate1 = 1;                              // Update flag
    }
    if (oldstate1 && Button(&GPIOE_IDR, 0, 2, 1)) {   // Detect zero-to-one transition
      oldstate1 = 0;                              // Update flag
      Example_State += 0x01;                      // set new Example state
      if ((Example_State & 0x0F) > 4)
        Example_State &= 0xF0;
    }
    // check T2 button
    if (Button(&GPIOA_IDR, 10, 2, 0)) {           // Detect logical zero
      oldstate2 = 1;                              // Update flag
    }
    if (oldstate2 && Button(&GPIOA_IDR, 10, 2, 1)) {   // Detect zero-to-one transition
      oldstate2 = 0;                              // Update flag
      Example_State += 0x10;                      // set new Example state
      if ((Example_State & 0xF0) > 0x40)
        Example_State &= 0x0F;
    }
  }
}
CODEGrip - 6 hours of tampering just to clear MCU on Clicker2 Board by testing any possible combination of options in the CODEGRIP suite.

Clicker4 for TMPM4K Board is not even programmable with CodeGrip nor the CLIKER4 for TMPM4K hardware is supported by any Mikroe Software products.

What is actually going on?

Smart_Aleck
Posts: 16
Joined: 07 Feb 2023 20:45

Re: MikroC pro for ARM compiler problems

#2 Post by Smart_Aleck » 10 Apr 2023 10:50

Hi p77,

I can fully understand your frustration. I'm using different tool chains, not only the ones from Mikroe, and they all have their issues.

Are you using Clicker 2 for STM32 or EasyMx PRO v7 for STM32 ?

At a first glance, including a header file like "__t_STM32.h" seems to be not correct, anyway.
CLICKER4 for TMPM4K hardware is (not) supported by any Mikroe Software products
This is correct. However, if you follow the links and instructions on the product page, you will find information how to use this board under IAR or Keil.
I had the same issue with my board.

p77
Posts: 10
Joined: 03 Nov 2016 16:33

Re: MikroC pro for ARM compiler problems

#3 Post by p77 » 10 Apr 2023 11:00

Hello Aleck,

Thanks for the fast reply. I think there are some issues with installation locations eg. You have to use the default installation locations for the software/compiler to work.

Yes, I am using Clicker2 for STM32.

I am browsing through libraries both .c and .h files like a tornado.
The header is there, the OLED display library uses it originally.
I need to cut out some parts and maybe do some testing but I think it might work this time.

I'll update you later.

Best regards,

User avatar
filip
mikroElektronika team
Posts: 11874
Joined: 25 Jan 2008 09:56

Re: MikroC pro for ARM compiler problems

#4 Post by filip » 13 Apr 2023 13:32

Hi,

If you don't manage to solve this, please attach your project here.

Regards,
Filip.

Post Reply

Return to “mikroC PRO for ARM General”