pylink
pylink copied to clipboard
JLinkFlashException('Could not write target memory.')
Hello community,
I am trying to flash an ARM Cortex-M0 using the flash_file. It's throwing the following exception: JLinkFlashException('Could not write target memory.')
Traceback, most recent call last:
File "C:/Users/User1/Desktop/inicio/inicio_pyverify_1.5.3.0/pverify/_training/examples/sys03_pyverify/cyclic_flash.py", line 78, in VariationLoop self.j.flash_file(self.Current_variation["hexfile"], 0xF0000000, on_progress=on_progress) File "C:\Inicio2\msys2\opt\inicio\inicio_conda_scientific_env_1.1.0.0\lib\site-packages\pylink\jlink.py", line 174, in wrapper return func(self, *args, **kwargs) File "C:\Inicio2\msys2\opt\inicio\inicio_conda_scientific_env_1.1.0.0\lib\site-packages\pylink\jlink.py", line 2220, in flash_file raise errors.JLinkFlashException(bytes_flashed)
Locals by frame, innermost first:
Frame flash_file in "C:\Inicio2\msys2\opt\inicio\inicio_conda_scientific_env_1.1.0.0\lib\site-packages\pylink\jlink.py" at line 2220 path = "C:\Users\User1..." addr = 4026531840 power_on = False bytes_flashed = -270
The function JLINK_DownloadFile() is returning the value -270. any ideas where is this coming from?
Sorry about the long turn around on a response here. It's hard to tell without any snippet of your code. Could you include some details around what you're trying to do? Personally, I would recommend using the flash() method directly. You can read the bytes using the intelhex Python package:
import intelhex
ih = intelhex.IntelHex()
ih.fromfile(self.Current_variation['hexfile'], format='hex')
data = ih.tobinarray()
self.j.flash(data, 0xF0000000, on_progress=on_progress)
You can enable the logger with logging.basicConfig(level=logging.DEBUG) to get more verbose output as in:
import logging
logging.basicConfig(level=logging.DEBUG)