WHICH CORE?!

Post here first, or if you can't find a relevant section!
saeed144
Posts: 36
Joined: Mon Sep 21, 2020 10:11 am

WHICH CORE?!

Post by saeed144 »

Hi
the question is simple but the answer is hard:
which core? official or Roger's core?
by mrburnette » Sun Oct 11, 2020 3:35 pm
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
Go to full post
mrburnette
Posts: 633
Joined: Thu Dec 19, 2019 1:23 am
Answers: 7

Re: WHICH CORE?!

Post 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
saeed144
Posts: 36
Joined: Mon Sep 21, 2020 10:11 am

Re: WHICH CORE?!

Post by saeed144 »

Thank you so much
windyyam
Posts: 12
Joined: Tue Oct 27, 2020 11:56 am

Re: WHICH CORE?!

Post 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?
mrburnette
Posts: 633
Joined: Thu Dec 19, 2019 1:23 am
Answers: 7

Re: WHICH CORE?!

Post 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.
ag123
Posts: 1655
Joined: Thu Dec 19, 2019 5:30 am
Answers: 24

Re: WHICH CORE?!

Post 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
feluga
Posts: 64
Joined: Wed Mar 18, 2020 2:50 am

Re: WHICH CORE?!

Post 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.
windyyam
Posts: 12
Joined: Tue Oct 27, 2020 11:56 am

Re: WHICH CORE?!

Post 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~
windyyam
Posts: 12
Joined: Tue Oct 27, 2020 11:56 am

Re: WHICH CORE?!

Post 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.
User avatar
fpiSTM
Posts: 1738
Joined: Wed Dec 11, 2019 7:11 pm
Answers: 91
Location: Le Mans
Contact:

Re: WHICH CORE?!

Post by fpiSTM »

Try

Code: Select all

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

Return to “General discussion”