Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Code bloat?
03-06-2013, 05:36 PM,
#21
RE: Code bloat?
Thanks to everyone:

I'm gonna try these new bootloaders to make some room in the MCU, thank you @regis and @pingotg!!!. Anyway, I've found something interesting: I was working until last week with Arch Linux and Windows, and both operating systems compiled the code identically.

But take a look to this:

Last week I switched from Arch Linux to Kubuntu 13.04, and the code size gets reduced significantly! The LCD hello world example, which was taking around 90% from storage, takes only 62% compiled under Kubuntu. Perhaps the IDE is optimized to work with an specific version of GCC compiler... Although that doesn't make much sense I guess.

Well, code is still way bigger than Arduino's.. But now things look A LOT BETTER! Smile THANKS AGAIN!
Reply
03-06-2013, 05:56 PM,
#22
RE: Code bloat?
(03-06-2013, 05:36 PM)daniellibonati Wrote: Last week I switched from Arch Linux to Kubuntu 13.04, and the code size gets reduced significantly! The LCD hello world example, which was taking around 90% from storage, takes only 62% compiled under Kubuntu. Perhaps the IDE is optimized to work with an specific version of GCC compiler... Although that doesn't make much sense I guess.
Are you sure you tried both OS with the same revision of the IDE ? I made some improvements on the last ones so it can make the difference ;-)

(03-06-2013, 05:36 PM)daniellibonati Wrote: Well, code is still way bigger than Arduino's.
How bigger ? Can you provide a simple example with code size, so that we can compare ... and improve the Pinguino code.

Thanks
It is easier to complain than it is to do, but it is better to do than it is to complain.
Reply
03-06-2013, 08:22 PM,
#23
RE: Code bloat?
(03-06-2013, 05:56 PM)regis Wrote:
(03-06-2013, 05:36 PM)daniellibonati Wrote: Last week I switched from Arch Linux to Kubuntu 13.04, and the code size gets reduced significantly! The LCD hello world example, which was taking around 90% from storage, takes only 62% compiled under Kubuntu. Perhaps the IDE is optimized to work with an specific version of GCC compiler... Although that doesn't make much sense I guess.
Are you sure you tried both OS with the same revision of the IDE ? I made some improvements on the last ones so it can make the difference ;-)

(03-06-2013, 05:36 PM)daniellibonati Wrote: Well, code is still way bigger than Arduino's.
How bigger ? Can you provide a simple example with code size, so that we can compare ... and improve the Pinguino code.

Thanks


@regis:

I'm currently using rev 857 on Kubuntu, I think it was the same on Arch Linux (I've installed the IDE just 3 or 4 weeks ago). Regardings the code size in comparison with Arduino, here's what I get after compiling the same code in both IDE's (Arduino's code has also the include and lcd initialization statements):

Code:
void setup() {
  // set up the LCD's number of columns and rows:
  lcd.begin(16, 2);
  // Print a message to the LCD.
  lcd.print("hello, world!");
}

void loop() {
  // set the cursor to column 0, line 1
  // (note: line 1 is the second row, since counting begins with 0):
  lcd.setCursor(0, 1);
  // print the number of seconds since reset:
  lcd.print(millis()/1000);
}

For Pinguino:

Code:
Board:     Pinguino 4550
Proc:     18f4550
File:     /home/daniel/PinguinoX4/examples/07.Display/LiquidCrystal/HelloWorld.pde
compiling...
compilation done
code size: 7948 / 29695 bytes (26% used)
0.6 seconds process time

And for Arduino:
Code:
Tamaño binario del Sketch: 2.414 bytes (de un máximo de 32.256 bytes)

PS: I'm using now the v4.9 bootloader, and besides the size, it also improved the execution of the program. Again, from 92% code lowered to 51%. Now I can live with that Smile
Reply
03-06-2013, 08:55 PM,
#24
RE: Code bloat?
With your example, Pinguino 4550 and bootloade v4.x :
code size: 7044 / 29695 bytes (23% used)

Go to millis.c and comment this lines :
13 //#include <interrupt.c>
28 // intUsed[INT_TMR0] = INT_USED;
and you will get :
code size: 5624 / 29695 bytes (18% used)

But this is still 3K more than with Arduino Huh
I know SDCC is not very good at optimization but I'm sure there is space to improve Pinguino's code.
It is easier to complain than it is to do, but it is better to do than it is to complain.
Reply
03-06-2013, 11:18 PM,
#25
RE: Code bloat?
(03-06-2013, 08:55 PM)regis Wrote: But this is still 3K more than with Arduino Huh
I know SDCC is not very good at optimization but I'm sure there is space to improve Pinguino's code.

Pinguino is using printf for formatting? If yes, there is another place where the size can be dramatically reduced.
Reply
04-06-2013, 12:21 AM,
#26
RE: Code bloat?
(03-06-2013, 08:55 PM)regis Wrote: Go to millis.c and comment this lines :
13 //#include <interrupt.c>
28 // intUsed[INT_TMR0] = INT_USED;
and you will get :
code size: 5624 / 29695 bytes (18% used)

@regis:

I did that, and code size dropped from 62% to only 21%! Now we're talking Smile THX!

Code:
code size: 6528 / 29695 bytes (21% used)
Reply
04-06-2013, 09:29 AM,
#27
RE: Code bloat?
(03-06-2013, 11:18 PM)funlw65 Wrote: Pinguino is using printf for formatting?
Pinguino has its own revisited printf function. It's up to users to call it or not. If code size is critical, I would recommend not to use it. Use lcd.print instead of lcd.printf for example.
It is easier to complain than it is to do, but it is better to do than it is to complain.
Reply
31-07-2013, 06:23 AM,
#28
RE: Code bloat?
Such a dramatic reduction, well done Smile
Reply
18-04-2016, 11:08 AM, (This post was last modified: 18-04-2016, 11:15 AM by funlw65.)
#29
RE: Code bloat?
Regis, Pinguino really needed XC8! Good job introducing it! Even in free version, it is much better than MPLAB C18 in professional version (which was a lot better than SDCC). Now, working with bootloaders in XC8 is piece of cake (only one linker option set in MPLAB X and your code is correctly allocated). Can't wait to see the version 12 of the Pinguino IDE.

BTW, using PIC16F1454 as an USB bridge (and included on a future Pinguino board) for serial bootloaders (Microchip has a Serial bootloader written in assembler, where the user program starts at 0x300), the Pinguino family can include all non-USB microcontrollers. But anyway, I guess, one step at a time, let's see XC8 at work first.

Again, congratulations for the decision!
Reply
18-04-2016, 07:00 PM,
#30
RE: Code bloat?
Thank you !
If you want to give a try to the version 12 (AKA "testing"), go to http://www.pinguino.cc/download.php and download one of the installers.
It is easier to complain than it is to do, but it is better to do than it is to complain.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)