You really don't like reading documentation ;-). I was under the impression that you had already installed Cosa previously and was now attempting to use it with Code::Blocks and a new version of Arduino. I understand now that this assumption was wrong. Sorry about that.

Well, yes I don't like reading documentation as I am a visual thinker. Still I did read your blog. Started with the first application, but managed to skip the whole installation blog I did however compile Cosa a few months back on another PC, but didn't know the special install anymore as you have noticed...

Quote

Cosa is not an Arduino library. The Arduino preprocessor cannot handle sub-directories within a library. I like to structure things so the include is "Cosa/XXX.hh" for header file and then there is even more structure like "Cosa/LCD.hh" and "Cosa/LCD/Driver/HD44780.hh".

Now how can we get the Arduino preprocessor (compiler include path) to recognize this? We put the Cosa directory into the arduino header/source directory! So the installation procedure is:

1. Download Cosa as a zip file.2. Unzip in your libraries folder in your sketches folder.3. Move the Cosa (source/header) folder to the Arduino source/header folder. For 1.0.5 that is the folder "arduino-1.0.5/hardware/arduino/cores/arduino".

You havn't done step 3 yet. That's all.

Thanx for the explanation. During my search I came accross some problems about subdirectories & libraries and the fact that this was filed as a bug, accepted, but then again rejected and considered as an Arduino feature! On the other side I use multiple libraries for my own projects (I was told to do so), and guess not able to use subdirectories is a reason, but I never realized this...

I wonder if Code::Blocks suffers from the same problem, as I'm using the Arduino compatible version, but haven't had time to check this.Code::Blocks btw caches already compiled files, so should be a lot faster, certainly if Cosa is compiled for each sketch, as pito mentioned.

Update: Result from compiling CosaPins.ino in Code::Blocks with the Cosa library in the Arduino folder:

Compiling: CosaPins.inoLinking console executable: build\CosaPins_uno.elfCosaPins.ino: In function 'void setup()':CosaPins.ino:83: warning: only initialized variables can be placed into program memory areaCosaPins.ino:86: warning: only initialized variables can be placed into program memory areaCosaPins.ino:89: warning: only initialized variables can be placed into program memory areaCosaPins.ino:90: warning: only initialized variables can be placed into program memory areaCosaPins.ino:91: warning: only initialized variables can be placed into program memory areaCosaPins.ino:92: warning: only initialized variables can be placed into program memory areaCosaPins.ino:93: warning: only initialized variables can be placed into program memory areaCosaPins.ino:94: warning: only initialized variables can be placed into program memory areaCosaPins.ino:95: warning: only initialized variables can be placed into program memory areaCosaPins.ino:96: warning: only initialized variables can be placed into program memory areaCosaPins.ino:97: warning: only initialized variables can be placed into program memory areaCosaPins.ino:98: warning: only initialized variables can be placed into program memory areaCosaPins.ino:99: warning: only initialized variables can be placed into program memory areaCosaPins.ino:100: warning: only initialized variables can be placed into program memory areaCosaPins.ino:113: warning: only initialized variables can be placed into program memory areaCosaPins.ino:115: warning: only initialized variables can be placed into program memory areaCosaPins.ino:117: warning: only initialized variables can be placed into program memory areaCosaPins.ino:119: warning: only initialized variables can be placed into program memory areaCosaPins.ino: In function 'void loop()':CosaPins.ino:131: warning: only initialized variables can be placed into program memory areaCosaPins.ino:134: warning: only initialized variables can be placed into program memory areaCosaPins.ino:138: warning: only initialized variables can be placed into program memory areaCosaPins.ino:143: warning: only initialized variables can be placed into program memory areaCosaPins.ino:146: warning: only initialized variables can be placed into program memory areaCosaPins.ino:147: warning: only initialized variables can be placed into program memory areaCosaPins.ino:148: warning: only initialized variables can be placed into program memory areaCosaPins.ino:149: warning: only initialized variables can be placed into program memory areabuild\CosaPins.o: In function `global constructors keyed to _Z11free_memoryv':CosaPins.ino:(.text._GLOBAL__I__Z11free_memoryv+0x8): undefined reference to `ExternalInterrupt::ExternalInterrupt(Board::ExternalInterruptPin, ExternalInterrupt::Mode)'CosaPins.ino:(.text._GLOBAL__I__Z11free_memoryv+0xec): undefined reference to `PWMPin::set(unsigned char)'CosaPins.ino:(.text._GLOBAL__I__Z11free_memoryv+0x120): undefined reference to `vtable for AnalogPin'CosaPins.ino:(.text._GLOBAL__I__Z11free_memoryv+0x122): undefined reference to `vtable for AnalogPin'C:\Users\xyz\My Documents\CosaPins\build\/core_uno_16.a(main.cpp.o): In function `main':main.cpp:(.text.main+0x8): undefined reference to `setup'main.cpp:(.text.main+0x10): undefined reference to `loop'Process terminated with status 1 (0 minutes, 4 seconds)6 errors, 28 warnings (0 minutes, 4 seconds)

Hmmm. Almost there, but not yet Never seen such errors, but I already discovered that Code::Blocks seems to be more strict than the Arduino IDE.I don't have an Arduino IDE installed here, but assume that Cosa will compile if installed right!

MarsWarrior, I see that you are back trying to get Cosa up and running on Code::Blocks. Below are a few hints on how to interpret the warning and error messages from the compiler.

1. The warnings have to do with the PSTR()/PROGMEM macro from AVR. It is not correctly defined in AVR. The same in Arduino. Requires a fix in AVR so for now just ignore "warning: only initialized variables can be placed into program memory area". 2. The errors are interesting as they reference free_memory() which is very strange. This might have to do with the preprocessing. 3. The link also seems to miss the object file for the preprocessed .ino file as setup() and loop() are missing.

You need to provide your compiler and link options to make sense of this. Also as I mentioned before this post/topic on this forum is mainly for Cosa updates and not support. Please use the github issue handling instead. I don't really provide support for stuff that is not on the project plan. Sorry about that.

When porting I start with something a bit simpler than CosaPins.ino and work my way upwards. This example sketch does use a lot of Cosa advanced stuff. It is not my first choice when going for a new IDE.

Last, the issue that pito mentioned. It isn't as bad as that. Yes, Cosa is compiled with the Arduino core when a sketch is built for the first time in a session (start of the IDE). A recompile of both the Arduino core and Cosa is forced when a new board is selected. Compiling another sketch in the same session with the same board setting will not force a new build of Cosa (or the Arduino core). All the object files are reused.

The Cosa I2C slave LCD driver is now completed. The initial design has been refactored to a new Virtual LCD class (VLCD) which allows any Cosa LCD device driver to be connected (not just the HD44780 driver). The VLCD class contains two parts; 1) the client part acts as a LCD proxy, translating LCD API calls to I2C messages, 2) the server part acts as an adapter that decodes the I2C messages and calls the LCD implementation.

Below is the CosaLCDslave sketch. It uses the new Virtual LCD class and binding to the HD44780 driver with the 4-bit parallel port IO. This sketch is compiled for an ATtiny84 in the example above but may be compiled for any Cosa supported Arduino.

By implementing the IOStream::Device methods puts(), puts_P() and write() the performance can be boosted to 50-98% of the performance of the I2C IO expander at 400kHz. Below are some results from the benchmarking. The first table shows the performance (operations per second/frames per second), and compares the 4-bit and I2C IO expander implementations (at 100khz and 400 khz).

The above results are used as the baseline for the comparison with the second table below which is the ATtiny84 (internal clock 8Mhz) compiled version and the VLCD version. The comparison is between the 4-bit implementation and then the VLCD implementation (with optimizations).

VLCD may be viewed as a "template" for how to construct I2C slave devices. http://dl.dropboxusercontent.com/u/993383/Cosa/doc/html/d1/d1f/classVLCD.html

Cheers!

For more details on the development of VLCD and the LCD optimizations see http://forum.arduino.cc/index.php?topic=175702.0

The next step; a USI based TWI master for ATtiny and the ported LCD support. Below is the LCD benchmark running on a LCD with I2C IO expander and an ATtiny85 (internal clock 8 MHz, internal pull-up). The benchmark result is 39 operations per second (32 characters plus 2 set cursor per op). The result for the Cosa LCD driver with I2C IO on a standard Arduino (Uno, Nano, etc) is 53 fps.

Every time I see your pictures with your 8pin attiny it comes across my mind how difficult would be to port Cosa onto LPC810M (8pin DIP as well)

LOL - Guess that would be in another forum!

Anyway after browsing through the LPC810M spec I actually think the ATtiny85 has the better cost/performance, though 1Kbyte SRAM is a small improvement, 4Kbyte PROGMEM is very limiting.

When the Arduino/AVR Cosa project starts to drops in velocity I will need to considering porting to other micro-controllers or starting a new project. ARM is the obvious next step even if it will not happen shortly as I still have tons to do.

The Cosa CosaBenchmarkPins.ino has been successfully built within the new UECIDE with Cosa library located in libraries..http://forum.arduino.cc/index.php?topic=176498.msg1319940#msg1319940

@pito

Great job! Thanks for testing that. Appreciate any feedback from the port to UECIDE. Read some of the dialogue in the topic above. And there seems to be some alternative installation strategy i.e. Cosa as a core instead of within the Arduino core.

As Cosa has grown build speed is becoming vital. I see that this has been discussed and is being addressed. Hope that a solution will soon be available also for the Arduino IDE.

I can't compare them because I've only used one, that being the LPCXpresso board and IDE (Eclipse-based). I'm well happy with both, the boards cost 20 Euro and the IDE is free for C, not for C++ although I believe it's easy enough to use it for C++, just not as turnkey as one might like.

I reckon the LPC1227 is roughly equivalent to the Mega1284, both are "just right" in terms of features IMO.

BTW, LPC11xx, LPC11Uxx, LPC12xx, LPC13xx are similar, and there is almost no difference at c source level with drivers. I've been toying with lpcxpresso 1343 and 11U14. For the purpose of Cosa port you may consider all the same (maybe except USB and DMA stuff). All have got an uart bootloader in a rom, plus other drivers there (it depends on the model).