Skip to content

Upload using programmer from another architecture gives java.lang.NullPointerException #7034

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

Closed
benlye opened this issue Dec 18, 2017 · 2 comments
Labels
Type: Invalid Off topic for this repository, or a bug report determined to not actually represent a bug

Comments

@benlye
Copy link

benlye commented Dec 18, 2017

I have created boards definitions for a couple of boards used in a project I'm working on. There are two avr boards but each needs it's own recipes in platform.txt, so I have created two architecture folders, let's say they are avr and avr2. The board package installation looks broadly like this:

project
    |-->hardware
        |--> avr
            |-->boards.txt
            |-->platform.txt
        |--> avr2
            |-->boards.txt
            |-->platform.txt

I would like to be able to use AVR programmers (USBasp, AVRISP, etc.) from either of my boards, but I am only able to use a programmer when I'm using the hardware board which is in the avr folder. I can rename the folders so avr2 becomes avr and vice-versa, and still only the avr folder works. For the non-avr folder I get this error when I try to Upload Using Programmer:

java.lang.NullPointerException
	at cc.arduino.packages.uploaders.SerialUploader.uploadUsingProgrammer(SerialUploader.java:314)
	at cc.arduino.packages.uploaders.SerialUploader.uploadUsingPreferences(SerialUploader.java:89)
	at cc.arduino.UploaderUtils.upload(UploaderUtils.java:78)
	at processing.app.SketchController.upload(SketchController.java:713)
	at processing.app.SketchController.exportApplet(SketchController.java:686)
	at processing.app.Editor$DefaultExportAppHandler.run(Editor.java:2265)
	at java.lang.Thread.run(Thread.java:748)

The same thing happens when attempting to burn the bootloader.

It seems like the problem is related to the avr2 folder name not matching the architecture of the Arduino avr boards, so the programmers are unknown.

So, my question is this: can I call a programmer from another architecture?

Is this a bug in the IDE or a known limitation? Either way, it would be nice if that error were friendlier. It took me quite a while to work out that it was the hardware folder name causing the problem.

I know I could add my own programmers using programmers.txt, but I don't like the idea of duplicating the existing programmers just for my board - this seems less than ideal.

If it's not possible to reference a programmer from a different architecture, how should I package two avr boards which have different build recipes? Can I do that in a single platform.txt file (which would allow me to put both boards in a single folder named avr?

@benlye benlye changed the title Upload using programmer from another architecture gives java exception Upload using programmer from another architecture gives java.lang.NullPointerException Dec 18, 2017
@cmaglie
Copy link
Member

cmaglie commented Dec 18, 2017

You should not use the architecture name avr2 because such arch doesn't exists.
A lot of libraries refers to the architecture avr you should use only that one.

how should I package two avr boards which have different build recipes?

Which part of the recipe is different? Maybe you can define a variable that you can set in boards.txt (for each board) and use in platform.txt something like the VID/PID for example:

yun.build.vid=0x2341

build.usb_flags=-DUSB_VID={build.vid} -DUSB_PID={build.pid} '-DUSB_MANUFACTURER={build.usb_manufacturer}' '-DUSB_PRODUCT={build.usb_product}'

@benlye
Copy link
Author

benlye commented Dec 18, 2017

You should not use the architecture name avr2 because such arch doesn't exists.

Understood. Don't make up arch names.

Which part of the recipe is different?

The compiler flags and upload commands are different. If I can override those from boards.txt then I think I can solve it and put everything in one package.

@per1234 per1234 closed this as completed Dec 19, 2017
@per1234 per1234 added the Type: Invalid Off topic for this repository, or a bug report determined to not actually represent a bug label Dec 19, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Invalid Off topic for this repository, or a bug report determined to not actually represent a bug
Projects
None yet
Development

No branches or pull requests

3 participants