I know that I need to define the architecture (most cases avr) and the board name.
This is universal, though the only thing that would make the statement “most cases avr” valid is that the AVR boards are very popular in the Arduino world.
In some cases, I also need to define the cpu. For example, when using mega and nano boards:
arduino --board arduino:avr:nano:cpu=atmega168
The manual defines the --board option as:
where :parameters “is a comma-separated list of boards specific parameters that are normally shown under submenus of the “Tools” menu”.
I need to know what are the other available parameters
You need to understand the mechanism behind these parameters. It is documented here:
After reading that, you will see that the parameters are completely arbitrary. The author of each board definition is free to add any parameters they like with any names. You can’t infer any standardized rules about these parameters. You only need to understand how to determine what they are for your target board. You can do this in two different ways:
The first option is to open the boards.txt of the target board and look at the custom menus definitions for that board. You can follow these instructions to easily find the boards.txt for any board:
Select a board from the hardware package you want to find from the Tools > Board menu
File > Examples > SPI > BarometricPressureSensor (or any other SPI example sketch)
Sketch > Show Sketch Folder
Move up folder levels until you reach the one that contains boards.txt
Open boards.txt in a text editor.
The second option, which is more crude, but also easier:
Start the Arduino IDE’s GUI.
File > Preferences
Check the box next to Show verbose output during: > compilation.
File > New
Tools > Board > select the target board
Select your preferred options for any custom Tools menus.
Sketch > Verify/Compile
After the compilation finishes, scroll the black console window at the bottom of the Arduino IDE window all the way to the top. The first line will look something like this:
You will find the complete FQBN for the board you compiled for in the -fqbn option:
A Python script written by one of the contributors to the ESP8266 core for Arduino might provide the glimpse of a 3rd option:
I think it might need some adaptation to be universally useful, since it is written with the assumption that all boards will use the same custom menus. That is the case with the ESP8266 core for Arduino, but no the case with most other hardware packages.
if there is some board that needs more information.
There sure is. I think the ESP8266 boards might have the most parameters: