[SOLVED] Maple_Upload.bat : EXCEPTION_ACCESS_VIOLATION

Development environment specific, Arduino, Eclipse, VS2013, Em::Blocks etc
Phono
Posts: 68
Joined: Thu Mar 19, 2020 9:32 am

Re: [SOLVED] Maple_Upload.bat : EXCEPTION_ACCESS_VIOLATION

Post by Phono »

I had this problem because I did not update my system.
I just updated Maple_Upload.bat and it works.
I did not update the platform.txt since it seems that the fix is only for linux, and I am using windows.
Actually, I am using an older version because I did personal changes to some libraries, and I do not want to loose them by updating the whole package.
stevestrong
Posts: 502
Joined: Fri Dec 27, 2019 4:53 pm
Answers: 8
Location: Munich, Germany
Contact:

Re: [SOLVED] Maple_Upload.bat : EXCEPTION_ACCESS_VIOLATION

Post by stevestrong »

I also use a major rework of the repo, but it still updates newest commits because I forked the main repo.
Unsure why the fix works for you without updating the platform.txt, that is not for linux, but for windows.
User avatar
fpiSTM
Posts: 1738
Joined: Wed Dec 11, 2019 7:11 pm
Answers: 91
Location: Le Mans
Contact:

Re: [SOLVED] Maple_Upload.bat : EXCEPTION_ACCESS_VIOLATION

Post by fpiSTM »

I have also some PR about this.
Anyway the proposed solution seems not complete (See https://github.com/rogerclarkmelbourne/ ... 2/pull/846) nor compatible with other IDE (Ex: PIO or Eclispe +Sloeber) as they are using the Arduino Java.
My guess is that .jar should be replaced to avoid any further issue. This would be more efficient than trying to give correct (and older) java version. What will happen if next Arduino IDE version change the Java version? It will probably failed.
stevestrong
Posts: 502
Joined: Fri Dec 27, 2019 4:53 pm
Answers: 8
Location: Munich, Germany
Contact:

Re: [SOLVED] Maple_Upload.bat : EXCEPTION_ACCESS_VIOLATION

Post by stevestrong »

The main development target IDE is Arduino.
If Arduino IDE changes the behavior, then this will be also adapted, but other IDEs will not be taken into account.
You cannot support every kind of specific behavior for every IDE.
ag123
Posts: 1655
Joined: Thu Dec 19, 2019 5:30 am
Answers: 24

Re: [SOLVED] Maple_Upload.bat : EXCEPTION_ACCESS_VIOLATION

Post by ag123 »

i think these problems may have something to do with the dicey windows dll environment.

if i'm not wrong jssc is actually a serial driver / connector library
https://github.com/java-native/jssc

this is apparently used by processing and that java-loader is apparently written in processing.
if you are willing to go the distance i'd guess you could try to rebuild that java-loader.jar as the source code is there.
https://github.com/rogerclarkmelbourne/ ... ple_loader
but rebuilding this likely won't help.

rather, you probably would want to try using a updated release of jssc in the earlier link or literally build it from source.
the minefields are actually the windows dll interfacing the c libraries to the actual windows serial drivers dll.
this is a likely potential trouble spot that will not go away. never! whatever java distributions you are using.

the alternatives are to do that upload manually. it isn't too difficult. there are reliable tools
e.g. stm32cube programmer
https://www.st.com/en/development-tools ... eprog.html

or you can try with the updated open sourced tools like dfu-util, st-link, stm32 loader etc
http://dfu-util.sourceforge.net/
https://github.com/stlink-org/stlink
https://github.com/jsnyder/stm32loader

a main thing you may want to first try if you insist on 'integrated' flashing is perhaps to update that jssc.jar with an updated release jar.
in case anyone is looking for a release 'jssc.jar', and messing with windows sources and drivers is 'too intimidating' (it may not work even if you try), i think processing uses jssc.jar, so you may be able to find something there.

windows has various 'gotchas' such as that it may 'hog' drivers etc. those may cause other woes related to the usb-ports. e.g. if you unplug your blue pill without 'informing' windows, and your driver is after all 'hogging' that port e.g. actively using it. that driver may keep thinking that it is still connected even if the board is already disconnected. i'm not too sure if this is indeed the symptom, but accordingly such behaviors can happen in windows.

that java-loader magic is simply that it sends a DTR 1EAF command to the sketch and the sketch / core triggers a reset.
it is an old maple magic that's still there today
http://docs.leaflabs.com/static.leaflab ... oader-mode
https://github.com/rogerclarkmelbourne/ ... Bootloader
note that this 'resetting' has nothing to do with that 'old' maple/stm32duino libmaple dfu bootloader.
the resetting provides some convenience as otherwise you would just need to press that reset button manually.
after resetting it calls dfu-util in the 'good old' maple way to upload the firmware.

it is convenient but that if one runs into 'driver problems'. the 'work around' is to find alternative more reliable upload means including manually.

usb-serial (vcp) etc is a 'different thing', libmaple core offers usb-serial as a 'default' serial port, in stm core you'd need to select that.
all that 'bootloader' magic can sometimes confuse poorly configured os (windows etc) or poor hardware as it first initialize as a dfu-port, then if nothing happens, it runs the sketch firmware which initialize as a usb-serial port (re-enumerates). the old maple mini actually goes the distance and place a 'big' transistor there to do a 'no nonsense' usb reset on pressing reset. other boards try to mimic that by doing a single ended zero. rather often, some hardware didn't detect that change and u'd need to find a way to 'reset' that usb port.

oh and normally st-link jtag/swd is normally a 'no nonsense' programming solution. and you need no 'boot loader' for that.
still one may stumble on a *protected* board, accordingly only stm32cube programmer and st-link
viewtopic.php?p=6709#p6709
offers a way out of that
stevestrong
Posts: 502
Joined: Fri Dec 27, 2019 4:53 pm
Answers: 8
Location: Munich, Germany
Contact:

Re: [SOLVED] Maple_Upload.bat : EXCEPTION_ACCESS_VIOLATION

Post by stevestrong »

I think the main issue is to find a universal tool which instantiate the USB DFU interface on all OS which allows the upload.
And Java is the one which can be used independent on the platform. Unless one develop different tools for each platform in part.
User avatar
fpiSTM
Posts: 1738
Joined: Wed Dec 11, 2019 7:11 pm
Answers: 91
Location: Le Mans
Contact:

Re: [SOLVED] Maple_Upload.bat : EXCEPTION_ACCESS_VIOLATION

Post by fpiSTM »

Well I agree the target is Arduino IDE.
Anyway, I would simply fix the issue and removing the maple_loader.jar seems the best solution. Implementing an upload_reset binary for windows and managing the upload thanks dfu_util (like on Linux and Mac) would aligned the method and simplify.
ag123
Posts: 1655
Joined: Thu Dec 19, 2019 5:30 am
Answers: 24

Re: [SOLVED] Maple_Upload.bat : EXCEPTION_ACCESS_VIOLATION

Post by ag123 »

stevestrong wrote: Thu Apr 15, 2021 3:31 pm I think the main issue is to find a universal tool which instantiate the USB DFU interface on all OS which allows the upload.
And Java is the one which can be used independent on the platform. Unless one develop different tools for each platform in part.
i think that java-loader.jar app's key use isn't quite USB DFU, but to send that DTR 1EAF 'magic' command to the core to trigger a reset.
hence, it is mostly the serial interface on the *java* side. the main trouble is
https://github.com/java-native/jssc
jssc bundled in the core may have used some deprecated (or possibly 'internal') features that possibly exists in the 'earlier' jdk, jre.
a simple jre update would jeopardize that. and that may not be all but that there could be n number of variants of the win32 comm interface dll.
if one os has a variant of the win32 comm dll that doesn't work with the java jni library/stub, all the troubles start erupting to the surface.

i'd guess rather than to 'solve' this issue, it is better to 'document' the alternate firmware install tools.
manually installing the sketch is hardly any more difficult than running a simple command.
The installation procedure is also more visible and there should be little/no doubt if the sketch firmware is properly installed with a dedicated install tool or step that the user controls.

edit:
apparently jssc did release precompiled binaries, they apparently includes the dll stubs for the various os (windows / linux etc)
https://github.com/java-native/jssc/releases
those who really want to use this with different java releases can try them out at their own initiative. it may perhaps 'fix' the issue.
the biggest catch with c/c++ based compiles is, they are normally build with respect to a particular os and release. and is possibly even dependent on patch level. so if it works for some one say on windows 10, it may break for someone else on another windows 10 (possibly at a different patch level).
the same can be said for linux, etc
User avatar
fpiSTM
Posts: 1738
Joined: Wed Dec 11, 2019 7:11 pm
Answers: 91
Location: Le Mans
Contact:

Re: [SOLVED] Maple_Upload.bat : EXCEPTION_ACCESS_VIOLATION

Post by fpiSTM »

ag123 wrote: Thu Apr 15, 2021 5:16 pm i think that java-loader.jar app's key use isn't quite USB DFU, but to send that DTR 1EAF 'magic' command to the core to trigger a reset.
Right
ag123 wrote: Thu Apr 15, 2021 5:16 pm the biggest catch with c/c++ based compiles is, they are normally build with respect to a particular os and release. and is possibly even dependent on patch level. so if it works for some one say on windows 10, it may break for someone else on another windows 10 (possibly at a different patch level).
the same can be said for linux, etc
That have to be tested. ;)
Gibsonmb
Posts: 4
Joined: Sun Jan 29, 2023 6:16 pm

Not SOLVED - Maple_Upload.bat : EXCEPTION_ACCESS_VIOLATION

Post by Gibsonmb »

Forgive this dumb question as I'm just trying to use this software to load build from the Arduino IDE V2.03 to my STM32F103. Should the maple_upload.bat file automatically run as part of the Ctrl-U compilation process within the IDE?
I ask because I have added the text "echo %path% > Ard-env.txt" into the file. If I run the file manually, it creates Ard-env.txt file. It does not create the Ard-env.txt file when I Ctrl-U and compile from within the IDE.

So why am I doing this anyway, because I'm getting the following when trying to compile and upload;

Sketch uses 12804 bytes (9%) of program storage space. Maximum is 131072 bytes.
Global variables use 2064 bytes (10%) of dynamic memory, leaving 18416 bytes for local variables. Maximum is 20480 bytes.
maple_loader v0.1
Resetting to bootloader via DTR pulse
#
# A fatal error has been detected by the Java Runtime Environment:
#
# EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x000000007110b5db, pid=27268, tid=0x000000000000673c
#
# JRE version: Java(TM) SE Runtime Environment (8.0_361) (build 1.8.0_361-b09)
# Java VM: Java HotSpot(TM) 64-Bit Server VM (25.361-b09 mixed mode windows-amd64 compressed oops)
# Problematic frame:
# C [jSSC-2.8_x86_64.dll+0xb5db]
# An error report file with more information is saved as:
# C:\Users\Mike\AppData\Local\Arduino15\packages\stm32duino\tools\stm32tools\2022.9.26\win\hs_err_pid27268.log

Obviously I don't have a JAVA install with the IDE as 2.0 onwards does not use Java. I should be pointing to my Java install which I installed today to make sure I had an up to date version.

C:\Users\Mike>java -version
java version "1.8.0_361"
Java(TM) SE Runtime Environment (build 1.8.0_361-b09)
Java HotSpot(TM) 64-Bit Server VM (build 25.361-b09, mixed mode)

and is located here;
C:\Program Files\Java
C:\Program Files(x86)\Java

for the 32 and 64 bit versions

The Ard-env.txt produces the following if maple_upload.bat is run manually;

java\bin;C:\Program Files (x86)\Common Files\Oracle\Java\javapath;C:\Python38\Scripts\;C:\Python38\;C:\ProgramData\Oracle\Java\javapath;C:\Program Files (x86)\Common Files\Microsoft Shared\Windows Live;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\QuickTime\QTSystem\;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\WINDOWS\System32\OpenSSH\;C:\Program Files\nodejs\;C:\ProgramData\chocolatey\bin;;C:\Program Files (x86)\IVI Foundation\VISA\WinNT\Bin\;C:\Program Files (x86)\IVI Foundation\VISA\WinNT\Bin;C:\Program Files\PuTTY\;C:\JTDX64\159-32A\bin;C:\WSJT\wsjtx\bin;C:\Users\Mike\AppData\Local\Microsoft\WindowsApps;C:\Users\Mike\AppData\Roaming\npm;C:\ProgramData\Mike\GitHubDesktop\bin;C:\Users\Mike\AppData\Local\GitHubDesktop\bin;C:\ProgramData\Mike\atom\bin;C:\Users\Mike\AppData\Local\Microsoft\WindowsApps

This is a plea for help, somebody must be able to help me fix the problem please.
Post Reply

Return to “IDE's”