Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error compiling for --fqbn arduino:avr:mega (missing cpu flags) #17

Closed
FernandoGarcia opened this issue Aug 28, 2018 · 8 comments
Closed
Labels
conclusion: resolved Issue was resolved topic: documentation Related to documentation for the project

Comments

@FernandoGarcia
Copy link

FernandoGarcia commented Aug 28, 2018

Hi!

I have successfully installed Go compiler and Arduino CLI using this steps:

wget https://dl.google.com/go/go1.11.linux-armv6l.tar.gz

sudo tar -C /usr/local -xvf go1.11.linux-armv6l.tar.gz

cat >> ~/.bashrc << 'EOF'

export GOPATH=$HOME/go

export PATH=/usr/local/go/bin:$PATH:$GOPATH/bin

EOF

source ~/.bashrc

go version

result: go1.11 linux/arm

Then:

go get -u github.com/arduino/arduino-cli

Now following the https://github.com/arduino/arduino-cli#getting-started starts the problems.

arduino-cli sketch new MyFirstSketch

Returns:

 Error: mkdir /home/pi/Arduino/MyFirstSketch: permission denied
Could not create sketch directory.

So I tried using sudo the result is:

sudo: arduino-cli: command not found

To try solved this issue I have created the folder manually using

sudo mkdir -p /home/pi/Arduino/MyFirstSketch

On next step I could not download package_index.json due permissions error again.

So I did:

sudo mkdir -p /home/pi/.arduino15/

cd /home/pi/.arduino15/

wget https://downloads.arduino.cc/packages/package_index.json

After I have successfully installed AVR core using:

arduino-cli core install arduino:avr

The result for arduino-cli core list is:

ID Installed Latest Name
arduino:avr 1.6.21 1.6.21 Arduino AVR Boards

Now using arduino-cli board list the result is always:

FQBN Port ID Board Name
/dev/ttyUSB0 0403:6001 unknown

In this point I don't know what to do to go on since the CLI doesn't find a FQBN to my Arduino mega connected to USB port.

Can someone help please?

Best regards.

@FernandoGarcia
Copy link
Author

I don't know if it helps but the output for lsusb is:

Bus 001 Device 004: ID 0403:6001 Future Technology Devices International, Ltd FT232 USB-Serial (UART) IC

So I'm not using Arduino drivers.

@mastrolinux
Copy link
Contributor

From what I see the board is discovered and you can use it by passing the right core during compilation. /dev/ttyUSB0 0403:6001 you get unknown board because the board does not seem to be original so vid and pid are not matching the standard Arduino Mega values.

@FernandoGarcia
Copy link
Author

Hi!

Thanks for your reply.

But what's the right value for Arduino Mega 2560 in this line for the argument --fqbn:

arduino-cli compile --fqbn arduino:samd:mkr1000 Arduino/MyFirstSketch

arduino:avr:mega2560 by example?

Best regards.

@FernandoGarcia
Copy link
Author

Tried arduino-cli compile --fqbn arduino:avr:mega2560 Arduino/MyFirstSketch but the result is:

Error: Error resolving FQBN: board arduino:avr@1.6.21:mega2560 not found

It should be only arduino-cli compile --fqbn arduino:avr:mega Arduino/MyFirstSketch

@FernandoGarcia
Copy link
Author

For arduino-cli compile --fqbn arduino:avr:mega Arduino/MyFirstSketch

The result is:

avr-g++: error: missing device or architecture after '-mmcu='
Error: exit status 1
Compilation failed.

@sandeepmistry
Copy link

@FernandoGarcia please try:

arduino-cli compile --fqbn arduino:avr:mega:cpu=atmega2560 Arduino/MyFirstSketch

Since the Mega has additional options (see Java IDE menu options for it), the FQBN needs the cpu type specified.

@FernandoGarcia
Copy link
Author

Thanks for your reply.

The settings are right now but I have permissions problem again.

arduino-cli compile --fqbn arduino:avr:mega:cpu=atmega2560 Arduino/MyFirstSketch

Build options changed, rebuilding all
Sketch uses 1462 bytes (0%) of program storage space. Maximum is 253952 bytes.
Global variables use 9 bytes (0%) of dynamic memory, leaving 8183 bytes for local variables. Maximum is 8192 bytes.
Error: open Arduino/MyFirstSketch/MyFirstSketch.arduino.avr.mega.cpu=atmega2560.hex: permission denied
Error copying output file.

sudo arduino-cli compile --fqbn arduino:avr:mega:cpu=atmega2560 Arduino/MyFirstSketch

sudo: arduino-cli: command not found

@FernandoGarcia
Copy link
Author

FernandoGarcia commented Aug 29, 2018

It worked now I had to make:

sudo chown -R pi:pi Arduino

I don't know why I had this permissions problem since the first command in Arduino CLI.

arduino-cli sketch new MyFirstSketch

A problem I had was pointed in #6 also.

I'll close this issue for now.
Thanks for all.

@cmaglie cmaglie changed the title Trying to run Arduino CLI on Raspberry pi Error compiling for --fqbn arduino:avr:mega (missing cpu flags) Aug 30, 2018
@cmaglie cmaglie added the topic: documentation Related to documentation for the project label Aug 30, 2018
per1234 added a commit that referenced this issue Aug 9, 2021
Add copyright header to source code files
@per1234 per1234 added the conclusion: resolved Issue was resolved label Feb 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
conclusion: resolved Issue was resolved topic: documentation Related to documentation for the project
Projects
None yet
Development

No branches or pull requests

5 participants