Out of curiosity, and for comparison purposes, is there a repository somewhere with avr-gcc built from ALL of the major release of gcc after 5.4 (the version shipping from Microchip)?
Version 6.x, 7.x (Arduino is shipping 7.x), 8.x, 9.x. and 10.x ?
secondary is no significant regressions in applications (bootloader, libc, ...); westfw, the maintainer of Optiboot, has posted in this thread.
I don't really consider "the code is bigger now" to be a "regression" unless it's gratuitous and there is no way to way to work around it.
For example, with 4.8, Optiboot failed to fit in its 512 bytes because avr-gcc got more aggressive with inlining short functions (despite -Os), and I had to add "noinline" attributes to putch() and getch() and similar.
Out of curiosity, and for comparison purposes, is there a repository somewhere with avr-gcc built from ALL of the major release of gcc after 5.4 (the version shipping from Microchip)?
Well I know how to get them for windows and linux but you use Mac, right?
Anyway, I use the archives of Zak Kemble's blog (@abebeos also mentions it as reference) from the Wayback Machine
Yes gcc is full of holes but some are useful. Problem is, some programmers will rely on them working and then updating to a new avr-gcc version will break the code (in fact, just reveal holes already present).
Here is a small C++ example, it's kind of my pet issue
#include <stdint.h>
#define MMREGADDR 0x20
#define MMREG (*(volatile uint8_t*) MMREGADDR)
typedef struct
{
volatile uint8_t data;
} port_t;
#define MMREG_s (*(port_t*) MMREGADDR)
// The following 2 lines should always generate errors, since they violate C++ standard regarding valid constant expressions
// (they include a reinterpret_cast, in fact 2: int -> pointer -> int)
constexpr uint16_t mmreg_addr = (uint16_t) &(MMREG_s.data); // v5 compiles (AS7), v7 compiles (Arduino), v9, v10 fail
//constexpr uint16_t mmreg_addr = (uint16_t) &MMREG; // v5 compiles (AS7), v7 fails (Arduino), v9, v10 fail
int main(void){
return mmreg_addr;
}
Basically this is a cast from int to pointer and back to int. Even though the compiler actually knows this value at compile time and could use it as a constant expression, the C++ standard says it should pretend it doesn't and generate an error (I don't agree with the standard here, but hey, I hear these people are very smart so whatever they say must surely be right).
Only newer versions of avr-gcc do the check, version 7 currently used in the Arduino suite does the check only in some situations. It's quite a mess.
Posted by SprinterSB: Tue. Dec 15, 2020 - 05:01 PM
1
2
3
4
5
Total votes: 0
El Tangas wrote:
It's quite a mess.
Well, you can of course blame the older versions of the compiler for accepting invalid code.
.
But the very problem is questionable C++ features like constexpr+reinterpret_cast and what is (not) allowed to do with them.
.
Or you could blame avr-libc for only supplying SFR accesses via dereferencing volatile pointers, but does not supply SFR addresses as (macros resolving to) scalars.
avrfreaks does not support Opera. Profile inactive.
Posted by El Tangas: Tue. Dec 15, 2020 - 06:06 PM(Reply to #108)
1
2
3
4
5
Total votes: 0
I guess I'm ranting because I've seen people using things like &PORTB as template arguments, because AS7 will accept that even though it's invalid code. I blame Microchip for still using avr-gcc v5 in their official toolchain when it has so many bugs.
Besides you added features like the optimized ISR prologue/epilogue to one of the v8 sub-versions, right? An important feature IMO. Yet lots of people won't ever benefit from it because v5 ships with AS7 and v7 with Arduino.
Basically this is a cast from int to pointer and back to int. Even though the compiler actually knows this value at compile time and could use it as a constant expression, the C++ standard says it should pretend it doesn't and generate an error (I don't agree with the standard here, but hey, I hear these people are very smart so whatever they say must surely be right).
A useful extension occurs to me:
__builtin_const_expr(arg) is a constant expression if the compiler can evaluate it.
If an author is truly ambitious, 'tis a constant expression if the toolchain can evaluate it.
Exactly, we already commented earlier in this thread that the $7k reward could not possibly cover the work involved here. So basically only people very dedicated to the open software cause and to AVR would work here for a symbolic prize.
People in it for the money will quickly run out of motivation.
Posted by SprinterSB: Wed. Dec 23, 2020 - 02:14 PM
1
2
3
4
5
Total votes: 0
abebeos wrote:
The work is not that much the problem. Dealing with a mismanaged project, terrible infrastructure and rude code-monkeys-in-a-position-of-power (those who see only code/patches, and not other kind of necessary efforts) is the motivation killer. I had so much momentum to continue this, but...
It's just a review https://gcc.gnu.org/ml/gcc-patches/2020-December/561757.html and nothing rude. It points out issues, asks questions and addresses parts that are wrong or overtly complicated (~30 lines where 1 line does it in ~100 places). And just the fact that you have spent some time on it is of no concern, what counts is what the patch does. Apart from the legal stuff, of course.
.
Your "I won't even change a blank" just shows that you don't know anything about it, presumably the only trigger is the bounty for which you set the goal to 13000$.
.
And just to make it clear: I do not blame the author for anything; the authors of either patch made clear that it is semi-working, incomplete, abandoned.
.
I don't even see what your contribution is, apart from dropping the stuff at gcc-patches@. Ok, you managed to build Binutils, GCC and found avr-libc and how to run the testsuite. So you have achieved milestone "Blinky". Congrats for that first essential step.
.
What you are writing is 80% complaints and rants, 10% how much work you put into it and 10% links to somewhere else, 0% about technical details or code.
.
Your split of the bounty into "2. get rid of cc0" and "3. introduce CCmode" is just not possible. And a bounty for "1. Me accomplished Blinky"? Come on.
avrfreaks does not support Opera. Profile inactive.
While I was (and a few others were, too) quite happy to assist you, I am disappointed in many of your responses. So far the only evidence of any rudeness has been from you.
Irrespective of any work you may have done, and any contributions you may have made, mouthing off here (or anywhere else, for that matter) will not buy you a lick of respect, but only served to undermine any good you may have done. Indeed, that is one of the most recognisable marks of an 'amateur'.
"Experience is what enables you to recognise a mistake the second time you make it."
"Good judgement comes from experience. Experience comes from bad judgement."
"Wisdom is always wont to arrive late, and to be a little approximate on first possession."
"When you hear hoofbeats, think horses, not unicorns."
"Fast. Cheap. Good. Pick two."
"We see a lot of arses on handlebars around here." - [J Ekdahl]
Ababeos - what on earth is the point of deleting almost every one of your posts in this thread? Apart from anything else, it renders the entire thread pointless for anyone reading at a later date, and to be blunt, it's downright rude.
#5 "If you think you need floating point to solve the problem then you don't understand the problem. If you really do need floating point then you have a problem you do not understand."
1. Automatic clobber of REG_CC in inline asm statements, via
TARGET_MD_ASM_ADJUST hook.
Does this mean that SREG will be presumed clobbered by inline assembly?
IIRC that was the case before CC) conversion.
I'd thought that that was one of the things that would change with the conversion.
The problem is if you do clobber SREG in your asm() then I think you'd need to explicitly list "cc" in the clobbers, and there is probably lots of existing code that does not do that.
So, in any case, I'm guessing it would be good practice to list "cc" in your clobbers if you do ping SREG.
The problem is if you do clobber SREG in your asm() then I think you'd need to explicitly list "cc" in the clobbers, and there is probably lots of existing code that does not do that.
So, in any case, I'm guessing it would be good practice to list "cc" in your clobbers if you do ping SREG.
That had been my expectation.
My understanding was that avr-gcc's implicit clobber of SREG was an
artifact of implementation and that it would go away after the conversion.
My problem is interpreting this statement:
Quote:
1. Automatic clobber of REG_CC in inline asm statements, via
TARGET_MD_ASM_ADJUST hook.
Emphasis added.
If avr-gcc no longer implicitly clobbers SREG,
some help for legacy code might be in order.
Perhaps add nocc as a possible clobber item.
It would not do anything except stifle a warning that would
be issued if the clobber list contained neither cc nor nocc.
I did that to avoid breaking existing inline asm code that does not have an explicit clobber for cc. It was also the easiest option to implement :)
Would a command line option, say -mclobber-regcc-inlineasm, to turn implicit clobbering on/off, work better?
I would suggest maybe -mclobber-inline-asm-cc=option where option is "none" "all", and, in the future -- maybe, something like "t", "i" "x". So in the case future effort goes to break out multiple cc modes for T bit, I bit and the rest. What do you think?
Out of curiosity, and for comparison purposes, is there a repository somewhere with avr-gcc built from ALL of the major release of gcc after 5.4 (the version shipping from Microchip)?
Version 6.x, 7.x (Arduino is shipping 7.x), 8.x, 9.x. and 10.x ?
I don't really consider "the code is bigger now" to be a "regression" unless it's gratuitous and there is no way to way to work around it.
For example, with 4.8, Optiboot failed to fit in its 512 bytes because avr-gcc got more aggressive with inlining short functions (despite -Os), and I had to add "noinline" attributes to putch() and getch() and similar.
- Log in or register to post comments
Topvoid
- Log in or register to post comments
TopWell I know how to get them for windows and linux but you use Mac, right?
Anyway, I use the archives of Zak Kemble's blog (@abebeos also mentions it as reference) from the Wayback Machine
https://web.archive.org/web/*/https://blog.zakkemble.net/avr-gcc-builds/
If you go to different time periods, it's possible to get different versions of the avr-gcc toolchain. It's not a neat list, but it works.
- Log in or register to post comments
Topvoid
- Log in or register to post comments
TopAVR LLVM released | AVR Freaks
"Dare to be naïve." - Buckminster Fuller
- Log in or register to post comments
TopYes gcc is full of holes but some are useful. Problem is, some programmers will rely on them working and then updating to a new avr-gcc version will break the code (in fact, just reveal holes already present).
Here is a small C++ example, it's kind of my pet issue
Basically this is a cast from int to pointer and back to int. Even though the compiler actually knows this value at compile time and could use it as a constant expression, the C++ standard says it should pretend it doesn't and generate an error (I don't agree with the standard here, but hey, I hear these people are very smart so whatever they say must surely be right).
Only newer versions of avr-gcc do the check, version 7 currently used in the Arduino suite does the check only in some situations. It's quite a mess.
edit: link to live compiler (v5 and v9 only) https://godbolt.org/z/d9K4sY
- Log in or register to post comments
TopWell, you can of course blame the older versions of the compiler for accepting invalid code.
.
But the very problem is questionable C++ features like constexpr+reinterpret_cast and what is (not) allowed to do with them.
.
Or you could blame avr-libc for only supplying SFR accesses via dereferencing volatile pointers, but does not supply SFR addresses as (macros resolving to) scalars.
avrfreaks does not support Opera. Profile inactive.
- Log in or register to post comments
TopI guess I'm ranting because I've seen people using things like &PORTB as template arguments, because AS7 will accept that even though it's invalid code. I blame Microchip for still using avr-gcc v5 in their official toolchain when it has so many bugs.
Besides you added features like the optimized ISR prologue/epilogue to one of the v8 sub-versions, right? An important feature IMO. Yet lots of people won't ever benefit from it because v5 ships with AS7 and v7 with Arduino.
- Log in or register to post comments
Top__builtin_const_expr(arg) is a constant expression if the compiler can evaluate it.
If an author is truly ambitious, 'tis a constant expression if the toolchain can evaluate it.
Moderation in all things. -- ancient proverb
- Log in or register to post comments
Topvoid
- Log in or register to post comments
TopExactly, we already commented earlier in this thread that the $7k reward could not possibly cover the work involved here. So basically only people very dedicated to the open software cause and to AVR would work here for a symbolic prize.
People in it for the money will quickly run out of motivation.
- Log in or register to post comments
Topvoid
- Log in or register to post comments
TopI appreciate the effort; it was fun to spin the toolchain on one of my Linux machines; I hope you can get the bounty; it is probably lost otherwise.
my projects: https://github.com/epccs
- Log in or register to post comments
TopSorry to have to tell you, but those sorts of problems are ALWAYS "part of the work." :-)
- Log in or register to post comments
Topvoid
- Log in or register to post comments
Topvoid
- Log in or register to post comments
Topvoid
- Log in or register to post comments
TopIt is in v8 mainline, see http://gcc.gnu.org/gcc-8/changes.html#avr
avrfreaks does not support Opera. Profile inactive.
- Log in or register to post comments
Topvoid
- Log in or register to post comments
TopIt's just a review https://gcc.gnu.org/ml/gcc-patches/2020-December/561757.html and nothing rude. It points out issues, asks questions and addresses parts that are wrong or overtly complicated (~30 lines where 1 line does it in ~100 places). And just the fact that you have spent some time on it is of no concern, what counts is what the patch does. Apart from the legal stuff, of course.
.
Your "I won't even change a blank" just shows that you don't know anything about it, presumably the only trigger is the bounty for which you set the goal to 13000$.
.
And just to make it clear: I do not blame the author for anything; the authors of either patch made clear that it is semi-working, incomplete, abandoned.
.
I don't even see what your contribution is, apart from dropping the stuff at gcc-patches@. Ok, you managed to build Binutils, GCC and found avr-libc and how to run the testsuite. So you have achieved milestone "Blinky". Congrats for that first essential step.
.
What you are writing is 80% complaints and rants, 10% how much work you put into it and 10% links to somewhere else, 0% about technical details or code.
.
Your split of the bounty into "2. get rid of cc0" and "3. introduce CCmode" is just not possible. And a bounty for "1. Me accomplished Blinky"? Come on.
avrfreaks does not support Opera. Profile inactive.
- Log in or register to post comments
Topvoid
- Log in or register to post comments
Topvoid
- Log in or register to post comments
Topvoid
- Log in or register to post comments
Top@abebos,
While I was (and a few others were, too) quite happy to assist you, I am disappointed in many of your responses. So far the only evidence of any rudeness has been from you.
Irrespective of any work you may have done, and any contributions you may have made, mouthing off here (or anywhere else, for that matter) will not buy you a lick of respect, but only served to undermine any good you may have done. Indeed, that is one of the most recognisable marks of an 'amateur'.
"Experience is what enables you to recognise a mistake the second time you make it."
"Good judgement comes from experience. Experience comes from bad judgement."
"Wisdom is always wont to arrive late, and to be a little approximate on first possession."
"When you hear hoofbeats, think horses, not unicorns."
"Fast. Cheap. Good. Pick two."
"We see a lot of arses on handlebars around here." - [J Ekdahl]
- Log in or register to post comments
Topvoid
- Log in or register to post comments
Topvoid
- Log in or register to post comments
TopAbabeos - what on earth is the point of deleting almost every one of your posts in this thread? Apart from anything else, it renders the entire thread pointless for anyone reading at a later date, and to be blunt, it's downright rude.
Neil
Neil Barnes
www.nailed-barnacle.co.uk
- Log in or register to post comments
Tophttps://github.com/abebeos/avr-gnu
"Experience is what enables you to recognise a mistake the second time you make it."
"Good judgement comes from experience. Experience comes from bad judgement."
"Wisdom is always wont to arrive late, and to be a little approximate on first possession."
"When you hear hoofbeats, think horses, not unicorns."
"Fast. Cheap. Good. Pick two."
"We see a lot of arses on handlebars around here." - [J Ekdahl]
- Log in or register to post comments
TopWhat do we think? He didn't get the bounty?
#1 Hardware Problem? https://www.avrfreaks.net/forum/...
#2 Hardware Problem? Read AVR042.
#3 All grounds are not created equal
#4 Have you proved your chip is running at xxMHz?
#5 "If you think you need floating point to solve the problem then you don't understand the problem. If you really do need floating point then you have a problem you do not understand."
- Log in or register to post comments
TopI would guess... no.
- Log in or register to post comments
TopMostly for my sanity and reference:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92729
https://github.com/saaadhu/gcc-avr-cc0/issues/2
at some point Georg told people on the GCC list who abebeos was
https://gcc.gnu.org/pipermail/gcc-patches/2020-December/561762.html
I don't know what to think; if it is drama, I don't like drama, but maybe it is more like a Monty Python sketch.
my projects: https://github.com/epccs
- Log in or register to post comments
TopAVR CC0 conversion
[PATCH 2/n] AVR CC0 conversion - adjust peepholes
GCC 11.0.0 Status Report (2021-01-18), Stage 4 in effect now
"Dare to be naïve." - Buckminster Fuller
- Log in or register to post comments
TopWhat was the status here ?
Did these patches get accepted , and avr-gcc "survived" or ?
https://gcc.gnu.org/pipermail/gc...
/Bingo
- Log in or register to post comments
Topedit3 :
12.0?
GCC 11.0.1 Status Report (2021-04-09)
AVR CC0 conversion
https://gcc.gnu.org/git/?p=gcc.git;a=tree;f=gcc/config/avr;h=e116816421b2f63c8b923601bfff82bb8ff9ed8e;hb=HEAD
edit :
GCC 11.0.0 Status Report (2021-01-14), Stage 3 closes Jan 16th
edit2 : bottom of
92729 – [avr] Convert the backend to MODE_CC so it can be kept in future releases
"Dare to be naïve." - Buckminster Fuller
- Log in or register to post comments
TopGCC 11.1 is definitely imminent.
GCC 12.0 is open.
GCC 11.0.1 Status Report (2021-04-20)
GCC 12.0.0 Status Report (2021-04-20)
"Dare to be naïve." - Buckminster Fuller
- Log in or register to post comments
TopGCC 11.1 Released
GCC 11.1.1 Status Report (2021-04-27)
"Dare to be naïve." - Buckminster Fuller
- Log in or register to post comments
TopAVR CC0 conversion patch applied into trunk
https://github.com/gcc-mirror/gcc/commit/3ba781d3b5c8efadb60866c9743b657e8f0eb222
"Dare to be naïve." - Buckminster Fuller
- Log in or register to post comments
TopIIRC that was the case before CC) conversion.
I'd thought that that was one of the things that would change with the conversion.
Moderation in all things. -- ancient proverb
- Log in or register to post comments
TopThe problem is if you do clobber SREG in your asm() then I think you'd need to explicitly list "cc" in the clobbers, and there is probably lots of existing code that does not do that.
So, in any case, I'm guessing it would be good practice to list "cc" in your clobbers if you do ping SREG.
- Log in or register to post comments
TopMy understanding was that avr-gcc's implicit clobber of SREG was an
artifact of implementation and that it would go away after the conversion.
My problem is interpreting this statement:
If avr-gcc no longer implicitly clobbers SREG,
some help for legacy code might be in order.
Perhaps add nocc as a possible clobber item.
It would not do anything except stifle a warning that would
be issued if the clobber list contained neither cc nor nocc.
Moderation in all things. -- ancient proverb
- Log in or register to post comments
TopI did that to avoid breaking existing inline asm code that does not have an explicit clobber for cc. It was also the easiest option to implement :)
Would a command line option, say -mclobber-regcc-inlineasm, to turn implicit clobbering on/off, work better?
Regards
Senthil
blog | website
- Log in or register to post comments
TopI received a ping on the bounty payout today. It looks legit. Thanks for the work , saaadu. Here is the link: gcc issue on avr CCmode
- Log in or register to post comments
TopI would suggest maybe -mclobber-inline-asm-cc=option where option is "none" "all", and, in the future -- maybe, something like "t", "i" "x". So in the case future effort goes to break out multiple cc modes for T bit, I bit and the rest. What do you think?
- Log in or register to post comments
Top"Dare to be naïve." - Buckminster Fuller
- Log in or register to post comments
TopThe option warning and no clobber would require a new clobber item to stifle the warning. nocc seems an obvious name.
As noted, it might be useful to break out the individual bits, especially T and I.
They are not affected by arithmetic.
Moderation in all things. -- ancient proverb
- Log in or register to post comments
TopGCC patch 5-May'21 :
[committed] Get avr building again
"Dare to be naïve." - Buckminster Fuller
- Log in or register to post comments
TopA new option to (not) clobber SREG in inline asm wont work
.
It wont work for performance improvment for obvious reasons.
.
It might break correctness because many inline asm is brought to you by system headers, in these might have other requirements than user code.
.
inline asm is transparent to gccs ISR optimization, which is performed by gas, anyway.
avrfreaks does not support Opera. Profile inactive.
- Log in or register to post comments
TopGCC 12.0.0 Status Report (2021-11-15), Stage 3 in effect NOW
"Dare to be naïve." - Buckminster Fuller
- Log in or register to post comments
Topreleased
then today for Windows
https://github.com/ZakKemble/avr-gcc-build/releases/tag/v12.1.0-1
"Dare to be naïve." - Buckminster Fuller
- Log in or register to post comments
TopPages