Pins_arduino.h error

Hi - just continuing my exploration of programming an avr4809. I’ve uploaded and used some of the Microchip code examples. All went ok (with some help fom this forum). I havenow decided to include the following framework line in my PIO.in

; Parameters used for all environments
[env]
platform = atmelmegaavr
framework = arduino

but when I try to compile with a #include <arduino.h> in my main.cpp (or without it actually) i now get the error below. Do I need to find the pins_arduino.h header and paste it somewhere? Why isn’t it in with the other arduino lib I wonder?

thanks for help
Paul

Processing ATmega4809_pyupdi_upload (platform: atmelmegaavr; board: atmega4809; framework: arduino)
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------Verbose mode can be enabled via `-v, --verbose` option
CONFIGURATION: https://docs.platformio.org/page/boards/atmelmegaavr/atmega4809.html
PLATFORM: Atmel megaAVR (1.4.0) > ATmega4809
HARDWARE: ATMEGA4809 16MHz, 6KB RAM, 48KB Flash
PACKAGES:
 - framework-arduino-megaavr-megacorex 1.0.7
 - toolchain-atmelavr 2.70300.201015 (7.3.0)
LDF: Library Dependency Finder -> http://bit.ly/configure-pio-ldf
LDF Modes: Finder ~ chain, Compatibility ~ soft
Found 9 compatible libraries
Scanning dependencies...
No dependencies
Building in release mode
Compiling .pio\build\ATmega4809_pyupdi_upload\src\main.cpp.o
Compiling .pio\build\ATmega4809_pyupdi_upload\FrameworkArduino\Tone.cpp.o
Compiling .pio\build\ATmega4809_pyupdi_upload\FrameworkArduino\UART.cpp.o
Compiling .pio\build\ATmega4809_pyupdi_upload\FrameworkArduino\UART0.cpp.o
Compiling .pio\build\ATmega4809_pyupdi_upload\FrameworkArduino\UART1.cpp.o
Compiling .pio\build\ATmega4809_pyupdi_upload\FrameworkArduino\UART2.cpp.o
Compiling .pio\build\ATmega4809_pyupdi_upload\FrameworkArduino\UART3.cpp.o
Compiling .pio\build\ATmega4809_pyupdi_upload\FrameworkArduino\USBCore.cpp.o
Compiling .pio\build\ATmega4809_pyupdi_upload\FrameworkArduino\WInterrupts.c.o
In file included from C:\Users\Paul\.platformio\packages\framework-arduino-megaavr-megacorex\cores\MegaCoreX/arduino.h:141:0,
Compiling .pio\build\ATmega4809_pyupdi_upload\FrameworkArduino\api\Stream.cpp.o
                 from src\main.cpp:6:
Compiling .pio\build\ATmega4809_pyupdi_upload\FrameworkArduino\api\String.cpp.o
Compiling .pio\build\ATmega4809_pyupdi_upload\FrameworkArduino\hooks.c.o
C:\Users\Paul\.platformio\packages\framework-arduino-megaavr-megacorex\cores\MegaCoreX/UART.h:28:10: fatal error: pins_arduino.h: No such file or directory

**********************************************************************
* Looking for pins_arduino.h dependency? Check our library registry!
*
* CLI  > platformio lib search "header:pins_arduino.h"
* Web  > https://platformio.org/lib/search?query=header:pins_arduino.h
*
**********************************************************************

 #include "pins_arduino.h"
          ^~~~~~~~~~~~~~~~
compilation terminated.
In file included from C:\Users\Paul\.platformio\packages\framework-arduino-megaavr-megacorex\cores\MegaCoreX\Arduino.h:141:0,
                 from C:\Users\Paul\.platformio\packages\framework-arduino-megaavr-megacorex\cores\MegaCoreX\Tone.cpp:40:
C:\Users\Paul\.platformio\packages\framework-arduino-megaavr-megacorex\cores\MegaCoreX\UART.h:28:10: fatal error: pins_arduino.h: No such file or directory

**********************************************************************
* Looking for pins_arduino.h dependency? Check our library registry!
*
* CLI  > platformio lib search "header:pins_arduino.h"
* Web  > https://platformio.org/lib/search?query=header:pins_arduino.h
*
**********************************************************************

 #include "pins_arduino.h"
          ^~~~~~~~~~~~~~~~
compilation terminated.
In file included from C:\Users\Paul\.platformio\packages\framework-arduino-megaavr-megacorex\cores\MegaCoreX\Arduino.h:141:0,
                 from C:\Users\Paul\.platformio\packages\framework-arduino-megaavr-megacorex\cores\MegaCoreX\UART.cpp:29:
C:\Users\Paul\.platformio\packages\framework-arduino-megaavr-megacorex\cores\MegaCoreX\UART.h:28:10: fatal error: pins_arduino.h: No such file or directory

**********************************************************************
* Looking for pins_arduino.h dependency? Check our library registry!
*
* CLI  > platformio lib search "header:pins_arduino.h"
* Web  > https://platformio.org/lib/search?query=header:pins_arduino.h
*
**********************************************************************

 #include "pins_arduino.h"
          ^~~~~~~~~~~~~~~~
compilation terminated.
In file included from C:\Users\Paul\.platformio\packages\framework-arduino-megaavr-megacorex\cores\MegaCoreX\Arduino.h:141:0,
                 from C:\Users\Paul\.platformio\packages\framework-arduino-megaavr-megacorex\cores\MegaCoreX\UART1.cpp:25:
C:\Users\Paul\.platformio\packages\framework-arduino-megaavr-megacorex\cores\MegaCoreX\UART.h:28:10: fatal error: pins_arduino.h: No such file or directory

**********************************************************************
* Looking for pins_arduino.h dependency? Check our library registry!
*
* CLI  > platformio lib search "header:pins_arduino.h"
* Web  > https://platformio.org/lib/search?query=header:pins_arduino.h
*
**********************************************************************

 #include "pins_arduino.h"
          ^~~~~~~~~~~~~~~~
compilation terminated.
*** [.pio\build\ATmega4809_pyupdi_upload\FrameworkArduino\Tone.cpp.o] Error 1
*** [.pio\build\ATmega4809_pyupdi_upload\FrameworkArduino\UART.cpp.o] Error 1
*** [.pio\build\ATmega4809_pyupdi_upload\src\main.cpp.o] Error 1
*** [.pio\build\ATmega4809_pyupdi_upload\FrameworkArduino\UART1.cpp.o] Error 1
In file included from C:\Users\Paul\.platformio\packages\framework-arduino-megaavr-megacorex\cores\MegaCoreX\Arduino.h:141:0,
                 from C:\Users\Paul\.platformio\packages\framework-arduino-megaavr-megacorex\cores\MegaCoreX\UART2.cpp:25:
C:\Users\Paul\.platformio\packages\framework-arduino-megaavr-megacorex\cores\MegaCoreX\UART.h:28:10: fatal error: pins_arduino.h: No such file or directory

**********************************************************************
* Looking for pins_arduino.h dependency? Check our library registry!
*
* CLI  > platformio lib search "header:pins_arduino.h"
* Web  > https://platformio.org/lib/search?query=header:pins_arduino.h
*
**********************************************************************

 #include "pins_arduino.h"
          ^~~~~~~~~~~~~~~~
compilation terminated.
In file included from C:\Users\Paul\.platformio\packages\framework-arduino-megaavr-megacorex\cores\MegaCoreX\Arduino.h:141:0,
                 from C:\Users\Paul\.platformio\packages\framework-arduino-megaavr-megacorex\cores\MegaCoreX\UART0.cpp:25:
C:\Users\Paul\.platformio\packages\framework-arduino-megaavr-megacorex\cores\MegaCoreX\UART.h:28:10: fatal error: pins_arduino.h: No such file or directory

**********************************************************************
* Looking for pins_arduino.h dependency? Check our library registry!
*
* CLI  > platformio lib search "header:pins_arduino.h"
* Web  > https://platformio.org/lib/search?query=header:pins_arduino.h
*
**********************************************************************

 #include "pins_arduino.h"
          ^~~~~~~~~~~~~~~~
compilation terminated.
In file included from C:\Users\Paul\.platformio\packages\framework-arduino-megaavr-megacorex\cores\MegaCoreX\Arduino.h:141:0,
                 from C:\Users\Paul\.platformio\packages\framework-arduino-megaavr-megacorex\cores\MegaCoreX\UART3.cpp:25:
C:\Users\Paul\.platformio\packages\framework-arduino-megaavr-megacorex\cores\MegaCoreX\UART.h:28:10: fatal error: pins_arduino.h: No such file or directory

**********************************************************************
* Looking for pins_arduino.h dependency? Check our library registry!
*
* CLI  > platformio lib search "header:pins_arduino.h"
* Web  > https://platformio.org/lib/search?query=header:pins_arduino.h
*
**********************************************************************

 #include "pins_arduino.h"
          ^~~~~~~~~~~~~~~~
compilation terminated.
*** [.pio\build\ATmega4809_pyupdi_upload\FrameworkArduino\UART2.cpp.o] Error 1
*** [.pio\build\ATmega4809_pyupdi_upload\FrameworkArduino\UART0.cpp.o] Error 1
*** [.pio\build\ATmega4809_pyupdi_upload\FrameworkArduino\UART3.cpp.o] Error 1
In file included from C:\Users\Paul\.platformio\packages\framework-arduino-megaavr-megacorex\cores\MegaCoreX\Arduino.h:141:0,
                 from C:\Users\Paul\.platformio\packages\framework-arduino-megaavr-megacorex\cores\MegaCoreX\USBCore.cpp:24:
C:\Users\Paul\.platformio\packages\framework-arduino-megaavr-megacorex\cores\MegaCoreX\UART.h:28:10: fatal error: pins_arduino.h: No such file or directory

**********************************************************************
* Looking for pins_arduino.h dependency? Check our library registry!
*
* CLI  > platformio lib search "header:pins_arduino.h"
* Web  > https://platformio.org/lib/search?query=header:pins_arduino.h
*
**********************************************************************

 #include "pins_arduino.h"
          ^~~~~~~~~~~~~~~~
compilation terminated.
*** [.pio\build\ATmega4809_pyupdi_upload\FrameworkArduino\USBCore.cpp.o] Error 1
In file included from C:\Users\Paul\.platformio\packages\framework-arduino-megaavr-megacorex\cores\MegaCoreX\wiring_private.h:31:0,
                 from C:\Users\Paul\.platformio\packages\framework-arduino-megaavr-megacorex\cores\MegaCoreX\WInterrupts.c:31:
C:\Users\Paul\.platformio\packages\framework-arduino-megaavr-megacorex\cores\MegaCoreX\Arduino.h:154:10: fatal error: pins_arduino.h: No such file or directory

**********************************************************************
* Looking for pins_arduino.h dependency? Check our library registry!
*
* CLI  > platformio lib search "header:pins_arduino.h"
* Web  > https://platformio.org/lib/search?query=header:pins_arduino.h
*
**********************************************************************

 #include "pins_arduino.h"
          ^~~~~~~~~~~~~~~~
compilation terminated.
*** [.pio\build\ATmega4809_pyupdi_upload\FrameworkArduino\WInterrupts.c.o] Error 1

Full platformio.ini? Not finding pins_arduino.h is either an indication of a broken Arduino core package (folder C:\Users\Paul\.platformio\packages\framework-arduino-megaavr-megacorex\variants\48pin-standard should exist) or a platformio.ini misconfiguration.

thanks, here’s the full PIO.ini Perhaps its where I’ve specified the board variant?

	
	; PlatformIO template configuration file for MegaCoreX
	; the pyupdi configuration worked for programming the avr4809 chip
; https://github.com/MCUdude/MegaCoreX/
;
;Build variant is 4809 40 pin DIP - PK 

;   Build options: build flags, source filter
;   Hardware options: oscillator type, BOD, UART number, EEPROM retain
;   Upload options: custom upload port, speed, and extra flags
;   Library options: dependencies, extra library storages
;   Advanced options: extra scripting
;
; Please visit documentation for the other options
; https://github.com/MCUdude/MegaCoreX/blob/master/PlatformIO.md
; https://docs.platformio.org/page/projectconf.html
; https://docs.platformio.org/en/latest/platforms/atmelmegaavr.html

[platformio]
; Default build target
default_envs = ATmega4809_pyupdi_upload

; Parameters used for all environments
[env]
platform = atmelmegaavr
framework = arduino

; Chip in use
board = ATmega4809
; Clock frequency in [Hz]
board_build.f_cpu = 16000000L
; Oscillator type (internal or external)
board_hardware.oscillator = internal
; Arduino pinout variant
board_build.variant = 40pin-default 

; Unflag build flags
;build_unflags =

; Extra build flags PK - see https://github.com/MCUdude/MegaCoreX/blob/master/PlatformIO.md for options 
;build_flags =

; Monitor port is auto detected. Override here
;monitor_port = 
; Serial monitor baud rate
monitor_speed = 115200


[env:ATmega4809_pyupdi_upload]
; Upload protocol for UPDI upload - from PIO help pages ; see bottom of this page https://github.com/MCUdude/MegaCoreX/blob/master/PlatformIO.md for install

platform = atmelmegaavr
;framework = arduino
board = atmega4809
upload_protocol = custom
upload_speed = 115200
upload_port = COM9
upload_flags = 
    -d
    atmega4809
    -c
    $UPLOAD_PORT
    -b
    $UPLOAD_SPEED
upload_command = pyupdi $UPLOAD_FLAGS -f $SOURCE


; Run the following command to upload with this environment
; pio run -e Upload_UART -t upload
;[env:Upload_UART]
; Upload protocol for serial uploads (using Optiboot)
;upload_protocol = arduino
;upload_flags =
;upload_port = /dev/cu.usbserial*


; run the following command to set fuses
; pio run -e fuses_bootloader -t fuses
; run the following command to set fuses + burn bootloader
; pio run -e fuses_bootloader -t bootloader
;[env:fuses_bootloader]
; Upload protocol for used to set fuses/bootloader
;upload_protocol = ${env:Upload_UPDI.upload_protocol}
;upload_flags =

; Hardware settings
board_hardware.bod = 2.7v
board_hardware.eesave = yes
board_hardware.uart = no_bootloader
board_hardware.rstpin = reset

Is right

Is not. Needs to exactly the same capitlization as before.

Weird that PlatformIO identifies the board correctly in the first place but then can’t set the variant though.

If I remember rightly, I changed the second instance of ATmega to lowercase, because I had a pyupdi error which perchance listed all the board names and I used the capitalisation from that.

Anyway, just changed them both to ATmega4809, but the error still persists.

I’ll check this:

C:\Users\Paul\.platformio\packages\framework-arduino-megaavr-megacorex\variants\48pin-standard should exist)

and report back,
thanks Max
Paul

If you keep this while declaring board = ATmega4809 it should work, those a separate.

thanks for pointing me to the right place Max. The error was this:
; Arduino pinout variant
board_build.variant = 40pin-default

when I changed it as below, which reflects the pio / megacorex dir structure, it works.

; Arduino pinout variant
board_build.variant = 40pin-standard

1 Like

Ahhh I swear I scrolled through the file and didn’t see a board_build.variant modification, but there it was.

Indeed, only variant names from MegaCoreX/megaavr/variants at master · MCUdude/MegaCoreX · GitHub can be used there.