Looking for AVR C functions

Hello,

After 5-6 years learning arduino and making large semi-commercial projects, I finally started to learn the C language behind it and use my own code even in things that I thought it were so difficult and I could only copy-paste them from others. I got recently the C language book from Kernighan, Ritchie and it explains basically everything there. The only issue is that there aren't many microcontroller commands as I found out. So the question is where to find everything C related for microcontrollers?

The next step for me is moving to STM32 and Cube ide. As I saw there are a lot of similarities and more capabilities. Is there an ARM related C language reference?

Thank's

No, there won't be. C was designed as a reasonably general purpose language, so there are no commands for microcontrollers, graphics, databases, games or anything else. If there is one special purpose C was designed for, maybe it was for writing operating systems.

Nowhere. Every family of microcontrollers is different. Each microcontroller manufacturer will have designed their own extensions to the C language for their own products.

There have been many attempts to create a unified set of extensions to C that cover multiple families of microcontrollers. Arduino is one such attempt. There is no version that could guarantee to cover every brand and family of microcontrollers, there are too many.

I see. So this avr-libc is made for atmel only chips? Is it something like HAL on stm's?
If yes then maybe I start looking there.

Yes, AVR is a family of microcontrollers developed by atmel.

An ARM is not a microcontroller. It's a CPU core. You can design a microcontroller using an ARM core. Many manufacturers have done that. Even if the ARM core they use is the same, the other parts of their microcontrollers will be different and require different C extensions.

There is no separate C for microcontrollers. The language is the same as described in Kernighan and Ritchie's textbook. What interests you is not separate language constructs, but simply additional libraries Each family of microcontrollers has its own libraries, moreover, there may be several options for the same controller.

Hmm... I got it. I'll better learn how to use the C language as good as I can and then it'll be more easy to proceed.

Thank's guys!

the STM32 devices are very sophisticated and are programmed using C++
the Cube IDE has extensive libraries to support peripheral devices
however, CubeIDE is not simple to use and requires a steep learning curve
STM have a range of Nucleo Development Boards which come with example programs
However, they are not cheap, e.g. STM32 Nucleo LoRa Pack used when developing LoraWAN applications

Be aware, that the language 'behind' Arduino is not C, but C++. So the ancient Kernighan+Ritchie Book will not tell you the whole truth. Nearly all libraries for Arduino supported controllers use classes. 'C' does not know anythng about classes. And C++ contains many further enhancements compared to pure C.
Buy a modern C++ book to learn the language of Arduino.

C and C++ both have all the "bare metal" commands you need for controller work. you've got your basic bit twiddle commands, shifts, memory mapped IO addressing, etc. The Arduino language ref here has most of the extensions beyond what out-of-box C++ needs. Like what else are you looking for? Arduinos will talk wifi, serial, usb, miso/mosi, I2C, rf, IR, enet, gps, radio. Is there something specific you had in mind?

As you all said, I better look into C++ instead of C. Any suggestions for a book that explains it well?

I was just looking for every command, function or anything else that I should need to know. From what the others said, I need to find every manufacturer's microcontroller libraries in order to program them without Arduino platform. Also this is good because you don't have to use only the arduino specific MCU's and by that I mean you become independent. Arduino is easy for making projects but I need something more for both educational and personal achievment purposes.

The Datasheet for the micro controller your using will contain all commands related to that micro controller.

usually no
The datasheet itself does not contain commands, but only the names and addresses of registers and the rules for handling them. Commands, as a rule, are part of a separate software package, which may be several on the same datasheet or not at all if this controller does not support this programming language.

I take exception to the term "Extensions to C++". The language is not being "extended". With very few exceptions (see below), all that you call "extensions" are just classes, functions, typdefes, #defines, etc written in standard C++.

For example, "Serial" is an object of the HardwareSerial class (on an Uno anyway). HardwareSerial inherits from the Stream class. Stream inherits from the Print class. Standard C++ stuff, no "extensions".

As another example (again on an Uno), PORTD is just #defined as '(*(volatile uint8_t *)((0x05) + 0x20))'. Again, not an "extension" to C++.

The exceptions I mentioned above are that (in addition to pure C++) you will find a little bit of pure C and (processor-specific) assembly code sprinkled in. Again, no language is being "extended".

i'm curious, what kind of "microcontroller" commands are you expecting?

some have said C is a PDP-7 assembler. while pointers aren't unique to C, allowing then to be set to arbitrary hardware memory addresses allowed C to be used where previously only assembler could be used

for those interested, Unix Tree provide source listings to very early Unix/C

I'd (more or less) ignore the specifics of C and learn C++ (or another higher-level language like Rust or Python). With your Arduino experience, you probably already know enough C to get by.

Especially if you're using 32-bit MCU's you'll find that they have vastly more resources and are far more flexible than AVR. Bigger MCUs tend to go along with bigger projects. Learn OOP, as it's a good way to manage the complexity of a large project. C++ is still an excellent footgun, but the modern extensions make it very powerful and allow you to work at higher levels of abstraction (again, a technique for managing the complexity of large programs) than C ever has.

IME, unless you're writing something that's a few hundred lines of code, tops, you shouldn't focus on C.

i think there's a huge difference in the learning curve between C and today's C++ without focusing on specific features of C++

and there's no reason you can't do OOD using C and many other languages without classes

In a clumsy sort of way. How, for example, would you implement in C making polymorphic calls to a function declared as virtual in a base class and implemented in inherited classes while using a pointer to the base class?

is this OOD or feature of C++ classes? OOD existed long before languages like C++

bear in mind, that the early versions of C++ were a translator that implemented C++ in C

C++ can certainly do and is well suited to do much much more than what C, a systems language well suited for embedded applications, is intended to do. but i believe C with a few convenient C++ features is well suited for the applications discussed on this forum.

OOP = Encapsulation + Abstraction + Inheritance + Polymorphism
My example was in reference to the last two.

And I'll bet the resultant C code was ugly.

I use extension in the generic sense. Any library, for instance, is an "extension" in the sense it enables new things. Sorry if I offended you.