Simavr linux_aarch64

I’m new to both PlatformIO and vscode, so my question may be silly. I come from a world where emacs and make were my IDE.

I’m running the 64-bit version of Raspberry Pi OS, so I’m not surprised that PlatformIO can’t find a simavr package for linux_aarch64. However, I do have simavr installed and working on the system. Is there a way to convince PlatformIO to use the system’s simavr?

My platformio.ini:

[env]
platform = atmelavr
board = pro16MHzatmega328
framework = arduino
lib_deps = 
    fastled/FastLED@^3.3.3
    thomasfredericks/Bounce2@^2.55
    deanisme/SevSeg@^3.4.0
platform_packages = toolchain-atmelavr@>=1.70300.0
upload_command = avrdude $UPLOAD_FLAGS -U flash:w:$SOURCE:i
upload_protocol = custom
upload_port = usb
upload_flags =
    -vvv
    -C
    $PROJECT_PACKAGES_DIR/tool-avrdude/avrdude.conf
    -p
    $BOARD_MCU
    -P
    $UPLOAD_PORT
    -c
    avrispmkii

[env:328p]

[env:simavr]
debug_tool = simavr

[env:serialdebug]
build_flags = -D serialdebug

As a workaround, can you please:

  • download the Linux x64 version tar archive from Service End for Bintray, JCenter, GoCenter, and ChartCenter | JFrog
  • extract it in ~/.platformio/packages/ on the pi so that all the files are in the ~/.platformio/packages/tool-simavr folder
  • in the package.json, replace linux_x86_64 with linux_aarch64
  • remove the old binaries and libs, bin/simavr and lib/libsimavr.{a,so,so.1} and replace them with the correct bins/libs of your native system (best to copy, not to symlink)
  • run pio package pack inside ~/.platformio/packages/tool-simavr and backup the resulting .tar.gz
  • rerun debugging and check if it now finds simavr

If that works it means you’ve created a functional tool-simavr package for aarch64. The .tar.gz file can then be used for distribution / reuse on other computers of the same arch, by adding

platform_packages = 
   tool-simavr@file://<filepath to .tar.gz file>

in the platformio.ini of the project and a provided path to the tool’s tar archive. (docs)

1 Like

So far, I’m still getting the same error, so I’ve probably done something wrong or maybe there’s a version mismatch?

The directory:

00:56:28 rpi07 lnelson:~/.../packages/tool-simavr> pwd
/home/lnelson/.platformio/packages/tool-simavr
00:56:29 rpi07 lnelson:~/.../packages/tool-simavr> tree
.
|-- bin
|   `-- simavr
|-- include
|   `-- simavr
|       |-- avr
|       |   `-- avr_mcu_section.h
|       |-- avr_acomp.h
|       |-- avr_adc.h
|       |-- avr_bitbang.h
|       |-- avr_eeprom.h
|       |-- avr_extint.h
|       |-- avr_flash.h
|       |-- avr_ioport.h
|       |-- avr_lin.h
|       |-- avr_spi.h
|       |-- avr_timer.h
|       |-- avr_twi.h
|       |-- avr_uart.h
|       |-- avr_usb.h
|       |-- avr_watchdog.h
|       |-- fifo_declare.h
|       |-- sim_avr.h
|       |-- sim_avr_types.h
|       |-- sim_cmds.h
|       |-- sim_core.h
|       |-- sim_core_config.h
|       |-- sim_core_decl.h
|       |-- sim_cycle_timers.h
|       |-- sim_elf.h
|       |-- sim_gdb.h
|       |-- sim_hex.h
|       |-- sim_interrupts.h
|       |-- sim_io.h
|       |-- sim_irq.h
|       |-- sim_network.h
|       |-- sim_regbit.h
|       |-- sim_time.h
|       |-- sim_utils.h
|       `-- sim_vcd_file.h
|-- lib
|   |-- libsimavr.a
|   |-- libsimavr.so -> libsimavr.so.2
|   |-- libsimavr.so.2
|   |-- libsimavrparts.a
|   |-- libsimavrparts.so -> libsimavrparts.so.1
|   |-- libsimavrparts.so.1
|   `-- pkgconfig
|       |-- simavr-avr.pc
|       `-- simavr.pc
`-- package.json

package.json:

00:56:30 rpi07 lnelson:~/.../packages/tool-simavr> cat package.json 
{
  "name": "tool-simavr",
  "version": "1.10600.200511",
  "description": "simavr is a lean, mean and hackable AVR simulator",
  "keywords": [
    "simulator",
    "avr",
    "microchip"
  ],
  "license": "GPL-3.0-or-later",
  "system": [
    "linux_aarch64"
  ],
  "repository": {
    "type": "git",
    "url": "https://github.com/buserror/simavr"
  }
}

T platform.ini:

01:01:51 rpi07 lnelson:~/src/ChristmasLights2020> cat platformio.ini 
; PlatformIO Project Configuration File
;
;   Build options: build flags, source filter
;   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 and examples
; https://docs.platformio.org/page/projectconf.html
[env]
platform = atmelavr
board = pro16MHzatmega328
framework = arduino
lib_deps = 
	fastled/FastLED@^3.3.3
	thomasfredericks/Bounce2@^2.55
	deanisme/SevSeg@^3.4.0
platform_packages = toolchain-atmelavr@>=1.70300.0
	tool-simavr @ file:///home/lnelson/tool-simavr-linux_aarch64-1.10600.200511.tar.gz
upload_command = avrdude $UPLOAD_FLAGS -U flash:w:$SOURCE:i
upload_protocol = custom
upload_port = usb
upload_flags =
	-vvv
	-C
	$PROJECT_PACKAGES_DIR/tool-avrdude/avrdude.conf
	-p
	$BOARD_MCU
	-P
	$UPLOAD_PORT
	-c
	avrispmkii

[env:328p]

[env:simavr]
debug_tool = simavr

[env:serialdebug]
build_flags = -D SERIALDEBUG

What error exactly please?

That looks wrongly formatted, should be

platform_packages = 
   toolchain-atmelavr@>=1.70300.0
   tool-simavr @ file:///home/lnelson/tool-simavr-linux_aarch64-1.10600.200511.tar.gz

Oops, forgot the error. Boneheaded move on my part. Sorry.

Error: Could not find the package with 'platformio/tool-simavr @ ~1.10600.200511' requirements for your system 'linux_aarch64'

The installed deb package is simavr_1.6+dfsg-1_arm64.deb from which I copied the libs and executable.

I fixed the formatting in platformio.ini. Thank you for that. However, I still get the same error mentioned above.

I built simavr from the latest source on github and placed the new binary and libraries in ~/.platformio/packages/tool-simavr. I update package.json and the package filename in platformio.ini to reflect the compiled version number. I still get the same error mentioned above. I compiled version 1.6 but platformio is still looking for ~1.10600.200511.

platformio.ini:

[env]
platform = atmelavr
board = pro16MHzatmega328
framework = arduino
lib_deps = 
	fastled/FastLED@^3.3.3
	thomasfredericks/Bounce2@^2.55
	deanisme/SevSeg@^3.4.0
platform_packages = 
	toolchain-atmelavr@>=1.70300.0
upload_command = avrdude $UPLOAD_FLAGS -U flash:w:$SOURCE:i
upload_protocol = custom
upload_port = usb
upload_flags =
	-vvv
	-C
	$PROJECT_PACKAGES_DIR/tool-avrdude/avrdude.conf
	-p
	$BOARD_MCU
	-P
	$UPLOAD_PORT
	-c
	avrispmkii

[env:328p]

[env:simavr]
debug_tool = simavr

[env:simavr_aarch64]
debug_tool = simavr
platform_packages = 
	toolchain-atmelavr@>=1.70300.0
	tool-simavr @ file:///home/lnelson/tool-simavr-linux_aarch64-1.6.tar.gz

[env:serialdebug]
build_flags = -D SERIALDEBUG

I use the environment simavr_aarch64 for this testing.

package.json:

{
  "name": "tool-simavr",
  "version": "1.6",
  "description": "simavr is a lean, mean and hackable AVR simulator",
  "keywords": [
    "simulator",
    "avr",
    "microchip"
  ],
  "license": "GPL-3.0-or-later",
  "system": [
    "linux_aarch64"
  ],
  "repository": {
    "type": "git",
    "url": "https://github.com/buserror/simavr"
  }
}

~/.platformio/packages/tool-simavr/

|-- bin
|   `-- simavr
|-- include
|   `-- simavr
|       |-- avr
|       |   `-- avr_mcu_section.h
|       |-- avr_acomp.h
|       |-- avr_adc.h
|       |-- avr_bitbang.h
|       |-- avr_eeprom.h
|       |-- avr_extint.h
|       |-- avr_flash.h
|       |-- avr_ioport.h
|       |-- avr_lin.h
|       |-- avr_spi.h
|       |-- avr_timer.h
|       |-- avr_twi.h
|       |-- avr_uart.h
|       |-- avr_usb.h
|       |-- avr_watchdog.h
|       |-- fifo_declare.h
|       |-- sim_avr.h
|       |-- sim_avr_types.h
|       |-- sim_cmds.h
|       |-- sim_core.h
|       |-- sim_core_config.h
|       |-- sim_core_decl.h
|       |-- sim_cycle_timers.h
|       |-- sim_elf.h
|       |-- sim_gdb.h
|       |-- sim_hex.h
|       |-- sim_interrupts.h
|       |-- sim_io.h
|       |-- sim_irq.h
|       |-- sim_network.h
|       |-- sim_regbit.h
|       |-- sim_time.h
|       |-- sim_utils.h
|       `-- sim_vcd_file.h
|-- lib
|   |-- libsimavr.a
|   |-- libsimavr.so -> libsimavr.so.1
|   |-- libsimavr.so.1
|   |-- libsimavrparts.a
|   |-- libsimavrparts.so -> libsimavrparts.so.1
|   |-- libsimavrparts.so.1
|   `-- pkgconfig
|       |-- simavr-avr.pc
|       |-- simavr.pc
|       `-- simavrparts.pc
`-- package.json

I haven’t made any changes in the include directory.

Seems like it’s dead-bent on first trying to install the package from the PlatformIO registry and then respecting the override in the PlatformIO. Can you please try the following:

  1. Move the platform_packages (for both packages) to env (only have 1 such directive)
  2. If that still fails, prepend platformio/ to the tool-simavr @ .. (as the owner name of the package)
  3. If that still fails, I would like to ask @valeros or @ivankravets to publish the missing tool-simavr package for linux_aarch64 so that it’s just fixed globally

(yes, using pio account and pio package publish commands, you could also publish your tool-simavr-linux_aarch64-1.6.tar.gz file and reference it in the platform.json of ~/.platformio/platforms/atmelavr, but then it’s still a local fix)

1 Like

Still no luck.

[env:default]
platform = atmelavr
board = pro16MHzatmega328
framework = arduino
debug_tool = simavr
lib_deps = 
	fastled/FastLED@^3.3.3
	thomasfredericks/Bounce2@^2.55
	deanisme/SevSeg@^3.4.0
platform_packages = 
	toolchain-atmelavr@>=1.70300.0
	tool-simavr @ file:///home/lnelson/tool-simavr-linux_aarch64-1.6.tar.gz
upload_command = avrdude $UPLOAD_FLAGS -U flash:w:$SOURCE:i
upload_protocol = custom
upload_port = usb
upload_flags =
	-vvv
	-C
	$PROJECT_PACKAGES_DIR/tool-avrdude/avrdude.conf
	-p
	$BOARD_MCU
	-P
	$UPLOAD_PORT
	-c
	avrispmkii

Changing
tool-simavr @ file:///home/lnelson/tool-simavr-linux_aarch64-1.6.tar.gz
to
platformio/tool-simavr @ file:///home/lnelson/tool-simavr-linux_aarch64-1.6.tar.gz

Makes no difference.

Unfortunately, there is no package for linux_aarch64. It should work if you specify the folder with package.json directly instead if an arhive:

platform_packages = 
	toolchain-atmelavr@>=1.70300.0
	tool-simavr @ file:///home/lnelson/tool-simavr-linux_aarch64