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

Arduino 1.8.12 and Arduino 2.1 give ino file const error! Does not work! #88

Open
Alectronics opened this issue Aug 20, 2023 · 8 comments

Comments

@Alectronics
Copy link

Alectronics commented Aug 20, 2023

\Atmega_Board_Programmer\Atmega_Board_Programmer\bootloader_atmega328.h:3:34: error: variable 'atmega328_optiboot' must be const in order to be put into read-only section by means of 'attribute((progmem))'
byte PROGMEM atmega328_optiboot [] = {
^
\Atmega_Board_Programmer\Atmega_Board_Programmer\Atmega_Board_Programmer.ino:147:9: error: 'atmega168_optiboot' was not declared in this scope
atmega168_optiboot, // loader image
^~~~~~~~~~~~~~~~~~
\Atmega_Board_Programmer\Atmega_Board_Programmer\Atmega_Board_Programmer.ino:147:9: note: suggested alternative: 'atmega328_optiboot'
atmega168_optiboot, // loader image
^~~~~~~~~~~~~~~~~~
atmega328_optiboot
\Atmega_Board_Programmer\Atmega_Board_Programmer\Atmega_Board_Programmer.ino:149:16: error: 'atmega168_optiboot' was not declared in this scope
sizeof atmega168_optiboot,
^~~~~~~~~~~~~~~~~~
\Atmega_Board_Programmer\Atmega_Board_Programmer\Atmega_Board_Programmer.ino:149:16: note: suggested alternative: 'atmega328_optiboot'
sizeof atmega168_optiboot,
^~~~~~~~~~~~~~~~~~
atmega328_optiboot
\Atmega_Board_Programmer\Atmega_Board_Programmer\Atmega_Board_Programmer.ino:184:9: error: 'optiboot_atmega1280_hex' was not declared in this scope
optiboot_atmega1280_hex,
^~~~~~~~~~~~~~~~~~~~~~~
\Atmega_Board_Programmer\Atmega_Board_Programmer\Atmega_Board_Programmer.ino:186:16: error: 'optiboot_atmega1280_hex' was not declared in this scope
sizeof optiboot_atmega1280_hex,
^~~~~~~~~~~~~~~~~~~~~~~
\Atmega_Board_Programmer\Atmega_Board_Programmer\Atmega_Board_Programmer.ino:195:9: error: 'atmega2560_bootloader_hex' was not declared in this scope
atmega2560_bootloader_hex,// loader image
^~~~~~~~~~~~~~~~~~~~~~~~~
\Atmega_Board_Programmer\Atmega_Board_Programmer\Atmega_Board_Programmer.ino:197:16: error: 'atmega2560_bootloader_hex' was not declared in this scope
sizeof atmega2560_bootloader_hex,
^~~~~~~~~~~~~~~~~~~~~~~~~
\Atmega_Board_Programmer\Atmega_Board_Programmer\Atmega_Board_Programmer.ino:217:9: error: 'optiboot_atmega1284p_hex' was not declared in this scope
optiboot_atmega1284p_hex,
^~~~~~~~~~~~~~~~~~~~~~~~
\Atmega_Board_Programmer\Atmega_Board_Programmer\Atmega_Board_Programmer.ino:219:16: error: 'optiboot_atmega1284p_hex' was not declared in this scope
sizeof optiboot_atmega1284p_hex,
^~~~~~~~~~~~~~~~~~~~~~~~
\Atmega_Board_Programmer\Atmega_Board_Programmer\Atmega_Board_Programmer.ino:235:9: error: 'atmega8_hex' was not declared in this scope
atmega8_hex,
^~~~~~~~~~~
\Atmega_Board_Programmer\Atmega_Board_Programmer\Atmega_Board_Programmer.ino:237:16: error: 'atmega8_hex' was not declared in this scope
sizeof atmega8_hex,
^~~~~~~~~~~
\Atmega_Board_Programmer\Atmega_Board_Programmer\Atmega_Board_Programmer.ino: In function 'void writeBootloader()':
\Atmega_Board_Programmer\Atmega_Board_Programmer\Atmega_Board_Programmer.ino:419:20: error: 'ATmegaBOOT_168_atmega328_pro_8MHz_hex' was not declared in this scope
bootloader = ATmegaBOOT_168_atmega328_pro_8MHz_hex;
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

exit status 1

Compilation error: variable 'atmega328_optiboot' must be const in order to be put into read-only section by means of 'attribute((progmem))'

@Alectronics Alectronics changed the title Arduino 1.18 and Arduino 2.x give ino file const error! Does not work! Arduino 1.8.12 and Arduino 2.1 give ino file const error! Does not work! Aug 20, 2023
@nickgammon
Copy link
Owner

I can't reproduce that. With both Arduino 1.18 and Arduino 2.1.1 it compiles OK:

Sketch uses 27196 bytes (84%) of program storage space. Maximum is 32256 bytes.
Global variables use 242 bytes (11%) of dynamic memory, leaving 1806 bytes for local variables. Maximum is 2048 bytes.

The error message you quoted says that the variable had to be const which it is:

https://github.com/nickgammon/arduino_sketches/blob/master/Atmega_Board_Programmer/bootloader_atmega328.h

const byte atmega328_optiboot [] PROGMEM = {

Have you downloaded the latest version of the code from GitHub?

@Alectronics
Copy link
Author

Alectronics commented Aug 21, 2023 via email

@nickgammon
Copy link
Owner

There are a number of such files. Since you are posting a bug report here on Github, I assumed you would have the latest code. I suggest downloading all the code again (from here).

@Alectronics
Copy link
Author

Alectronics commented Aug 21, 2023 via email

@Alectronics
Copy link
Author

Alectronics commented Aug 21, 2023 via email

@Alectronics
Copy link
Author

Alectronics commented Aug 21, 2023 via email

@nickgammon
Copy link
Owner

There is something strange about your packed sketch file. When I extract these with WinRar they never show up anywhere in Windows 10? Looked in older 1.8.12 and also in Arduino 2.1.

I don't know why you are using WinRar. They aren't RAR files. They are ZIP files which Windows 10 should easily be able to open natively. It is a very common format. See screenshot:

Screenshot from 2023-08-22 07-52-08

@Alectronics
Copy link
Author

Alectronics commented Aug 22, 2023 via email

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

2 participants