Custom Board Profile in Newer Arduino IDE

Hello,

I have recently updated my Arduino from 1.0.5 to the latest and greatest, 1.8.2. I needed to do this because what was good code did not compile correctly in 1.0.5. When I did this, I learned the hard way that I needed to change my hardware specifications. In 1.0.5, I had simply added an entry for a custom build board into boards.txt. I learned that as of 1.5.3, a major revision in arduino allowed for multiple hardware vendors etc. So, instead of being able to add my entry to boards.txt, I had to create my own vendor folder, fill it with mostly arduino copies and edit the boards.txt. I also found out that some syntax had changed. I can now get it to work with my hardware, but the IDE is giving me the following warning:

Warning: Board ies:avr:?menu doesn't define a 'build.board' preference. Auto-set to: AVR_?MENU

Here is my boards.txt:

menu.cpu=Processor

##############################################################

ies.name=IES Standard
ies.upload.tool=avrdude
ies.upload.protocol=arduino
ies.upload.maximum_size=32768
ies.upload.maximum_data_size=2048
ies.upload.speed=115200

ies.bootloader.tool=avrdude
ies.bootloader.low_fuses=0xFF
ies.bootloader.high_fuses=0xD1
ies.bootloader.extended_fuses=0xFD
ies.bootloader.unlock_bits=0x3F
ies.bootloader.lock_bits=0x2F

ies.build.mcu=atmega328p
ies.build.f_cpu=16000000L
ies.build.board=IES_328P
ies.build.core=arduino
ies.build.variant=standard

##############################################################

Can anyone help me to understand this warning and what I might need to do to be more compliant?

Perehama:
fill it with mostly arduino copies

It's not necessary to copy most things because you can reference them from another package. For example,
reference the Arduino AVR boards avrdude tool:

ies.upload.tool=arduino:avrdude

instead of copying the Arduino AVR Boards core you can do this:

ies.build.core=arduino:arduino

Instead of copying the Arduino AVR Boards standard variant you can do this:

ies.build.variant=arduino:standard

The only thing you can't reference is bootloader files, you do need to copy those but since you're not using one that's no problem.

Perehama:
the IDE is giving me the following warning:

Warning: Board ies:avr:?menu doesn't define a 'build.board' preference. Auto-set to: AVR_?MENU

Since you don't use it, remove the first line from your boards.txt:

menu.cpu=Processor

Actually that shouldn't normally cause a problem. I think the "?menu" part is a clue, there must be some sort of a hidden character or something before menu, which is causing the Arduino IDE to think you have another board definition with the ID "?menu", which is missing a build.board definition.

I removed menu.cpu=Processor and it didn't like the bars of # so I removed them also, leaving only the following, edited as you explained:

ies.name=IES Standard
ies.upload.tool=arduino:avrdude
ies.upload.protocol=arduino
ies.upload.maximum_size=32768
ies.upload.maximum_data_size=2048
ies.upload.speed=115200

ies.bootloader.tool=avrdude
ies.bootloader.low_fuses=0xFF
ies.bootloader.high_fuses=0xD1
ies.bootloader.extended_fuses=0xFD
ies.bootloader.unlock_bits=0x3F
ies.bootloader.lock_bits=0x2F

ies.build.mcu=atmega328p
ies.build.f_cpu=16000000L
ies.build.board=IES_328P
ies.build.core=arduino:arduino
ies.build.variant=arduino:standard

and now it's broke and I get the following error:

Warning: Board ies:avr:?ies doesn't define a 'build.board' preference. Auto-set to: AVR_?IES
avr-g++: error: missing device or architecture after '-mmcu='

Edited in Windows Notepad coding UTF-8

I changed the encoding to ANSI and no errors...

Yea, Notepad definitely causes that sort of thing a lot, glad you found the solution!

I like Notepad++:
https://notepad-plus-plus.org/
or if you want something super simple like notepad but more programmer friendly this is a good one:
http://akelpad.sourceforge.net/en/index.php

Thanks, Pert, for your help.

I have a folder named ies in the hardware folder with a folder named avr with boards.txt, platform.txt and programmers.txt

the boards.txt as below, and the platform.txt and programmers.txt copies of the arduino folder.

Do I need these in there?

I am using a USBASP to program my custom board.

Do I need to do anything different for that?

If you reference the upload tool from Arduino AVR Boards then it's not necessary to have a platform.txt, unless you need to customize some of the recipes. I sometimes add a platform.txt that is empty except for defining the name property:

name=IES Boards

That will add a label to the top of that section of the Tools > Board menu. That can be helpful if the boards names don't already clearly identify the package. In your case it's already obvious from the board name and there's only one board so doing that might just clutter your Board menu, that's up to you, it has no effect on how the package works, just aesthetics.

Unless you need custom programmers it's not necessary to have a programmers.txt.

So actually if you don't need bootloaders a hardware package can be as minimal as only a boards.txt file.

Thank you. :sunglasses:

I read somewhere that Tools>Burn Bootloader would in fact burn the fuses as I've set them up in boards.txt and not install any bootloader.

Is this true?

Is it true that "Upload" will not set the fuses?

Perehama:
I read somewhere that Tools>Burn Bootloader would in fact burn the fuses as I've set them up in boards.txt and not install any bootloader.

Is this true?

Tools > Burn Bootloader will set the fuses and then try to install the bootloader but since you haven't specified a bootloader file it will fail at that point. So it works for your purposes but it's kind of confusing that it says it failed. You could probably fix that by defining a dummy tools.avrdude.bootloader.pattern in your platform.txt. You could also add a dummy bootloader file, as was done in ATtinyCore:

Perehama:
Is it true that "Upload" will not set the fuses?

Correct, and neither will Sketch > Upload Using Programmer.

pert:
defining a dummy tools.avrdude.bootloader.pattern in your platform.txt.

I love this idea the best, as I think it results in the clearest path to my intention to remove the bootloader.
I have seen empty bootloaders before, but my understanding is that they aren't completely empty, just very very light and innocuous.
Now, I have to spend a few hours reading the avrdude documentation, unless someone has already done this and the code is public.

Perehama:
unless someone has already done this and the code is public.

Do you mean the dummy recipe? You can just leave it blank:

tools.avrdude.bootloader.pattern=

Ok, here is my platform.txt with the dummy recipe.

name=IES AVR Boards
version=1.0.0

# AVR Uploader/Programmers tools
# ------------------------------

tools.avrdude.path={runtime.tools.avrdude.path}
tools.avrdude.cmd.path={path}/bin/avrdude
tools.avrdude.config.path={path}/etc/avrdude.conf

tools.avrdude.network_cmd={runtime.tools.arduinoOTA.path}/bin/arduinoOTA

tools.avrdude.upload.params.verbose=-v
tools.avrdude.upload.params.quiet=-q -q
# tools.avrdude.upload.verify is needed for backwards compatibility with IDE 1.6.8 or older, IDE 1.6.9 or newer overrides this value
tools.avrdude.upload.verify=
tools.avrdude.upload.params.noverify=-V
tools.avrdude.upload.pattern="{cmd.path}" "-C{config.path}" {upload.verbose} {upload.verify} -p{build.mcu} -c{upload.protocol} -P{serial.port} -b{upload.speed} -D "-Uflash:w:{build.path}/{build.project_name}.hex:i"

tools.avrdude.program.params.verbose=-v
tools.avrdude.program.params.quiet=-q -q
# tools.avrdude.program.verify is needed for backwards compatibility with IDE 1.6.8 or older, IDE 1.6.9 or newer overrides this value
tools.avrdude.program.verify=
tools.avrdude.program.params.noverify=-V
tools.avrdude.program.pattern="{cmd.path}" "-C{config.path}" {program.verbose} {program.verify} -p{build.mcu} -c{protocol} {program.extra_params} "-Uflash:w:{build.path}/{build.project_name}.hex:i"

tools.avrdude.erase.params.verbose=-v
tools.avrdude.erase.params.quiet=-q -q
tools.avrdude.erase.pattern="{cmd.path}" "-C{config.path}" {erase.verbose} -p{build.mcu} -c{protocol} {program.extra_params} -e -Ulock:w:{bootloader.unlock_bits}:m -Uefuse:w:{bootloader.extended_fuses}:m -Uhfuse:w:{bootloader.high_fuses}:m -Ulfuse:w:{bootloader.low_fuses}:m

tools.avrdude.bootloader.params.verbose=-v
tools.avrdude.bootloader.params.quiet=-q -q
tools.avrdude.bootloader.pattern=
Ulock:w:{bootloader.lock_bits}:m

tools.avrdude_remote.upload.pattern=/usr/bin/run-avrdude /tmp/sketch.hex {upload.verbose} -p{build.mcu}

tools.avrdude.upload.network_pattern="{network_cmd}" -address {serial.port} -port {upload.network.port} -sketch "{build.path}/{build.project_name}.hex" -upload {upload.network.endpoint_upload} -sync {upload.network.endpoint_sync} -reset {upload.network.endpoint_reset} -sync_exp {upload.network.sync_return}

I put the whole “AVR Uploader/Programmers tools” section in because I was getting errors that parts were missing when I added just the one line…

Now, I get the following warning:

avrdude: warning: cannot set sck period. please check for usbasp firmware update.

googling this, it appears my programming speed may be too high, but I am not sure where to set it lower.

Or, I may be way off the mark…

Just ignore that. It’s normal with the stock firmware those USBasps come with and won’t cause any problems. It’s in no way related to your custom board, it would happen the same if you have a standard board selected.

Perehama:

Ulock:w:{bootloader.lock_bits}

That’s a little fragment of the original tools.avrdude.bootloader.pattern that was left behind. I don’t know if it would cause a problem but it’s likely to lead to confusion later: “now, what does this strange line do?”