platform-atmelavr icon indicating copy to clipboard operation
platform-atmelavr copied to clipboard

Incorrect order of actions in "Upload using programmer and set fuses" target

Open me21 opened this issue 5 years ago • 0 comments

Configuration

Operating system: Windows 10 x64 LTSB 2016

PlatformIO Version (platformio --version): 4.3.1

Description of problem

The order of actions is incorrect in "Upload using programmer and set fuses" target. It sets fuses first, then uploads the firmware, which can lead to lock bits removal if lock bits are set.

Steps to Reproduce

  1. Execute "Upload using programmer and set fuses" target
  2. The executed command is: > Executing task: C:\.platformio\penv\Scripts\platformio.exe run --target fuses --target program --environment uno_usbasp <

Actual Results

The lock bits are set first, which leads to inability to set other fuse bits. Then the firmware is written to the board, erasing the board in process, which leads to removal of lock bits again.

Expected Results

The firmware is flashed first, then the fuse bits are set, then the lock bits.

If problems with PlatformIO Build System:

The content of platformio.ini:

[env:uno_usbasp]
platform = atmelavr
board = uno
board_upload.maximum_size = 32768
upload_protocol = usbasp
framework = arduino
board_fuses.lfuse = 0xFF
board_fuses.hfuse = 0xDF ; do not use the bootloader
board_fuses.efuse = 0xFD
board_fuses.lock = 0x3C ; lock the board - protect the firmware against readout attempts

me21 avatar Mar 31 '20 23:03 me21