milkv-duo / duo-arduino

GNU Lesser General Public License v2.1
15 stars 8 forks source link

Cannot upload a program to Duo256 from macOS #11

Closed TakaTamaki0914 closed 4 months ago

TakaTamaki0914 commented 5 months ago

Development Environment

Error

When I tried to upload a program to my Duo256 Dev module, the below errors occur.

python3 /Users/taka/Library/Arduino15/packages/sophgo/tools/burntool_py/0.2/burntool -p /dev/cu.usbmodem01234567893 -f /var/folders/c5/vsk0v4f15yd3xffg0_6270t00000gn/T/arduino_build_2526/micros_test.ino.elf 
/Applications/Xcode.app/Contents/Developer/usr/bin/python3: can't open file '/Users/taka/Library/Arduino15/packages/sophgo/tools/burntool_py/0.2/burntool': [Errno 2] No such file or directory
An error occurred while uploading the sketch
error

My Solution

After compiling, I can upload the program with the below command.(the command was added only ".py")

python3 /Users/taka/Library/Arduino15/packages/sophgo/tools/burntool_py/0.2/burntool.py -p /dev/cu.usbmodem01234567893 -f 
fix

However I tried to issue the PR of this solution, I don't know how to generate package_sg200x_index.json.

@carbonfix, would you solve the problem?

Best regards,

shiptux commented 5 months ago

Hi @TakaTamaki0914

Currently, Milkv Duo Arduino doesn't support Arduino IDE 1.8.x. Strongly recommend using the 2.3.x version. The JSON file has some known issues on Arduino IDE 1.8.x: such as https://github.com/milkv-duo/duo-arduino/issues/8, issue 11 is similar to it. These will be fixed in the next version. Thank you.

Gitefu commented 5 months ago

Hi @shiptux and @TakaTamaki0914

Although I have used Arduino IDE 2.3.2, I faced the same problem as him.

python3 "/Users/username/Library/Arduino15/packages/sophgo/tools/burntool_py/0.2/burntool" -p "/dev/cu.usbmodem01234567893" -f /private/var/folders/1p/cknff7js1mz1py52h64x0czr0000gn/T/arduino/sketches/F79F505DEBEE1A80980DDC12F784F26D/led_test.ino.elf
/Users/username/.pyenv/versions/3.12.3/bin/python3: can't open file '/Users/username/Library/Arduino15/packages/sophgo/tools/burntool_py/0.2/burntool': [Errno 2] No such file or directory
Failed uploading: uploading error: exit status 2

The error is a little different from #8, I think.

8 says that "pyserial" module was not found.

His error says .../burntool_py/0.2/burntool was not found.

@TakaTamaki0914 shows us that adding ".py" will be a way to solve it. I can upload my program to duo256 with his solution.

My development environment is shown below.

thanks,

shiptux commented 5 months ago

@Gitefu

The error is a little different from https://github.com/milkv-duo/duo-arduino/issues/8, I think. https://github.com/milkv-duo/duo-arduino/issues/8 says that "pyserial" module was not found. His error says .../burntool_py/0.2/burntool was not found.

Sorry, there is a mistake here, the example that I want to show is https://github.com/milkv-duo/duo-arduino/issues/7. But this issue is different from yours too.

So this is a new issue, also should be fixed in the next version.

Thanks.

Gitefu commented 5 months ago

@shiptux

Thank you for checking it.

In platform.txt, the 110th line is tools.burntool_py.cmd=burntool. https://github.com/milkv-duo/duo-arduino/blob/b0c727e81fb25ea936ba37c58d98e0c4c58ccadb/platform.txt#L107-L112

To fix the bug, I think that .py has to be added to the prefix of the 110th line like tools.burntool_py.cmd=burntool.py. I found this way, but I don't know how to build package_sg200x_index.json...

If the problem has not yet been solved, could you try this idea? or could you tell us how to build package_sg200x_index.json?

thanks

shiptux commented 5 months ago

@Gitefu @TakaTamaki0914

This issue was caused by https://github.com/milkv-duo/duo-arduino/blob/dev/platform.txt#L113. Here should define burntool.py for MacOS, but it didn't. This will be updated in the next version. If you want to fix it locally. You can try to add the definition to your file.

This information I just want to send, but I forgot. After my dinner, you find the same place. LOL...

To fix the bug, I think that .py has to be added to the prefix of the 110th line like tools.burntool_py.cmd=burntool.py. I found this way, but I don't know how to build package_sg200x_index.json...

If the problem has not yet been solved, could you try this idea? or could you tell us how to build package_sg200x_index.json?

A simple way is to add "tools.burntool_py.cmd.macos=burntool.py" at platform.txt. You can change this locally (Arduino installed location)

Or:

  1. Fix the platform.txt, and edit the Version file.
  2. repack this repo as a zip file and edit the JSON file manually.
  3. Start an HTTP server locally, and put all the files and the JSON on the root.
  4. Put your HTTP server URL to Arduino IDE and reinstall the board file.

The JSON file can be generated by package/release.sh. But I don't recommend using it. Because it has some known issues.

Thanks.

Gitefu commented 5 months ago

@shiptux

I see. I'll try to launch a local HTTP server and fix the JSON file manually.

thanks,

shiptux commented 5 months ago

@shiptux

I see. I'll try to launch a local HTTP server and fix the JSON file manually.

thanks,

Don't forget to update the version. Otherwise, you will need to remove the board info first.

Gitefu commented 5 months ago

@shiptux

I succeeded in uploading my program to a duo-256m from Arduino IDE!

I succeeded in uploading my program to a duo-256m from Arduino IDE after adding .py to the 110th line of duo-arduino/platform.txt.

Should I issue a pull request?

image
/Users/username/Library/Arduino15/packages/sophgo/tools/xpack-riscv-none-elf-gcc/13.2.0-2/bin/riscv-none-elf-objcopy -O binary /private/var/folders/1p/cknff7js1mz1py52h64x0czr0000gn/T/arduino/sketches/F79F505DEBEE1A80980DDC12F784F26D/led_test.ino.elf /private/var/folders/1p/cknff7js1mz1py52h64x0czr0000gn/T/arduino/sketches/F79F505DEBEE1A80980DDC12F784F26D/led_test.ino.bin
/Users/username/Library/Arduino15/packages/sophgo/tools/xpack-riscv-none-elf-gcc/13.2.0-2/bin/riscv-none-elf-objcopy -O ihex -R .eeprom /private/var/folders/1p/cknff7js1mz1py52h64x0czr0000gn/T/arduino/sketches/F79F505DEBEE1A80980DDC12F784F26D/led_test.ino.elf /private/var/folders/1p/cknff7js1mz1py52h64x0czr0000gn/T/arduino/sketches/F79F505DEBEE1A80980DDC12F784F26D/led_test.ino.hex

python3 "/Users/username/Library/Arduino15/packages/sophgo/tools/burntool_py/0.2/burntool.py" -p "/dev/cu.usbmodem01234567893" -f /private/var/folders/1p/cknff7js1mz1py52h64x0czr0000gn/T/arduino/sketches/F79F505DEBEE1A80980DDC12F784F26D/led_test.ino.elf

burntool.py v0.3

upload firmware /private/var/folders/1p/cknff7js1mz1py52h64x0czr0000gn/T/arduino/sketches/F79F505DEBEE1A80980DDC12F784F26D/led_test.ino.elf

start upload...

communication and testing...

connecting...

connection successful...
stop firmware...

ready to update firmware...
start to update firmware...
send data... 10.00%
send data... 20.00%
send data... 30.00%
send data... 40.00%
send data... 50.00%
send data... 60.00%
send data... 70.00%
send data... 80.00%
send data... 90.00%
send data... 100.00%
update firmware done...

restart firmware...

upload and runing success...

Appendix

To debug on my local environment, I did the below works.

  1. Downloading this repository to my home directory.
  2. Adding .py to the prefix of the 110th line of platform.txt like tools.burntool_py.cmd=burntool.py.
  3. Change the version to 0.2.4 in Version, package.json and package/package_sg200x_index.template.json
  4. Repack the local repository and rename the zip to arduino-soghgo.zip
  5. Issue the SHA256 checksum of the zip file with shasum -a 256 arduino-sophgo.zip
  6. Replace the 19th line of package/package_sg200x_index.template.json to the new SHA256 checksum
  7. Launch an HTTP local server with python -m http.server 80 in my home directory
  8. Launch Arduino IDE, and remove the installed board files and a json file path of preference.
  9. Restart IDE and write the json path to the preference like http://127.0.0.1/duo-arduino-dev/package/package_sg200x_index.template.json
  10. Uploading a program to duo-256m

Maybe, when uploading a program to duo-256m for the first time, an error about the size of the zip occurs. Then the 20th line of package/package_sg200x_index.template.json has to be replaced to the correct size. After replacing that, you should retry from the 8th process.


thanks,

Gitefu commented 5 months ago

@carbonfix @shiptux I issued the PR #12. Would you review it?

thanks

shiptux commented 5 months ago

@carbonfix @shiptux I issued the PR #12. Would you review it?

thanks

LGTM, but this PR should be approved by Carbonfix.

Gitefu commented 5 months ago

Hi @shiptux, Thank you for the review!

Gitefu commented 5 months ago

@carbonfix, I would appreciate it if you could check the PR #12 whenever you have time.

Best,

Gitefu commented 5 months ago

Hi @carbonfix, Thank you for merging the PR.

Gitefu commented 5 months ago

@carbonfix @shiptux ,

After replacing a json link of Arduino IDE with the json url released as new, the same issue occurs...

In the 17th - 20th lines of package_sg200x_index.json of the "config" tag, the zip file params are not changed to config from V1.0.0.

          "url": "https://github.com/milkv-duo/duo-arduino/releases/download/V1.0.0/arduino-sophgo.zip",
          "archiveFileName": "arduino-sophgo.zip",
          "checksum": "SHA-256:225ff6e17133ac1c8b71a3a198343f6d8576c0cfab211129bddb6f0f42f917ec",
          "size": "628119",

If you have time, could you check it?

Best,

shiptux commented 5 months ago

@carbonfix @shiptux ,

After replacing a json link of Arduino IDE with the json url released as new, the same issue occurs...

In the 17th - 20th lines of package_sg200x_index.json of the "config" tag, the zip file params are not changed to config from V1.0.0.

          "url": "https://github.com/milkv-duo/duo-arduino/releases/download/V1.0.0/arduino-sophgo.zip",
          "archiveFileName": "arduino-sophgo.zip",
          "checksum": "SHA-256:225ff6e17133ac1c8b71a3a198343f6d8576c0cfab211129bddb6f0f42f917ec",
          "size": "628119",

If you have time, could you check it?

Best,

Here is a PR to generate JSON from GitHub Action: https://github.com/milkv-duo/duo-arduino/pull/15. The problem should be fixed after this PR is merged.

Thanks.

Gitefu commented 5 months ago

@shiptux @carbonfix I see! I didn't know that PR was already issued.

After a new JSON is released, I'll try to upload a program from my Mac.

Thanks,

Gitefu commented 4 months ago

Hi @shiptux @carbonfix,

Uploading the program to Duo 256m was succeeded with the new release! https://github.com/milkv-duo/duo-arduino/releases/tag/v0.2.4

Can I close this issue?

Best,

shiptux commented 4 months ago

Hi @shiptux @carbonfix,

Uploading the program to Duo 256m was succeeded with the new release! https://github.com/milkv-duo/duo-arduino/releases/tag/v0.2.4

Can I close this issue?

Best,

Thank you for your test. Please feel free to close it.

Gitefu commented 4 months ago

Hi @shiptux Sorry, I noticed that I don't have the authority to close this :)

Could you close this?

shiptux commented 4 months ago

Hi @shiptux Sorry, I noticed that I don't have the authority to close this :)

Could you close this?

Hi, @Gitefu

I don't have the authority, too. @carbonfix Could you please close this?