Closed MCUdude closed 4 years ago
Thanks for the amazing work!
2.0.0 is out! https://github.com/platformio/platform-atmelavr/releases/tag/v2.0.0
Thank you for letting enthusiasts like me contribute to this great project. I will update the PlatformIO readme doc for MightyCore, MegaCore, and MiniCore to reflect these new changes.
Hi!
As a developer working with AVRs I feel like the last thing missing from PlatformIO now is the ability to set the correct fuse bits and burn the correct bootloader based on the information given in platformio.ini.
MightyCore, MiniCore, and MegaCore (all supported by PlatformIO) comes with a bunch of pre-compiled bootloaders where all shares the same file names rules.
As long as
board
,board_build.f_cpu
, andboard_upload.speed
is present in platformio.ini Is it possible for a script to figure out the correct fuse bits and load the correct bootloader hex file.Preferably there should be three flags, one to only set the fuse bits, one to only burn the bootloader and one for doing both. Since the name and path of the bootloader are so extensive, we can check if the user entered a valid
board_build.f_cpu
, andboard_upload.speed
by checking if a bootloader with these values exists.A bootloader for a >=64kB device is named like this:
A bootloader for a <=32kB device is named like this:
By adding a new parameter to platformio.ini (
board_upload.uart_port
maybe?) we can specify if UART0, UART1 or UARTn should be used for uploading. Again, this decides what bootloader hex file is loaded.Another fuse related feature is the ability to set the brownout detection level. This is possible in Arduino IDE through a separate menu option. Something like
board_fuses.bod = 2.7V
?The last option should be to manually set fuses and override everything. My idea here would be to check if
board_fuses.high
,board_fuses.low
andboard_fuses.extended is present
. If one or more is present, then this fuse is overridden by whatever value the particular boards_fuses fields holdsI have very little experience with python, but I think this should be doable, even for me if someone points me in the right direction. I also haven't worked with PlatformIO advanced scripting before, so forgive me if some of the following questions are silly to some.
pio extra_script -f
orpio extra_script --fuses
pio extra_script -b
orpio extra_script --bootloader
pio extra_script -f -b
orpio extra_script --fuses --bootloader
EDIT: It seems like
boards_mightycore.txt
boards_minicore.txt
andboards_megacore.txt
already exist in my .platformio folder. Maybe these files can be parsed to make this job a little easier?