Serial.println() was not printing on serial monitor

used library as below

http://dan.drown.org/stm32duino/package_STM32duino_index.json
https://github.com/stm32duino/BoardManagerFiles/raw/main/package_stmicroelectronics_index.json

OK. You lost the first one in the loop(). It should have started at 0. So we are back to post #2 also mentioned now in post #41 (and maybe elsewhere)
Anyway, it looks like it needs 5 seconds to start if left on its own.
Try this:

void setup()
{
  // put your setup code here, to run once:
  Serial.begin(115200);

  while (!Serial)
  {
    ; // Wait for serial to connect
  }

  delay(1000);
  Serial.println("setup()");
}

void loop()
{
  static uint32_t i = 0 ;
  Serial.print("loop()");  // should start at 0
  Serial.println( i++ ) ;
  delay( 1000) ;
}
void setup()
{
  // put your setup code here, to run once:
  Serial.begin(115200);

  while (!Serial)
  {
    ; // Wait for serial to connect
  }

  delay(1000);
  Serial.println("setup()");
}

void loop()
{
  static uint32_t i = 0 ;
  Serial.print("loop()");  // should start at 0
  Serial.println( i++ ) ;
  delay( 1000) ;
}

Serial monitor:
loop()1
loop()2
loop()3
loop()4
loop()5
loop()6
loop()7
loop()8

One last try. This time with serialEventRun(); which is about the only difference between setup() and loop() :

void setup()
{
  // put your setup code here, to run once:
  Serial.begin(115200);

  while (!Serial)
  {
    ; // Wait for serial to connect
  }

  delay(1000);
  serialEventRun();   
  Serial.println("setup()");
  serialEventRun();
}

void loop()
{
  static uint32_t i = 0 ;
  Serial.print("loop()");  // should start at 0
  Serial.println( i++ ) ;
  delay( 1000) ;
}

exit status 1
'serialEventRun' was not declared in this scope

how to declare "serialEventRun" ?

ok bro , i think better i change the board with UNO Board. first of all actually i need only six free pwm pin. 3 for servo and 3 for dc motor. but uno board pwm pin there are 2 pin (pin 3 and pin 11) already used by irremote library. if i use board 2560, it waste a lot of pin and flash memory (not economically). any idea.

For RC servos, you don't have to use PWM pins, but you will lose the use of two of them.

OK. That was simply to try to isolate the problem. serialEventRun() is not the main issue. I don't have the old "David Clarke" STM core installed (that DanDrown link) to try.

However, if that is the only problem that code in setup() does not run until one full loop iteration is executed before it behaves normally, you can do a trick like this creating your own version of setup() :

uint8_t loopCount = 0 ;

void mySetup() {
  // put your setup code here, to run once:
  Serial.begin(115200);
  delay(1000);
  Serial.println("setup()");
}

void setup()
{ /* leave empty */
}


void loop()
{
  // =============================
  if ( loopCount == 0 ) {
    loopCount++ ;
    return ;
  } else if ( loopCount == 1 ) {
    loopCount ++ ;
    mySetup() ;
  }
  // =============================

  static uint32_t i = 0 ;
  Serial.print("loop()");  // should start at 0
  Serial.println( i++ ) ;
  delay( 100) ;
}

But if there is a basic problem with the Arduino core software that you are using, you'd be better clearing that issue first rather than resorting to work arounds.

sorry late reply. the serial monitor was showing :
loop()1
loop()2
loop()3
loop()4
loop()5
loop()6
loop()7
loop()8
loop()9
loop()10
loop()11

they are not starting from "0"

RC = RACING CAR ? so can i use others I/O pin ?

RC == Radio Control

this one means for two pwm pin or two of rcservo?

Start here

thank you for the solution. i closed this issue.