Skip to content
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

Ensure the go command trigger a run through the bootrom #51

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions ezFlashCLI/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -415,9 +415,9 @@ def importAndAssignDevice(self, device):

def go(self):
"""Reset the device and run."""
self.link.connect(self.args.jlink)
self.link.reset()
self.link.go()
self.importAndAssignDevice(str(self.deviceType.identifier))
self.da.connect(self.args.jlink)
self.da.reset()

def probeDevice(self):
"""Look for attached smarbond device."""
Expand Down
17 changes: 17 additions & 0 deletions ezFlashCLI/ezFlash/smartbond/smartbondDevices.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,13 @@ def connect(self, id):
raise Exception("Device not found")
return id

def reset(self):
"""Reset through jlink."""
if not self.link:
raise Exception("Calling reset before connecting")

self.link.reset()

def get_flash(self, flashId, flash_db):
"""Get the flash device id and return its name.

Expand Down Expand Up @@ -1212,6 +1219,7 @@ def flash_program_data(self, my_data_array, address=0x80000000):
my_data_array: bytes array
address: destination address
"""
self.link.reset()
self.link.jl.JLINKARM_BeginDownload(c_uint32(0))
self.link.jl.JLINKARM_WriteMem(
self.FLASH_ARRAY_BASE + address, len(my_data_array), c_char_p(my_data_array)
Expand Down Expand Up @@ -1259,6 +1267,8 @@ class da1469x(da1468x_da1469x_da1470x):
OTP_CFG_SCRIPT_ENTRY_SIZE = 4
OTP_CFG_SCRIPT_ENTRY_CNT_MAX = 256

SYS_CTRL_REG = 0x50000024

DEFAULT_IMAGE_ADDRESS = 0x2000
DEFAULT_IMAGE_OFFSET = 0x400

Expand All @@ -1273,6 +1283,13 @@ def __init__(self, name=b"DA1469x"):
self.OTPC_TIM1_REG += self.OTPC_BASE
self.OTPC_TIM2_REG += self.OTPC_BASE

def reset(self):
"""Reset through jlink."""
# Ensure the device is going through the bootrom
self.link.wr_mem(16, self.SYS_CTRL_REG, 0x000000D0)
self.link.reset()
self.link.go()

def make_image_header(self, image):
"""Image header generation.

Expand Down
Loading