Page 1 of 3

WHICH CORE?!

Posted: Sun Oct 11, 2020 12:42 pm
by saeed144
Hi
the question is simple but the answer is hard:
which core? official or Roger's core?

Re: WHICH CORE?!

Posted: Sun Oct 11, 2020 3:35 pm
by mrburnette
saeed144 wrote: Sun Oct 11, 2020 12:42 pm Hi
the question is simple but the answer is hard:
which core? official or Roger's core?
Not hard: Official is the professional choice with STM Corporate support. Core built on their professional libraries. Official core provides a supported codebase beyond ArduinoIDE if needs require a migration path.

Opinion, libmaple (Roger's reworked core) may be easier for home experimenters and makers but is not supported beyond the occasional fix. Libmaple is more like Arduino in the version 0022 days. Roger + community took this from V0022 to version 1.51 and beyond.


Ray

Re: WHICH CORE?!

Posted: Mon Oct 12, 2020 5:50 am
by saeed144
Thank you so much

Re: WHICH CORE?!

Posted: Tue Oct 27, 2020 11:58 am
by windyyam
I have question about the 2 cores too, is there a test for performance? Which one is overall faster? And the storage/memory consumption?

Re: WHICH CORE?!

Posted: Tue Oct 27, 2020 2:39 pm
by mrburnette
windyyam wrote: Tue Oct 27, 2020 11:58 am I have question about the 2 cores too, is there a test for performance? Which one is overall faster? And the storage/memory consumption?
To my knowledge, there is no direct comparison.
Consider the monolithic nature of libmaple (Roger's core), my suspicion is that Roger's core will be the smaller compiled bin file, but the Official core may have better performance and peripheral support.

"Fastest" is not a reasonable attribute, rather quality is a better comparison. If you are a professional programmer, the Official core will provide everything you need. If you are a weekend hobby programmer, Roger's core will likely meet your requirements.

Re: WHICH CORE?!

Posted: Tue Oct 27, 2020 2:44 pm
by ag123
Sometimes it is simply a preference, sometimes it is driven by which soc / board that one uses e.g. STM core support many of nucleo and discovery boards right out of the core. If you want to use libmaple for it you may end up coding most of it yourself if it isn't supported after all

In terms of performance it depends on how you do it, even with either core one can always access the hardware registers directly and even resort to assembler. the thing to remember is it's still bare metal programming, the core is the icing on the cake, you can choose a flavour

Re: WHICH CORE?!

Posted: Wed Oct 28, 2020 3:43 am
by feluga
windyyam wrote: Tue Oct 27, 2020 11:58 am I have question about the 2 cores too, is there a test for performance? Which one is overall faster? And the storage/memory consumption?
Roger's core uses a lot more RAM and Flash to build the final binary file.
In this matter, STM32 Official Core is way better, thus if your sketch needs RAM space, this is the best option.

Talking about performance, I built an Arduino VGA library that has to deal with very tiny timing limitations.
Regarding performance, I found Roger's core faster when it deals with TIMER IRQ callback.
When using STM32 Core it takes maybe 50 to 100 more cycles to start the IRQ, which in my case leaded to a bad VGA image on screen.
To solve it, I had to disable Hardware Timer on the sketch and to use it directly linked to NVIC, avoiding software overhead.

More details about the memory consumption difference at viewtopic.php?f=10&t=347
and about the way I solved the HW TIMER issue on the Github page for this project.

It means that there are performance and consumption differences between both cores, but only when you really need every bit of RAM or every CPU cycle for the job. Otherwise, as MrBurnette said, it's a matter of preference - but it's important to notice that I think that only STM32 Offical Core is being currently updated and evolving.

Re: WHICH CORE?!

Posted: Wed Oct 28, 2020 6:01 am
by windyyam
feluga wrote: Wed Oct 28, 2020 3:43 am
windyyam wrote: Tue Oct 27, 2020 11:58 am I have question about the 2 cores too, is there a test for performance? Which one is overall faster? And the storage/memory consumption?
Roger's core uses a lot more RAM and Flash to build the final binary file.
In this matter, STM32 Official Core is way better, thus if your sketch needs RAM space, this is the best option.

Talking about performance, I built an Arduino VGA library that has to deal with very tiny timing limitations.
Regarding performance, I found Roger's core faster when it deals with TIMER IRQ callback.
When using STM32 Core it takes maybe 50 to 100 more cycles to start the IRQ, which in my case leaded to a bad VGA image on screen.
To solve it, I had to disable Hardware Timer on the sketch and to use it directly linked to NVIC, avoiding software overhead.

More details about the memory consumption difference at viewtopic.php?f=10&t=347
and about the way I solved the HW TIMER issue on the Github page for this project.

It means that there are performance and consumption differences between both cores, but only when you really need every bit of RAM or every CPU cycle for the job. Otherwise, as MrBurnette said, it's a matter of preference - but it's important to notice that I think that only STM32 Offical Core is being currently updated and evolving.
wow, that's an interesting project, I never thought a microcontroller could do that~

Re: WHICH CORE?!

Posted: Wed Oct 28, 2020 6:15 am
by windyyam
mrburnette wrote: Tue Oct 27, 2020 2:39 pm
windyyam wrote: Tue Oct 27, 2020 11:58 am I have question about the 2 cores too, is there a test for performance? Which one is overall faster? And the storage/memory consumption?
To my knowledge, there is no direct comparison.
Consider the monolithic nature of libmaple (Roger's core), my suspicion is that Roger's core will be the smaller compiled bin file, but the Official core may have better performance and peripheral support.

"Fastest" is not a reasonable attribute, rather quality is a better comparison. If you are a professional programmer, the Official core will provide everything you need. If you are a weekend hobby programmer, Roger's core will likely meet your requirements.
Yes, thanks for the direction. It makes totally sense that ST's core got more attention as it's more "alive" and have official support.
But on the other hand, I've already get used to Roger's core as many of my projects are based upon it.

I've done a simple test with the infamous digitalWrite from Arduino. We all know that function took a lot of unnecessary overhead and can be quite slow in some of the situations.

The test is done on bluepill f103, using Os optimization, without USB serial. code is as follows:

Code: Select all

unsigned long lasttick = 0;
void setup() {
  // put your setup code here, to run once:
  pinMode(PC13, OUTPUT);
  Serial.begin(115200);
  lasttick = micros();
}
void loop() {
  // put your main code here, to run repeatedly:
  for(int i=0;i<10000;i++){
    digitalWrite(PC13, HIGH);
    digitalWrite(PC13, LOW);
  }
  unsigned long nowtick = micros();
  Serial.println(nowtick - lasttick);
  lasttick = nowtick;
}
Using Roger's core the output is 12840 microseconds each 10k loops, on ST core the output is 19661.
If I turn on O2 with LTO, Roger's core output is 1290, while ST's fail to serial output
So be fair, on Os optimization Roger's core is 34.7% faster than ST's on digitalWrite.

Re: WHICH CORE?!

Posted: Wed Oct 28, 2020 7:25 am
by fpiSTM
Try

Code: Select all

digitalWriteFast(PC_13,HIGH);
digitalWriteFast(PC_13,LOW);