Hello everyone! A couple new thoughts visited me recently. I have no doubt that programming in assembly is extremely useful. Struggling to make the assembly code to work, solving problems gives much experience: makes to read documentation carefully and learn the architecture, trains patience, teaches not to be scared of object dumps. These are fundamental skills. Good fundamental skills are the roots of good higher level skills.
Some routines such as startup and init_clock travel from post to post as many constants also do. So the thoughts about creating a sort of a library appear in such case. But that means going more high level. Actually it leads to C language usage.
When looking at C function and not understanding what is it doing on actual hardware means knowing the library but not the processor under it. The opposite deal is to look at the C-function as an assebly programmer. The assembly effectively gives knowledge and C gives an opportunity to effectively use that knowlenge. So I decided to be more effective.
On this blog each post covers some new feature of the hardware programming. Certainly each example also uses some features which were covered in previous posts like GPIO usage, clock initialization etc. and need not to have focus on them. It is much more clean and effective to use such features at higher level as they are considered to be already learned in assembly.
So that’s the concept: new features in this blog are going to be written in assembly and old ones - in C. I agree with the opinion that C should be used for writing applications, but with the condition of knowing the architecture and assembly language.
C projects workspace
To create C applications for stm32 we need to use ST library. The ST library is introduced just as a collection of sources and their headers splitted by functionality they implement. If we need GPIO functionality for example, we should compile our source together with the GPIO source. It is convenient to organize such manipulations using make
utility. So, our C projects workspace is a directory tree with ST library and projects’ source folder having some common for all projects files at the top level.
The main point is to construct the Makefile. Master Google led me to this stm32 discovery development on linux tutorial. Thanks to Ross Wolin, I’ve took his Makefile as the base.
Please, let me introduce the variant of the workspace for C projects. Refer it’s README to get more information. Feel free to contact me if there are any questions