2018-06-09 06:42 AM
I understand that programming enterprise software on a 8 core CPU with 4GHz and a simple STM32 MCU is different, nevertheless I would have added a few things to the HAL layer from the beginning:
Wouldn't such things help greatly to get started? And to debug? And make the user experience better? And lower frustrations? And cause proper error messages rather than simply not working?
Or am I missing something.
Note: this post was migrated and contained many threaded conversations, some content may be missing.2018-06-10 08:05 AM
I'm not forcing you specifically to use my method. I can not demand, but I can perfectly sow panic, violence and insanity. I do it well.
The main goal is to give a new idea. From how much this idea will be successful and attractive - depends on its distribution. Yes, there is an appropriate section of this forum - but I'm not sure what I was answered by a living person.
It is useless to wait for solutions from domestic hamsters, obediently pushing the mouse in the CubeMX. They do not have their own thoughts, they do not even have their own desires. They need quickly and now - a completely justified approach among other things. But if you look at the messages of this forum: even pushing the buttons in the ready interface does not solve the problem of human error.How should exactly look like cmsis - I do not know. It is necessary to conduct natural tests with several models of data representation. However, now I know for sure - you can not use &sharpdefine, you need to use static structures. With their help, you can avoid most errors associated with mutually exclusive use of constants, skipping the desired values, and using unnecessary ones.
I use dolls (blanks) - which I place directly in the most important sacred file. Example
This example is not complete, I do not have time for a complete transformation.But the general meaning is simple: a higher-level workpiece is created, created specifically for one type of processor (unique). It does not have exact register values, but it has the exact sequence of their use !!! it is very important. Using the search tools of the software shell - I search for the declaration of the selected element of the array of registers, and I get to the saved doll (workpiece). I copy it completely, delete the unnecessary, fill in the necessary data with meaningful data.You may be surprised - but you do not have to look at the documentation for the chip !!!Can you tell me the same about HAL, LL, or cmsis? There it is impossible to write a new sink without an open reference book.2018-06-10 08:34 AM
Juha Aaltonen - Do you need a handy weapon with protection against misuse? This is not possible on a physical level.
To solve this problem, programming languages of a higher level than pure C were invented. There you can not make a physical mistake (more precisely, very difficult), but you can easily make a logical mistake. Your weapon will shoot properly, but without hitting the target. C ++, Go, and a whole bunch of younger programming languages - they all make logical mistakes, all without exception.To solve such problems, a large project is assembled from an infinite number of small fragments. Each separate piece of code is checked, has no errors, and works exactly as described in the function header. Naturally - someone should make efforts to create small code. There are those who collect larger fragments from smaller fragments, and so on.
This is the reason - there are no ready-made small blocks from ST. There are tools, there is an instruction, there is a sand pit and a mine. You need to lead the sand yourself, melting steel and making reinforced concrete structures for your house.
Convenient truth?2018-06-10 08:49 AM
I'm usually fine with assembly. Or C if the SW is to be bigger. If there are lots of participants writing the code, I'd recommend Ada. I wouldn't use any interpreted languages - not even with bytecode interpreters.
I wrote this:
https://github.com/turboscrew/rpi_stub
because I didn't have any means of bare metal SW debugging. It's my 'blinky' in the ARM world...I didn't write all of it myself - I included 'stdint.h'... :D
2018-06-10 09:46 AM
'
Can you tell me the same about HAL, LL, or cmsis? There it is impossible to write a new sink without an open reference book.'
the fact that something cannot be fitted through your particular approach nicely doesn't make that something bad. you have to first establish for everyone that your approach is good. and then we can go from there.
2018-06-10 09:47 AM
'
However, I am surprised by people who take these libraries and make a standard on them.'
i'm not, as I have yet to see something making a standard on them.
unless of course you use the word 'standard' in some unique ways.
2018-06-10 10:28 PM
you have to first establish for everyone that your approach is good. and then we can go from there.
I've already heard such a proposal - do it first, and then we'll see.
I did it for myself, and was pleased. The new one appears in accordance with personal requirements, when I personally have to read the documentation once again. At this point the issue with the problem block is closed once and for all. The next project using this periphery does not require reading the documentation.This does not mean that I remember or learned part of the periphery, I do not need this. I just made a doll (the full standard template for copying into the project) for this part of the periphery. In a day I will forget all these bizarre names of registers, it will be enough for me that the whole block works as expected.These are the smallest bricks of which a large building is being built. And I do not care how many quality certificates my tool has. The main thing is that the finished product has a working state.
2018-06-14 11:24 AM
to Juha Aaltonen and to all who sees the advantage of the low level programming.....
Just a couple of days ago I had to add reading the raw input from an incremental encoder. Now I have those GPIO pins used for both GPIO inputs and inputs to timer in encoder mode. Good that HAL didn't check for 'conflicts'. And yes, our company wants us to use HAL. I'd do fine without any libraries and frameworks.
Your example is misused - this is not an example of something to be checked by HAL for a conflict - there is no possibility of conflict. Branching of a single output to many inputs is not a conflict (subject to amperage allowed).
Correctly written HAL abstraction library is the way of the future and even today, given intelligent implementation (there are such implementations outside of ST).
I started my first embedded development back in 1978...... it was Assembly language programing bits of the Intel 8080 registers... I did not trust even the first appearance of the cross compiler with it's toolchain running on IBM - I thought this is not the way to do embedded micro-processor... I wanted a full control of every programmed bit ..........
Looking back at all my projects in two continents and dozen of companies, I will tell you now -
Intelligent HAL library in the future will completely obliterate any notion of the low level register-based programming... this future is already here but you don;t know it yet because those HAL-software tools are in their infancy, but for you to understand this view you need the same what made me to change my mind - 40 years .... holly number
2018-06-14 11:47 AM
Hmm, you started almost 10 years before me...
One thing that's hard to do nicely with HAL is clock reconfigurations when the system is regularly put to sleep on RTC timer only to save battery.
HAL routines 'have always' milliseconds to waste waiting things to come up/shut down one by one.
Also partial reconfiguration of peripherals on-the-fly is often messy.
And third, HAL is BIG.
2018-06-14 12:21 PM
I'll let you laugh by sharing my 'proofs' 40 years ago that using 'C' cross compiler to program embedded processor is no good - one must do it in Assembler : here we go
That above is a very limited list - there was more.... aren't those reasons sound ? How much would you accomplish today if the technology were stuck in my mentality 40 years ago?
Many things changed since then as you now know .... not only technology... there is also a personal aspect - I was young and knowing at the time that there was nobody within a radius of 1000 km around me who knew as much of the digital embedded CPU, gave rise to the boosted ego (my on-going high tech experience surely must be superior than anything else...... young age is the utmost ego which subsides over the years)
Now, in 21st century, it is even funny to need to convince other developers that they should focus on their goal product, not spend time on dealing with the chip internal register' bits.... not all companies these days came to understand this - the competition in making the truly advanced software development tools (HAL is the key) only started... watch around ...........
2018-06-14 12:27 PM
Do you realize that your grievances have all to do with a particular implementation of HAL library, not with idea of HAL as it suppose to be ? This (like everything else in life) has it's benefit for you - sooner or later, when you get in your hands a truly intelligent HAL library you will feel BLESSED