Closed GoogleCodeExporter closed 9 years ago
Ok I will review it tomorrow. Thanks a lot for the patch!
Original comment by bson...@gmail.com
on 1 Feb 2012 at 10:41
Here I don't have the file pgmtypes.h
It brings problems with pm_char type. Do you know if there is a #ifdef that we
could add somewhere?
Original comment by bson...@gmail.com
on 2 Feb 2012 at 6:45
My mistake, pgmtypes.h is new file. I've forgot to call svn add before
generating patch with svn diff. As I wrote before, these are not special types,
they have just pm_ prefix to show they point to progmem data, so they can't be
used directly. Alto, this is not special file I took somewhere, it's new file
where I put type definitions similar to those from avr/pgmspace.h with new
prefix pm_ so they do not conflict. If you want you can put it in open9x.h or
somewhere else.
New patch is attached.
Changes:
- removed forgotten comment from open9x.h
- added pgmtypes.h
- added change to util/xbm2lbm.rb
- svn diff called from top directory, not from src/
Original comment by mih...@mihlit.cz
on 2 Feb 2012 at 7:28
Attachments:
Would it be possible you update with latest revision? I have a lot of conflicts
that I think you will not have! I will not commit anything meanwhile!
Original comment by bson...@gmail.com
on 2 Feb 2012 at 7:34
ok, refreshed patch - against revision 185
Original comment by mih...@mihlit.cz
on 2 Feb 2012 at 8:30
Attachments:
refreshed patch - revision 185. This time for real (in comment 5, it was the
old one again)
Original comment by mih...@mihlit.cz
on 2 Feb 2012 at 8:33
Attachments:
That's a really good work. It seems to compile perfectly here.
One more check:
Could you compile with this command: make clean ; make PCB=STD EXT=FRSKY and
send me the .lss file, I would like to check the stack for the
__getSwitch(int8_t swtch) function which is recursive.
Also what is the size of the binary produced on the new compiler (with options
abobe)?
Here I have:
Program: 58914 bytes (89.9% Full)
(.text + .data + .bootloader)
Data: 3254 bytes (79.4% Full)
(.data + .bss + .noinit)
If the last compiler version does better, I will change before producing next
official version.
Thanks again for this work. Provided these last checks are ok, I am ok for you
to commit them.
Bertrand.
Original comment by bson...@gmail.com
on 2 Feb 2012 at 9:57
It took a while, I had to update avr-binutils to 2.22 because avr-objdump 2.20
did not understand dwarf data produced by new avr-gcc (BFD: Dwarf Error:
mangled line number section.) with updated avr-binutils, this error is gone.
attached is open9x.lss file obtained with avr-gcc 4.6.2, make PCB=STD EXT=FRSKY
and following Makefile patch:
Index: Makefile
===================================================================
--- Makefile (revision 185)
+++ Makefile (working copy)
@@ -364,7 +364,7 @@
CFLAGS += $(patsubst %,-I%,$(EXTRAINCDIRS))
CFLAGS += $(CSTANDARD)
-CFLAGS+= --combine -fwhole-program
+CFLAGS+= -flto -fwhole-program
#---------------- Compiler Options C++ ----------------
@@ -394,6 +394,7 @@
#CPPFLAGS += -Wa,-adhlns=$(<:%.cpp=$(OBJDIR)/%.lst)
CPPFLAGS += $(patsubst %,-I%,$(EXTRAINCDIRS))
#CPPFLAGS += $(CSTANDARD)
+CPPFLAGS += -flto
AVRGCCFLAGS = -fno-inline-small-functions
$ avr-size open9x.elf
text data bss dec hex filename
57796 26 3228 61050 ee7a open9x.elf
man page with -flto information:
http://gcc.gnu.org/onlinedocs/gcc-4.6.2/gcc/Optimize-Options.html
Original comment by mih...@mihlit.cz
on 2 Feb 2012 at 10:52
Attachments:
About the __getSwitch function, it is ok (no change), then it may be used in
recursive switches without any limitation (the limit is 12 = the number of
virtual switches)
The size is really good, 1000bytes saved. Do you know where it has been saved?
BTW you convinced me, I have to update my compiler now. Please commit your
changes, you are commiter.
Thanks again,
Bertrand.
Original comment by bson...@gmail.com
on 2 Feb 2012 at 11:08
Where it has been saved? In CPPFLAGS.
-combine: ... Currently the only language for which this is supported is C. ...
so in Makefile you have -combine only in CFLAGS, not in CPPFLAGS.
When building, I put -flto to both CFLAGS and CPPFLAGS:
CPPFLAGS & CFLAGS: text size=57796
CFLAGS only: text size=58422
Btw, when I try to add -combine to CPPFLAGS too (using avr-gcc 4.3.3), the
result is much smaller: 52k, but it's not supported and I did not test the
result, so I don't know what output it produces.
Original comment by mih...@mihlit.cz
on 2 Feb 2012 at 11:38
Issue fixed in revision 186.
To whom it may concern:
To make the code compatible in the future, use following style when working
with progmem variables:
- usual declaration:
const pm_char *str;
int foo(const pm_char *src,...
-> use pm_ instead of prog_ prefix, always use 'const' and never use PROGMEM
- variable definition with pointer initialization:
const pm_char *str = s;
-> the same as above, do not use PROGMEM
- variable definition with data initialization:
const pm_char *str PROGMEM = "hello world";
-> use pm_ instead of prog_ prefix, always use 'const' and use PROGMEM here
(only here)
And once again, what's behind this:
prog_char or pm_char... they are just usual variables, nothing special. They
are just numbers for both MCU and compiler, it just depends how you use them.
PROGMEM just says where to put initialization data, it does not affect type nor
variable anyway. That's the reason why it belongs (and in fact makes sense) to
put it only where you initialize data.
Original comment by mih...@mihlit.cz
on 2 Feb 2012 at 11:53
Original issue reported on code.google.com by
mih...@mihlit.cz
on 1 Feb 2012 at 10:34Attachments: