Maker Pro
Maker Pro

Need a support for IAR-STM8

STP.Asghari

Nov 22, 2022
7
Joined
Nov 22, 2022
Messages
7
Hi everyone
I have downloaded a code and I want to use it in IAR for stm8 software.
Code:
// delay v1.0
// delays are limited by F_CPU * x overflowing 32bit integer value
#ifndef _UTIL_DELAY_H_
#define _UTIL_DELAY_H_ 1

#ifndef F_CPU
#warning F_CPU is not defined!
#endif

/*
 * Func delayed N cycles, where N = 3 + ( ticks * 3 )
 * so, ticks = ( N - 3 ) / 3, minimum delay is 6 CLK
 * when tick = 1, because 0 equels 65535
 */

static @inline void _delay_cycl( unsigned short __ticks )
{
#if defined(__CSMC__)
/* COSMIC */
  //#define T_COUNT(x) (( F_CPU * x / 1000000UL )-3)/3) // pùvodní varianta byla pøesnìjší ale hrozila podtíkáním
    #define T_COUNT(x) (((( F_CPU * x / 1000000UL ))/3)+1)
    // ldw X, __ticks ; insert automaticaly
    _asm("nop\n $N:\n decw X\n jrne $L\n nop\n ", __ticks);
#elif defined(__SDCC)
  //#define T_COUNT(x) (( F_CPU * x / 1000000UL )-5)/5) // pùvodní varianta byla pøesnìjší ale hrozila podtíkáním
    #define T_COUNT(x) (((( F_CPU * x / 1000000UL ))/5)+1)
    __asm__("nop\n nop\n");
    do {         // ASM: ldw X, #tick; lab$: decw X; tnzw X; jrne lab$
                __ticks--;//      2c;                 1c;     2c    ; 1/2c 
        } while ( __ticks );
    __asm__("nop\n");
#elif defined(__RCST7__)
/* RAISONANCE */
  #error ToDo for RAISONANCE
#elif defined(__ICCSTM8__)
/* IAR */
  #error ToDo for IAR
#else
 #error Unsupported Compiler!          /* Compiler defines not found */
#endif
}
This error occurs during compilation:
Code:
Fatal Error[Pe035]: #error directive: ToDo for IAR L:\شرکت\پروژه ها\Gps\Code\6 - rah andazi lcd\8\delay.h 37
The error is related to the following line:
Code:
  #error ToDo for IAR
I would be grateful if the experts of this forum could help to solve this problem.
 

bidrohini

Feb 1, 2023
164
Joined
Feb 1, 2023
Messages
164
Hi everyone
I have downloaded a code and I want to use it in IAR for stm8 software.
Code:
// delay v1.0
// delays are limited by F_CPU * x overflowing 32bit integer value
#ifndef _UTIL_DELAY_H_
#define _UTIL_DELAY_H_ 1

#ifndef F_CPU
#warning F_CPU is not defined!
#endif

/*
 * Func delayed N cycles, where N = 3 + ( ticks * 3 )
 * so, ticks = ( N - 3 ) / 3, minimum delay is 6 CLK
 * when tick = 1, because 0 equels 65535
 */

static @inline void _delay_cycl( unsigned short __ticks )
{
#if defined(__CSMC__)
/* COSMIC */
  //#define T_COUNT(x) (( F_CPU * x / 1000000UL )-3)/3) // pùvodní varianta byla pøesnìjší ale hrozila podtíkáním
    #define T_COUNT(x) (((( F_CPU * x / 1000000UL ))/3)+1)
    // ldw X, __ticks ; insert automaticaly
    _asm("nop\n $N:\n decw X\n jrne $L\n nop\n ", __ticks);
#elif defined(__SDCC)
  //#define T_COUNT(x) (( F_CPU * x / 1000000UL )-5)/5) // pùvodní varianta byla pøesnìjší ale hrozila podtíkáním
    #define T_COUNT(x) (((( F_CPU * x / 1000000UL ))/5)+1)
    __asm__("nop\n nop\n");
    do {         // ASM: ldw X, #tick; lab$: decw X; tnzw X; jrne lab$
                __ticks--;//      2c;                 1c;     2c    ; 1/2c
        } while ( __ticks );
    __asm__("nop\n");
#elif defined(__RCST7__)
/* RAISONANCE */
  #error ToDo for RAISONANCE
#elif defined(__ICCSTM8__)
/* IAR */
  #error ToDo for IAR
#else
 #error Unsupported Compiler!          /* Compiler defines not found */
#endif
}
This error occurs during compilation:
Code:
Fatal Error[Pe035]: #error directive: ToDo for IAR L:\شرکت\پروژه ها\Gps\Code\6 - rah andazi lcd\8\delay.h 37
The error is related to the following line:
Code:
  #error ToDo for IAR
I would be grateful if the experts of this forum could help to solve this problem.
I am not that experienced in STM. But I found the arm forum helpful in case of STM microcontrollers. You can post your questions there: https://community.arm.com/
 
Top