[SOLVED] Maple_Upload.bat : EXCEPTION_ACCESS_VIOLATION

Development environment specific, Arduino, Eclipse, VS2013, Em::Blocks etc
Phono
Posts: 66
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: 459
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: 1022
Joined: Wed Dec 11, 2019 7:11 pm
Answers: 47
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: 459
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: 732
Joined: Thu Dec 19, 2019 5:30 am
Answers: 3

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: 459
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: 1022
Joined: Wed Dec 11, 2019 7:11 pm
Answers: 47
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: 732
Joined: Thu Dec 19, 2019 5:30 am
Answers: 3

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: 1022
Joined: Wed Dec 11, 2019 7:11 pm
Answers: 47
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. ;)
Post Reply

Return to “IDE's”