Author Topic: [ARM] optimization and inline functions  (Read 7663 times)

0 Members and 1 Guest are viewing this topic.

Online brucehoult

  • Super Contributor
  • ***
  • Posts: 4035
  • Country: nz
Re: [ARM] optimization and inline functions
« Reply #75 on: January 20, 2022, 08:52:51 pm »
You cannot possibly rely on cycle accuracy if you write in C.

You can, if you put the timing critical part in its own module, adjust it until it matches the expectations, using a scope for example, keep it small, compile it once, verify the module, then just keep the object file.

For someone who doesn't feel confident writing assembly, this could be the easiest way.

Or, do gcc -S and keep the .s assembly language file as the source code from then on, possibly after some manual cleanup.
 
The following users thanked this post: MK14

Online brucehoult

  • Super Contributor
  • ***
  • Posts: 4035
  • Country: nz
Re: [ARM] optimization and inline functions
« Reply #76 on: January 20, 2022, 09:08:16 pm »
Arduino, by their own definition, is not supposed to be used by programmers or electronics designers, but by artists. The whole idea is you can just buy a shield and write led.blink(); and get an art project out of it. It needs to be dumbed down, it needs to be limited. Art projects also don't have strict requirements so you can always work with what you have.

By trying anything more challenging than that, you hit the limits, and it's not Arduino's fault. If you want to blame someone, blame fanboys who don't understand the limits.

But instead, I suggest you just completely ditch the Arduino software ecosystem. You can still use the boards, just program them like you program the microcontroller on the board.

Not only the boards. Other parts of the ecosystem are usable.

The Arduino ecosystem has quite a number of different parts:

- boards with a particular form-factor and connector layout (several of them: Uno, Mega, pro mini), often copied by other manufacturers.

- accessories designed to be plugged onto those boards

- an IDE with a limited but usable text editor and terminal emulator

- a project manager integrated into the IDE. This is pretty crap as soon as you want multiple source files

- a manager for build tools. This is pretty darn useful -- enter a URL in a preferences dialog and BOOM you get a compiler&linker (usually GCC), download tool (avrdude, openocd etc), headers and libraries for a new CPU type instantly, all working together.

- a library providing access to some basic functions of MCUs, with API that is portable to just about anything. Good enough for many beginner tasks, but maligned by "professionals" who sometimes don't seem to understand that they DON'T HAVE TO USE IT and can program some or all of their app to the bare metal instead, if they don't care about portability.

- a set of example programs. Very useful to get beginners going.

- a huge set of 3rd party libraries to interface to just about anything. Code is of very variable quality, and quite a lot of it is a bit AVR specific.

- extensive tutorials all over the internet


I don't understand how anyone can form an opinion that this is not an extremely valuable (if inevitably imperfect) contribution to the microcontroller community.
 
The following users thanked this post: MK14


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf