Skip to content
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

[Error Compiling] read-only variables must be const. #10

Open
e-lin opened this issue Jul 21, 2015 · 2 comments
Open

[Error Compiling] read-only variables must be const. #10

e-lin opened this issue Jul 21, 2015 · 2 comments

Comments

@e-lin
Copy link

e-lin commented Jul 21, 2015

The compiling error message is shown below:


Arduino: 1.7.4 (Mac OS X), Board: "Arduino Uno"

In file included from /Users/../Documents/Arduino/libraries/Sha/sha256.cpp:3:0:
/Users/../Documents/Arduino/libraries/Sha/sha256.cpp:6:20: error: variable 'sha256K' must be const in order to be put into read-only section by means of 'attribute((progmem))'
uint32_t sha256K[] PROGMEM = {
^
/Users/../Documents/Arduino/libraries/Sha/sha256.cpp:19:27: error: variable 'sha256InitState' must be const in order to be put into read-only section by means of 'attribute((progmem))'
uint8_t sha256InitState[] PROGMEM = {
^

Error compiling.

Read-only variables must be const as above suggestion.
Thanks!

@beyondszine
Copy link

also, declare them const.

@raddevus
Copy link

Just confirming that I had same issues: In Sha256.cpp need to change so it looks like (partial snippets of each) : -- simply added const keyword to each.

uint32_t const sha256K[] PROGMEM = {
  0x428a2f98,0x71374491,0xb5c0fbcf,

and

uint8_t const sha256InitState[] PROGMEM = {
  0x67,0xe6,0x09,0x6a, // H0
  0x85,0xae,0x67,0xbb, // H1

After changing these -- along with a changing the return value of write() method, it all compiled in the Arduino IDE against a nano board with atmeg328.
Thanks,

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

No branches or pull requests

3 participants