Go Down

Topic: New alternative to the Arduino frontend ? (Read 2326 times) previous topic - next topic

avrgen

Hello together,

i want to discuss some basic ideas with Arduino users.

Personally i am using the avr-gcc in the classic way with normal make files and the Editor Kate (with some plugins) in KDE.

But i am familiar with the world of Arduino also, because most of the sources for special hardware can be found here.

Before i used the avr-gcc i have programmed in Basic with Bascom.
So i am a user who esteem the comfort of easy programming microcontroller.

From my point of view there are two worlds now:

1. The basic world of programming in C using the avr-gcc. When you do this there are only some libraries solving some of the problems, e.g. using the serial interace.
Most of the users seems not to miss any comfort programming the peripheral?

2. The world of Arduino with a framework for programming in C/C++ and standard hardware, that gives an easy entranceway for beginner.

But there is a gap between this two worlds for users who want more then the things offered by Arduino.
Specially when you want to use other microcontroller with less memory and when you want to use timer and interrupts.

I want to have something in the middle of this two worlds.


Two years ago i asked in the german community for a solution of easy using the timer.
https://www.mikrocontroller.net/topic/318025#new
Now i asked again because there is still no nice solution for the problem.
https://www.mikrocontroller.net/topic/382811

In the discussion there was a suggestion for a nice solution:
http://www.jarkonkotisivu.org/AVRcoder/
The problem is that this tool is hardcoded only for 3 microcontroller.


My idea is two create such a tool for all AVR microcontroller.
For this i am working to extract all the needed informations from the XML files shipped with the AVR Studio and push them into an database.
The author of the AVRcoder Jarkko Hautakorpi is interested to build a new interface for more controller interacting with my database.

The first database will be ready soon, but i don't know if Jarkko will build the interface.
Additionally i am thinking about an simple scripting interface, that will allow to do the microcontroller configuration with easy settings in an configuration file. So this solution would fit to an automated compilation with make too.


What do you think about this?

Is someone interested to help to create such an solution?

Regards
Karsten

kowalski

#1
Dec 12, 2015, 05:33 pm Last Edit: Dec 12, 2015, 05:34 pm by kowalski
@avrgen

Do I understand you correctly that this project is to build a database in XML with all the AVR register attributes for all AVR MCUs and to automatically from the database generate a web-based tool for configuration and code generation?

I looked at the tool link and it is nice to see all the registers and functions in this format. The code that is generated is also very nice. It looks a lot like the fuse calculator but many more registers and functions.

What I do not see is how this would be used in general. Could you describe some typical use cases for this type of tool and how it is better or easier that Arduino or other class library approaches (such as my own Cosa project)?

This type of tool makes it very easy for anybody that understands all the registers and functions in the AVR MCUs but does not make code more portable, configurable, etc. It does automate some of the initialization code but there is no abstraction of the hardware and there is no support for device drivers, etc.

Cheers!

avrgen

#2
Dec 12, 2015, 06:40 pm Last Edit: Dec 12, 2015, 06:50 pm by avrgen
Do I understand you correctly that this project is to build a database in XML with all the AVR register attributes for all AVR MCUs and to automatically from the database generate a web-based tool for configuration and code generation?
No - there is much information in form of XML files existant in the AVR Studio.
This information is extracted and pushed into an relational database (MySQL).
The hierarchy is simple: AVR -> Peripherals -> Register -> Modes -> Settings

The plan is to use this information to dynamically generate the right register settings for a simple configuration.
The second thing is to get an overview about the differences of the AVR microcontroller.
Let's say it is an enhancement for the avr-gcc.

With the help of Jarkko i hope to get a visual web interface to do this.


What I do not see is how this would be used in general. Could you describe some typical use cases for this type of tool and how it is better or easier that Arduino or other class library approaches (such as my own Cosa project)?
This should not be better or easier as Arduino.
Every frontend or tool has benefits to different requirements.
As i have written this tool should give more comfort to the avr-gcc.
Maybe it can solve some problems to Arduino too?


I have read a little bit about Cosa but i have not understand all details so far.

What is the way the configuration is done?

Which AVR microcontroller do you support?

Can my idea be combined with yours?


This type of tool makes it very easy for anybody that understands all the registers and functions in the AVR MCUs but does not make code more portable, configurable, etc. It does automate some of the initialization code but there is no abstraction of the hardware and there is no support for device drivers, etc.
I am simply searching for a solution to simply configure an USART, Timer and so on.
This should be possible in the same way for different AVR microcontroller.

I don't want to read the datasheet each time and puzzle the bits manually.
I can't understand that there is only a tool for the fuse bits so far.

Robin2

I am simply searching for a solution to simply configure an USART, Timer and so on.
This should be possible in the same way for different AVR microcontroller.
Write an Arduino library and share it on the Forum ?

...R
Two or three hours spent thinking and reading documentation solves most programming problems.

kowalski

Quote
This should not be better or easier as Arduino. As i have written this tool should give more comfort to the avr-gcc.
So I guess you see this tool as an extension of the avr/io include files. There are all these symbols defined for all the supported MCUs.

Quote
What is the way the configuration is done? Which AVR microcontroller do you support?
If you take a closer look at the AVR MCUs you can see that they are configurations of a set of hardware modules. The product family is built up by the size of the memories, the hardware modules, implementation technology and packaging. Just as the hardware product we can define the software interface for the hardware modules (registers, bits, etc) and from them compose the MCU support. This allows a simpler configuration strategy. Instead of checking for a specific MCU the code checks for a specific hardware module.

An example. The Cosa UART class supports basically all MCUs with up to five UARTs (ATmega2560). A single source code for all with a high level abstraction of the buffering (Cosa IOBuffer).

Cheers!

avrgen

Write an Arduino library and share it on the Forum ?
I want a solution that is usable for the avr-gcc.
Arduino is based on the avr-gcc - so this should fit here too.

But there are 2 differences:
1. Arduino is using only a fix set of avr microcontroller.
2. The hardware abstraction of Arduino makes it not so easy.

The reason i posted my question here is that nearly nobody in the avr-gcc world seems to be interested in an easy way of configuration of hardware modules.


So I guess you see this tool as an extension of the avr/io include files. There are all these symbols defined for all the supported MCUs.
If you take a closer look at the AVR MCUs you can see that they are configurations of a set of hardware modules. The product family is built up by the size of the memories, the hardware modules, implementation technology and packaging. Just as the hardware product we can define the software interface for the hardware modules (registers, bits, etc) and from them compose the MCU support
Yes - i agree. I can see this structure.
You can find this hierarchy in the XML files and in the database.


This allows a simpler configuration strategy. Instead of checking for a specific MCU the code checks for a specific hardware module.

An example. The Cosa UART class supports basically all MCUs with up to five UARTs (ATmega2560). A single source code for all with a high level abstraction of the buffering (Cosa IOBuffer).
Sorry - i am not familiar with C++.
Somehow i understand that we want the same things.
But your solution is coupled to the Arduino framework.
Maybe it is possible to use it in another way directly for the avr-gcc?

Really nice in cosa are the built-in drivers.


In the first solution 2 years ago there was a handmade configuration script for the timer.
Timer initialization
But this is not convenient to edit.
It covers only one microcontroller and one hardware module.
So my idea is to have this for all the AVR microcontroller.
I got the tip that the information i need is in the XML files of AVR Studio.
This files are not convenient and can only be shipped together with the AVR Studio.
So my idea was to build an relational database to get an overview and have a solution that can be shipped independent of AVR Studio.
Then i see the AVRcoder and it would be a really nice idea to have this for all AVR microcontroller.
But it would be a good idea also to have an additional library that can cover the programming and configuration without using an web interface.

I think it should be possible to generate the needed header files automatically.
Up to now it was my idea to have a perl script that calculates the settings by fetching the needed informations from the database and generates directly a header file with the correct register settings like the AVRcoder is doing.


P.S. I followed your instructions and get at the point of the update of the git:
Quote
$ git pull origin master
fatal: Not a git repository (or any parent up to mount point /srv)
Stopping at filesystem boundary (GIT_DISCOVERY_ACROSS_FILESYSTEM not set).

Robin2

The reason i posted my question here is that nearly nobody in the avr-gcc world seems to be interested in an easy way of configuration of hardware modules.
REAL PROGRAMMERS don't need sissy stuff like that.  :)

...R
Two or three hours spent thinking and reading documentation solves most programming problems.

avrgen

#7
Dec 13, 2015, 12:51 pm Last Edit: Dec 13, 2015, 02:07 pm by avrgen
REAL PROGRAMMERS don't need sissy stuff like that.  :)
That's maybe right - and this is the point i can't understand.

BUT the world of Arduino is not addressed to REAL PROGRAMMERS.  ;)
The success of Arduino i based on the idea of making things easier to the users / not programmers !
As you can see you get many people to the world of programming with this idea. ;)

In this context - is Cosa a success?

As you can read above - i am searching for a solution for the people between the beginners and "real programmers".

I can accept not to be a "REAL PROGRAMMER" - but maybe i simply don't want to be one, when life MUST be hard and incommodious for this.  :smiley-grin:
But nevertheless i can have fun and success with my programming. :P
Some people have fun to be a masochist ...

Robin2

#8
Dec 13, 2015, 06:12 pm Last Edit: Dec 13, 2015, 06:12 pm by Robin2
That's maybe right - and this is the point i can't understand.
It was an attempt at a joke that clearly failed miserably.

I don't agree with the sentiment myself - I like all the help I can get. Which is why I avoid C/C++ at every opportunity.

...R
Two or three hours spent thinking and reading documentation solves most programming problems.

avrgen

#9
Dec 13, 2015, 06:31 pm Last Edit: Dec 13, 2015, 06:39 pm by avrgen
It was an attempt at a joke that clearly failed miserably.

I don't agree with the sentiment myself - I like all the help I can get. Which is why I avoid C/C++ at every opportunity.
Your joke clearly represents the mainstream opinion - so it was very convincing.
(I was thinking about asking you what you are doing in an Arduino forum :smiley-twist: )
Besides - it is possible to write very easy and clear code in C and Perl.
But many people like to produce a daring exploit instead. ;)


O.K. - After clearing this point (for you and hopefully others) it would be fine to come back to the way of solution.


For a solution without a nice webfrontend i see 2 ways:

1. Automated creation of configuration (header) files.
+ It can easy be used with an simple include.
- Much work to get them produced out of the database.
- The result will be again big files with much #defines and preprocessor workarounds.

2. Perl (or other language) program that produces the needed register values.
+ Extended calcuations without the limitations of the preprocessor are possible.
+ The result are only some clear statements for the user (e.g. TCCRIA = 0b10101010)
- Can only be used within a makefile that calls this program

Other solutions?

Robin2

I wonder if the stuff in this other current Thread could form a basis for what you are thinking of?

...R
Two or three hours spent thinking and reading documentation solves most programming problems.

kowalski

@avrgen
Quote
But your solution [Cosa] is coupled to the Arduino framework.
Maybe it is possible to use it in another way directly for the avr-gcc?
Actually Cosa is not coupled to the Arduino framework. It runs on Arduino hardware and other AVR based boards. It does not require the Arduino pre-processor at all, only the GCC AVR tool chain.

The source code is written so that it can be compiled with a traditional make system. There is actually command line build support in the Cosa distribution (see the build directory). I do not use the Arduino IDE at all for development. Cosa can be used from the Arduino IDE and there is support for install with the Boards Manager to make it as easy as possible to get started.

Cheers!

avrgen

I wonder if the stuff in this other current Thread could form a basis for what you are thinking of?
As i have understand the intention is to simplify the C syntax for beginners.
A good idea but not my thing.

My intention is to simplify the register settings generally for all AVR's.


@avrgen
Actually Cosa is not coupled to the Arduino framework. It runs on Arduino hardware and other AVR based boards. It does not require the Arduino pre-processor at all, only the GCC AVR tool chain.

The source code is written so that it can be compiled with a traditional make system. There is actually command line build support in the Cosa distribution (see the build directory). I do not use the Arduino IDE at all for development. Cosa can be used from the Arduino IDE and there is support for install with the Boards Manager to make it as easy as possible to get started.

Cheers!
That sounds perfect!
I must take me the time and try to understand your libraries / framework.
It's not so easy for me.

I have seen that you have done already many good work and documentation - that's fine.
But i didn't read anything regarding "normal avr-gcc" use.

Time is always a great problem ...
I want to finisch my work with the xml import into the database first.
Then we can look together what can be done / combined?

Robin2

As i have understand the intention is to simplify the C syntax for beginners.
A good idea but not my thing.
I realize that.

I was thinking that maybe the techniques that @YemSalat is using for his project could be useful for your project.

As I understand it, he is making a "program" that translates from one system to another, and it sounds to me that you are doing something similar.

...R
Two or three hours spent thinking and reading documentation solves most programming problems.

avrgen

#14
Dec 14, 2015, 05:59 pm Last Edit: Dec 14, 2015, 06:05 pm by avrgen
As I understand it, he is making a "program" that translates from one system to another, and it sounds to me that you are doing something similar.
Yes - translate data from a database into C code.
But i will not try to create a new syntax alternative to C.

I think i have read they are doing it in Java - and i don't like Java. ;)
This will be a problem for me.

Go Up