arduino-language-server icon indicating copy to clipboard operation
arduino-language-server copied to clipboard

Unknown target CPU `atmega4809` required by megaAVR boards

Open bradcush opened this issue 2 years ago • 0 comments

Describe the problem

When specifying the arduino:megaavr:uno2018 platform core as the FQBN, whether as part of the original language server command or inside of a sketch.json file for a given project, the language server is able to run but isn't functional due to multiple errors. When the arduino:avr:uno platform core is specified instead, the language server works as expected.

I'm specifically running the language server with the built-in Neovim LSP but I've seen the same type of issue reported by users in the context of the Arduino IDE. I’m opening an issue here as the problem seems to be focused on the language server itself. Some of the relevant errors are included below:

[ERROR][2022-06-12 10:09:26] .../vim/lsp/rpc.lua:420 "rpc" "/Users/bcushing/go/bin/arduino-language-server" "stderr" "V[10:09:26.721] Ignored diagnostic. unknown target CPU 'atmega4809'\nV[10:09:26.721] Ignored diagnostic. unknown target CPU 'atmega4809'\n"

[ERROR][2022-06-12 10:09:26] .../vim/lsp/rpc.lua:420 "rpc" "/Users/bcushing/go/bin/arduino-language-server" "stderr" "V[10:09:26.714] Ignored diagnostic. unknown target CPU 'atmega4809'\nV[10:09:26.714] Ignored diagnostic. valid target CPU values are: avr1, avr2, avr25, ..., atiny104\n"

[ERROR][2022-06-12 10:09:29] .../vim/lsp/rpc.lua:420 "rpc" "/Users/bcushing/go/bin/arduino-language-server" "stderr" "E[10:09:29.213] Could not build a preamble for file /private/var/folders/cl/h4959ym96wn_dd1zg6v7tdl00000gq/T/arduino-language-server1483186440/sketch/practice.ino.cpp version 4: CreateTargetInfo() return null\n"

[ERROR][2022-06-12 10:09:29] .../vim/lsp/rpc.lua:420 "rpc" "/Users/bcushing/go/bin/arduino-language-server" "stderr" "E[10:09:29.213] Failed to prepare a compiler instance: valid target CPU values are: avr1, avr2, avr25, ..., attiny104\nI[10:09:29.213] --> textDocument/publishDiagnostics\n"

To reproduce

  1. Setup the arduino_language_server using nvim-lspconfig
  2. Specify the cmd to be used for running the language server
  3. Set the -fqbn flag to be arduino:megaavr:uno2018
  4. Open an ino file in a buffer and monitor log output

Example language server setup showing command:

-- Set paths for arduino language server command
local arduino_binary = '/Users/bcushing/go/bin/arduino-language-server'
local arduino_config = '/Users/bcushing/Library/Arduino15/arduino-cli.yaml'
nvim_lsp['arduino_language_server'].setup({
    on_attach = on_attach,
    cmd = {
        arduino_binary,
        '-cli-config',
        arduino_config,
        '-clangd',
        'clangd',
        '-cli',
        'arduino-cli'
        '-fqbn',
        'arduino:megaavr:uno2018'
    }
})

Expected behavior

The arduino:megaavr:uno2018 platform core can be specified as the FQBN and the language server is functioning similarly to how it does for FQBNs that are supported like arduino:avr:uno.

Arduino Language Server version

v0.0.0-20220608154818-2554452cd205

Arduino CLI version

arduino-cli Version: 0.23.0 Commit: 899dc91b Date: 2022-06-06T08:13:52Z

Operating system

macOS

Operating system version

Version 12.4 (21F79)

Additional context

No response

Issue checklist

  • [X] I searched for previous reports in the issue tracker
  • [X] I verified the problem still occurs when using the latest version
  • [X] My report contains all necessary details

bradcush avatar Jun 12 '22 14:06 bradcush