New alternative to the Arduino frontend ?

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

@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!

kowalski:
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.

kowalski:
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?

kowalski:
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.

avrgen:
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

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.

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!

Robin2:
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.

kowalski:
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.

kowalski:
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:

$ 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).

avrgen:
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. :slight_smile:

...R

Robin2:
REAL PROGRAMMERS don't need sissy stuff like that. :slight_smile:

That's maybe right - and this is the point i can't understand.

BUT the world of Arduino is not addressed to REAL PROGRAMMERS. :wink:
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. :wink:

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. :grin:
But nevertheless i can have fun and success with my programming. :stuck_out_tongue:
Some people have fun to be a masochist ...

avrgen:
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

Robin2:
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 :smiling_imp: )
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. :wink:

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.
  1. 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?

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

...R

@avrgen

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!

Robin2:
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.

kowalski:
@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?

avrgen:
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

Robin2:
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. :wink:
This will be a problem for me.

avrgen:
I think i have read they are doing it in Java - and i don't like Java. :wink:

Who are "they" ?

If you are referring to the link I gave you I believe @YemSalat is using node.js which is javascript - much more acceptable than Java.

...R

Robin2:
Who are "they" ?

If you are referring to the link I gave you I believe @YemSalat is using node.js which is javascript - much more acceptable than Java.

I must correct me: I don't like java and java script!
Better? :smiley:

But your general idea was correct.
I think the java script is needed together with the Arduino framework?

avrgen:
I must correct me: I don't like java and java script!
Better? :smiley:

NO

Java and javascript are so very different from each other that your range of "likes" must be very narrow indeed.

...R

Robin2:
NO
Java and javascript are so very different from each other that your range of "likes" must be very narrow indeed.

I agree about the differences.

Up to now i only worked with javascript for web purposes - and i don't like it!

But please back to the main discussion now.

Happy new Year!

The database is ready and up now.
It takes more time then i expected but it was interesting.

In the database i imported all relevant informations from the XML files of AVR-Studio 7.0 (including all errors).
I attached the result in form of the cpu table for an overview.

Jarkko is working on the Web-Interface now.
But there maybe other ways to work with the data.

For test purposes there is an existing API that delivers data in JSON format.
Please tell me when anybody have ideas and wants to try it.

AVR.ods.zip (23.3 KB)