Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

Need a support for IAR-STM8

Status
Not open for further replies.

STP.Asghari

New Member
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.
 
The error is simply due to there being no code whatsoever for IAR in that program, as the author never wrote anything!

They put the #error directive in as a placeholder.


The various "#if defined()" lines disable different sections dependant on the compiler being used.

The code only has a delay & calculation section for the "COSMIC" compiler.

That entire section would need re-writing with appropriate code and assembler lines, as needed, to work with the IAR compiler.
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top