Go Down

Topic: Cosa: An Object-Oriented Platform for Arduino programming (Read 107960 times) previous topic - next topic

kowalski

#315
Mar 27, 2014, 10:38 pm Last Edit: Mar 27, 2014, 10:46 pm by kowalski Reason: 1
Some news on the latest updates.

1. Improved time/clock handling
Additional support for time/clock compare and handling of wrap-around (RTC/Watchdog/Alarm/Activity).
https://github.com/mikaelpatel/Cosa/blob/master/examples/Compiler/CosaDiff/CosaDiff.ino

2. Improved portability
UART, Pin Change Interrupt and External Interrupt class have been restructured to improve porting. The hardware resource symbols are used instead of board symbols.
https://github.com/mikaelpatel/Cosa/blob/master/cores/cosa/Cosa/IOStream/Driver/UART.hh
https://github.com/mikaelpatel/Cosa/blob/master/cores/cosa/Cosa/IOStream/Driver/UART.cpp

3. Code quality
The Cosa class header file have been restructure to improve readability. Protected and private definitions are moved last in the class definition. The Arduino build setting (platform.txt) suppressing compiler warnings has been removed and all compiler issues removed.

4. AVR GNU tool chain (AVR_8_bit_GNU_Toolchain_3.4.3)
The AVR GCC 4.8.1 is now supported. Previous version (4.3.X) will be deprecated. The new compiler fixes a number of issues (PROGMEM and PSTR warnings, etc).

5. Support for ATmega256rfr2 (Pinoccio)
https://github.com/mikaelpatel/Cosa/blob/master/cores/cosa/Cosa/Board/Pinoccio.hh

Cheers!

avenue33

#316
Apr 04, 2014, 02:22 pm Last Edit: Apr 04, 2014, 02:28 pm by avenue33 Reason: 1
I'm working on adding support for Cosa on embedXcode.

I'm facing two issues:
  • First is the [font=Courier].hh[/font] extension for header files. As a matter of facts, Xcode doesn't recognize the [font=Courier].hh[/font] extension, only the [font=Courier].h[/font].

  • Second in the leading [font=Courier]Cosa/[/font] in [font=Courier]#include "Cosa/Pins.h"[/font] in the code that prevents code-sense.


With those two minor changes, embedXcode compiles and links sketches developed with Cosa successfully.

How possible to use the [font=Courier].h[/font] extension for headers and remove the leading [font=Courier]Cosa/[/font]?

Thank you.

kowalski


I'm working on adding support for Cosa on embedXcode.
How possible to use the [font=Courier].h[/font] extension for headers and remove the leading [font=Courier]Cosa/[/font]?

Hi! I would have appreciated this as an issue on github as that allows better support but let us take it here this time. The usage of .hh suffix for C++ header files is in no way my invention. Using the "correct" file suffix allows better integration with standard open-source tools. What does the GCC manual say about C++ extensions?
Quote

C++ source files conventionally use one of the suffixes .C, .cc, .cpp, .CPP, .c++, .cp, or .cxx; C++ header files often use .hh or .H; and preprocessed C++ files use the suffix .ii. GCC recognizes files with these names and compiles them as C++ programs even if you call the compiler the same way as for compiling C programs (usually with the name gcc).

http://gcc.gnu.org/onlinedocs/gcc-3.4.3/gcc/Invoking-G_002b_002b.html

The C++ mode in GNU Emacs is automatically invoked for files with the suffix .cpp and .hh.  Emacs is what I use and it is still the fastest IDE in the world ;-)
http://books.google.se/books?id=-RtYk55cqfgC&pg=PA322&dq=emacs+invokes+c%2B%2B+mode&hl=sv&sa=X&ei=KQo_U5izI-uX4wScqYDwAw&ved=0CDQQ6AEwAA#v=onepage&q=emacs%20invokes%20c%2B%2B%20mode&f=false

Removing the Cosa prefix will not help as the header/source is highly organized in several levels of sub-directories. A flat organization is a very poor design. The structuring is there for a very specific purpose. Java, Cocoa, AVR, X11, Boost, etc, etc, all use a very similar structure.

Both these issues should be possible to configure in Xcode. This is not a problem in other IDEs (UEIDE, Eclipse, etc).  I will see what I can find in the Xcode manual.

Code sense for Cosa/Pins.hh can actual be due to the fact that this file contains several classes. This is "legacy" and should instead be several files for each of the Cosa Pin classes. I have this on the "todo"-list.

Cheers!

avenue33

#318
Apr 04, 2014, 10:02 pm Last Edit: Apr 04, 2014, 10:21 pm by avenue33 Reason: 1
Thank you for your answers.


Hi! I would have appreciated this as an issue on github as that allows better support but let us take it here this time.


IMHO, I haven't considered this as an issue but rather as an open question, hence the post.

I managed to get the [font=Courier].hh[/font] files recognized as C++ header files by Xcode. So question answered.


Code sense for Cosa/Pins.hh can actual be due to the fact that this file contains several classes. This is "legacy" and should instead be several files for each of the Cosa Pin classes. I have this on the "todo"-list.


As you rightly point out, the culprit seems to be Xcode here, not the structure Arduino recommends which is pretty standard.

kowalski

#319
Apr 04, 2014, 10:18 pm Last Edit: Apr 05, 2014, 11:42 pm by kowalski Reason: 1

I managed to get the [font=Courier].hh[/font] files recognized as C++ header files by Xcode. So question answered.

@avenue33

Nice! The comment about using the issue handling of github is that it better supports dialog. This is often lost if a new topic is not created on the forum. Also after time the topics often become multi-purpose.

It does not have to be a trouble report for an issue. I like to use it also for new features, discussing design, etc. As the issue tracking is integrated with github there is a lot of benefits such as linking to commits, lines of code, other issues, etc. But the most important is keeping the dialog intact and you get attention ;-)

Appreciate your efforts!

Cheers!

[Update: Link to issue on github, https://github.com/mikaelpatel/Cosa/issues/146]

kowalski

@avenue33

With the latest update I understand that you have got the Xcode code-sense work. Does this mean that the Cosa documentation is now available as pop-up boxes? As all member functions are fully documented with the doxygen-style this would give a major advantage when learning to use the Cosa classes. Most of the Arduino/Wiring code base is not documented in this style.

Are there any code-sense specific tags that can be used to improve documentation?

Also does the code-sense also handle auto-completion?

Cheers!


kowalski

#322
Apr 08, 2014, 08:28 pm Last Edit: Apr 08, 2014, 09:06 pm by kowalski Reason: 1

Have you considered other platforms?

Yes! I get this question a lot and have considered porting Cosa to other hardware platforms. Cosa is 100+ KLOC commented multiple AVR MCU core with 100+ example sketches. And with over 1000 development hours put into it. Porting to Due or other popular boards such as Launchpad takes 200-300 hours development and then lots of hours regression testing. With this in mind there would need to be a larger community and interest for such an undertaking.

Moving to "larger" boards such as the 32-bit Due/SAM would require even more structure; a RTOS with HAL, and interfaces for device drivers and other hardware resources. Getting this right is important to allow scaling.

Cheers!

avenue33

Weel, this is the very same with embedXcode... with 800 cumulated hours or so, including the documentation and the e-book.

I even had to change my laptop as the previous one wasn't powerful enough for Xcode.

kowalski

#324
Apr 14, 2014, 11:35 pm Last Edit: Apr 18, 2014, 09:22 pm by kowalski Reason: 1
Some news on the latest updates:

1. Improved documentation
The on-line documentation (web/embedXcode) has been extended with circuit illustrations. Below are a few examples:
http://dl.dropboxusercontent.com/u/993383/Cosa/doc/html/dc/d6e/classST7735.html#friends
https://github.com/mikaelpatel/Cosa/blob/master/cores/cosa/Cosa/Canvas/Driver/ST7735.hh#L39
https://github.com/mikaelpatel/Cosa/blob/master/examples/Canvas/CosaCanvasHCSR04/CosaCanvasHCSR04.ino#L23
The class documentation has also been restructured to improve readability.

2. Improved LCD 4-bit adapter
The Cosa LCD (HD44780) 4-bit parallel adapter may be used with all boards supported by Cosa. The LCD keypad shield works correctly on Uno, Mega, Leonardo, etc.
https://github.com/mikaelpatel/Cosa/blob/master/cores/cosa/Cosa/LCD/Driver/HD44780.hh#L297
https://github.com/mikaelpatel/Cosa/blob/master/cores/cosa/Cosa/LCD/Driver/HD44780_IO_Port4b.cpp

3. LCD horizontal and vertical bars
New example sketches that shows how to implement horizontal and vertical bars for progress indication or value.
https://github.com/mikaelpatel/Cosa/blob/master/examples/LCD/CosaLCDvbar/CosaLCDvbar.ino
https://github.com/mikaelpatel/Cosa/blob/master/examples/LCD/CosaLCDhbar/CosaLCDhbar.ino

4. Additional footprint reduction
Fine tuning of the Cosa startup code and classes to reduce the footprint.

5. Input/OutputPin optimizations
Additional optimization of the Cosa Input- and OutputPin classes to allow speedup X3-X10 compared to Arduino digitalRead/Write. See Cosa Benchmarks.
https://github.com/mikaelpatel/Cosa/blob/master/examples/Benchmarks/CosaBenchmarkPins/CosaBenchmarkPins.ino#L529

6. Circuit descriptions
Circuit descriptions are available in device header files, doxygen documentation and in example sketches.

Cheers!

aZumpano

#325
Apr 19, 2014, 03:13 pm Last Edit: Apr 19, 2014, 03:21 pm by aZumpano Reason: 1
I installed the platform "Cosa" as described . When I compile the examples I get the following error in the inclusion:
CosaBlinkClassic.ino:35:29: error: Cosa/OutputPin.hh: No such file or directory
I use Arduino 1.0.5. on Windows 7.
Can anyone help me?

kowalski

My guess is that you have not selected the correct board. You need to select one of the Cosa Arduino boards. See the Tools>Boards menu in the Arduino IDE.

Cheers!

aZumpano

I chose attiny84 @ 8MHz board, and the following errors occurs when compiling:

CosaBlinkClassic.ino:35:29: error: Cosa/OutputPin.hh: No such file or directory
CosaBlinkClassic:37: error: 'OutputPin' does not name a type
CosaBlinkClassic.ino: In function 'void loop()':
CosaBlinkClassic:41: error: 'ledPin' was not declared in this scope

It seems that the included file is not found!


kowalski

I guess you mean "Cosa Tiny (ATtiny84, 8 MHz internal clock)". In that case you have not installed correctly. What is the path to the install directory?

Cheers!

aZumpano

I use Arduino 1.0.5. on Windows 7
The path of sketches is "D:\sketchbook"
I have unzip "Cosa" in this path "D:\sketchbook\hardware\Cosa"


Go Up