-
Notifications
You must be signed in to change notification settings - Fork 13.3k
pgmspace.h functions won't compile/link in a sketch #401
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
Comments
First, minor, but it is suggested that PROGMEM goes between the type and the name
Second, I can't repro your problem. Are you using the latest builds? |
Yep I'm using the latest version installed from the boards manager (http://arduino.esp8266.com/package_esp8266com_index.json), looks like it's version 1.6.4-673-g8cd3697. Just curious, what version are you using? |
Is this the same issue as #343? 1.6.4-758-ga194024, no problems due to Links2004@936669e 673 is getting a little old. |
Ahh sorry didn't see that earlier issue, yeah that's probably what I'm hitting. I'll grab the current github repo version and manually install to check if that fixed it. Thanks! |
You can also use the staging json file to get the latest using Arduino Board manager. |
Ah yep looks like it was just an issue with that older build I was using from the package index json. After building the latest version of the esp8266 branch from github the example code works great without any changes necessary. I'll close this and the related pull. Just curious what's the staging json file, is it a link to a more recent build that you could point Arduino's board manager at? Thanks! |
http://arduino.esp8266.com/staging/package_esp8266com_index.json |
It looks like there's a small issue with linking the pgmspace.h functions (flash memory routines like strlen_P, strcpy_P, etc.). For example try compiling the sketch below:
You will see it fail with an error that it can't find the functions when linking:
Looking more into it it looks like the pgmspace.h/cpp functions are compiled with G++ as C++ code but don't have an extern "C" wrapper to prevent name mangling. When gcc links the objects with the sketch it can't find the right symbols and fails.
Luckily the fix is easy, just extend the extern "C" in pgmspace.h that's for the headers so that it also covers the function declarations. I have a small pull request for this that I'll send in a moment.
The text was updated successfully, but these errors were encountered: