Skip to content

Eliminate pgmspace? #11

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
WestfW opened this issue Nov 24, 2018 · 2 comments
Closed

Eliminate pgmspace? #11

WestfW opened this issue Nov 24, 2018 · 2 comments

Comments

@WestfW
Copy link
Contributor

WestfW commented Nov 24, 2018

This is just an idea, at the moment - I may get some statistics to support it (or not), soon.

The 0-seriese "megaavr" chips have a unified address space where flash is accessible the same as RAM, and so LPM instructions are no longer needed to access constant tables stored in flash. An LDx from flash isn't actually any faster than an LPM, but there are a lot of extra addressing modes available
(indexing using X, Y, and Z, rather than only Z, for example), so I'd expect some overall improvement in behavior once the compiler gets it's register allocation optimization fingers in there.

That means that the various tables (notably the digital_pin_to* tables) can be allocated without specifying PROGMEM, and we don't need "pgm_read_*" functions to access them.

See also https://www.avrfreaks.net/comment/2593311#comment-2593311

(Hmm. FlashStringHelper could go away too. I guess Serial.print("string") is already automatically using this feature. (confirmed, BTW!))

(Probably the best way to do this is to redefine the existing stuff as null macros, rather than eliminating it. #define F(x) (x), for example`)
http://forum.arduino.cc/index.php?topic=581415.msg3957672#msg3957672

@facchinm
Copy link
Member

To be merged with #53

@facchinm
Copy link
Member

Fixed by merging 3b5508e

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants